Skip to content

Instantly share code, notes, and snippets.

View fuzzy's full-sized avatar

Mike 'Fuzzy' Partin fuzzy

View GitHub Profile
@fuzzy
fuzzy / cpkg-usage
Created July 31, 2012 22:17
cpkg rewrite usage
$ cpkg
cpkg <command> <...>
Commands:
list [pkg] List packages or versions of [pkg]
use [global|(session)] <pkg>-<ver> Use <pkg>-<ver>
drop [global|(session)] <pkg>-<ver> Stop using <pkg>-<ver>
In progress:
@fuzzy
fuzzy / slndir.sh
Created August 5, 2012 16:07
lndir in Sh
slndir() {
if [ -z "${1}" ] || [ -z "${2}" ]; then
echo 'Usage: slndir /dir1 /dir2/'
else
SRC=${1}
if [ "${2}" = "." ] || [ "${2}" = "./" ]; then
DST=${PWD}
else
DST=${2}
fi
#!/usr/bin/env ruby
require 'drb'
class PingCheck
attr_accessor :cfg
def initialize(count=3, wait=3)
@cfg = Hash.new
@cfg[:count] = count
@cfg[:wait] = wait
#!/usr/bin/env python
################################################################################
# #
# Copyright (c) 2013, Mike 'Fuzzy' Partin <[email protected]> #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are met: #
# #
@fuzzy
fuzzy / output.txt
Created May 26, 2013 02:58
car.py output
$ ls
./ ../ Python-2.7.4.tar.bz2 car.py* ruby-1.8.6-p420.tar.gz
$ ./car.py
Sat May 25 19:55:33 2013
objA = Libarchive(fname="/home/mpartin/.cpkg/tmp/ruby-1.8.6-p420.tar.gz", debug=True)
DEBUG: Loaded library <CDLL '/usr/lib/libarchive.so', handle 80079d000 at 801775f90>
objB = Libarchive(fname="/home/mpartin/.cpkg/tmp/Python-2.7.4.tar.bz2", debug=True)
DEBUG: Loaded library <CDLL '/usr/lib/libarchive.so', handle 80079d000 at 80177e0d0>
ret = objA.extractArchive()
@fuzzy
fuzzy / car.py
Last active December 17, 2015 18:09
#!/usr/bin/env python
################################################################################
# #
# Copyright (c) 2013, Mike 'Fuzzy' Partin <[email protected]> #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are met: #
# #
@fuzzy
fuzzy / bit.rb
Created June 21, 2013 15:28
an example of metaprogramming in ruby
class Logging
def initialize
@PROMPTS = {
:info => '>>'.bold.green,
:warn => '**'.bold.yellow,
:error => '!!'.red,
:fatal => '!!'.bold.red,
:debug => '**'.bold.cyan
}
mike@jubei:~$ git clone git://git.silverirc.com/screenfetch.git
Cloning into 'screenfetch'...
remote: Counting objects: 1595, done.
remote: Compressing objects: 100% (1048/1048), done.
remote: Total 1595 (delta 928), reused 948 (delta 533)
Receiving objects: 100% (1595/1595), 1.90 MiB | 390 KiB/s, done.
Resolving deltas: 100% (928/928), done.
mike@jubei:~$ cd screenfetch/
mike@jubei:~/screenfetch$ ./screenfetch-dev
_,met$$$$$gg. mike@jubei
@fuzzy
fuzzy / apt-tool.rb
Created October 11, 2013 00:00
apt automation tool for use in puppet
#!/usr/bin/env ruby
require 'open3'
require 'open-uri'
require 'getoptlong'
require 'digest/md5'
class Apt
def initialize
@fuzzy
fuzzy / models.py
Created January 21, 2014 06:38
models
from cryptolizzard.db.peewee import *
db = MySQLDatabase('cryptolizzard', user='clizzard', passwd='<pass>', host='192.168.0.2')
db.connect()
class BaseModel(Model):
class Meta:
database = db
# Operational models