Skip to content

Instantly share code, notes, and snippets.

View NaanProphet's full-sized avatar

Krishna Bhamidipati NaanProphet

View GitHub Profile
@NaanProphet
NaanProphet / padcolors.py
Created February 8, 2023 14:07 — forked from llimllib/padcolors.py
Setting pad colors on the Novation LaunchKey Mini MK3
# This file demonstrates how to use midi codes to control the color of the
# keypads on a Novation LaunchKey mini; There is no official documentation of
# it as far as I can tell
#
# the LaunchKey MK2 Programmer's guide is useful, though not accurate to
# details on the MK3 mini:
# https://customer.novationmusic.com/sites/customer/files/novation/downloads/10535/launchkey-mk2-programmers-reference-guide.pdf
import random
import time
@NaanProphet
NaanProphet / getlabel.sh
Created May 25, 2018 14:26
Determine Finder Label Color from Terminal
# 0 = no colour
# 1 = orange
# 2 = red
# 3 = yellow
# 4 = blue
# 5 = purple
# 6 = green
# 7 = grey
getlabel() {
@NaanProphet
NaanProphet / rsync-compile.sh
Created May 12, 2017 15:08
OS X script that compiles rsync binary from source with detect-renamed patch
#!/bin/sh
# rsync 3.1.2 patched with additional options
# detect-renamed
# detect-renamed-lax
# detect-moved options
# special thanks to:
# https://moderncaveman.org/projects/modern/rsync-detect-renamed/patching-rsync-for-renamed.html
# note: the improved 3.0.9 from the above URL is already part of 3.1.x
@NaanProphet
NaanProphet / markdown-table-to-html.py
Last active August 25, 2016 00:44 — forked from bsweger/markdown-table-to-html.py
Convert markdown table rows to html (we converted some markdown tables to html so we could use the "scope" attribute in the header rows for accessibility).
import sys
import re
# input: first argument is a file that contains the piped markdown table rows
with open (sys.argv[1]) as f:
content = f.readlines()
rows = []
pattern = re.compile("^\|[ -][ -]+")
@NaanProphet
NaanProphet / generics.java
Created June 3, 2016 22:05
Java obtain generic type at runtime
// This statement is magic
// If you declare it: Set<String> getMyGeneric; it returns java.lang.String
final Class<?> genericClazz = (Class<?>)((ParameterizedType) getClass().getDeclaredField("getMyGeneric").getGenericType()).getActualTypeArguments()[0];
@NaanProphet
NaanProphet / App Nap Script.scpt
Created February 3, 2016 13:09
App Nap Script for MBA
-- thanks to: http://osxdaily.com/2014/05/13/disable-app-nap-mac-os-x/
-- disable App Nap
--do shell script "defaults write NSGlobalDomain NSAppSleepDisabled -bool YES"
-- renable App Nap
do shell script "defaults delete NSGlobalDomain NSAppSleepDisabled"
@NaanProphet
NaanProphet / timecode-rewrap.sh
Last active May 12, 2017 14:57
Timecode Enricher
#!/bin/sh
### Timecode generation script for MP4 footage (AVCHD, XAVC-S, etc.)
### Uses ffmpeg for timecode creation; EditReady for container cleanup;
### exiftool for copying over original track dates; and SetFile for setting
### the File Creation Date for FCP X event
### Note: this script currently does not work for files with spaces
# quit on first error (almost always)
@NaanProphet
NaanProphet / mkvWrapper.sh
Created January 16, 2016 15:28
YouTube mkvWrapper
#!/bin/bash
# mkvWrapper.sh
# helpful for rewrapping valid MOV exports from Compressor 4 into MKVs that can be batched to YouTube for faster processing
# USAGE
# sh mkvWrapper.sh "Compressor Export-MPEG4_HighQ to YT.mov"
# OUTPUT
# Compressor Export-MPEG4_HighQ to YT.mkv
@NaanProphet
NaanProphet / datepojoregex
Created January 4, 2016 22:41
Regex Pojos
Notepad++ Regex for replacing malicious dates in POJOs
note: . matches newline must NOT be checked
Only meant for Notepad++, have to open the files from Explorer and then click Refresh in Eclipse afterwards.
May not be 100% foolproof! Imperative to review the files manually!
Note: before replacing, use the "Mark All" feature in Notepad++ with "Bookmark line" checked. Then after replacing, jump to the next bookmark using F2 (and Shift+F2)
********************
@NaanProphet
NaanProphet / compressor.py
Created December 31, 2015 20:30 — forked from andrewbunday/compressor.py
This is how little I trust Compressor's Command Line Interface.
#!/usr/bin/env python
"""
Compressor wrapper script.
"""
import os
import sys
import re
import argparse
import subprocess
import logging