Skip to content

Instantly share code, notes, and snippets.

View supertunaman's full-sized avatar

Andrew "Tuna" Williamson supertunaman

View GitHub Profile
@supertunaman
supertunaman / oly.sh
Created March 1, 2020 04:13
Nasty bash script to download images from an Olympus E-M10 Mark III (and probably some others) via its wifi feature
#!/bin/bash
mkdir olypics/
curl http://192.168.0.10/get_imglist.cgi?DIR=/DCIM/100OLYMP | cut -d, -f2 | grep 'JPG$' | while read file; do
echo "Downloading ${file}..."
curl -so olypics/${file} "http://192.168.0.10/DCIM/100OLYMP/${file}"
done
#!/bin/bash
# Usage: t.sh [minutes]
# default is 5 minutes
minutes=5
arg=$( echo "${1}" | grep -o '[0-9]*' | head -1 )
if [ -n "${arg}" ]; then
@supertunaman
supertunaman / fakeserver.sh
Last active December 12, 2015 04:08 — forked from pib/fakeserver.sh
#!/bin/bash
BODY="$1"
if [ -z "$1" ]; then
BODY="/proc/uptime"
fi
{
echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c $BODY | egrep -o '^[0-9]+')\r\nContent-Type: $(file -b --mime-type $BODY)\r\n\r\n"
cat $BODY
} | nc -l 8080 -v
@supertunaman
supertunaman / alarmclock.sh
Created November 26, 2012 16:10
Because this was so needed.
#!/bin/bash
MPD_HOST=192.168.0.105
MPC=/usr/bin/mpc
NOISY_SHIT='Cowboy Bebop/Cowboy Bebop OST 1 - Cowboy Bebop/01 - Tank!.mp3'
CHECK_URL="http://flying.sexsnak.es/alarmclockdisable"
CHECK_FILE="/root/.alarmclockdisable"
check_disabled() {
@supertunaman
supertunaman / socialstack_reality.pl
Created October 23, 2012 18:46
It's sort of like a dream catcher, except if you swing a dream catcher around in the neglected septic tank that is the collective dreams of every nontechnical hipster yuppie ever. So go fish out a nice dookie of an idea!
#!/usr/bin/perl
use strict;
use warnings;
use Carp;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new(requests_redirectable => [ 'GET' ]);
my $socialstackapp4gltecloudasaservice = 'http://socialstack.heroku.com/';
@supertunaman
supertunaman / facetest.c
Created April 2, 2011 12:44
Tests ace-high straights that aren't flushes in ircpoker
#include <stdio.h>
#include "card.h"
#include "deck.h"
#include "hand.h"
void print_rank(card_t hand[])
{
switch (rank_hand(hand)) {
case HIGHCARD:
printf("High Card");
@supertunaman
supertunaman / drawbat.sh
Created March 10, 2011 23:46
A battery life indicator that fits nicely in a $PS1
#!/bin/bash
endcolor="\033[1;31m"
innercolor="\033[1;33m"
nocolor="\033[0m"
charge_now=$(cat /sys/class/power_supply/BAT0/charge_now)
charge_full=$(cat /sys/class/power_supply/BAT0/charge_full)
percent=$(echo "scale=2; ( $charge_now / $charge_full ) * 100" | bc | sed 's/\(.*\).../\1/g')
bars=$(echo "($percent / 20) + 1" | bc)
Does not protect my liability if the chicken dance causes death.