Skip to content

Instantly share code, notes, and snippets.

View halkeye's full-sized avatar

Gavin Mogan halkeye

View GitHub Profile
@halkeye
halkeye / xbmcStats.rb
Created November 29, 2012 03:33 — forked from anonymous/file1.txt
XBMC collectd stats collection
#!/usr/bin/env ruby
#
# Written by Gavin Mogan (gavin@kodekoan.com)
require 'rubygems'
require 'mysql2'
# Enable auto flush
STDOUT.sync = true
@halkeye
halkeye / transmissionStats.rb
Created November 29, 2012 05:10
transmission stats collectd
#!/usr/bin/env ruby
#
# Written by Gavin Mogan (gavin@kodekoan.com)
require 'rubygems'
require 'transmission-rpc'
# Enable auto flush
STDOUT.sync = true
@halkeye
halkeye / top-level-jars.sh
Created October 23, 2015 05:20
hacked solution to track down jar files with top level class files
for jar in $(find ~/.m2/repository -name '*.jar'); do unzip -qql $jar | awk '{ if ($4 ~ /^\w+\.class$/) exit 1 }' || echo $jar ; done
<?php
require 'facebook-php-sdk/src/facebook.php';
ini_set('display_errors', true);
require '/home/halkeye/git/rob_facebook_poster/config.php';
/* FIXME - put your stuff here */
$facebook = new Facebook(array(
'appId' => $config['FACEBOOK_APP_ID'],
'secret' => $config['FACEBOOK_APP_SECRET'],
));
#!/bin/bash
DRY_RUN=
DATABASE=
cd /tmp/
mysqldump --skip-dump-date --opt --flush-logs --single-transaction ${DATABASE} bzcat -zc > ${DATABASE}.sql.bz2
for i in `seq 5 -1 2`; do
PREV_I=$(expr $i - 1)
#!/bin/sh
rm /etc/udev/rules.d/70-persistent-net.rules
cd /etc/sysconfig/network-scripts/
TMP=`mktemp`
TEST=`ifconfig | grep eth | awk '{ print $5}'`; sed "s/HWADDR.*/HWADDR\=$TEST/g" ifcfg-eth0 > $TMP; mv $TMP ifcfg-eth0
@halkeye
halkeye / updateWPPlugin.py
Last active December 21, 2015 09:49
Simple little script I use to update wordpress plugins
#!/usr/bin/env python
# Simple little script I use to update wordpress plugins
# Author: Gavin Mogan <gavin@kodekoan.com>
#
# Usage:
# for i in ~/wp-plugins/*; do svn sw $(updateWPPlugin $i) $i; done
# Changelog:
# Ignore any tag that has characters other than 0-9 and .
# This usually means that its a beta tag
@halkeye
halkeye / beep.sh
Created October 2, 2013 19:08
Very simple little script I use inside of screen/tmux window to notify me of output
#!/usr/bin/env perl
print "$_\007" while (<>);
@halkeye
halkeye / unittest.pl
Created October 4, 2013 22:10
Ugly code for generating random word and random character for a unittest
sub rw { my $word = "$_[0]"; $word =~ s/(.)/rc($1)/ge; $word;}
sub rc { return ((rand(1)*2+1)%2) ? lc($_[0]): uc($_[0]); }
@halkeye
halkeye / production.rb
Created January 25, 2014 00:08
For production Capistrano deploys, we can't use our own internal git server because the one off amazon box doesn't have access to the internal network. Hacked in a solution to create a port forward to talk back to our network. Works in this case so sharing.
set :repo_url, "ssh://git@localhost:9000/#{fetch(:application)}.git"
module SSHKit; module Backend
class Netssh < Printer
alias_method :orig_ssh, :ssh
def ssh
ret = orig_ssh
@@created_remote ||= ret.forward.remote(22, 'gitserver', 9000)
return ret
end