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
color_0 = ffff ffff ffff | |
color_1 = 0000 0000 0000 | |
color_2 = 0000 0000 7f7f | |
color_3 = 2a3d 8ccc 2a3d | |
color_4 = ffff 0000 0000 | |
color_5 = 7f7f 0000 0000 | |
color_6 = 9c9c 0000 9c9c | |
color_7 = fcfc 7f7f 0000 | |
color_8 = ffff ffff 0000 | |
color_9 = 0000 fcfc 0000 |
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
########################################################## | |
# How to NEVER use Lambdas. An inneficient and yet educa-# | |
# tonal guide to the proper misuse of the lambda constru-# | |
# ct in Python 2.x. [DO NOT USE ANY OF THIS EVER] # | |
# by: e000 (13/6/11) # | |
########################################################## | |
## Part 1. Basic LAMBDA Introduction ## | |
# Well, it's worth diving straight into what lambdas are. | |
# Lambdas are pretty much anonymous "one line" functions |
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
s..[){+[^{}.;y.{+}^)[. \-\/fmr.;qx.$_.; | |
# How it works | |
s..[){+[^{}.; # defines $_ as "[){+[^{}." | |
y.{+}^)[. \-\/fmr.; # translates | |
print $_; | |
# "{" = " " | |
# "+" = "-" | |
# "}" = "/" |
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
(lambda n,s,I:n.classobj('h',(),dict(__init__=(lambda M,S,P,C:M.__dict__.update( | |
dict(R=(S,P),H=C,O=s.socket()))),C=(lambda M:(M.O.connect(M.R),setattr(M,'D',M.O | |
.makefile()),setattr(M,'S',(lambda l: M.O.send('%s\r\n'%l))),M.S("NICK hue"),M.S | |
("USER a b c d :LOL!"),setattr(M,'R',lambda n,m: M.S('PRIVMSG %s :%s'%(n,m))),M. | |
P())),G = (lambda M,S:S.split(' :',1)[1] if' :'in S else ''),P=(lambda M:next(I. | |
dropwhile((lambda Lu:((lambda L:((lambda: M.S("PONG :%s"%M.G(L))if L.startswith( | |
'PING')else(lambda P,G,S:({'001':(lambda: M.S('JOIN %s'%M.H)),'PRIVMSG':(lambda: | |
M.HC(L[1:].split('!',1),P[2],G[1:].split(),G)if G.startswith('!')else None)}.get | |
(P[1],lambda: None)())if len(P)>1 else None)(L.split(),M.G(L),M.O))()))(Lu.strip | |
()),True)[1]),iter(M.D)),None)),HC=(lambda M,(N,H),C,P,L: {'hello':lambda:M.R(C, |
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
# Download Sublime Text 2 from http://www.sublimetext.com/2 | |
# If you aren't root, sudo su | |
tar -xvjf Sublime\ Text\ 2*.tar.bz2 | |
mv Sublime\ Text\ 2/ /opt/sublime-text-2/ | |
ln -s /opt/sublime-text-2 /usr/local/sublime-text-2 | |
ln -s /usr/local/sublime-text-2/sublime_text /usr/local/bin/sublime_text | |
rm Sublime\ Text\ 2*.tar.bz2 | |
# Sublime Text 2 can now be run as normal user with command "sublime_text" |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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 struct | |
import SocketServer | |
from base64 import b64encode | |
from hashlib import sha1 | |
from mimetools import Message | |
from StringIO import StringIO | |
class WebSocketsHandler(SocketServer.StreamRequestHandler): | |
magic = '258EAFA5-E914-47DA-95CA-C5AB0DC85B11' |
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
.input-recaptcha { | |
width:172px; | |
} |
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
# vxl2tga.py: renders a vxl map isometrically | |
# by GreaseMonkey, 2013 - public domain | |
import sys, struct | |
WIDTH, HEIGHT = 2048, 1024+128 | |
g = [[None for i in xrange(WIDTH)] for j in xrange(HEIGHT)] | |
def pp(x,y,z,col): | |
rx = (z-x)*2+1024 |
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
/* | |
* Partial applied functions in C | |
* Leandro Pereira <leandro@tia.mat.br> | |
*/ | |
#include <assert.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdint.h> | |
#include <stdbool.h> |
OlderNewer