Skip to content

Instantly share code, notes, and snippets.

View redaready's full-sized avatar
😀

redaready redaready

😀
  • Aix en provence, France <-> Tokyo, Japan
View GitHub Profile
@zcdziura
zcdziura / Crypto Test
Last active July 13, 2023 05:08
Encryption using Elliptic Curves and Diffie-Hellman key exchanges
import java.io.UnsupportedEncodingException;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.PublicKey;
@jboner
jboner / latency.txt
Last active December 25, 2025 23:33
Latency Numbers Every Programmer Should Know
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
@j2labs
j2labs / gist:1763847
Created February 8, 2012 01:05
A fresh cerealization.
$ python ./cereal.py
Dumping:
json: 16.3266839981
simplejson: 21.8916499615
cjson: 5.22964906693
ujson: 2.02208805084
cPickle: 18.5925779343
tnetstrings: 60.592509985
tnetstring: 2.44516205788
msgpack: 21.7611129284
@terrancesnyder
terrancesnyder / regex-japanese.txt
Created November 7, 2011 14:05
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@y10h
y10h / redis_vs_sqlite.py
Created November 7, 2011 10:04 — forked from perses76/redis_vs_sqlite.py
Redis vs SQLite
from datetime import datetime
import redis
import random
import sqlite3
BROKER_HOST = "localhost" # Maps to redis host.
REDIS_PASSWORD = None
KEY_PREFIX = "speed_"
ALPHABETE = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM"
SQLITE_DB = ":memory:"
@perses76
perses76 / redis_vs_sqlite.py
Created October 5, 2011 14:23
Redis vs SQLite
from datetime import datetime
import redis
import random
import sqlite3
BROKER_HOST = "localhost" # Maps to redis host.
REDIS_PASSWORD = None
KEY_PREFIX = "speed_"
ALPHABETE = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM"
SQLITE_DB = ":memory:"
@mattpodwysocki
mattpodwysocki / nodeconf_2011.md
Created May 7, 2011 02:03 — forked from guybrush/nodeconf_2011.md
a list of slides from nodeconf 2011
@jdp
jdp / refactor.py
Created December 7, 2010 04:59
A toy tail-recursive concatenative language implementation
#!/usr/bin/env python
import sys
import types
import operator
class Runtime:
def __init__(self, env={}, stack=[]):
self.env = {
# Primitive words, not an impressive base but it works