Skip to content

Instantly share code, notes, and snippets.

View brucewoodward's full-sized avatar

Bruce Woodward brucewoodward

  • N/A
  • Sydney Australia
View GitHub Profile
@brucewoodward
brucewoodward / rotating-message.sh
Created April 15, 2019 06:36
Rotate a message on the screen.
#!/bin/bash
# When I was 11, this bit of code appeared in a book on BASIC that had.
# This is just for nostalgia.
str="$1"
typeset -i start=0 len=${#str}
while true
do for s in `seq 1 $len`
do clear
@brucewoodward
brucewoodward / c.c
Created October 22, 2017 00:40
Playing with C and Ruby
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
char *monthnames[] = {
(char*)0, "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
int days_in_month[] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
@brucewoodward
brucewoodward / vlc
Created October 12, 2017 21:41
Wrapper for viewing movies using vlc
#!/bin/bash
VLCTMP=/tmp/vlc.out
QUIET=false
log_vlc() {
echo $(date +%s) "$@" >> ~/.vlc
}
run_vlc() {
@brucewoodward
brucewoodward / install.sh
Created July 30, 2017 09:23
Installing vim from github
mkdir ~/local
cd /tmp
git clone https://github.com/vim/vim
cd vim
./configure --prefix=$HOME/local --enable-terminal=yes && make install
oldPATH="$PATH"
PATH=$HOME/local/bin:$PATH
type vim
@brucewoodward
brucewoodward / unpack
Last active March 25, 2017 00:07
Unpack zip files from usenet.
#!/usr/local/bin/bash
zipOutput=/tmp/$$.tmp
die()
{
echo $* 1>&2
exit 1
}
@brucewoodward
brucewoodward / usedby.sh
Created February 27, 2017 05:57
Show who has been accessing your rails app
#!/bin/sh
# Install geoiplookup
# Remove the reference to the IP address 69.162.124.237 to play.
grep `date '+%Y-%m-%d'` production.log | grep Started | grep -v 69.162.124.237 | awk '{print $10, $12}' | while read path ip
do
echo `echo $path | sed 's/"//g'` $ip `geoiplookup $ip | awk -F: '{print $NF}'` `nslookup $ip | awk '/arpa/ {print $NF}'`
done | sort -u