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
(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
/* | |
* 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
#!/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', ' |
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(bst). | |
-export([bst_create/0, bst_insert/2, bst_search/2]). | |
bst_create() -> []. | |
bst_insert(Bst, N) -> | |
case Bst of | |
[] -> [N, [], []]; | |
[Root, Lhs, Rhs] -> | |
if |
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/python2 | |
# unshred.py - Vedant Kumar <vsk@berkeley.edu> | |
import sys | |
import math | |
import colorsys | |
from collections import deque | |
from PIL import Image |
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
int main() { | |
int a[2] = {1, 2}, b = 3; | |
memset(a, 0, 12); | |
printf("a1 = %d, a2 = %d, b = %d\n", a[0], a[1], b); | |
int d[2] = {2, 3}, c = 1; | |
memset(&c, 0, 12); | |
printf("c = %d, d1 = %d, d2 = %d\n", c, d[0], d[1]); | |
printf( "&a[] = %p\n" |