Skip to content

Instantly share code, notes, and snippets.

View Luzifer's full-sized avatar

Knut Ahlers Luzifer

View GitHub Profile
@Luzifer
Luzifer / gist:6131936
Created August 1, 2013 14:32
Moving files named in schema %Y%m%d_something.pdf into folders %Y/%m/filename.pdf
for i in *.pdf; do I=$(echo $i | sed "s/^\(\([0-9]\{4\}\)\([0-9]\{2\}\).*\)$/\2\/\3\/\1/"); mkdir -p $(dirname $I) && mv $i $I; done
@Luzifer
Luzifer / github_status.py
Created August 15, 2013 16:58
Script to output last 5 status messages from status.gitub.com to be used for example with GeekTool or similar
#!/usr/bin/env python
import urllib, json
from dateutil.parser import parse
from textwrap import wrap
messages_url = 'https://status.github.com/api/messages.json'
data = json.loads(urllib.urlopen(messages_url).read())
status_char = {
@Luzifer
Luzifer / traveltime.py
Last active December 23, 2015 17:49
Need a quick overview how long you will need by car from geolocation xx.xxxx,yy.yyyy to xx.xxxx,yy.yyyy? Just ask: python traveltime.py xx.xxxx,yy.yyyy xx.xxxx,yy.yyyy
#!/usr/bin/env python
import urllib, json, sys
if len(sys.argv) < 3:
print 'Usage: %s <lat,lon> <lat,lon>' % sys.argv[0]
sys.exit(2)
url = 'http://maps.googleapis.com/maps/api/directions/json?origin=%s&destination=%s&sensor=false' % (sys.argv[1], sys.argv[2])
@Luzifer
Luzifer / README.md
Last active December 28, 2015 13:08
Werbung aus einem Film schneiden mit ffmpeg

Werbung aus einem Film schneiden mit ffmpeg

Cutlist

[Cut0]
Start=584.32
Duration=1221.96
StartFrame=14608
DurationFrames=30549
@Luzifer
Luzifer / sendmail.aug
Created December 29, 2013 17:32
Augeas lens to parse /etc/mail/sendmail.conf file
(*
Module: Sendmail
Parses simple key = "value" conffiles
Author: Knut Ahlers <knut@ahlers.me>
About: License
This file is licenced under the LGPL v2+, like the rest of Augeas.
*)
@Luzifer
Luzifer / check_reboot_required.py
Last active January 2, 2016 10:29
Simple Nagios check for NRPE / PeriodicNoise to check whether an Ubuntu server required reboot
#!/usr/bin/env python
import apt, os, re, sys, subprocess
if os.path.exists('/var/run/reboot-required'):
print 'reboot-required marker file exists'
sys.exit(1)
kernels = []
@Luzifer
Luzifer / collectWindows.applescript
Last active January 8, 2016 14:57
Collect OSX windows from not present screens to main
-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}
-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
set _b to bounds of window of desktop
set screen_width to item 3 of _b
set screen_height to item 4 of _b
end tell
@Luzifer
Luzifer / vault-sshadd.sh
Created April 8, 2016 13:23
vault-sshadd script to unlock SSH keys using Vault stored passwords #blog
#!/bin/bash
COLOR_RED="\033[0;31m"
COLOR_GREEN="\033[0;32m"
COLOR_CYAN="\033[0;36m"
COLOR_PLAIN="\033[0m"
function error {
echo -e "${COLOR_RED}$@${COLOR_PLAIN}"
}
@Luzifer
Luzifer / README.md
Last active May 13, 2016 10:29
A simple clone of the Dashing-Milkman widget which does not require API access to the API but uses the non-event iCalendar whose URL you can get on your dashboard.

Preview

Description

A simple clone of the Dashing-Milkman widget which does not require API access to the API but uses the non-event iCalendar whose URL you can get on your dashboard.

Dependencies

@Luzifer
Luzifer / main.go
Created July 22, 2016 09:20
Test for executing commands while using a context to terminate them within a certain time
package main
import (
"log"
"os/exec"
"strconv"
"time"
"golang.org/x/net/context"
)