Skip to content

Instantly share code, notes, and snippets.

@javouhey
javouhey / gist:1274844
Created October 10, 2011 08:08
How to inspect a javascript object like python's dir
http://stackoverflow.com/questions/4652559/in-javascript-is-their-a-way-to-inspect-an-objects-methods-and-attributes-such-a
(1)
var dir = '';
for (var i in obj) dir += 'obj[' + i + '] = ' + obj[i];
alert(dir);
http://stackoverflow.com/questions/5357442/how-to-inspect-javascript-objects

Effective Engineer - Notes

What's an Effective Engineer?

  • They are the people who get things done. Effective Engineers produce results.

Adopt the Right Mindsets

@javouhey
javouhey / gist:d4c0882e990453a1e70ca0f5e403bcf0
Last active December 11, 2017 05:12
Best talks at Kubecon + CloudNativeCon 2017 North America
These are a subset of the talks that I attended & ones that I enjoyed.
In no particular order:
1. Shipping in Pirate-Infested Waters: Practical Attack and Defense in Kubernetes
Greg Castle & CJ Cullen, Google
https://kccncna17.sched.com/event/CU86/shipping-in-pirate-infested-waters-practical-attack-and-defense-in-kubernetes-a-greg-castle-cj-cullen-google
- The presenters wore hats that matched with the pirate theme.
- tldr; basic ways to harden your kubernetes cluster.
- extra: Google security team (in the Seattle office) is hiring.
@javouhey
javouhey / sbt on cygwin
Created November 29, 2010 12:10
Getting sbt to work in cygwin 1.77
dir=`dirname $0`
stty -icanon min 1 -echo > /dev/null 2>&1
java -Djline.terminal=jline.UnixTerminal -Xmx512M -jar `cygpath -w $dir`/sbt-launch-0.7.4.jar "$@"
stty icanon echo > /dev/null 2>&1
0x99CD46E14d28B88460334C8c83eD8D987bA64d0e
@javouhey
javouhey / gist:1624750
Created January 17, 2012 04:40
Log to syslog in python
import logging
from logging.handlers import SysLogHandler
logger = logging.getLogger()
logger.setLevel(logging.INFO)
syslog = SysLogHandler(address='/dev/log', facility='user')
formatter = logging.Formatter('%(name)s: %(levelname)s %(module)s %(message)r')
syslog.setFormatter(formatter)
logger.addHandler(syslog)
@javouhey
javouhey / linux.sh
Created January 9, 2017 01:43 — forked from marcan/linux.sh
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <marcan@marcan.st>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
2016-nov-22 - installed https://blog.golang.org/go-fonts in C:\dev\2016\image
@javouhey
javouhey / latency.markdown
Created October 9, 2016 04:26 — 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

@javouhey
javouhey / gist:9405636
Created March 7, 2014 05:13
#golang bufio.NewScanner
func parse(str string) map[string]string {
scanner := bufio.NewScanner(strings.NewReader(str))
for scanner.Scan() {
fmt.Println("=> ", scanner.Text())
}
return nil
}