Skip to content

Instantly share code, notes, and snippets.

View penghou620's full-sized avatar

Peng Hou penghou620

  • LoadSmart Inc.
  • New York
View GitHub Profile
@penghou620
penghou620 / Startup
Created April 21, 2013 17:44
Launch the dependences of Hilary including: cassandra, redis, elasticsearch, rabbitmq
#!/bin/bash
#Program:
# This program runs the dependences of HIlary:
# cassandra
# redis
# elasticsearch
# rabbitmq
#Parameter:
# config
# config the script even if there's configuration file exist
set-window-option -g mode-keys vi
# set prefix key fro C-b to C-a
set-option -g prefix C-n
#####################################
# Key Binding
# bind-key [-cnr] [-t key-table] key command [arguments]
# -n: ignore prefix key
#####################################
## split
syntax on
set tabstop=4
set autoindent
set nu
set background=dark
"Comment
"colorscheme solarized
nmap <CR> o<ESC>k
nmap <SPACE> i<SPACE><ESC>
! 37 control_l
! 133 Super_L
! remove Lock = Caps_Lock
! remove Control = Control_L
! keysym Control_L = Caps_Lock
! keysym Caps_Lock = Control_L
! add Lock = Caps_Lock
! add Control = Control_L
#!/bin/bash
ipaddr=$(ifconfig eth0 | grep 'inet addr:')
ROS_MASTER_URI=${ipaddr:20:12}
export ROS_MASTER_URI=$ROS_MASTER_URI
@penghou620
penghou620 / theme_nice_menus
Last active December 22, 2015 13:49
Example code of using theme_nice_menus() function
$menu = theme('nice_menus',array(
'id'=>'main-menu',
'direction'=>'down',
'depth'=>-1,
'menu_name'=>'main-menu',
'menu'=>NULL,
));
print $menu['content'];
1 #!/bin/bash
2 ip=$(ifconfig eth0 | grep inet | awk '{print $2}' | cut -d':' -f2)
3 echo "To: dustsnow@126.com\nFrom: dustsnow@gmail.com\nSubject: IP Address\n" > msg.txt
4 echo ${ip} >> msg.txt
5
6 ssmtp dustsnow@126.com < msg.txt
String[] myStringArray = new String[] { "Cool", "Very nice", "Hate it" };
ArrayAdapter adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, myStringArray);
ListView listView = (ListView) findViewById(R.id.listView1);
listView.setAdapter(adapter);
@penghou620
penghou620 / nginx
Created September 29, 2014 20:39
This is nginx configuration file for WordPress and Node.js running parallel.
server {
listen 80;
root /var/www;
index index.php index.html index.htm;
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
@penghou620
penghou620 / Procfile
Last active August 29, 2015 14:14 — forked from mojodna/Procfile
web: node app.js
worker: node consumer.js