Skip to content

Instantly share code, notes, and snippets.

View imchao9's full-sized avatar
🎯
Focusing

JunChao imchao9

🎯
Focusing
View GitHub Profile
@imchao9
imchao9 / javascript
Created March 31, 2017 08:22
output the table in html
var table = document.getElementById('abc');
var text = "";
var rowLength = table.rows.length;
var cell1,cell2 = 0;
for(var i=0; i<rowLength; i+=1){
var row = table.rows[i];
//your code goes here, looping over every row.
//cells are accessed as easy
@imchao9
imchao9 / shell,mac
Last active March 22, 2017 07:42
mac: run the command to delete the match string in all files
find . -name "*.ts" -exec sed -i '' '/tsd\.d/d' {} \;
@imchao9
imchao9 / shell
Created March 15, 2017 03:05
stop nginx when the system boot
update-rc.d nginx defaults disable
@imchao9
imchao9 / perf-flame-graph-notes.md
Created February 25, 2017 16:17 — forked from sericaia/perf-flame-graph-notes.md
Quick steps of how to create a flame graph using perf

The prep-script.sh will setup the latest Node and install the latest perf version on your Linux box.

When you want to generate the flame graph, run the following (folder locations taken from install script):

sudo sysctl kernel.kptr_restrict=0
# May also have to do the following:
# (additional reading http://unix.stackexchange.com/questions/14227/do-i-need-root-admin-permissions-to-run-userspace-perf-tool-perf-events-ar )
sudo sysctl kernel.perf_event_paranoid=0
@imchao9
imchao9 / init-server.sh
Created January 7, 2017 08:54
change ssh config & install docker
#! /bin/bash
#echo 'Add user';
#adduser codemao
#usermod -a -G sudo codemao
#passwd codemao
#su codemao
#
#echo 'Apt update';
#sudo apt-get update
#
@imchao9
imchao9 / sort_by_specify_array.js
Last active December 5, 2016 08:44
use lodash sortby to sort the array by specifc array
var sortedCollection = _.sortBy(collection, function(item){
return firstArray.indexOf(item.id)
});
@imchao9
imchao9 / gist:e1823eb48e77b944fb67751507c592cb
Created December 5, 2016 08:42
use lodash sortby to sort the array by specifc array
var sortedCollection = _.sortBy(collection, function(item){
return firstArray.indexOf(item.id)
});
@imchao9
imchao9 / bash
Created December 1, 2016 06:12
本地通过ssh执行远程服务器的脚本
#!/bin/bash
#变量定义
ip_array=("192.168.1.1" "192.168.1.2" "192.168.1.3")
user="test1"
remote_cmd="/home/test/1.sh"
#本地通过ssh执行远程服务器的脚本
for ip in ${ip_array[*]}
@imchao9
imchao9 / bash
Created December 1, 2016 06:12
本地通过ssh执行远程服务器的脚本
#!/bin/bash
#变量定义
ip_array=("192.168.1.1" "192.168.1.2" "192.168.1.3")
user="test1"
remote_cmd="/home/test/1.sh"
#本地通过ssh执行远程服务器的脚本
for ip in ${ip_array[*]}
@imchao9
imchao9 / tmux-cheatsheet.markdown
Created November 29, 2016 05:55 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]