Skip to content

Instantly share code, notes, and snippets.

View leepro's full-sized avatar
🏠
Working from home

DW Lee leepro

🏠
Working from home
View GitHub Profile
@leepro
leepro / latency.markdown
Created November 3, 2015 23:00 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

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

@leepro
leepro / selenium_with_python.rst
Created November 5, 2015 23:28 — forked from mabroor/selenium_with_python.rst
Selenium with Python

Selenium with Python

Author: Baiju Muthukadan
Email:baiju.m.mail AT gmail.com
Version: 0.5.0
@leepro
leepro / echo.go
Last active November 8, 2015 04:30 — forked from paulsmith/echo.go
A simple echo server testing a few interesting Go language features, goroutines and channels.
// $ 6g echo.go && 6l -o echo echo.6
// $ ./echo
//
// ~ in another terminal ~
//
// $ nc localhost 3540
package main
import (
@leepro
leepro / gist:716bb0feded9a09d7fea
Created November 8, 2015 04:29 — forked from iwanbk/gist:2295233
TCP Echo Client in Golang
package main
import (
"net"
"os"
)
func main() {
strEcho := "Halo"
servAddr := "localhost:6666"
tcpAddr, err := net.ResolveTCPAddr("tcp", servAddr)
2015-11-17 16:24:23,399: ERROR ajp-bio-0.0.0.0-8010-exec-85 nl.greenvalley.archiving.core.storage.jdbcfs.virtual.VirtualSnapshotBuildingService - Create virtual snapshot, headers, and set build status for Snapshot ID [29448636] took [2545] milliseconds.
2015-11-17 16:24:23,625: ERROR ajp-bio-0.0.0.0-8010-exec-85 nl.greenvalley.archiving.core.storage.jdbcfs.virtual.VirtualSnapshotBuildingService - Trying to call snapshot building procedure for fullcrawl snapshot
2015-11-17 16:24:25,259: ERROR ajp-bio-0.0.0.0-8010-exec-90 nl.greenvalley.archiving.core.storage.jdbcfs.virtual.VirtualSnapshotBuildingService - Create virtual snapshot, headers, and set build status for Snapshot ID [29448636] took [1531] milliseconds.
2015-11-17 16:24:27,031: ERROR ajp-bio-0.0.0.0-8010-exec-93 nl.greenvalley.archiving.core.storage.jdbcfs.virtual.VirtualSnapshotBuildingService - Create virtual snapshot, headers, and set build status for Snapshot ID [29448636] took [3303] milliseconds.
2015-11-17 16:24:28,742: ERROR ajp-bio-0.0.0.0-801
@leepro
leepro / git-loglive
Created December 7, 2015 20:21 — forked from tlberglund/git-loglive
Log Live Git Command
#!/bin/bash
while :
do
clear
git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $*
sleep 1
done
import (
"syscall"
"unsafe"
)
type winsize struct {
Row uint16
Col uint16
Xpixel uint16
Ypixel uint16
@leepro
leepro / example.go
Created April 5, 2016 15:17 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
package main
import (
"net/http"
)
type SingleHost struct {
handler http.Handler
allowedHost string
}
@leepro
leepro / c.h
Created April 12, 2016 16:47 — forked from lorepozo/c.h
Golang cgo objective-c cocoa button callback
#include <Cocoa/Cocoa.h>
extern void ButtonClick(void);
@interface GoPasser : NSObject
+ (void)buttonClick:(id)sender; // this should call the cgo function defined in main.go
@end
void StartApp(void);