Skip to content

Instantly share code, notes, and snippets.

View arsham's full-sized avatar

Arsham Shirvani arsham

View GitHub Profile
@arsham
arsham / reflext_go_test.sh
Created May 26, 2018 12:00
Run #golang tests with reflex and print a separator after each iteration.
reflex -d none -r "\.go$" -- zsh -c "time go test ./... ; repeat 100 printf '#'"
@arsham
arsham / iotop_refresh_rate.sh
Created May 2, 2018 22:22
Iotop with refresh rate and only active processes. #linux #sysadmin
iotop -aod 0.5
@arsham
arsham / sysctl.conf
Created April 30, 2018 12:47
Sysctl configuration to reduce swap stress on #linux
# put insize /etc/sysctl.d/99-sysctl.conf
vm.swappiness=1
vm.max_map_count=262144
vm.vfs_cache_pressure=50
@arsham
arsham / cpu_flags.sh
Created April 29, 2018 19:00
Identify CPU_FLAGS for the cpu
git clone [email protected]:mgorny/cpuid2cpuflags.git
cd cpuid2cpuflags
autoreconf --install
./configure
make
./cpuid2cpuflags
@arsham
arsham / ccache_tips.md
Last active July 25, 2024 17:48
#ccache tips for better compilations performance. #linux

Ccache

Setup

Install ccache then update the PATH:

export PATH="/usr/lib/ccache:$PATH"
@arsham
arsham / patch_guru_cgo.sh
Last active May 5, 2018 21:01
Patch guru to work with #golang cgo
cd $GOPATH/src/golang.org/x/tools
git remote add cgo [email protected]:FrankReh/tools.git
git merge cgo/current
cd cmd/guru
find . -type f -print0 | xargs -0 sed -i 's/guru "github\.com\/frankreh\/tools\/cmd\/guru"//g'
find . -type f -print0 | xargs -0 sed -i 's/import "github\.com\/frankreh\/tools\/cmd\/guru"//g'
go install
# back to original
git reset origin/master --hard
@arsham
arsham / qt_add_component.txt
Created April 26, 2018 16:02
Qt add/update components
Run `MaintenanceTool` in Qt installation directory. Select settings and add:
`http://download.qt.io/online/qt5/linux/x86/online_repository/`
@arsham
arsham / replace_string_in_files.sh
Created April 25, 2018 20:38
Replace string in all files recursively
find . -type f -print0 | xargs -0 sed -i 's/MATCH/REPLACEMENT/g'
@arsham
arsham / restart_plasma.sh
Created April 23, 2018 13:41
Restart Plasma shell and panel
kquitapp5 plasmashell && kstart plasmashell
@arsham
arsham / grep_compressed_files.sh
Created April 21, 2018 21:19
Group in all compressed files
find -name \*.gz -print0 | xargs -0 zgrep "TEXT"