Skip to content

Instantly share code, notes, and snippets.


Max Kleucker mkleucker

View GitHub Profile
mkleucker / logstash.conf
Last active Jul 31, 2020
Grok filter for Cloudfront Logs to be used with Logstash & ElasticSearch
View logstash.conf
filter {
grok {
match => ["message", "%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day}[ \t]%{TIME:time}[ \t]%{DATA:x_edge_location}[ \t](?:%{NUMBER:sc_bytes}|-)[ \t]%{IP:c_ip}[ \t]%{WORD:cs_method}[ \t]%{HOSTNAME:cs_host}[ \t]%{NOTSPACE:cs_uri_stem}[ \t]%{NUMBER:sc_status}[ \t]%{GREEDYDATA:referrer}[ \t]%{NOTSPACE:user_agent}[ \t]%{GREEDYDATA:cs_uri_query}[ \t]%{NOTSPACE:cookie}[ \t]%{WORD:x_edge_result_type}[ \t]%{NOTSPACE:x_edge_request_id}[ \t]%{HOSTNAME:x_host_header}[ \t]%{URIPROTO:cs_protocol}[ \t]%{INT:cs_bytes}[ \t]%{NUMBER:time_taken}[ \t]%{NOTSPACE:x_forwarded_for}[ \t]%{NOTSPACE:ssl_protocol}[ \t]%{NOTSPACE:ssl_cipher}[ \t]%{NOTSPACE:x_edge_response_result_type}([ \t])?(%{NOTSPACE:cs_protocol_version})?"]
geoip {
source => "c_ip"
mutate {
add_field => ["listener_timestamp", "%{year}-%{month}-%{day} %{time}"]
convert => {
mkleucker /
Last active Jan 12, 2016
One liner to get a coma-separated list of all JIRA-issues between to two commits / branches / tags.
# Replace `v1` and `v2` with the correct SHAs or tags.
# Replace `PROJ` with your Jira-Project identifier.
git log --pretty=oneline v1..v2 | pcregrep -o --regexp="(PROJ-\d+)" | sort -n | uniq | tr '\n' ','
mkleucker /
Last active Aug 29, 2015
Simple video conversion to create videos compatible with various browser and devices. Uses ffmpeg on a Mac. Source material is supposed to be a higher quality h.264 video.

Resize a video to 480p w/ max. bitrate of 750k

ffmpeg -i video-raw.mp4 -codec:v libx264 -profile:v main -preset slow -b:v 750k -maxrate 750k -bufsize 1000k -vf scale=720:480 -threads 0 -codec:a libfaac -acodec libfaac -ac 2 -ar 44100 -ab 128k video.mp4

Change only the quality of a video

ffmpeg -i video-raw.mp4 -codec:v libx264 -profile:v main -preset slow -b:v 1000k -maxrate 1000k -bufsize 2000k -threads 0 -codec:a libfaac -acodec libfaac -ac 2 -ar 44100 -ab 128k video.mp4
mkleucker / mobileVisits.js
Last active Dec 23, 2015
Script to extract all mobile vitsits from your (synced) Chrome history. Run this script in the dev-tools of chrome://history-frame.
View mobileVisits.js
// Script to extract the mobile visits from the the synced Chrome history.
// 1. Open chrome://history-frame
// 2. Copy & Paste the code below into the console
// 3. Run and wait (it will evaluate all visits dating back to 12. September 2013)
// 4. Success
var mobileVisits;
var endDate = new Date('2013','08', '12');
mkleucker /
Created Aug 20, 2013
Mounts and unmounts a USB drive based on the presence of another machine in the network. A little more explanation on what it does:
mkleucker / is.justcurious.photostreamsync.plist
Last active Dec 20, 2015
Syncing photostream to Dropbox. Find a full explanation over at my blog:
View is.justcurious.photostreamsync.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
mkleucker / MainWindow.xaml.cs
Created Apr 9, 2013
Serializing Kinect-Skeletons and transmitting them via MemoryMappedFiles to another process. These are just snippets and won't run without further Code.
View MainWindow.xaml.cs
// This process uses the data comming from the kinect processes.
// Read from the MemoryMappedFile
MemoryMappedViewAccessor accessor = memoryMappedFile.createViewAccessor();
// Read to Array
accessor.ReadArray<byte>(0, mmf_result, 0, mmf_result.Length);
// Use a local Array for further instructions
byte[] temp = new byte[mmf_result.Length];
mkleucker / gist:5233150
Created Mar 24, 2013
Hide the iTerm2 Dock icon.
View gist:5233150
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/
mkleucker /
Created Dec 13, 2012
Reset the "Open With..." entries on a Mac
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
mkleucker / VPN.scpt
Created Mar 9, 2012
Connects / Disconnects to a VPN and pushes its action to Growl
View VPN.scpt
-- config: change the VPN name here (as listed under the network preferences)
set VPNname to "LRZ VPN"
tell application "System Events"
set isGrowlRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
end tell
if isGrowlRunning then
tell application id "com.Growl.GrowlHelperApp"
set the allNotificationsList to ¬
You can’t perform that action at this time.