Skip to content

Instantly share code, notes, and snippets.

@etaf
etaf / fun of coolshell
Last active August 29, 2015 14:04
fun of coolshell
http://fun.coolshell.cn/welcome.html
http://fun.coolshell.cn/1944.html
http://fun.coolshell.cn/42.html
http://fun.coolshell.cn/81648.html
http://fun.coolshell.cn/unix.html
http://fun.coolshell.cn/furyy.html
http://fun.coolshell.cn/cat.html
http://fun.coolshell.cn/variables.html
http://fun.coolshell.cn/tree.html
http://fun.coolshell.cn/zWp8LGn01wxJ7.html
@etaf
etaf / [ Tcl ] read file by line
Last active August 29, 2015 14:06
[ Tcl ] read file by line
set fp [open $some_file]
while {-1 != [gets $fp line]} {
puts "The current line is '$line'."
}
@etaf
etaf / [ Tcl ] Read file to variable
Created September 15, 2014 11:07
[ Tcl ] Read file to variable
#!/usr/bin/tclsh
set fp [open "tmp" r]
while {-1 != [gets $fp line]} {
puts "The current line is '$line'."
set vs [split $line " "]
set a [lindex $vs 0]
set b [lindex $vs 1]
puts "$a + $b = [expr $a+$b]"
}
@etaf
etaf / [bash] convert filename from lower to upper
Created March 27, 2015 13:53
[bash] convert filename from lower case to upper case
#!/bin/bash
DIR="./leetcode"
for file_name in `ls ./leetcode`;
do
new_file_name=`echo "$file_name" | tr '[:upper:]' '[:lower:]' `
if [ "$file_name"x != "$new_file_name"x ]; then
echo "mv $DIR/$file_name $DIR/$new_file_name"
`mv $DIR/$file_name $DIR/$new_file_name`
fi
done
@etaf
etaf / run-time 4 kemy in ec2
Last active August 29, 2015 14:18
redhat7 run-time 4 kemy in ec2
#sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
sudo yum install -y epel-release
sudo yum install -y git boost boost-devel libX11-devel xorg-x11-proto-devel libXt-devel libXmu-devel autoconf automake gcc gcc-c++ protobuf protobuf-devel pkg-conf jemalloc* tmux vim zsh autojump
curl -o ~/.zshrc https://gist.githubusercontent.com/etaf/4a5ac4f7c5e170dc6f67/raw/60a29d50a665d1fb8fb50a2e3e56f7e322c48231/gistfile1.sh
sudo chsh ec2-user
@etaf
etaf / .dircolors
Last active August 29, 2015 14:26
.dircolors
# Dark 256 color solarized theme for the color GNU ls utility.
# Used and tested with dircolors (GNU coreutils) 8.5
#
# @author {@link http://sebastian.tramp.name Sebastian Tramp}
# @license http://sam.zoy.org/wtfpl/ Do What The Fuck You Want To Public License (WTFPL)
#
# More Information at
# https://github.com/seebi/dircolors-solarized
@etaf
etaf / kemy-centos-docker.sh
Last active August 29, 2015 14:26
kemy-centos-docker
yum install -y epel-release
yum install -y git boost boost-devel libX11-devel xorg-x11-proto-devel libXt-devel libXmu-devel autoconf automake make gcc gcc-c++ protobuf protobuf-devel pkg-conf jemalloc* tmux vim zsh autojump
cd /home
curl -sSL http://etaf.me/public/ns-allinone-2.35.tar.gz | tar -xz
cd ns-all*
rm ns-2.35 -rf
git clone https://github.com/etaf/ns4kemy.git && mv ns4kemy ns-2.35
cd ns-2.35/queue/kemy-train
./autogen.sh && ./configure > configure_out && make clean && make
@etaf
etaf / Dockerfile
Last active August 29, 2015 14:26
kemy-docker
FROM centos
MAINTAINER etaf <fjdksfjdks@qq.com>
RUN yum install -y epel-release
RUN yum install -y git boost boost-devel libX11-devel xorg-x11-proto-devel libXt-devel libXmu-devel autoconf automake make gcc gcc-c++ protobuf protobuf-devel pkg-conf jemalloc*
RUN cd /home && curl -sSL http://etaf.me/public/ns-allinone-2.35.tar.gz | tar -xz
RUN cd /home/ns-all* && rm ns-* -rf && git clone --recursive https://github.com/etaf/ns4kemy.git && mv ns4kemy ns-2.35
RUN cd /home/ns-all*/ns-*/queue/kemy-train && ./autogen.sh && ./configure > configure_out && make clean && make
RUN cd /home/ns-all* && sed -i '1i alias make="make -j 4"' ./install && ./install
@etaf
etaf / ProcessBar.bas
Last active August 29, 2015 14:27
VB ProcessBar
Sub ProgressBar()
' by dukenuke@newsmth.net
' Sun Jul 11 00:06:13 2010
Dim mySlides As Slides
Dim pageBar As ShapeRange
Dim pageSHower As Shape
Dim pageWidth, pageHeight, pageStep
Set mySlides = Application.ActivePresentation.Slides