Skip to content

Instantly share code, notes, and snippets.

View santazhang's full-sized avatar
👨‍💻
SIGSEGV

Santa Zhang santazhang

👨‍💻
SIGSEGV
View GitHub Profile
#!/usr/bin/perl
$device = "eth0";
#check if device has an expected ip address
$ifoutput = `ifconfig $device`;
if (!($ifoutput =~ /216.165.108/)) {
$device = "eth1";
$ifoutput = `ifconfig $device`;
die "neither eth0 nor eth1 have right ip\n" if (!($ifoutput =~ /216.165.108/));
}
@santazhang
santazhang / google-hyperloglog-data.c
Created February 21, 2015 04:11
Google HyperLogLog data, obtained from http://goo.gl/iU8Ig
double[][] rawEstimateData = {
// precision 4
{ 11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722, 17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766, 24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996, 32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966, 41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506, 51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482, 61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928, 70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394, },
// precision 5
{ 23, 23.1194, 23.8208, 24.2318, 24.77, 25.2436, 25.7774, 26.2848, 26.8224, 27.3742, 27.9336, 28.503, 29.0494, 29.6292, 30.2124, 30.798, 31.367, 31.9728, 32.5944, 33.217, 33.8438, 34.3696, 35.0956, 35.7044, 36.324, 37.0668, 37.6698, 38.3644, 39.049, 39.
base00: "323232"
base01: "d25252"
base02: "7fe173"
base03: "ffc66d"
base04: "4098ff"
base05: "f57fff"
base06: "bed6ff"
base07: "eeeeec"
base08: "535353"
base09: "f07070"
@santazhang
santazhang / %gconf.xml
Created August 23, 2014 00:06
gnome-terminal config (with idleToes theme)
<?xml version="1.0"?>
<gconf>
<entry name="bold_color_same_as_fg" mtime="1408752282" type="bool" value="false"/>
<entry name="default_show_menubar" mtime="1408751572" type="bool" value="false"/>
<entry name="font" mtime="1408749339" type="string">
<stringvalue>Monospace 8</stringvalue>
</entry>
<entry name="default_size_rows" mtime="1408748855" type="int" value="40"/>
<entry name="default_size_columns" mtime="1408748871" type="int" value="128"/>
<entry name="use_custom_default_size" mtime="1408748849" type="bool" value="true"/>
@santazhang
santazhang / install_ffmpeg.py
Created March 4, 2012 07:55
Python script to compile and install ffmpeg
#!/usr/bin/env python
#
# Python script to compile and install ffmpeg.
#
# part of ffcluster project.
# see full project at github.com/santazhang/ffcluster
#
# Author: Santa Zhang <[email protected]>
import os