Skip to content

Instantly share code, notes, and snippets.

Stefan Heinemann schtibe

Block or report user

Report or block schtibe

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
schtibe / i3_screenshot_config
Last active Sep 29, 2019
Screenshot keybindings with i3 and scrot that are copied to the clipboard
View i3_screenshot_config
bindsym Print exec "scrot -e 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'; sleep 1; exec notify-send 'screenshot has been saved to ~/tmp'"
bindsym $mod+Print --release exec "scrot -ue 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'; sleep 1; exec notify-send 'screenshot has been saved to ~/tmp'"
bindsym $mod+Shift+Print --release exec "notify-send 'selection will be saved to ~/tmp'; scrot -se 'mv $f ~/tmp && xclip -selection clipboard -t image/png -i ~/tmp/$n'"
schtibe / i3shell
Last active Nov 2, 2017
Spawn a new terminal in the same directory as the current one is in
View i3shell
# Launch a sakura terminal with the same directory as the terminal
# that has the focus
# based on
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
PID=$(xprop -id $ID | grep PID | awk ' { print $3 }')
SHELL_PID=$(ps -opid= --ppid $PID | tr -d '[:space:]')
schtibe /
Last active Jul 31, 2017
Bash function to view a file in $EDITOR at a certain commit
function gshow() {
tmp_dir=$(mktemp -d)
filename=$(basename $2)
git show $1:$2 > $tmp_path
$EDITOR $tmp_path
rm $tmp_path
rmdir $tmp_dir
schtibe /
Last active Apr 4, 2017
Screen changer
# This script provides following functionality:
# - When detect is given, the
# - When no argument is given, make a dmenu list of the available screen layouts
# Last two options are mostly used by the udev system
AVAILABLE_LAYOUTS=$(ls -1 $BASE_PATH | awk -F '.' '{ print $1 }')
schtibe /
Last active Jan 3, 2017 — forked from shashwatblack/
Git fuzzy checkout with substring matching and case-insensitivity (and colors!)
#!/usr/bin/env python
git fuzzy-checkout
Same as `git checkout branch`, but with fuzzy matching if checkout fails.
Turns `git checkout barnch` into `git checkout branch`,
assuming `branch` is a branch.
import difflib
import sys
#!/usr/bin/env python
import sys
from plumbum.cmd import git
from termcolor import cprint
new_branch = sys.argv[1]
except IndexError:
print("Provide a branch name!", file=sys.stderr)
schtibe / tny
Last active Jul 29, 2019 — forked from gbl08ma/tny
Unix shell script to shorten URLs with URL shortener. wget must be installed for this to work.
View tny
if [ -t 0 ]; then
if [ -z "$1" ]; then
echo "usage: tny long_url [custom_keyword]"
echo ""
echo "Shorten URLs with URL shortener"
echo "This script expects a long URL to shorten either as an argument or passed through STDIN."
echo "When using arguments, an optional second argument can be provided to customize the later part of the short URL (keyword)."
exit 1
View response.json
"data": {
"type": "vehiclechecks",
"id": "1",
"attributes": {
"relationships": {
"customer": {
"data": {
schtibe / Webdev Grep
Created Jun 25, 2015
Grep for Webdevs (filter all the minified stuff)
View Webdev Grep
grep --exclude=\"*min.js\" --exclude=\"*min.css\" --exclude=\"*map\" --color=always "$@"| awk '{ if (length($0) < 200) print }'
schtibe / gist:8298779
Created Jan 7, 2014
nib picdump fix for extracting imgur images
View gist:8298779
var fs = require('fs')
, path = require('path')
, mkdirp = require('mkdirp')
, request = require('request')
, htmlparser = require("htmlparser")
, select = require('soupselect').select
function downloadImage(uri, file) {
request.head(uri, function(err, res, body){
if (err) return console.err(err)
You can’t perform that action at this time.