Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ $# -ne 2 ]; then
echo "Usage: fuck you <programm>"
exit 1
fi
if killall -9 "$2"; then
echo
echo " (╯°□°)╯︵$(echo "$2"|toilet -f term -F rotate)"
echo
fi
@Nervengift
Nervengift / pentadactyl-mpv
Created February 9, 2015 18:19
Open videos (e.g. on youtube) in external player (mpv) in pentadactyl
:map ,m :silent execute "!mpv '" + buffer.URL + "'"<enter>
@Nervengift
Nervengift / yeganesh_run
Created February 15, 2015 14:55
yeganesh (dmenu wrapper) wrapper
#!/bin/sh
yeganesh -x | ${SHELL:-"/bin/sh"} &
@Nervengift
Nervengift / i3_focus_next
Last active January 20, 2023 19:05
focus next window in i3 (like Alt+Tab in other WMs)
#!/bin/bash
# ================================================================================== #
# Focus the next window on the current workspace in i3, e.g. for binding to Alt+Tab #
# Depends: jq, awk, i3wm (obviously) #
# Author: Nervengift <dev@nerven.gift> #
# License: Don't think this deserves a license, Public Domain #
# Known bugs: doesn't work with non-window container focused #
# ================================================================================== #
ws=$(i3-msg -t get_workspaces|jq "map(select(.focused))[]|.name")
@Nervengift
Nervengift / motd
Created April 11, 2015 21:54
Bastel-VM MOTD: BMO
 
▄▄▄▄▄ ▄▄▄▄▄▄▄▄▄▄▄▄  Let's play
  ▄▄        sysadmin
  ▄    ▄ ▄     games!
   ▄    ▄     
  ▄▄       
  ▄▄   ▄ ▄▄▄▄▄   
▄▄▄▄▄▄   ▄▄ [38;5;
@Nervengift
Nervengift / build_nodemcu
Last active August 29, 2015 14:21
building (and flashing) nodemcu
git clone https://github.com/pfalcon/esp-open-sdk
cd esp-open-sdk
make
export PATH="$(pwd)/xtensa-lx106-elf/bin:$PATH"
cd ..
git clone https://github.com/nodemcu/nodemcu-firmware.git
cd nodemcu-firmware
# optional: edit app/include/user_modules.h and other configs
make
#make flash
@Nervengift
Nervengift / rofi-pulse-sink.sh
Last active August 10, 2022 08:30
Choose pulseaudio sink via rofi/dmenu
#!/usr/bin/bash
# choose pulseaudio sink via rofi or dmenu
# changes default sink and moves all streams to that sink
sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|rofi -dmenu -p 'pulseaudio sink:' -location 6 -width 100|grep -Po '[0-9]+(?=:)') &&
# alternate version using dmenu:
# sink=$(ponymix -t sink list|awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}'|dmenu -p 'pulseaudio sink:'|grep -Po '[0-9]+(?=:)') &&
ponymix set-default -d $sink &&
for input in $(ponymix list -t sink-input|grep -Po '[0-9]+(?=:)');do
@Nervengift
Nervengift / foo.service
Last active October 16, 2015 13:16
Simple template unit file for running daemons via systemd
[Unit]
Description=<description>
# Start after network (network may still not be online on start, see http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget/)
#After=network.target
[Service]
# If the program forks to background
#Type=forking
ExecStart=<full path to program [with parameters and option]>
# Run as specific user
@Nervengift
Nervengift / post-receive
Last active February 25, 2016 15:45
Generate a signed timestamp for all git commits using openssl and the DFN server
#!/bin/bash
# install on central git repo as hooks/post-receive
# generates timestamp signatures for all commits
read oldrev newrev refname
mkdir -p timestamps
oldrev=$(git rev-parse $oldrev)
newrev=$(git rev-parse $newrev)
git rev-list "$oldrev..$newrev" | while read commit; do
echo "creating timestamp signature for $commit..."
@Nervengift
Nervengift / pandoc-md
Last active March 9, 2023 14:20
Automatically build markdown file on change using pandoc
function pandoc-md {
while true ;do
inotifywait -e modify $1 2>/dev/null
date
pandoc $1 -V geometry:margin=2cm -o $1.pdf
done
}