Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
alias ls='ls --color'
alias ll='ls -l'
export SCALA_HOME='/Users/zhen/Downloads/scala-2.10.4'
export PATH=$SCALA_HOME/bin:$PATH
set nocompatible " use vim defaults
set ls=2 " allways show status line
set expandtab " use space to replace tab
set tabstop=4 " numbers of spaces of tab character
set shiftwidth=4 " numbers of spaces to (auto)indent
set scrolloff=3 " keep 3 lines when scrolling
set showcmd " display incomplete commands
set hlsearch " highlight searches
set incsearch " do incremental searching
set ruler " show the cursor position all the time
@zhpengg
zhpengg / .tmux.conf
Last active May 1, 2016 05:56
tmux conf
# status bar
set-option -g status-utf8 on
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
# set window split
## 依赖环境
0. 两个程序运行都需要 java 环境, 运行 `java -version` 确保 java 版本是 1.6 以上.
1. 这个系统涉及到两台机器: a) 前端 access log 所在的机器:FE b) 后端实时计算机器: BE
2. 日志收集程序 `flume` 安装在 FE 机器上, 数据库 `mongodb` 和 `spark` 安装在 BE 机器上.
## 安装数据库 mongodb
@zhpengg
zhpengg / .bashrc
Created March 1, 2013 09:22
screenssh greate tools
function screenssh ()
{
local username=work
local server=''
local timeout=3
for server in $@; do
screen -S $STY -X screen ssh $username@$server
done
#sleep $timeout
#local cmd="screen -S $STY -X at ssh# stuff $'$password\n'"
@zhpengg
zhpengg / gettimeofday.c
Created July 14, 2012 06:52
gettimeofday test
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/time.h>
#include <signal.h>
static long couter = 0;
void sigalarm(int sig)
{
@zhpengg
zhpengg / skip_list.c
Created June 5, 2012 07:52
skiplist implementation in c
/* Skip Lists: A Probabilistic Alternative to Balanced Trees */
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#define SKIPLIST_MAX_LEVEL 6
typedef struct snode {
int key;
@zhpengg
zhpengg / lru.cc
Created May 23, 2012 15:39
LRU Cache Demo In C++
#include <iostream>
#include <string>
#include <map>
using namespace std;
struct entry {
entry(string k, int v, entry *n, entry *p):
key(k), value(v), next(n), prev(p){}
string key;
int value;
@zhpengg
zhpengg / lru_cache.c
Created May 23, 2012 07:25 — forked from jehiah/lru_cache.c
a LRU cache in C using uthash
#include <string.h>
#include <uthash.h>
// this is an example of how to do a LRU cache in C using uthash
// http://uthash.sourceforge.net/
// by Jehiah Czebotar 2011 - jehiah@gmail.com
// this code is in the public domain http://unlicense.org/
#define MAX_CACHE_SIZE 100000
@zhpengg
zhpengg / get_random64.c
Created April 28, 2012 03:30
使用/dec/random获取64bit随机数
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdint.h>
#include <inttypes.h>
int main()
{