Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / gdbinit
Created January 24, 2016 07:24
gdbinit
#
# STL GDB evaluators/views/utilities - 1.03
#
# The new GDB commands:
# are entirely non instrumental
# do not depend on any "inline"(s) - e.g. size(), [], etc
# are extremely tolerant to debugger settings
#
# This file should be "included" in .gdbinit as following:
# source stl-views.gdb or just paste it into your .gdbinit file
@etaf
etaf / vimrclocal
Created January 24, 2016 07:40
vimrclocal
" set F5 for compile and run c/cpp/python
"map <C-F5> : call CompileRunC()<CR>
map <F5> : call CompileRunCpp()<CR>
"map <F5>: call DebugCpp()<CR>
"map <F6> : call RunPython()<CR>
map <F6> : call RunShell()<CR>
func! CompileRunC()
exec "w"
exec "!gcc -std=c++11 -g -lboost_program_options -lpthread -lboost_system -lboost_filesystem % -o %<"
spinner() {
local spin="\\|/-"
local i=0
tput civis
while kill -0 "$1" 2>/dev/null; do
i=$(( (i+1) %4 ))
printf "\b%s" "${spin:$i:1}"
sleep 0.07
done
tput cnorm
@etaf
etaf / auto_passwd.exp
Created January 19, 2017 13:56
auto_passwd
#!/usr/bin/expect
set timeout 20
set cmd [lrange $argv 1 end]
set password [lindex $argv 0]
eval spawn $cmd
expect "assword:"
send "$password\r";
@etaf
etaf / yum_download_only.sh
Last active August 5, 2017 08:53
yum download only
yum install yum-utils
# use --resolve to download dependencies.
yumdownloader --destdir ./rpms --resolve <package>
# on other machine
cd rpms
yum --disablerepo=* localinstall *.rpm -y
@etaf
etaf / gtags with python support
Last active May 16, 2019 05:20
gtags with python support
# 1 install universal ctags first.
# if mac:
# brew install libxml2
# ln -s /usr/local/Cellar/libxml2/2.9.9_2/include/libxml2/libxml /usr/local/include/libxml
git clone https://github.com/universal-ctags/ctags.git
cd ctags
./autogen.sh
./configure --prefix=${HOME}/.local
make -j$(nproc) && make install