Skip to content

Instantly share code, notes, and snippets.

@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 / .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 / 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 / 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 / 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 / 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 / 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
# andrea.lazzarotto@gmail.com
# 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 / 12306.user.js
Created January 5, 2012 09:49 — forked from quietlynn/12306.user.js
下载,解压,拖到 Chrome 中或是配合 GreaseMonkey 使用,12306订票专用。
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js
@rainly
rainly / will_paginate_left_right_arrrow
Created August 24, 2011 05:32 — forked from huacnlee/will_paginate.js
使 WillPaginate 支持用左右键翻页
// From Dribbble.com
// Keyboard shortcuts for browsing pages of lists
// 使 WillPaginate 支持用左右键翻页
(function($) {
$(document).keydown(handleKey);
function handleKey(e){
var left_arrow = 37;
var right_arrow = 39;
if (e.target.localName == 'body' || e.target.localName == 'html') {
@rainly
rainly / git_tips.md
Created May 1, 2011 00:58 — forked from fguillen/git_tips.md
Git Tips

(Several of these git examples have been extracted from the book 'Pragmatic guide to GIT' of Travis Swicegood )

Git tips

Global git user

git config --global user.name "Fernando Guillen"
git config --global user.email "fguillen.mail+spam@gmail.com"

Repository git user

cd /develop/myrepo