Skip to content

Instantly share code, notes, and snippets.

@rainly
rainly / slideshare-downloader.sh
Created March 2, 2012 08:58 — forked from giudinvx/slideshare-downloader.sh
Slideshare Downloader
#!/bin/bash
# Author: Andrea Lazzarotto
# http://andrealazzarotto.com
# [email protected]
# Slideshare Downloader
# This script takes a slideshare presentation URL as an argument and
# carves all the slides in flash format, then they are converted to
# and finally merged as a PDF
@rainly
rainly / Gemfile
Created March 11, 2012 05:12 — forked from kaichen/Gemfile
play-with-em
source :rubygems
gem "eventmachine", "0.12.10"
gem "rack"
@rainly
rainly / grep.cs
Created March 30, 2012 14:08 — forked from onlytiancai/grep.cs
对象健身操演练-grep
/*
## 对象健身操
http://www.infoq.com/cn/minibooks/thoughtworks-anthology
###规范
1. 方法只使用一级缩进。
1. 全部符合要求
1. 大部分通过方法提取做到,有的带yield的语句块不好提取,幸好一些Linq方法可以用来抽象一些集合操作。
1. 所有方法都尽量控制在5行以内,不包含空行和括号单独占的行
@rainly
rainly / stock5Min.c
Created April 22, 2012 09:18 — forked from border/stock5Min.c
通达信股票天和5分钟数据格式分析, 参考: http://alantop.5166.info/gpdatasoft/gpformat/gpformat.htm
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
struct stock5Min
{
unsigned short monthDay; // 月日
unsigned short hourMin; // 小时, 分钟
@rainly
rainly / zabbix.conf
Created April 25, 2012 07:35
User parameters for postgres node monitoring
# Postgresql 9.1 conf
# by http://www.postgresql.org/docs/9.1/interactive/monitoring-stats.html#MONITORING-STATS-FUNCS-TABLE
#
# Server specific parameters
# Example: psql.pg_stat_get_bgwriter_timed_checkpoints
#
UserParameter=psql.pg_stat_get_bgwriter_timed_checkpoints,psql -d neiron -t -c "SELECT pg_stat_get_bgwriter_timed_checkpoints() FROM pg_database WHERE datname='${1-"neiron"}'"
UserParameter=psql.pg_stat_get_bgwriter_requested_checkpoints,psql -d neiron -t -c "SELECT pg_stat_get_bgwriter_requested_checkpoints() FROM pg_database WHERE datname='${1-"neiron"}'"
UserParameter=psql.pg_stat_get_bgwriter_buf_written_checkpoints,psql -d neiron -t -c "SELECT pg_stat_get_bgwriter_buf_written_checkpoints() FROM pg_database WHERE datname='${1-"neiron"}'"
UserParameter=psql.pg_stat_get_bgwriter_buf_written_clean,psql -d neiron -t -c "SELECT pg_stat_get_bgwriter_buf_written_clean() FROM pg_database WHERE datname='${1-"neiron"}'"
@rainly
rainly / .Xdefaults
Created April 28, 2012 01:43 — forked from yevgenko/.Xdefaults
URxvt settings with solarized theme
!-------------------------------------------------------------------------------
! Xft settings
!-------------------------------------------------------------------------------
Xft.dpi: 96
Xft.antialias: false
Xft.rgba: rgb
Xft.hinting: true
Xft.hintstyle: hintslight
@rainly
rainly / latency.txt
Created June 1, 2012 02:32 — forked from jboner/latency.txt
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
Send 2K bytes over 1 Gbps network 20,000 ns
Read 1 MB sequentially from memory 250,000 ns
Round trip within same datacenter 500,000 ns
Disk seek 10,000,000 ns
@rainly
rainly / gist:3065231
Created July 7, 2012 07:31 — forked from newhouseb/gist:1620133
MySQL vs PostgreSQL Schema changes benchmarks
The basic idea here is to substantiate the claims made by this square post:
http://corner.squareup.com/2011/06/postgresql-data-is-important.html
In PostgreSQL, and MySQL (MyISAM and InnoDB) I create millions of rows and then add
and remove columns and add and remove indexes. For columns without defaults this is
basically free in PostgreSQL and O(n) in MySQL. For adding indexes its at best O(n)
everywhere, but with PostgreSQL it claims not to do any locking that would otherwise
prevent table interaction.
Also, PostgreSQL has _awsome_ documentation (it has real examples!). I always get
@rainly
rainly / vagrant_postinstall.sh
Created August 3, 2012 01:39 — forked from dholbrook/vagrant_postinstall.sh
vagrant centos 5.8 post install
####################
# centos 5.8
# post installation
# adapted from
# https://github.com/jedi4ever/veewee/tree/master/templates/CentOS-5.7-i386-netboot
####################
yum -y install sudo
/usr/sbin/groupadd vagrant
@rainly
rainly / youku-video-parser.py
Created August 12, 2012 12:15
A simple python script that takes a youku video url or video id as argument and output the video playlist.
#!/usr/bin/env python2
import sys
import urllib
from HTMLParser import HTMLParser
class FlvcdParser(HTMLParser):
def handle_starttag(self, tag, attrs):
if tag == "a":