Skip to content

Instantly share code, notes, and snippets.

@StanAngeloff
StanAngeloff / mintty.ahk
Created September 11, 2010 20:27
MinTTY at your fingertips
; AutoHotkey script, download from:
; http://www.autohotkey.com/
; NOTE: Save this file with Windows line endings i.e. \r\n
;
cmd_line := "C:\bin\cygwin\bin\mintty.exe /bin/zsh --login"
wnd_class := "ahk_class mintty"
#c::
@lsauer
lsauer / gist:1260083
Created October 3, 2011 20:04
JavaScript compensating for RegExp global non capturing groups
//author: lo sauer 2011
//given for instance, is a text with placeholders of which only the value is to be captured
//JS's 'match' ignores the non-capture group (?:...), for instance in a global search
str = "Hello I am {{name}}. Is it already the {{date}}";
str.match(/(?:\{{2})([a-z0-9]*)(?:\}{2})/i);
>>>["{{name}}", "name"]
str.match(/(?:\{{2})([a-z0-9]*)(?:\}{2})/gi);
>>>["{{name}}", "{{date}}"]
@rudiedirkx
rudiedirkx / download.js
Created May 6, 2012 16:55
Download any File/Blob via JS
/**
* `url` can be a data URI like data: or a blob URI like blob: or an existing, public resource like http:
* `filename` is the (default) name the file will be downloaded as
*/
function download( url, filename ) {
var link = document.createElement('a');
link.setAttribute('href',url);
link.setAttribute('download',filename);
var event = document.createEvent('MouseEvents');
event.initMouseEvent('click', true, true, window, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@dsc
dsc / gist:3855240
Created October 8, 2012 21:52
Python argparse Cheatsheet
Arg Name or Optional Flags:
positional : str = "foo"
options : str = "-f", "--foo"
Standard:
action : str = [store], append, store_true, store_false, store_const, append_const, version
default : * = [None]
type : callable = [str], argparse.FileType(mode='wb', bufsize=0)
Exotic:
@remy
remy / hang.js
Created November 30, 2012 13:23
How to hang JavaScript (useful - to me - for slowing down code and testing)
function hang(n) {
var x = new XMLHttpRequest();
x.open('GET', 'http://hang.nodester.com/script.js?' + n, false);
x.send();
}
// usage: hang(2 * 1000);
@spion
spion / killgrep.sh
Last active November 28, 2021 15:49
killgrep and psgrep
#!/bin/bash
# Put me in /usr/local/bin/killgrep
ps aux | egrep $1 | egrep -v '(killgrep)|(egrep)' | awk '{print $2}' | xargs kill -9
@devoncrouse
devoncrouse / clean_audio.sh
Created May 7, 2013 17:02
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@Uberi
Uberi / Ping.ahk
Created July 12, 2013 19:35
SimplePing - AHK library providing a variety of ICMP pinging-related functionality.
#NoEnv
/*
SimplePing
==========
AHK library providing a variety of ICMP pinging-related functionality.
Examples
--------
@consti
consti / hosts
Last active June 7, 2024 13:12
/etc/hosts to block shock sites etc.
# This hosts file is brought to you by Dan Pollock and can be found at
# http://someonewhocares.org/hosts/
# You are free to copy and distribute this file for non-commercial uses,
# as long the original URL and attribution is included.
#<localhost>
127.0.0.1 localhost
127.0.0.1 localhost.localdomain
255.255.255.255 broadcasthost
::1 localhost