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
function sort(array, sortReliability=10) { | |
'use strict'; | |
return new Promise(resolve => { | |
let sorted = []; | |
Promise.all(array.map(e => { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
sorted.push(e); | |
resolve(e); | |
}, e * sortReliability); |
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
.intel_syntax noprefix | |
.text | |
.globl strlen; strlen: | |
xor rax, rax | |
cmpb [rdi], 0 | |
je 1f | |
0: | |
add rax, 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
.intel_syntax noprefix | |
.text | |
.globl strlen; strlen: | |
xor rcx, rcx | |
mov rsi, rdi | |
jmp 0f | |
1: | |
inc rcx |
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
# compile with gcc -noprefix | |
# example usage: | |
# echo Hello server\! | netcat -c 127.0.0.1 8005 | |
.intel_syntax noprefix | |
.set sys_socket, 41 | |
.set sys_setsockopt, 54 | |
.set sys_bind, 49 | |
.set sys_listen, 50 |
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/sh | |
if [ $EUID -ne 0 ]; then | |
echo "It's a weird tree." | |
else | |
cat << "EOF" | |
@@@ @@@ | |
@///@ /@@ @; @ | |
@/ //@ / ;@ @;; @ | |
@// ///@ @ ;;@ @;;;;;@ |
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
module.exports = parse = (function() { | |
function isDigit(c) { | |
return c >= '0' && c <= '9'; | |
} | |
function Parser(source) { | |
this.cursor = 0; | |
this.lineno = 1; | |
this.tokens = []; | |
this.lookahead = 0; | |
this.tokindex = 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
/* | |
g++ -std=c++14 -ftemplate-depth=2001 fizz.cc -o fizz 2>&1 >/dev/null | grep -oE '[0-9]+, (Fizz|Buzz|FizzBuzz|None)' | |
*/ | |
#include <iostream> | |
struct Fizz; | |
struct Buzz; | |
struct FizzBuzz; | |
struct 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <time.h> | |
#define PRINT_SOLUTIONS | |
#define FANCY_PRINT | |
static inline void print_array(uint8_t *a, uint8_t n) { | |
putchar('['); |
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
/** | |
* Argument parser for the FileUtilities class | |
* | |
* @author Jake Eaton | |
*/ | |
public class ArgumentParser { | |
private static String helpLine = | |
"Usage: java FileUtilities COMMAND SHIFT FILE [-verbose]\n" + | |
"Encrypt/decrypt files using the shift cipher.\n\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 <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <regex> | |
std::regex::flag_type parse_flags(const std::string& flag_str) { | |
std::regex::flag_type grammar = std::regex::ECMAScript; | |
std::regex::flag_type flags = grammar ^ grammar; | |
for (const auto& c: flag_str) { | |
switch (c) { |