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
# ============== shell | |
# Case-insensitive globbing. | |
shopt -s nocaseglob; | |
# Do not overwrite files when redirecting using ">", ">&" or "<>". | |
# Note that you can still override this with ">|". | |
set -o noclobber; | |
# UTF-8 all the way. | |
export LC_ALL='en_GB.UTF-8'; |
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
# Read a random word from the dictionary and try to get its definition from | |
# Merriam-Webster. | |
function word-of-the-day { | |
local file="${1:-/usr/share/dict/words}"; | |
if ! [ -r "$file" ]; then | |
echo "Cannot read from dictionary file: $file" 1>&2; | |
return 1; | |
fi; | |
local IFS=$'\n' words=($(<"$file")); | |
local num_words=${#words[@]}; |
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 | |
# Make a temporary directory for our little test. | |
mkdir linkage.tmp || exit $?; | |
cd linkage.tmp; | |
# Create two directories and a symlink to the first. | |
rm -rvf v1 v2 current; | |
mkdir v1 v2; | |
ln -s v1 current; |
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
# == WHAT | |
# Expand the tweets mentioned in a channel, as well as the tweets those tweets refer to. | |
# | |
# == WHO | |
# Jan Moesen, 2012 | |
# | |
# == INSTALL | |
# Place these files in `~/.irssi/scripts/`. | |
# /script load twatspam.pl |
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 | |
function log { | |
echo "$@" 1>&2; | |
} | |
for page_url; do | |
log "Now processing page: $page_url"; | |
# Assemble the playlist URL. It is stored in two JavaScript properties in | |
# the HTML page. |
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
<?php | |
/** | |
* Get the output of var_dump() for better legibility. | |
* | |
* @param mixed $arg1..N | |
*/ | |
function getVarDump() { | |
$output = array(); |
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
/** | |
* Search Google Maps for a bicycle route. | |
* | |
* @title Google Maps (for cyclists) | |
*/ | |
(function ride() { | |
/* Try to get the parameter string from the bookmarklet/search query. */ | |
/* Fall back to the current text selection, if any. If those options | |
/* both fail, prompt the user. */ | |
var s = (function () { /*%s*/ }).toString() |
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 manneke { | |
:;:;:;:;:;:;: | |
:;:;:;:;:;:;: | |
<. :;:;:;:;:;:;:;:;: | |
[ ! ] ; [ ! ] | |
: : | |
: _ : | |
[ \_____/ ] |
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
stack=(''); | |
for i in {1..10}; do | |
printf -v alias_name '.%s' "${stack[@]}"; | |
printf -v path '../%s' "${stack[@]}"; | |
alias ".$alias_name"="cd $path"; | |
stack+=(''); | |
done |
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
javascript: (function () { | |
// Use this on http://www.camper.com/en_BE/men/shoes/shoe to change the | |
// thumbnails to the top-down view. Useful for people with wide feet. | |
var images = document.querySelectorAll('img[src*="JGVzaG9wNiQ="]'); | |
Array.prototype.slice.call(images).forEach(function (img) { | |
img.src = img.src.replace('_L.jpg', '_C.jpg'); | |
}); | |
})(); |
OlderNewer