Skip to content

Instantly share code, notes, and snippets.

View farrokhi's full-sized avatar
🚀

Babak Farrokhi farrokhi

🚀
View GitHub Profile
@farrokhi
farrokhi / vim-cscope.txt
Created January 21, 2025 12:11
vim cscope
CTRL+T return to previous location
CTRL+\\ find-command
find-commands:
c: Find functions calling this function
d: Find functions called by this function
e: Find this egrep pattern
f: Find this file
g: Find this definition
@farrokhi
farrokhi / build-mpv_silicon.sh
Created April 26, 2024 18:28 — forked from dbrookman/build-mpv_silicon.sh
How to build mpv & mpv.app on an Apple silicon Mac
#!/usr/bin/env bash
# Builds mpv & mpv.app on Apple silicon Macs.
# Run this script from the root directory of the mpv repo.
# if anything fails, gtfo
set -ex
meson setup build
meson compile -C build

Using gpg (using homebrew on MacOS) with mailmate

MailMate looks into the default path from MacGPG to find gpg binary. The path is indeed different if you have gpg installed using homebrew or any other method. It is not possible to chnage the default path through user interface, but it is possible through hidden settings.

defaults write com.freron.MailMate environmentVariables -array '{ enabled = :true;  name = "MM_GPG"; value = "/opt/homebrew/bin/gpg"; }'
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 January 30, 2025 11:03
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.3
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