Skip to content

Instantly share code, notes, and snippets.

linux-vdso.so.1 => (0x00007fff7e73a000)
libvirt.so.0 => /usr/lib64/libvirt.so.0 (0x00007fa50ae7a000)
libguestfs.so.0 => /usr/lib64/libguestfs.so.0 (0x00007fa50abcb000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fa50a993000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fa50a776000)
libc.so.6 => /lib64/libc.so.6 (0x00007fa50a3e3000)
libcap-ng.so.0 => /lib64/libcap-ng.so.0 (0x00007fa50a1dd000)
libyajl.so.1 => /usr/lib64/libyajl.so.1 (0x00007fa509fd6000)
libnl.so.1 => /lib64/libnl.so.1 (0x00007fa509d84000)
libaudit.so.1 => /lib64/libaudit.so.1 (0x00007fa509b67000)
define i32 @mul_add(i32 %x, i32 %y, i32 %z) {
entry:
%tmp = mul i32 %x, %y
%tmp2 = add i32 %tmp, %z
ret i32 %tmp2
}
define i32 @main() {
%tmp = call i32 @mul_add(i32 2, i32 2, i32 4)
ret i32 %tmp
pkg_add -r fusefs-sshfs
echo 'fusefs_enable="YES"' >> /etc/rc.conf
/usr/local/etc/rc.d/fusefs start
sysctl vfs.usermount=1
# mkdir mount
# sshfs -o idmap=user preetamjinka@10.0.2.2:/Users/preetamjinka mount
@Preetam
Preetam / ps.sh
Created October 12, 2013 17:10
Inspired by TJ Holowaychuk's PS1
function git_branch {
git rev-parse --abbrev-ref HEAD 2> /dev/null | sed -e 's/\(.*\)/\ \(\1\)/'
}
PS1="\n ∂\[\e[00;30m\] \[\e[0m\]\[\e[00;34m\][\[\e[0m\]\[\e[00;30m\]\W\[\e[0m\]\[\e[00;34m\]]\[\e[0m\]\$(git_branch)\[\e[00;30m\]:\[\e[0m\] "
PS2=" | "
/*
OUTPUT:
x: 0x9cb010
a: 0x7fff40fe88e0
0x7fff40fe88e0
Current stack pointer address: 0x7fff40fe88e0 with value 0x17e
Current stack pointer address: 0x7fff40fe88e1 with value 0x1000000001000001
Current stack pointer address: 0x7fff40fe88e2 with value 0xb010000000020000
/*
∂ [src]: cc memmaps.c && ./a.out
Address of myVar: 0x7fff808cb864
Address of pointer: 0x7fff808cb878
Looks like 0x7fff808cb3b0->0x7fff808cb864 is a pointer to 0x7fff808cb864!
Looks like 0x7fff808cb770->0x7fff808cb864 is a pointer to 0x7fff808cb864!
Looks like 0x7fff808cb778->0x7fff808cb864 is a pointer to 0x7fff808cb864!
Looks like 0x7fff808cb828->0x7fff808cb864 is a pointer to 0x7fff808cb864!
Looks like 0x7fff808cb878->0x7fff808cb864 is a pointer to 0x7fff808cb864!
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
void* mallocAddress = NULL;
int
look_for_pointer(void* start, void* end, void* address, void* ignore) {
if(address == NULL) return 0;

Benchmarking Nginx with Go

Today I just wanted to know which of these options is faster:

  • Go HTTP standalone
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI

Hardware

MemTotal = 3765948
@Preetam
Preetam / pyfickle.py
Last active January 1, 2016 04:09
This is a small Python class to communicate with a Fickle instance: https://github.com/PreetamJinka/fickle
import socket
'''
There's probably a better way to do these.
'''
def int_to_uint16(num):
return chr(num & 255)+chr((num>>8) & 255)
def chars_to_int(c1, c2):
return ord(c2) + ord(c1)<<8