Skip to content

Instantly share code, notes, and snippets.

@etaf
etaf / dircolor
Created January 24, 2016 07:23
dircolor
# 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 / gist:7635f163a51b902a4532
Created December 31, 2015 02:59
rename filename using regex
rename file:
2015-01-21-hello.md
2015-04-02-word.md
to:
hello.md
word.md
for f in 2015* ; do mv $f $(echo $f | sed 's/[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}-//') ; done
@etaf
etaf / clc_elapsed_time.cpp
Created September 18, 2015 10:31
clc_elapsed_time.cpp
#include <iostream>
#include <chrono>
#include <thread>
int main()
{
//using namespace std::literals;
std::cout << "Hello waiter" << std::endl;
auto start = std::chrono::high_resolution_clock::now();
std::this_thread::sleep_for (std::chrono::seconds(1));
auto end = std::chrono::high_resolution_clock::now();
@etaf
etaf / ProcessBar.bas
Last active August 29, 2015 14:27
VB ProcessBar
Sub ProgressBar()
' by [email protected]
' 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
@etaf
etaf / Dockerfile
Last active August 29, 2015 14:26
kemy-docker
FROM centos
MAINTAINER etaf <[email protected]>
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 / 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 / .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 / 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 / [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 / mtw_download.sh
Last active July 19, 2016 05:39
download the easy fm more to learn mp3 from start day to now
#!/bin/bash
#usage:
#download the easy fm more to learn mp3 from start day to now
trap ctrl_c INT
function ctrl_c(){
echo "\n catched interput signal, exiting..."
[ ! -e $current_process_file ] || rm $current_process_file
echo "bye!"
exit
}