Skip to content

Instantly share code, notes, and snippets.

View maxkandler's full-sized avatar
👨‍💻

Max Kandler maxkandler

👨‍💻
View GitHub Profile
@maxkandler
maxkandler / functions.php
Created January 26, 2012 07:42
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.
<?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);
@maxkandler
maxkandler / VPN.scpt
Created March 9, 2012 11:49
Connects / Disconnects to a VPN and pushes its action to Growl
-- 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 ¬
@maxkandler
maxkandler / context-reset.sh
Created December 13, 2012 21:42
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
@maxkandler
maxkandler / gist:5233150
Created March 24, 2013 19:25
Hide the iTerm2 Dock icon.
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
@maxkandler
maxkandler / MainWindow.xaml.cs
Created April 9, 2013 09:42
Serializing Kinect-Skeletons and transmitting them via MemoryMappedFiles to another process. These are just snippets and won't run without further Code.
// 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];
@maxkandler
maxkandler / is.justcurious.photostreamsync.plist
Last active December 20, 2015 02:19
Syncing photostream to Dropbox. Find a full explanation over at my blog: http://justcurious.is/2013/sync-ios-photostream-to-dropbox/
<?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>
@maxkandler
maxkandler / automounter.sh
Created August 20, 2013 00:23
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/
#!/bin/bash
host="island1.local"
mountPoint="/media/KRETA"
drive="/dev/sda1"
device="/dev/sda"
hostIsUp=-1
checkHostIsUp()
@maxkandler
maxkandler / mobileVisits.js
Last active December 23, 2015 02:49
Script to extract all mobile vitsits from your (synced) Chrome history. Run this script in the dev-tools of chrome://history-frame.
// 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');
@maxkandler
maxkandler / ffmpeg.md
Last active August 29, 2015 13:56
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
@maxkandler
maxkandler / issues.sh
Last active January 12, 2016 12:42
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' ','