Skip to content

Instantly share code, notes, and snippets.

View fbrinker's full-sized avatar
🤓
Inquisitive.

Florian Brinker fbrinker

🤓
Inquisitive.
View GitHub Profile
@fbrinker
fbrinker / volume-control-sync.sh
Created May 17, 2020 12:38
Sync pamixer with playerctl volume
#!/bin/bash
function up() {
pamixer -i 10
sync
}
function down() {
pamixer -d 10
sync
@fbrinker
fbrinker / i3lock-screenshot.sh
Created February 25, 2019 14:24
Create a screenshot, apply some filters (blur, reduce colors and bightness) and add a logo to it. Then use it as lockscreen via i3lock
#!/bin/bash
# Dependencies:
# ffmpeg
# i3lock-color-git
IMAGE=/tmp/i3lock.png
LOGO=~/i3lock-logo.png
RES=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
@fbrinker
fbrinker / sshkey-to-remote.sh
Created December 19, 2018 19:03
Add your ssh key to the remotes authorized_keys file
#!/usr/bin/env bash
USAGE="Usage: script.sh user@remoteserver"
if [ $# == 0 ] ; then
echo $USAGE
exit 1;
fi
cat ~/.ssh/id_rsa.pub | ssh $1 'tee -a .ssh/authorized_keys' >/dev/null
@fbrinker
fbrinker / terminfo-to-remote.sh
Created December 19, 2018 18:56
Send your current terminal info to the remote server - needed for my termite instance, that uses `xterm-termite`
#!/usr/bin/env bash
USAGE="Usage: script.sh user@remoteserver"
if [ $# == 0 ] ; then
echo $USAGE
exit 1;
fi
infocmp | ssh $1 'tic -x -'
@fbrinker
fbrinker / i3-display-swap.sh
Last active March 6, 2024 11:09
Swap i3 displays / workspaces between displays
#!/usr/bin/env bash
# requires jq
DISPLAY_CONFIG=($(i3-msg -t get_outputs | jq -r '.[]|"\(.name):\(.current_workspace)"'))
for ROW in "${DISPLAY_CONFIG[@]}"
do
IFS=':'
read -ra CONFIG <<< "${ROW}"
if [ "${CONFIG[0]}" != "null" ] && [ "${CONFIG[1]}" != "null" ]; then
@fbrinker
fbrinker / movieToGif.sh
Created March 12, 2018 14:31
A small script to convert movies (tested with mpg files) into gifs. Usage: ./movieToGif.sh input.mpg [output.gif]
#!/bin/bash
# dependencies: ffmpeg imgemagick
INPUT=$1
OUTPUT=$2
if [ -z ${2+x} ]; then
OUTPUT="$1.gif"
fi
@fbrinker
fbrinker / ci-phplint-all-files-recursive
Last active November 20, 2017 10:58
Lint all php files and invert the grep return code so a CI build can fail on found errors
#!/usr/bin/env bash
find . -type f -name '*.php' -exec php -l {} \; | (! grep -v "No syntax errors detected" )