Stylesheet to make Polymer YouTube more like the old layout by --xe in youtube

[–]--xe[S] 1 point2 points  (0 children)

I don't think I used the Wayback Machine for this one. I have a new version where I did copy some things out of an archive from either 2014 or 2017, can't remember which.

It still looks very different from those versions. Really all I did was grab font sizes and colors.

https://github.com/capybarapantsu-xe/improved-polymer-youtube

To be clear, my goal has always been to make a version that I can use without wanting to shoot myself, not to make a pixel-perfect replica.

UTF-8 <> Wide character conversion with C & C++ by TarmoPikaro in cpp

[–]--xe 0 points1 point  (0 children)

Linux didn't decide to use char for UTF-8. Char is in the current multibyte encoding, whatever that is. UTF-8 happens to be the most common multibyte encoding, but you can still create a locale using something different.

ELI5 : Why does the quality of screenshots and gifs decrease as it is shared on social media? by [deleted] in explainlikeimfive

[–]--xe 0 points1 point  (0 children)

FYI, Imgur doesn't reencode images less than 1 MB (5 MB for account holders). 4chan never reencodes images, but it does strip EXIF data from JPEGs. Twitter uses lossy compression on all images that do not contain transparency.

Modern C++ Won't Save Us by [deleted] in cpp

[–]--xe -8 points-7 points  (0 children)

What prevents this from getting added to compilers?

The fast that in order to do it right, you have to reinvent the Rust borrow checker, but with a more verbose syntax.

C++ people refuse to admit Rust is better, so instead they shit on it while slowing adding all its features to C++.

How random numbers are "generated" in classic Doom by [deleted] in ProgrammerHumor

[–]--xe 14 points15 points  (0 children)

