This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int = 10000; // set to false to test with floats (disables inclusion tests) | |
const n = 10000; | |
const m = 100; | |
const rand = int? () => Math.floor(Math.random() * int) : Math.random; | |
const T = s => console.time(t = s); | |
const E = s => console.timeEnd(t); | |
let i, j, t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const _ = require("lodash"); | |
const n = 10000, m = 10000; | |
const T = s => console.time(t = s); | |
const E = s => console.timeEnd(t); | |
console.log("Iterations:", n); | |
console.log("Subiterations:", m); | |
console.log(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <termios.h> | |
struct termios original_attrs; | |
void enable_cbreak(); | |
void restore_attrs(); | |
void set_attrs(struct termios *attrs); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.css-1dbjc4n.r-150rngu.r-16y2uox.r-1wbh5a2.r-rthrr5 { | |
/* Also main content? */ | |
width: 100%; | |
} | |
.css-1dbjc4n.r-1niwhzg.r-hxarbt { | |
/* "More v" */ | |
display: none; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.action-menu .mn-dwn-arw { | |
/* Down arrows next to URLs */ | |
border-color: #006621 transparent; | |
} | |
.GHDvEf { | |
/* Down arrows next to URLs (parent) */ | |
transform: translate(-2px, 29px); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
enable_hmargins() { echo -ne "\x1b[?69h"; } | |
disable_hmargins() { echo -ne "\x1b[?69l"; } | |
hmargins() { echo -ne "\x1b[$1;$2s"; } # left, right | |
vmargins() { echo -ne "\x1b[$1;$2r"; } # top, bottom | |
origin_on() { echo -ne "\x1b[?6h"; } | |
origin_off() { echo -ne "\x1b[?6l"; } | |
scroll_up() { echo -ne "\x1b[$1S"; } | |
scroll_down() { echo -ne "\x1b[$1T"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
enable_hmargins() { echo -ne "\x1b[?69h"; } | |
disable_hmargins() { echo -ne "\x1b[?69l"; } | |
hmargins() { echo -ne "\x1b[$1;$2s"; } # left, right | |
vmargins() { echo -ne "\x1b[$1;$2r"; } # top, bottom | |
origin_on() { echo -ne "\x1b[?6h"; } | |
origin_off() { echo -ne "\x1b[?6l"; } | |
scroll_up() { echo -ne "\x1b[$1S"; } | |
scroll_down() { echo -ne "\x1b[$1T"; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unsigned int get_core_id() { | |
unsigned int ebx; | |
__asm__("cpuid" : "=b" (ebx) : "a" (1)); | |
// When you call cpuid with eax=1, the upper 8 bits of ebx contain the CPU ID. | |
return ebx >> 24; | |
} | |
unsigned int get_x2apic_id() { | |
unsigned int edx; | |
// When calling cpuid with eax=0xb, it seems you need to have ebx=0 to prevent a segfault. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <optional> | |
#include <string> | |
struct Delete { | |
std::string str = "delete"; | |
Delete() = delete; | |
Delete(const Delete &) = delete; | |
Delete(Delete &&) = delete; | |
Delete(const std::string &str_): str(str_) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
int main() { | |
int x = 0, y = 0; | |
enum Direction {Up, Right, Down, Left}; | |
Direction direction = Up; | |
int max_extent = 1; | |
int extent = 0; | |
std::map<Direction, const char *> dirs {{Up, "up"}, {Right, "right"}, {Down, "down"}, {Left, "left"}}; |
OlderNewer