Skip to content

Instantly share code, notes, and snippets.

View thuandt's full-sized avatar
💀
This.isDevOps(powah_code=36)

Thuan Duong thuandt

💀
This.isDevOps(powah_code=36)
View GitHub Profile
import sys
def gcd(a, b):
t = b
b = a % b
if b == 0:
return t
else:
return gcd(t, b)

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@thuandt
thuandt / unique_digit_prime.py
Created December 8, 2012 23:53 — forked from lewtds/unique_digit_prime.py
Tìm số nguyên tố lớn nhất có 9 chữ số và các chữ số khác nhau từng đôi một
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Filename: prime.py
#
# Description: Tìm số nguyên tố lớn nhất có 9 chữ số khác nhau
#
# Created: 12/09/2012 06:32:33 AM
# Last Modified: 12/09/2012 06:40:49 AM
@thuandt
thuandt / userChrome.css
Last active August 29, 2015 14:20
userChrome.css
/* Disable "List all Tabs" Button */
.tabs-alltabs-button {
display: none !important;
}
/* Disable Container box for "List all Tabs" Button */
.tabs-alltabs-box {
display: none !important;
}