Skip to content

Instantly share code, notes, and snippets.

Max Kleucker mkleucker

Block or report user

Report or block mkleucker

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
@mkleucker
mkleucker / ffmpeg.md
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.
View ffmpeg.md

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
mkleucker / functions.php
Created Jan 26, 2012
Wordpress – Cleaning up the JavaScripts: - load jQuery at the end of the page - load own JavaScript - embed JS for Contact Form 7 only when needed.
View functions.php
<?php
/**
* Cleaning up the scripts
*/
function jc3_register_scripts() {
// Put jQuery to the bottom
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js', false, '1.7.1', true );
wp_enqueue_script( 'jquery' );
wp_register_script( 'jc3' , get_template_directory_uri() . '/jc3.js', false, '1.0', true);
@mkleucker
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 ¬
@mkleucker
mkleucker / context-reset.sh
Created Dec 13, 2012
Reset the "Open With..." entries on a Mac
View context-reset.sh
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
@mkleucker
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
mkleucker / is.justcurious.photostreamsync.plist
Last active Dec 20, 2015
Syncing photostream to Dropbox. Find a full explanation over at my blog: http://justcurious.is/2013/sync-ios-photostream-to-dropbox/
View is.justcurious.photostreamsync.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>is.justcurious.photostreamsync</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/utils/photostream</string>
</array>
@mkleucker
mkleucker / automounter.sh
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: http://justcurious.is/2013/raspberry-pi-and-external-drives/
View automounter.sh
#!/bin/bash
host="island1.local"
mountPoint="/media/KRETA"
drive="/dev/sda1"
device="/dev/sda"
hostIsUp=-1
checkHostIsUp()
@mkleucker
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.
//
// INSTRUCTIONS:
// 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
mkleucker / issues.sh
Last active Jan 12, 2016
One liner to get a coma-separated list of all JIRA-issues between to two commits / branches / tags.
View issues.sh
# 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
mkleucker / logstash.conf
Last active Mar 19, 2019
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 => {
You can’t perform that action at this time.