Skip to content

Instantly share code, notes, and snippets.

@zhouji
zhouji / rm.sh
Created March 22, 2012 09:49 — forked from zhasm/rm.sh
safe rm command
logger ()
{
time=`TZ="Asia/Shanghai" date +"%Y-%m-%d %T"`;
echo "[$time] $*"
}
filesize ()
{
/bin/ls -alF "$1" | awk '{print $5}'
}
@zhouji
zhouji / gist:2315650
Created April 6, 2012 01:07 — forked from sharrissf/gist:700690
Direct Memory vs On Heap in Java
import java.nio.ByteBuffer;
import java.util.Random;
public class BufferPerformanceComparison {
public final static int MEGA_BYTE = 1024 * 1024;
public final static long GIGA_BYTE = MEGA_BYTE * 1024;
private final ByteBuffer heapByteBuffer;
private final ByteBuffer offHeapByteBuffer;
private final long dataToLoad;
private final int bufferSize;
@zhouji
zhouji / EC_KestrelClient.php
Created November 6, 2012 15:51 — forked from shupp/EC_KestrelClient.php
Kestrel Client Decorator
<?php
/**
* A thin kestrel client that wraps Memcached (libmemcached extension)
*
* @author Bill Shupp <hostmaster@shupp.org>
* @copyright 2010-2011 Empower Campaigns
*/
class EC_KestrelClient
{
/**
@zhouji
zhouji / .vimrc
Last active October 13, 2015 03:08 — forked from stupend/.vimrc
My Vim config file
set nocompatible
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'python.vim'
Bundle 'taglist.vim'
Bundle 'TWiki-Syntax'
import ro.isdc.wro.model.resource.*
import ro.isdc.wro.extensions.processor.js.*
buildscript {
repositories { mavenCentral() }
dependencies {
classpath "ro.isdc.wro4j:wro4j-extensions:${versions.wro4j}"
}
}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
/**
* 新浪微博mid与url互转实用工具
* 作者: XiNGRZ (http://weibo.com/xingrz)
*/
var WeiboUtil = {
// 62进制字典
str62keys: [
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
@zhouji
zhouji / test.clj
Created August 12, 2013 01:53 — forked from adambard/test.clj
; Comments start with semicolons.
; Clojure is written in "forms", which are just
; lists of things inside parentheses, separated by whitespace.
;
; The clojure reader assumes that the first thing is a
; function or macro to call, and the rest are arguments.
;
; Here's a function that sets the current namespace:
(ns test)
@zhouji
zhouji / ssh-agent
Created September 26, 2013 06:49 — forked from rezlam/ssh-agent
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: