Skip to content

Instantly share code, notes, and snippets.

View aheadley's full-sized avatar

Alex Headley aheadley

View GitHub Profile
@tessro
tessro / redis-server
Created December 16, 2009 14:20
A CentOS initscript for Redis
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@mahmoudimus
mahmoudimus / python-monkey-patch-built-ins.py
Created February 4, 2010 22:20
pythonic monkey patching built-in types
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
# figure out side of _Py_ssize_t
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
_Py_ssize_t = ctypes.c_int64
else:
_Py_ssize_t = ctypes.c_int
@agrif
agrif / gist:934818
Created April 21, 2011 15:52
hacky php unsigned long to float
$n = unpack("N", ...);
$res = 0.0;
for ($bit = 0; $bit < 32; $bit++) {
if ($n & (1 << $bit)) {
$res += pow(2, $bit);
}
}
echo $res;
@rcoup
rcoup / blocksync.py
Last active May 8, 2024 09:30
Block device sync between remote hosts. Based off http://www.bouncybouncy.net/programs/blocksync.py
#!/usr/bin/env python
"""
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <[email protected]>
Copyright 2011 Robert Coup <[email protected]>
License: GPL
Getting started:
@frimik
frimik / warranty.rb
Created February 15, 2012 22:33
Dell warranty fact
# Dell Facter module
#
# Author: Mikael Fridh <[email protected]>
# Date: 2011-11-24
#
# this is a rather substantial rewrite of the camptocamp puppet module
# https://github.com/camptocamp/puppet-dell
#
# The regex matching has been ripped out completely and replaced with
# some xpath expressions from Nokogiri. Unfortunately this means another
@leinaddm
leinaddm / dell_soap_check.py
Created February 23, 2012 14:18
dell warranty check
#!/usr/bin/python
# Daniel De Marco - [email protected] - 2012-02-23
# suds from https://fedorahosted.org/suds/
import suds
import sys
def get_warr(svctag):
@contre
contre / gist:2764280
Created May 21, 2012 19:55
Generating profile images
# Code taken from http://code.google.com/p/jrfonseca/wiki/Gprof2Dot
python -m cProfile -o output.pstats ./overviewer.py --config=settings_exmaple.py
./gprof2dot.py -f pstats output.pstats | dot -Tpng -o output.png
@aperson
aperson / reddit_submit.py
Created July 14, 2012 23:44
Quick script to submit a url to subreddits
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# moderator-bot.py
#
# Copyright 2012 Zach McCullough <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# handy aliases
[alias]
co = checkout
stat = status
prune-all = !git remote | xargs -n 1 git remote prune
fetch-all = !git remote | xargs -n 1 git fetch
# do the right thing for gh:user/repo.git urls
[url "[email protected]:"]
Antec Performance One Series P183 V3 Black Aluminum / Steel / Plastic ATX Mid Tower Computer Case
http://www.newegg.com/Product/Product.aspx?Item=N82E16811129174
Intel BOXDZ68DB LGA 1155 Intel Z68 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
http://www.newegg.com/Product/Product.aspx?Item=N82E16813121527
PNY XLR8 VCGGTX660TXPB-C GeForce GTX 660 Ti 2GB 192-bit GDDR5 PCI Express 3.0 x16 HDCP Ready SLI Support Video Card w/ HDMI Cable
http://www.newegg.com/Product/Product.aspx?Item=N82E16814133467
CORSAIR Professional Series HX650 650W ATX12V v2.2 / EPS12V 2.91 SLI Ready 80 PLUS GOLD Certified Modular Active PFC Power Supply