Skip to content

Instantly share code, notes, and snippets.

View fuzzy's full-sized avatar

Mike 'Fuzzy' Partin fuzzy

View GitHub Profile
@fuzzy
fuzzy / irc.go
Last active August 29, 2015 14:10
package main
import (
// Stdlib
"log"
// 3rd party
"github.com/husio/go-irc"
)
#!/usr/bin/env python
import sys, json, urllib2, random
if sys.argv[1] == '--usage':
print 'Usage: !search <search terms>'
sys.exit(0)
nick, host, args = sys.argv[1], sys.argv[2], sys.argv[3]
data = json.loads(urllib2.urlopen(
{
///////////////////////////
// Global config section //
///////////////////////////
// The command character (ie: first character of the message, eg: !seen)
"cmdchar": "!",
// The directory that our event based, executable commands live in
"command_dir": "",
@fuzzy
fuzzy / mpos.py
Created February 13, 2015 08:36
MPOS api in python, no error handling, but full api coverage, it is hereby placed in the public domain
import json
import types
import urllib
import urllib2
class Mpos:
def __init__(self, apiUri=None, apiKey=None, UserId=None):
self.apiUri = apiUri
self.apiKey = apiKey
self.UserId = UserId
@fuzzy
fuzzy / abused.py
Last active August 29, 2015 14:16
A Basic USe EDitor for gentoo. drop abused.py into your path, and use it in place of emerge when doing installs. It will allow you to edit your use flags on the fly.
#!/usr/bin/env python
import os
import re
import sys
import string
import subprocess
class Abused:
@fuzzy
fuzzy / dd.py
Created May 3, 2015 22:52
dd.py
#!/usr/bin/env python
###########
# Imports #
###########
# Stdlib
import re
import os
import sys
@fuzzy
fuzzy / java-ps.rb
Created May 5, 2015 19:58
java commandline colorizer (ps output)
#!/usr/bin/env ruby
procs = Hash.new
scrpt = `basename #{__FILE__}`.strip
$color = {
:black => 30, :red => 31, :green => 32,
:yellow => 33, :blue => 34, :purple => 35,
:cyan => 36, :white => 37
}
must() {
case "${1}" in
(have)
case "${2}" in
(file) test -f ${3} || err "Missing file: ${3}" ;;
(link) test -L ${3} || err "Missing symlink: ${3}" ;;
(dir) test -d ${3} || err "Missing dir: ${3}" ;;
(prog) which ${3} >/dev/null 2>&1 || err "Missing ${2}: ${3}" ;;
(user) test ! -z "$(grep ${3} /etc/passwd)" || err "Missing ${2}: ${3}" ;;
(group) test ! -z "$(grep ${3} /etc/group)" || err "Missing ${2}: ${3}" ;;
@fuzzy
fuzzy / golang15-bootstrap.sh
Last active August 29, 2015 14:22
bootstrap for go1.5
#!/bin/sh
go14src=https://storage.googleapis.com/golang/go1.4.2.src.tar.gz
go14fnm=$(basename ${go14src})
bootstrap() {
cd /tmp
wget ${go14src}
tar zxf ${go14fnm}
cd /tmp/go/src
@fuzzy
fuzzy / bootstrap-go.sh
Created June 20, 2015 16:25
bootstrap-go.sh
#!/bin/sh
unset GOROOT
unset GOPATH
GOBASE=${HOME}/.govers/$(uname -s)/$(uname -m)
GO_SVER=${1:-"1.4.2"}
go14src=https://storage.googleapis.com/golang/go${GO_SVER}.src.tar.gz
go14fnm=$(basename ${go14src})