Skip to content

Instantly share code, notes, and snippets.

View notthetup's full-sized avatar
🔊

Chinmay Pendharkar notthetup

🔊
View GitHub Profile
@notthetup
notthetup / runOnImgLoadComplete.js
Last active October 13, 2015 02:28
Javascript to run a given function only when all the images in the page are loaded.
function runOnImgLoadComplete(onImgLoadCompleteCallback){
var allImgs = document.images;
numTotalImages = imgs.length,
numLoadedImages = 0;
[].forEach.call( allImgs, function( img ) {
if (img.complete){
numLoadedImages++;
if (numLoadedImages == numLoadedImages)
@notthetup
notthetup / gist:4213687
Created December 5, 2012 08:09 — forked from aehlke/gist:992798
zsh hooks to growl completion of long-running commands
# long-running command growler
# hooks for zsh, built on bash version at http://hints.macworld.com/article.php?story=20071009124425468
preexec_functions+='save_preexec_time'
save_preexec_time() {
export PREEXEC_CMD="$(history $HISTCMD | tail -n 1| sed 's/ *[0-9]* *//')"
export PREEXEC_TIME=$(date +'%s')
}
precmd_functions+='growl_about_long_running_commands'
@notthetup
notthetup / soxleveller.sh
Last active February 16, 2023 18:43
SoX Normalize (Leveller) for speech.
#!/bin/bash
filename=${1%%.*}
extension=${1##*.}
outputname="$filename"_levelled.$extension
sox $1 $outputname highpass 80 lowpass 8000 compand 0.01,1 -80,-80,-55,-20,-20,-15,0,0 0 -40 0.1 norm -0.5
@notthetup
notthetup / HipsterSG.md
Last active December 11, 2015 09:08
List of hipster places to hangout in Singapore.
@notthetup
notthetup / growl-long.zsh
Created April 4, 2013 03:25
Oh my zsh custom script to growl on completion of all commands which take more than 10secs
preexec_functions+='save_preexec_time'
save_preexec_time() {
export PREEXEC_CMD="$(history $HISTCMD | tail -n 1 | sed 's/ *[0-9]* *//')"
export PREEXEC_TIME=$(date +'%s')
}
precmd_functions+='growl_about_long_running_commands'
growl_about_long_running_commands() {
exitstatus=$?
@notthetup
notthetup / bind-dnssec-osx.md
Last active December 16, 2015 04:59
Setting up local bind9 server with dnssec on MacOSX Lion

Installing Bind9 with DNSSEC support on OSX Mountain Lion

Based on the instructions from haller.ws

Check bind installation

  1. run named -v to check if you have BIND 9.x (or greater) installed
@notthetup
notthetup / helloworld.java
Created May 10, 2013 04:22
Java Hello World Test
/*************************************************************************
* Compilation: javac helloworld.java
* Execution: java helloworld
*
*
*************************************************************************/
public class helloworld {
public static void main(String[] args) {
@notthetup
notthetup / ex33 tweak
Last active December 26, 2015 23:09 — forked from shurru/ex33 tweak
Fixed indentation for return.
numbers= []
def loopy(i):
while i<6:
print "at the top of i is %d" %i
numbers.append(i)
i = i+1
print "Numbers now", numbers
print "at the bottom of i is %d" %i
@notthetup
notthetup / tryload.js
Last active August 29, 2015 13:56
Try to load using XMLHTTPRequest
var tryload = function(url){
var ir_request = new XMLHttpRequest();
ir_request.open("GET", url, true);
ir_request.responseType = "blob";
ir_request.onload = function () {console.log("loaded")};
ir_request.send();
}
@notthetup
notthetup / audioplayback.js
Last active August 29, 2015 13:57
Basic Audio Playback without an DOM element.
var flapSound = new Audio("./flyaway.wav");
flapSound.play(); // has to be done in an UI event callback