Skip to content

Instantly share code, notes, and snippets.

View grahamg's full-sized avatar

Graham Greenfield grahamg

View GitHub Profile
@jbd
jbd / power_officeblade.template
Created July 17, 2012 16:29
Cobbler template file for supermicro officeblade chassis
#if $power_mode == "on"
#set operation = "up"
#else
#set operation = "down"
#end if
cd /etc/SMCIPMITool/ && java -jar /etc/SMCIPMITool/SMCIPMITool.jar "$power_address" "$power_user" "$power_pass" blade $power_id power "$operation" && cd -
@grahamg
grahamg / .vimrc
Last active October 14, 2016 14:34
Vim Configuration
" Use Vim settings rather than Vi settings
" Required to be at the beginning of file
set nocompatible
" Required
filetype off
" Turn on syntax highlighting
syntax on
/**
* Gets or sets cookies
* @param name
* @param value (null to delete or undefined to get)
* @param options (domain, expire (in days))
* @return value or true
*/
_.cookie = function(name, value, options)
{
if (typeof value === "undefined") {
@beheadedmyway
beheadedmyway / gitweb
Created January 2, 2012 08:12
Gitweb on Centos behind Nginx with init script.
#!/bin/bash
#
# gitweb
#
# chkconfig: 235 20 80
# description: start and stop gitweb
# processname: gitweb
# pidfle: /var/run/gitweb.pid
# Source function library.
@grahamg
grahamg / Linux Command Reference
Created April 3, 2011 02:53
A List that I often refer to for useful commands for debugging Linux systems.
Plesk port: 8443
R1Soft CDP port: 1167
cPanel port: WHM over SSL = 2087
cPanel over SSL = 2083
regular WHM = 2086
regular cPanel = 2082
feedback loop information:
http://www.eliteemail.com/features/email-delivery/feedback-loops/
@Arthraim
Arthraim / bottle_example.py
Created May 27, 2011 04:27
a python web framework bottle's example
#coding: utf-8
from bottle import route, error, post, get, run, static_file, abort, redirect, response, request, template
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello World page</a>'
@route('/hello')
def hello():
@squioc
squioc / gist:3078803
Created July 9, 2012 20:49
conversion between iso8601 date format and unix epoch datetime
from datetime import datetime
import calendar
def epoch_to_iso8601(timestamp):
"""
epoch_to_iso8601 - convert the unix epoch time into a iso8601 formatted date
>>> epoch_to_iso8601(1341866722)
'2012-07-09T22:45:22'
"""
@mathiasverraes
mathiasverraes / TestFrameworkInATweet.php
Last active May 23, 2022 12:28
A unit testing framework in a tweet.
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
@cesarblum
cesarblum / gist:2011279
Created March 10, 2012 12:17
TinyWM in Chicken Scheme
;; TinyWM is written by Nick Welch <mack@incise.org>, 2005.
;; Ported to Chicken by César L. B. Silveira <cesarbs@gmail.com>, 2011.
;;
;; Original TinyWM website: http://incise.org/tinywm.html
;;
;; This software is in the public domain
;; and is provided AS IS, with NO WARRANTY.
(require-extension xlib)
@josdejong
josdejong / gist:4537647
Last active September 27, 2022 22:55
String interpolation method for underscore.js.
/*
String interpolation method for underscore.js
Usage:
var props = {
first: 'Jos',
last: 'de Jong'
};
var message = _.interpolate('Hello $first $last, welcome!', props);