Skip to content

Instantly share code, notes, and snippets.

View opsymcdevface's full-sized avatar

Zee Do opsymcdevface

View GitHub Profile
@opsymcdevface
opsymcdevface / s3cmd_sync
Created May 29, 2012 09:47
How to sync files using s3cmd
s3cmd sync ./* s3://<bucket-name>/<target-directory>
@opsymcdevface
opsymcdevface / uninstall_xcode_cli.sh
Created June 5, 2012 04:48
Uninstall XCode command line tools
sudo /Library/Developer/Shared/uninstall-devtools --mode=all
@opsymcdevface
opsymcdevface / immunize-nginx
Created June 12, 2012 04:51
Immunize main NGiNX process from oom-killer
# add custom function here to prevent main nginx process to be killed by oom-killer
# add this near the end, before the case statement where we indicate what the script will do (start, stop, etc)
immunize() {
if [ -e $PIDSPATH/$PIDFILE ]; then
NGINX_PID=`cat $PIDSPATH/$PIDFILE`
logger -s "Disabling oom-killer for main NGiNX process with PID $NGINX_PID..."
sleep 1
echo -17 > /proc/$NGINX_PID/oom_adj
else
@opsymcdevface
opsymcdevface / ssh-config
Last active December 15, 2015 06:48
SSH config file to simplify life
### If you want SSH multiplexing, comment out lines 2-3
# ControlMaster auto
# ControlPath /tmp/ssh_mux_%h_%p_%r
### Core set of config
### Enable agent forwarding
ForwardAgent yes
### Don't let SSH die
ServerAliveInterval 60
@opsymcdevface
opsymcdevface / genpasswb.rb
Created March 27, 2013 09:08
A simple shell password generator script
print "Enter string to encrypt: "
to_crypt = gets.chomp
print "Put some salt: "
salty = gets.chomp
puts to_crypt.crypt(salty)
@opsymcdevface
opsymcdevface / squid3-delaypools.txt
Last active July 24, 2016 01:03
Squid3 delay pools configuration
# DELAY POOL PARAMETERS
# ----------------------------------------------------------------------------
# lone delay pool
delay_pools 1
# look into the documented /etc/squid3/squid.conf config file
# the line below means delay pool 1 belongs to a class 1 delay pool
# *everything is in a single delay bucket*
delay_class 1 1
@opsymcdevface
opsymcdevface / squid3-nocaching.txt
Created March 27, 2013 14:43
Squid3 - You shall not cache
# This is an attempt to no caching on squid3
# deny cache to everyone
no_cache deny all
@opsymcdevface
opsymcdevface / gist:5530219
Created May 7, 2013 04:16
Ansible conditional
From site.yml
vars:
- is_vanilla: "'{{ nginx-install-type }}' == 'vanilla'"
- is_passenger: "'{{ nginx-install-type }}' == 'passenger'"
From roles/common/tasks/main.yml
- include: ../setup/install-gem.yml gem=passenger
when: '{{ is_passenger }}'
@opsymcdevface
opsymcdevface / catchpointoutline
Created May 15, 2013 13:42
CatchPoint Tutorial Outline
- Introduction
Hello, I'm <name_here>. Blah blah blah.
- Catchpoint what it is, what it's not.
-- You know, for tests.
- Basic Workflow.
-- Login
-- Home

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