Skip to content

Instantly share code, notes, and snippets.

@galaxy001
galaxy001 / 12306.user.js
Created January 7, 2012 00:24 — forked from quietlynn/12306.user.js
12306 Auto Query => A javascript snippet to help you book ticket
/*
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
/*
12306 Auto Login => A javascript snippet to help you auto login 12306.com.
Copyright (C) 2011 Kevintop
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
This program is free software: you can redistribute it and/or modify
@galaxy001
galaxy001 / conv.cc
Created August 25, 2013 11:58 — forked from timothyqiu/conv.cc
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <windows.h> // 各种位图数据结构
class Converter
{
public:
Converter() : pixels_(NULL), width_(0), height_(0) {}
var PROXY = 'SOCKS5 127.0.0.1:10007';
var PROXY_HOSTS = [
/* google */
'google.com', 'googleusercontent.com', 'gstatic.com', 'ggpht.com', 'googleapis.com',
'googlecode.com', 'google.co.id', 'googleadservices.com',
/* other */
'godaddy.com', 'blogger.com', 'blogspot.jp', 'youtu.be', 'goo.gl', 'facebook.com',
'feedsportal.com', 'cloudfront.net', 'alexa.com', 's3.amazonaws.com', 'cl.ly', 'yfrog.com',
2015-05-12 02:43:42 +0800
./configure
--prefix=/usr/local/Cellar/zenity/3.14.0
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
2015-07-02 22:17:25 +0800
./configure
--prefix=/usr/local/Cellar/ffmpeg/2.7.1
--enable-shared
--enable-pthreads
--enable-gpl
--enable-version3
--enable-hardcoded-tables
--enable-avresample
@galaxy001
galaxy001 / test.md
Last active August 29, 2015 14:27
for test only

!TOC

h1

h2

@galaxy001
galaxy001 / current_utc_time.c
Last active August 31, 2015 14:46 — forked from jbenet/current_utc_time.c
work around lack of clock_gettime in os x
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@galaxy001
galaxy001 / gist:40d8f38c988af76ac80f
Created November 10, 2015 07:42
gevent performance tuning
$ vi /etc/sysctl.conf
# 系统所有进程一共可以打开的文件数量, 每个套接字也占用一个文件描述字
fs.file-max = 1491124
# 系统同时保持TIME_WAIT套接字的最大数目,http 短链接会产生很多 TIME_WAIT 套接字。
net.ipv4.tcp_max_tw_buckets = 7000
# 关闭 tcp 来源跟踪
net.ipv4.conf.default.accept_source_route = 0
# 缩短套接字处于 TIME_WAIT 的时间, 60s -> 30s
net.ipv4.tcp_fin_timeout = 30
# 启用 TIME_WAIT 复用,使得结束 TIEM_WAIT 状态的套接字的端口可以立刻被其他套接字使用。
@galaxy001
galaxy001 / gist:203407b0d85e02d8d359
Created December 8, 2015 12:29 — forked from jvenator/gist:9672772a631c117da151
PDFtk Server Install Workaround for Mac OS X

Installing PDFtk Server edittion on your Mac

This workaround install is necessary because PDFtk was pulled from homebrew-cask due to issues with it aggressively overwriting file permissions that could impact other installed libraries. See this homebrew-cask issue.
The following steps worked on Mac OS X 10.10.1 with a standard brew installation for the PDFtk Mac OS X server libary version 2.02.
All Terminal commands separated by a full line space. Some commands wrap into multiple lines.

Download and extract the Mac OS X server install pacakge