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
.section .data | |
.section .text | |
.globl _start | |
_start: | |
# adjust stack frame and push fib args to stack | |
pushl $5 | |
pushl $1 | |
pushl $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
import timeit | |
from numpy import mean | |
nqueens_gen_setup = """def threatened(pos, past, n): | |
for i in range(len(past)): | |
if past[i] == pos or abs(pos - past[i]) == len(past) - i: | |
return True | |
return False | |
def nqueens(n, past=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
def threatened(pos, past, n): | |
for i in range(len(past)): | |
if past[i] == pos or abs(pos - past[i]) == len(past) - i: | |
return True | |
return False | |
def nqueens(n, past=None): | |
if past == None: | |
for i in range(n): | |
yield from nqueens(n, [i+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
; prayer for λ long night's sleep | |
(let ((yourself rest) | |
(sometimes | |
(λ (person) cannot-connect 'anymore | |
(and ;has-to | |
sleep | |
(for ([days '(at . λ . 'time)]) | |
(not even?) 2 | |
raise (λ (single) 'finger)))))) | |
shutdown (and #'just sleep |
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
section .data | |
section .text | |
global _start | |
global power | |
power: | |
; ro ro fite | |
push rbp | |
mov rbp, rsp |
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
section .data | |
section .text | |
global start | |
global power | |
power: | |
; ro ro fite | |
push rbp | |
mov rbp, rsp |
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
def queue_time(customers, n): | |
# keep track of time | |
wait = 0 | |
# pool of people currently checking out at a register | |
checkers_out = [] | |
# how many customers to load into queue. |
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
def upload(config_file): | |
bucket = s3.get_bucket(bucket_name) | |
# build a list of files already in the bucket | |
remote_files = {key.name : key.etag.strip('"') for key in bucket.list()} | |
# upload local files not already in the bucket | |
for root, dirs, files in os.walk(static_root): |
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
#define _GNU_SOURCE | |
#include <dirent.h> /* Defines DT_* constants */ | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
#include <sys/syscall.h> | |
#define handle_error(msg) \ |
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 <dirent.h> | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
#include <sys/syscall.h> | |
#define handle_error(msg) \ | |
do { perror(msg); exit(EXIT_FAILURE); } while (0) |