Skip to content

Instantly share code, notes, and snippets.

View liweinan's full-sized avatar
🐢

阿男 liweinan

🐢
View GitHub Profile
@lxneng
lxneng / gist:741932
Created December 15, 2010 13:21
install PostgreSQL 9 in Mac OSX via Homebrew
install PostgreSQL 9 in Mac OSX via Homebrew
Mac OS X Snow Leopard
System Version: Mac OS X 10.6.5
Kernel Version: Darwin 10.5.0
Install notes for PostgreSQL 9.0.1 install using Homebrew:
sh-3.2# brew install postgresql
@yuya-takeyama
yuya-takeyama / binarytree.rb
Created February 5, 2011 14:32
Binary Tree implemented in Ruby.
module BinaryTree
class Node
attr_reader :word, :count, :left, :right
include Enumerable
def initialize(word)
@word, @count = word, 1
end
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
@error454
error454 / gist:1202171
Created September 7, 2011 23:38
Java random delay
void randomDelay(float min, float max){
int random = (int)(max * Math.random() + min);
try {
Thread.sleep(random * 1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@ryangray
ryangray / buttondown.css
Created February 22, 2012 06:45
A clean, minimal CSS stylesheet for Markdown, Pandoc and MultiMarkdown HTML output.
/*
Buttondown
A Markdown/MultiMarkdown/Pandoc HTML output CSS stylesheet
Author: Ryan Gray
Date: 15 Feb 2011
Revised: 21 Feb 2012
General style is clean, with minimal re-definition of the defaults or
overrides of user font settings. The body text and header styles are
left alone except title, author and date classes are centered. A Pandoc TOC
@alum
alum / binarytree.py
Created February 24, 2012 17:20
Binary tree in python
class BinaryNode:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
class BinaryTree:
''' A Binary Tree class '''
def __init__(self):
self.root = None
@milenkovicm
milenkovicm / WarSmokeTest.java
Created March 14, 2012 11:42
[Junit] Arquillian - how to export shrinkwrap archive
@RunWith(Arquillian.class)
public class WarSmokeTest {
@Deployment
public static Archive<?> createTestArchive() {
final MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");
final WebArchive archive = ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource("META-INF/beans.xml")
///
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active November 17, 2024 01:28
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname