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> | |
#define ___CONCAT(a,b) a ## b | |
#define ___APPLY(fn,n) ___CONCAT(fn, n) | |
#define _TYPE_VAL_MAP(t, v) t v | |
#define _VAL_MAP(t, v) v | |
#define _MAP0(args...) | |
#define _MAP1(m, t, v, args...) m(t, v) |
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 <arpa/inet.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
int main(int argc, char **argv) { | |
if (argc < 2) { | |
fprintf(stderr, "Please provide a hostname or IP...\n"); | |
exit(-1); |
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
class MinHeap { | |
private: | |
// value -> (row, col) | |
vector<tuple<int, int, int>> nodes; | |
size_t used = 0; | |
public: | |
MinHeap(size_t n) { | |
nodes.resize(n); | |
} |
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 <stdint.h> | |
#include <stddef.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
size_t strlen_simple(const char *str) | |
{ | |
size_t i = 0; |
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
struct list_head { | |
struct list_head *next, *prev; | |
}; | |
#define list_for_each(pos, head) \ | |
for (pos = (head)->next; !list_is_head(pos, (head)); pos = pos->next) | |
#define list_entry(ptr, type, member) \ | |
container_of(ptr, type, member) |
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> | |
void g() | |
{ | |
printf("456\n"); | |
} | |
void f(int a, int b) | |
{ | |
g(); | |
} | |
int main() { |
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
g: | |
.LFB0: | |
endbr64 | |
subq $8, %rsp | |
leaq .LC0(%rip), %rdi | |
call puts@PLT | |
nop | |
addq $8, %rsp | |
ret |
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
global main | |
section .text | |
f: | |
ret | |
main: | |
call f | |
xor rax, rax | |
ret |
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 <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <vector> | |
#include <unordered_set> | |
#include <unordered_map> | |
#include <iostream> | |
#define CHECK_REPEAT_THRESHOLD 1000 | |
#define REPEAT_CHAR_THRESHOLD 200 |
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 <sys/time.h> | |
#include <sys/resource.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <string.h> | |
int main() { |
NewerOlder