Skip to content

Instantly share code, notes, and snippets.

View farrokhi's full-sized avatar
🚀

Babak Farrokhi farrokhi

🚀
View GitHub Profile
brew install emacs-mac --with-natural-title-bar --with-starter --with-native-comp --with-imagemagick --with-librsvg --with-xwidgets
@farrokhi
farrokhi / cleanup-mastodon.sh
Created August 2, 2023 14:31
Cleanup mastodon server and remove unnecessary cached objects
su - mastodon
cd live
export RAILS_ENV=production
./bin/tootctl accounts prune;
./bin/tootctl statuses remove --days 4;
./bin/tootctl media remove --days 4;
./bin/tootctl media remove --remove-headers --include-follows --days 0;
./bin/tootctl preview_cards remove --days 4;
./bin/tootctl media remove-orphans;
@farrokhi
farrokhi / Xresources
Last active May 17, 2023 11:09
gruvbox-dark-hard color code (can be imported and converted via https://terminal.sexy/)
! special
*.foreground: #ebdbb2
*.background: #1d2021
*.cursorColor: #f2da47
! black
*.color0: #282828
*.color8: #928374
! red
@farrokhi
farrokhi / openpgp.md
Created March 30, 2023 14:43
keyoxide verification

[verifying my keyoxide key:openpgp4fpr:13FD03680931ECD20D7EF23A99E95EA4FCE567A8]

@farrokhi
farrokhi / webster-dict-macos.md
Last active February 14, 2023 10:50
Using Webster 1939 dictionary in MacOS terminal

Download and extract the dictionary:

wget https://s3.amazonaws.com/jsomers/dictionary.zip
unzip dictionary.zip
tar zxf dictionary/stardict-dictd-web1913-2.4.2.tar.bz2

Move it to a proper place:

mkdir ~/dict/
@farrokhi
farrokhi / upgrade-mastodon.sh
Last active February 26, 2024 11:44
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.2.8
export RAILS_ENV=production
#!/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 / 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
@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 / 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