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
#!/usr/local/bin/python3 | |
class AVLTree: | |
def __init__(self, data): | |
self.data = data | |
self.lhs = None | |
self.rhs = None | |
def insert(self, data): | |
if data == self.data: |
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/zsh | |
# Find each struct's usage frequency in each subsystem. In each search, discard | |
# the files that have no matches, get rid of the directory prefix, only keep | |
# the subsystem, and then pipe the information out to a temporary file. Loop | |
# through every (Subsystem Of File, Count) tuple and sum up the contribution | |
# from each subsystem to that struct's frequency. | |
for line in $(cat structs.txt); do | |
echo ">"$line |
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 <vector> | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
void gray(int n, vector<string>& code) { | |
if (n == 1) { | |
code.push_back(string("0")); | |
code.push_back(string("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
man | |
* man grep | |
* apropos uname | |
if, then, else, fi | |
* -e (file exists) | |
* -d (file is directory) | |
* -z (string is empty) |
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
/* | |
* apply.c | |
* | |
* A basic implementation of apply() for systems that use the | |
* System V AMD64 calling convention. | |
*/ | |
#include <string.h> | |
#include <sys/mman.h> |
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 (send object action . args) | |
(apply (lookup object action) args)) |
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> | |
extern void* apply(void* func, void** args, size_t argc); | |
long bar(int a, int b, long c, long d, int e, long f, long g, int h) { | |
printf( "a = %x\n" | |
"b = %x\n" | |
"c = %lx\n" | |
"d = %lx\n" | |
"e = %x\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
#!/usr/bin/python | |
import sys | |
from random import random | |
from flotype.bridge import Bridge | |
bridge = Bridge(api_key='abcdefgh') | |
def start_job(): | |
n = 32 |
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 (yin-yang n) | |
(define yv | |
(for/vector ([i (in-range n)]) | |
((lambda (cc) (printf "~a " i) cc) (call/cc (lambda (k) k))))) | |
(for ([i (in-range (- n 1))]) | |
((vector-ref yv i) (vector-ref yv (+ i 1))))) | |
;; > (yin-yang 0) | |
;; > (yin-yang 1) | |
;; 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
''' | |
>>> find('rage') | |
{'ager', 'gear', 'rage'} | |
>>> find('lascivious') | |
{'viscus', 'salvo', 'ciao', 'souls', 'lacs', 'ovisac', 'clavi', 'lasso', 'ovals', 'laics', 'solus', 'vail', 'ulvas', 'voila', 'cusso', 'assoil', 'ossa', 'cuss', 'sauls', 'iliac', 'cols', 'vails', 'sialic', 'silo', 'loss', 'ulva', 'louis', 'colas', 'salvos', 'saul', 'visuals', 'salic', 'ovisacs', 'ascus', 'coss', 'ails', 'cilia', 'sail', 'sous', 'laic', 'aviso', 'oculi', 'viol', 'vaus', 'avos', 'caulis', 'sola', 'aioli', 'oasis', 'sols', 'lass', 'vacs', 'cauls', 'cola', 'cavils', 'soli', 'civil', 'aiolis', 'sials', 'locus', 'sacs', 'oval', 'silva', 'sisal', 'casus', 'clivia', 'vials', 'visas', 'ocas', 'calo', 'viscous', 'silvas', 'avisos', 'silicas', 'clavus', 'oils', 'visual', 'coulis', 'asci', 'luvs', 'clivias', 'sial', 'socials', 'vial', 'coals', 'soul', 'vocal', 'ossia', 'vocals', 'silvics', 'loca', 'soil', 'loci', 'aulic', 'soils', 'ilia', 'viols', 'oscula', 'silos', 'violas', 'sics', 'also', 'viola', 'sails', 'lavs', 'cavil', 'coils', ' |