Skip to content

Instantly share code, notes, and snippets.

View afriza's full-sized avatar

Afriza N. Arief afriza

  • Indonesia
  • 09:32 (UTC +07:00)
View GitHub Profile
@afriza
afriza / install-ffmpeg-with-decklink-support-ubuntu-18.04-server.md
Last active May 3, 2024 18:37
Compiling and installing `ffmpeg` with Decklink SDK on Ubuntu 18.04 Server. Check out forks of this gist for more up-to-date info.
@afriza
afriza / proxmox-mikrotik.md
Last active March 16, 2024 02:17
install Mikrotik CHR on ProxMox Virtual Environment 8.1.4
  • create bridges for use by mikrotik CHR
  • create VM without any media
wget https://download.mikrotik.com/routeros/7.14/chr-7.14.img.zip
apt update
apt install unzip
unzip chr-7.14.img.zip
qemu-img resize -f raw chr-7.14.img 256M
qm disk import 100 chr-7.14.img local-lvm
@afriza
afriza / add-rsync-to-git-for-windows.sh
Last active March 13, 2024 15:27
Copies rsync binaries and its dependencies from MSYS2 to Git for Windows
#! /bin/sh -x
# The reason to copy rsync binaries into Git for Windows is because
# VS Code has built in support for Git Bash shell in its Terminal.
# steps:
# 1. install Git for Windows from https://gitforwindows.org/
# 2. install MSYS2 from https://www.msys2.org/
# 3. Run as administrator: MSYS2 MSYS
# 4. execute the commands below in MSYS2 MSYS from step 3
@afriza
afriza / redsocks.conf
Created July 21, 2011 13:42
Setup iptables for RedSocks in OpenWRT
base {
// debug: connection progress & client list on SIGUSR1
log_debug = on;
// info: start and end of client session
log_info = on;
/* possible `log' values are:
* stderr
* file:/path/to/file
@afriza
afriza / lvm-extend-lv-vg.md
Created February 3, 2024 06:39
Extend LVM Logical Volume / Volume Group
  1. Check status
    vgdisplay
    lvdisplay
    
  2. Extend Logical Volume
    lvextend -l +100%FREE /dev/VG_NAME/LV_NAME
    
  3. Resize Filesystem
@afriza
afriza / install-nginx-rtmp-module.sh
Last active December 31, 2023 22:04
Install NGINX RTMP module with HLS support on Ubuntu 18.04
sudo apt install curl gnupg2 ca-certificates lsb-release
echo "deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx" | sudo tee /etc/apt/sources.list.d/nginx.list
curl -fsSL https://nginx.org/keys/nginx_signing.key | sudo apt-key add -
sudo apt update
NGINX_VERSION=$(apt show nginx | grep "^Version" | cut -d " " -f 2 | cut -d "-" -f 1)
# take note of the nginx version in the "stable" release. e.g. 1.14.2
echo NGINX version $NGINX_VERSION
wget https://hg.nginx.org/pkg-oss/raw-file/default/build_module.sh
chmod a+x build_module.sh
@afriza
afriza / mount-hdd.sh
Last active May 12, 2023 01:43
mount disk filesystem by LABEL from Linux and mount Samba shares from macOS via AppleScript
#!/bin/sh
domnt() {
local lbl="$1" mnt="$2"
if ! mount | grep -qF " $mnt " ; then
mkdir -p "$mnt"
if mount "LABEL=$lbl" "$mnt" ; then
echo "'LABEL=$lbl' has been mounted at '$mnt'"
fi
@afriza
afriza / goroutine-id.go
Last active February 22, 2023 05:59 — forked from metafeather/main.go
Get goroutine id for debugging
package main
import (
"fmt"
"runtime"
"strings"
"sync"
)
// Goid gets goroutine ID. Only used for debugging purpose.
@afriza
afriza / setup-gpg-over-ssh-forwarding.md
Last active February 19, 2023 14:07
Remote git signing with GPG (GnuPG / GNU Privacy Guard) over SSH Forwarding

On local machine

$ brew install gnupg pinentry-mac # macOS
$ echo 'export GPG_TTY=$(tty)' >> ~/.bashrc
$ echo 'export GPG_TTY=$(tty)' >> ~/.zshrc
$ echo "pinentry-program $(command -v pinentry-mac)" > ~/.gnupg/gpg-agent.conf # macOS
$ defaults write org.gpgtools.common UseKeychain NO # macOS
$ gpgconf --kill gpg-agent
$ gpg-connect-agent /bye
@afriza
afriza / git-shallow-all.sh
Last active January 1, 2023 03:25
Convert git repository into shallow clone to save storage space when there is no need for git histories
#! /bin/sh
# Ref: https://stackoverflow.com/a/62650346/109747
# macOS/BSD find requires root path
root=${1:-.}
# TODO: handle if git-shallow.sh exits with non-zero code
find $root -type d -name '.git' -exec sh -c 'pushd "${0%/*}" && ( git-shallow.sh ) && popd' {} \;