Skip to content

Instantly share code, notes, and snippets.

@mallipeddi
mallipeddi / gist:24bd367932d6259fedcb
Created January 8, 2015 01:50
go pprof helper script
#!/bin/bash
BINARY=$1
HOST=$2
PORT=$3
DURATION=$4
echo "Forwarding port..."
ssh -t -t -L$PORT:localhost:$PORT $HOST &
SSH_PID=$!
@mallipeddi
mallipeddi / gist:8447745
Created January 16, 2014 00:44
MBA Retina Mavericks 10.9 crash (happens once every week)
Date/Time: 2014-01-14 22:26:18 -0800
OS Version: 10.9.1 (Build 13B42)
Architecture: x86_64
Report Version: 18
Event: Sleep Wake Failure
Steps: 0
Hardware model: MacBookPro10,2
Active cpus: 4
@mallipeddi
mallipeddi / Main.sublime-menu
Last active December 26, 2015 06:58
Multiple custom layouts for SublimeText editor
[{"id":"view",
"children":[{
"id":"layout",
"children":[
{"command":"set_layout","caption":"Custom Grid - 3 col","args":{"cols":[0,0.33,0.67,1],"rows":[0,0.5,1],"cells":[[0,0,1,2],[1,0,2,2],[2,0,3,1],[2,1,3,2]]}},
{"command":"set_layout","caption":"Custom Grid - 2 col","args":{"cols":[0,0.5,1],"rows":[0,0.5,1],"cells":[[0,0,1,2],[1,0,2,1],[1,1,2,2]]}}
]
}]
}]
@mallipeddi
mallipeddi / gist:5923494
Last active December 19, 2015 08:09
yappi overhead is proportional to the number of function calls in the codepath. So yappi could penalize some code paths more than some other code paths.
import yappi
import time
yappi.set_clock_type("cpu")
def foo(n):
s = 0
for i in xrange(n):
s += n*n
@mallipeddi
mallipeddi / smem_test.py
Created April 25, 2013 00:27
Playing around with smem output.
#!/usr/bin/env python
"""
smem_test.py - test smem's USS/PSS/RSS values
More info on smem: http://www.selenic.com/smem/
Sample run:
# ./smem_test.py
@mallipeddi
mallipeddi / gist:3173138
Created July 24, 2012 22:38
Using oprofile
sudo opcontrol --start-daemon
sudo opcontrol --shutdown
sudo opcontrol --status
sudo opcontrol --vmlinux=/usr/lib/debug/lib/modules/2.6.18-164.el5debug/vmlinux
sudo opcontrol --start --callgraph=5
sudo opcontrol --stop
sudo opcontrol --dump
sudo opcontrol --reset
@mallipeddi
mallipeddi / gist:3154145
Created July 21, 2012 01:21
RHEL5 - Adding debuginfo yum repo & installing debug kernel image
#
# Follow instructions from the website below and add rhel5-debuginfo.repo to yum repos list (if not exists)
# http://le-huy.blogspot.com/2011/01/using-debuginfo-packages-in-redhat.html
#
[root@localhost ~]# cat /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
@mallipeddi
mallipeddi / pmp-pstack-el5.sh
Last active October 7, 2015 03:58
Poor Man's Profiler w/ pstack output on RHEL5
#!/bin/bash
nsamples=$2
sleeptime=$3
pid=$1
for x in $(seq 1 $nsamples)
do
pstack $pid && echo "--eos--"
sleep $sleeptime
done | \
@mallipeddi
mallipeddi / README
Created November 18, 2010 12:13
OpenVPN setup - server on Ubuntu & Tunnelblick on OS X (Snow Leopard)
# install openvpn
sudo apt-get install -y openvpn
# NAT 192.168.99.1/2 subnet <-> eth0 (interface on server)
sudo modprobe iptable_nat
echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables -t nat -A POSTROUTING -s 192.168.99.1/2 -o eth0 -j MASQUERADE
# generate secret key; scp this key to the client later
/mnt/bonnie - LVM striped over 4 ephemeral
Version 1.03c ------Sequential Output------ --Sequential Input- --Random-
-Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks--
Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP
db_experimen 30000M 59364 99 221719 42 94578 15 57870 99 303915 16 407.4 0
------Sequential Create------ --------Random Create--------
-Create-- --Read--- -Delete-- -Create-- --Read--- -Delete--
files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP
16 10583 38 +++++ +++ 6411 10 10067 35 +++++ +++ 5363 9