This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple more advanced arguments parsing than builtin tools like getopts or a simple while/case looping over the arguments | |
# | |
# Features include handling of: | |
# - multiple grouped shorthands (f.i. -abc becoming -a -b -c), | |
# - equal sign value assignment (f.i. --arg=value becoming --arg value, and also -a=value becoming -a value) | |
# - dashless value assignment (f.i. arg=value becoming arg value) | |
# | |
# The only dependencies are bash (for arrays) and expr (included in coreutils) (for regexp matching and extraction) which are likely available everywhere (even in a busybox or on a mac!) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Cache () { | |
"use strict"; | |
if (this.constructor != Cache) throw new TypeError("Constructor Cache requires 'new'"); | |
/* | |
A dumb, simple cache, to make access to cross-pageload variables easy and manageable. | |
All cache times are in milliseconds. | |
*/ | |
var storage = window['localStorage']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*/ | |
* This simulates JQuery's constructor functionality as best as easiest possible | |
* Some minor things that I never really use (like calling select() without arguments, | |
* or some ambiguous css paths not being interpreted by querySelectorAll correctly) | |
* might not really work, but I personally don't see much need to make it more complicated | |
* to work around them currently. | |
/*/ | |
var select = function (s, c) { | |
if (!c || c == null) | |
c = document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# author: syl20bnr (2013) | |
# goal: Focus the nth window in the current workspace (limited to 10 firsts) | |
# | |
# Example of usage in i3 config: | |
# | |
# bindsym $mod+0 exec focus_win.py -n 0 | |
# bindsym $mod+1 exec focus_win.py -n 1 | |
# ... ... |