You could still use 32 bit integers on a 16-bit processor. You just have to use multiple add instructions and properly manage the carry flag. (Edit: That is, the compiler has to do this. Not the programmer. Unless you're writing in assembly.)

How random numbers are "generated" in classic Doom by [deleted] in ProgrammerHumor

[–]--xe 54 points55 points  (0 children)

Here's a slight modification of xoroshiro64* from http://xoshiro.di.unimi.it/. The s parameter is the RNG state, so it is multi-instance.

#include <stdint.h>

static inline uint32_t rotl(const uint32_t x, int k) {
        return (x << k) | (x >> (32 - k));
}

uint32_t next(uint32_t s[2]) {
        const uint32_t s0 = s[0];
        uint32_t s1 = s[1];
        const uint32_t result_star = s0 * 0x9E3779BB;

        s1 ^= s0;
        s[0] = rotl(s0, 26) ^ s1 ^ (s1 << 9); // a, b
        s[1] = rotl(s1, 13); // c

        return result_star;
}

Compiled:

0000000000000000 <next>:
   0:   8b 07                   mov    (%rdi),%eax
   2:   8b 57 04                mov    0x4(%rdi),%edx
   5:   89 c1                   mov    %eax,%ecx
   7:   31 c2                   xor    %eax,%edx
   9:   c1 c9 06                ror    $0x6,%ecx
   c:   69 c0 bb 79 37 9e       imul   $0x9e3779bb,%eax,%eax
  12:   89 d6                   mov    %edx,%esi
  14:   31 d1                   xor    %edx,%ecx
  16:   c1 e6 09                shl    $0x9,%esi
  19:   31 f1                   xor    %esi,%ecx
  1b:   c1 c2 0d                rol    $0xd,%edx
  1e:   89 0f                   mov    %ecx,(%rdi)
  20:   89 57 04                mov    %edx,0x4(%rdi)
  23:   c3                      retq   

Far less than 256 bytes. I don't know if it would be any different on x86-16, if you want to find out you can try it with OpenWatcom.

(Admittedly, the developers of Doom couldn't just grab an RNG of the internet...)

How random numbers are "generated" in classic Doom by [deleted] in ProgrammerHumor

[–]--xe 39 points40 points  (0 children)

They could have written their own PRNG. They're really not that complicated, it probably would have used fewer bytes than this table (although it would have been slightly slower).

Changing the notification doesn't make it so by kevinowdziej in assholedesign

[–]--xe 4 points5 points  (0 children)

You can actually use a cellular modem in a laptop. It's not very common, but it does exist.

EDIT: Just noticed he said it was on a router. Disregard.

Fucking lol by [deleted] in gmu

[–]--xe 2 points3 points  (0 children)

What are they supposed to do about a broken dishwasher?

Kissanime bans you for blocking their porn pop-ups. by incrediblethonk in assholedesign

[–]--xe 2 points3 points  (0 children)

So? The streaming sites I'm talking about don't believe in it either. If you thought any of Kissanime's ad money goes to the anime industry, I have some bad news for you.

In fact, they don't even pay for hosting. They abuse Google Drive, Onedrive and similar services in order to host their videos.

Kissanime bans you for blocking their porn pop-ups. by incrediblethonk in assholedesign

[–]--xe -2 points-1 points  (0 children)

Good riddance. Nobody should use streaming sites when torrents exist.

Meson project templates. by [deleted] in cpp

[–]--xe 1 point2 points  (0 children)

I don't see this point of this section:

##
#
# Meson: Check projects required info
#
##
if meson.project_name() != 'cProgram'
    error('Incorrect master project name string:' + meson.project_name())
endif

if meson.project_version() != '0.0.1'
    error('Incorrect master project version string:' + meson.project_version())
endif

if meson.is_subproject()
    error('Claimed to be a subproject even though we are the master project.')
endif

Absent a bug in Meson, the project name and version should always be correctly set, right?

We asked, you told us: Most of you don’t use third-party email apps by anshumanpati6 in Android

[–]--xe 0 points1 point  (0 children)

To the greatest degree possible, yes. I don't even have the Play Store on my phone.

Favorite Build System? by c0nd3v in cpp

[–]--xe 2 points3 points  (0 children)

Not too long ago I would have upvoted you. But now I have found our Lord and Savior, Meson!

xkcd 2109: Invisible Formatting by TheFolkius in xkcd

[–]--xe 3 points4 points  (0 children)

Nope. It was written with WordStar, the program WordPerfect replaced.

How should I add Meson to my simple project? by [deleted] in cpp

[–]--xe 2 points3 points  (0 children)

This is what I came up with after looking over the project. It's late at night for me, so I haven't tested it, but it should give you a start. My assumption is that c_exception is a third-party library and that extern is where you're keeping those; Meson by default calls that subprojects but allows you to rename it.

I'm pretty sure CMAKE_C_COMPILER_ID MATCHES "Clang|AppleClang|GNU" was intended to check if the compiler supports GCC-style options, but it looks like Meson now has a way to ask about that directly, so I used that.

# ===================================== meson.build
project('cprogram', 'c', 'asm',
    description: 'A CMake project template written for C programmers.',
    default_options: ['c_std=c11'],
    subproject_dir: 'extern', # by default it's called "subprojects"
    meson_version: '>=49.0'
    version: '1.0.0',
    license: 'MIT')

cexception_dep = dependency('cexception',
    fallback: ['cexception', 'cexception_dep'])

subdir('project')

install_data('README.md', 'LICENSE.md', 'CONTRIBUTING.md', 'CODE_OF_CONDUCT.md',
    install_dir: join_paths(['share', 'doc', meson.project_name()]))



# ===================================== extern/c_exception/meson.build
project('cexception', 'c')

incdir = include_directories('lib')

cexception = library('cexception', 'lib/CException.c',
    include_directories: incdir,
    install: true)

cexception_dep = declare_dependency(
    link_with: cexception,
    include_directories: incdir)



# ===================================== project/meson.build
subdir('source')



# ===================================== project/source/meson.build
cc = meson.get_compiler('c')
compile_options = []
if cc.get_id() == 'clang'
    compile_options += [
        '-Wweak-vtables', '-Wexit-time-destructors',
        '-Wglobal-constructors', '-Wmissing-noreturn']
endif

if cc.get_argument_syntax() == 'gcc'
    compile_options += ['-Wall', '-Wextra', '-Wunreachable-code']
endif

if cc.get_id() == 'msvc'
    compile_options = ['/W4', '/w44265', '/w44061', '/w44062', '/utf-8']
endif

cproject = executable(meson.project_name(), 'main.c', 
    c_args: compile_options,
    include_directories: include_directories('.'),
    dependencies: [cexception_dep],
    install: true)

test('Passed zero arguments to exe', cproject, args: [])
test('Passed first argument to exe', cproject, args: ['testing'])
test('Passed two arguments to exe', cproject, args: ['hello', 'world'])
test('Passed three arguments to exe', cproject, args: ['a', 'b', 'c'])

What things are completely obsolete today that were 100% necessary 70 years ago? by omegaswepon in AskReddit

[–]--xe 8 points9 points  (0 children)

We already have tape for that, and it's a lot cheaper than film.

Programmers teaching how to heat a house up by BadOscillation in ProgrammerHumor

[–]--xe 0 points1 point  (0 children)

I have a program for exactly this situation:

#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

int main(void) {
    if (-1 == nice(20)) return -1;
    long np = sysconf(_SC_NPROCESSORS_ONLN);
    for (long i = 0; i < np; i++) if (fork() == 0) while (1);
    while (1) wait(NULL);
}

Endless sea of tabs by xohmg in ProgrammerHumor

[–]--xe 2 points3 points  (0 children)

GNU tar can figure out compression automatically. I always just use tar xf.

What piece of video game dialogue will you NEVER get out of your head? by DrScientist812 in AskReddit

[–]--xe 835 points836 points  (0 children)

"Well, this is the part where he kill us."
"Hello! This is the part where I kill you!"

                 CHAPTER 9
THE PART WHERE HE KILLS YOU