Skip to content

Instantly share code, notes, and snippets.

View farrokhi's full-sized avatar
🚀

Babak Farrokhi farrokhi

🚀
View GitHub Profile
@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
@farrokhi
farrokhi / cpu-mem-online.sh
Last active April 24, 2024 09:32
Turn all CPU and RAM online in Linux under VMWare
#!/bin/bash
# Based on script by William Lam - http://engineering.ucsb.edu/~duonglt/vmware/
# Bring CPUs online
for CPU_DIR in /sys/devices/system/cpu/cpu[0-9]*
do
CPU=${CPU_DIR##*/}
echo "Found cpu: '${CPU_DIR}' ..."
CPU_STATE_FILE="${CPU_DIR}/online"
if [ -f "${CPU_STATE_FILE}" ]; then

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"; }'
@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
@farrokhi
farrokhi / mbuf_autotune.sh
Last active November 10, 2023 18:43
Script to suggest optimum mbuf tunables based on your hardware configuration (FreeBSD)
#!/bin/sh
#
# Copyright (c) 2016 Babak Farrokhi. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
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
#!/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 / openpgp.md
Created March 30, 2023 14:43
keyoxide verification

[verifying my keyoxide key:openpgp4fpr:13FD03680931ECD20D7EF23A99E95EA4FCE567A8]