Skip to content

Instantly share code, notes, and snippets.

View farrokhi's full-sized avatar
🚀

Babak Farrokhi farrokhi

🚀
View GitHub Profile
@farrokhi
farrokhi / cscope.md
Created January 19, 2020 11:17
Setting up cscope for a (large) C project

build/update database:

cd $PROJ_DIR
find . -path .git -path .svn -prune -o -name "*.[ch]" > cscope.files
cscope -bqk

browse code:

cscope -d
@farrokhi
farrokhi / freebsd-ntpd.md
Created January 19, 2020 11:18
Bind FreeBSD ntpd to given IP address

In order to avoid FreeBSD ntpd listen on wildcard interface, add following lines to /etc/ntp.conf:

interface ignore wildcard
interface listen 10.0.0.1
@farrokhi
farrokhi / mem_swap_linux.md
Created January 19, 2020 11:19
memory usage and swap investigation in linux
grep -A1 Normal  /proc/zoneinfo  ; echo "--"; sysctl vm.min_free_kbytes ; echo "--"; numactl -H | grep free
@farrokhi
farrokhi / go-build.md
Created January 20, 2020 13:03
Building go
@farrokhi
farrokhi / disable_dsstore.sh
Created September 17, 2020 09:18
Disable DS_Store file creation on USB disks and network shares
#!/bin/sh
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults read com.apple.desktopservices
@farrokhi
farrokhi / curl-web-perf.md
Last active December 22, 2020 07:25
Poor man's Connection and Transfer speed measurement using curl

Save this as curl-perf.cfg:

{\n
"time_connect":       %{time_connect},\n
"time_pretransfer":   %{time_pretransfer},\n
"time_starttransfer": %{time_starttransfer},\n
"time_total":         %{time_total},\n
"size_request":       %{size_request},\n
"size_upload":        %{size_upload},\n
"size_download": %{size_download},\n
@farrokhi
farrokhi / jupyter-setup.md
Last active February 10, 2022 10:06
Setup a sane and usable Jupyter and Pandas environment on MacOS

setup environment

virtualenv .venv
source .venv/bin/activate
pip3 install jupyter pandas
pip3 install matplotlib
pip3 install seaborn scipy # optional
@farrokhi
farrokhi / emacs-on-macos.md
Last active September 14, 2022 09:29
emacs installation on MacOS

Install emacs view brew:

brew tap railwaycat/emacsmacport
brew install --with-native-comp --with-imagemagick --with-natural-title-bar --with-starter emacs-mac

Install latest mu (including mu4e):

brew install --HEAD mu
#!/bin/sh
set -eu
export LISPDIR="${HOME}/.emacs.d/lisp"
export MUCOMMIT="HEAD-"$(git log -n1 --decorate=no --shortstat --abbrev-commit | head -n1 | awk '{print $2}')
if [ `uname -m` = "arm64" ]; then
export HBPREFIX="/opt/homebrew/Cellar"
else
@farrokhi
farrokhi / upgrade-mastodon.sh
Last active April 4, 2025 10:39
Upgrade mastodon via git
# as root
systemctl stop mastodon-web mastodon-sidekiq mastodon-streaming
su - mastodon
cd live
# as mastodon user, in its live direcotry
export MASTODON_VER=v4.3.7
export RAILS_ENV=production