Skip to content

Instantly share code, notes, and snippets.

@alpianon
alpianon / safe_run.sh
Last active October 19, 2025 12:25
safely run/test a script within a minimal chroot environment with only selected commands available
#!/bin/bash
script=$1
shift
args="$@"
CHROOT=$(mktemp -d)
COMMANDS="/bin/bash /bin/echo"
for c in $COMMANDS; do
mkdir -p $CHROOT$(dirname $c)
cp -a $c $CHROOT$(dirname $c)
libs="$libs $(ldd $c | grep '=>' | cut -d' ' -f 3)"
@alpianon
alpianon / nvenc-install.sh
Last active December 6, 2024 18:14 — forked from lucaspar/nvenc-install.sh
Installation script of CUDA-accelerated `ffmpeg` with NVIDIA Encoder
#!/bin/bash
# ==================================================================
# This script will compile and install a static ffmpeg build with
# support for NVENC in Ubuntu. Developed in Ubuntu 22.04 LTS
# It assumes NVIDIA drivers are installed and that you have a
# CUDA-compatible GPU. You can check installed drivers with:
# $ apt list *nvidia-driver-* | grep installed
# $ nvidia-smi
# It installs the CUDA toolkit from Ubuntu repos so you do not need
# to manually install it.
@alpianon
alpianon / install_inline-git-diff.sh
Last active April 27, 2020 07:42
install my modified inline-git-diff for Atom in linux
cd ~/.atom/packages
git clone https://github.com/alpianon/inline-git-diff.git
mv atom-inline-git-diff inline-git-diff
cd inline-git-diff
apm install
# then restart Atom...