Skip to content

Instantly share code, notes, and snippets.

@ikbear
ikbear / site.sh
Created January 8, 2011 13:57
备份全站,网站目录为www
#!/bin/bash
suffix=$(date +%y%m%d)
tar -zcf www.$suffix.tar.gz www
ctrl-z
bg
touch /tmp/stdout
touch /tmp/stderr
gdb -p $!
# In GDB
p dup2(open("/tmp/stdout", 1), 1)
p dup2(open("/tmp/stderr", 1), 2)

Game Engines

Name Latest Release Size (KB) License Type Unit Tests Docs Notes
The Render Engine 1.5.3 MIT Cross-browser; extensive API; open-source. 2
gameQuery 0.5.1 CC BY-SA 2.5 Designed to be used with jQuery
gTile 0.0.1 (2008-07-21) Tile based
Akihabara 1.3 GPL2/MIT Classic Repro Intended for making classic arcade-style games in JS+HTML5 3
The Javascript 2D Game Engine GPL Emphasis on gravity/physics/collision detection; uses HTML5 Canvas and ExplorerCanvas for IE support. Focus on limiting CPU usage. 4
The GMP Javascript Game Engine
@ikbear
ikbear / cnk.py
Created March 10, 2011 12:16
Computing Combinations with Python
import operator
def c(n, k):
return (reduce(operator.mul, range(n-k+1, n+1)) /
reduce(operator.mul, range(1, k+1)))
@ikbear
ikbear / cnk.java
Created March 10, 2011 12:16
Computing Combinations with Java
import java.math.*;
public class cnk{
public static BigInteger cnk(int n, int k)
{
BigInteger fenzi = new BigInteger("1");
BigInteger fenmu = new BigInteger("1");
for(int i=n-k+1; i <= n; i++){
String s = Integer.toString(i);
BigInteger stobig = new BigInteger(s);
@ikbear
ikbear / solution.py
Created March 12, 2011 13:32
A solution to this problem B
# This is the problem:
# http://www.acm-japan.org/past-icpc/domestic2003/B.htm
# Here is the input data:
# http://www.acm-japan.org/past-icpc/domestic2003/input/B1.txt
import operator,string
f = open("B1.txt")
while(True):
line = int(f.readline())
@ikbear
ikbear / osx_lion_rail_setup.md
Created August 25, 2011 07:34 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@ikbear
ikbear / osx_lion_rail_setup.md
Created August 26, 2011 01:37 — forked from jpantuso/osx_lion_rail_setup.md
Setup OS X 10.7 w/ homebrew, oh-my-zsh, rvm, rails, and MySQL
@ikbear
ikbear / nginx.conf
Created September 15, 2011 01:31 — forked from huacnlee/nginx.conf
Nginx http proxy cache to mirror of Rubygems.org
# 在本地服务器建立 rubygems.org 的镜像缓存,以提高 gem 的安装速度
# 此配置设置缓存过期为1天,也就是说,新上的 gem 无法马上安装
# 做这个起什么作用?
# rubygems 的很多资源文件是存放到 Amazon S3 上面的,由于 GFW 对某些 S3 服务器又连接重置或丢包,导致 gem 安装异常缓慢或有时候根本无法连接安装。
# 而通过这种跳板的方式可以很好的解决这个问题,当然前提是 Nginx反向代理 服务器需要在国外
proxy_cache_path /var/cache/rubygems levels=1:2 keys_zone=RUBYGEMS:10m
inactive=24h max_size=1g;
server {
listen 80;
@ikbear
ikbear / gist:1274521
Created October 10, 2011 02:36 — forked from xdite/gist:1273518
Octopress Wordpress converter
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
require 'ya2yaml'
include REXML
doc = Document.new(File.new(ARGV[0]))