Skip to content

Instantly share code, notes, and snippets.

View ScoreUnder's full-sized avatar

score ScoreUnder

View GitHub Profile
@ScoreUnder
ScoreUnder / hash
Created September 19, 2016 09:08
Naive hash code functions for creating terminal colours
#!/bin/busybox sh
# Original code, slow, not sh-compatible
hashcode() {
local hash=0
local str="$1"X
while [ -n "$str" ]; do
ch="${str:0:1}"
hash=$(( ($hash * 173 + $(printf '%d' "'$ch")) % 256 ))
str="${str:1}"
done
@ScoreUnder
ScoreUnder / skulldl
Last active August 29, 2015 14:27
skullmp3 downloader gui thing
#!/bin/sh
title="mp3skull downloader"
put() { eval 'printf %s\\n "$'"$1"'"'; }
music_dir=$(xdg-user-dir MUSIC || put HOME)
cleanup() {
ret=$?
rm -f -- "$cookie_jar"
@ScoreUnder
ScoreUnder / pomfload
Last active August 29, 2015 14:01 — forked from xy4n/pomfload
#!/bin/sh
# Requires node.js: sudo pacman -Sy nodejs
if [ $# -lt 1 ]; then
echo "Usage: $(basename "$0") FILE [FILE...]" >&2
exit 1
fi
for f in "$@"; do
d=$(node -pe "JSON.parse(process.argv[1]).files[0].url" "$(curl -sS --progress-bar -F "files[]=@$f" http://pomf.se/upload.php)")