Skip to content

Instantly share code, notes, and snippets.

View grahamg's full-sized avatar

Graham Greenfield grahamg

View GitHub Profile
@dnagir
dnagir / rspec-syntax-cheat-sheet.rb
Created November 5, 2010 09:29
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@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():
@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.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@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)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active May 7, 2024 06:03
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@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'
"""
@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 -
@rtomaszewski
rtomaszewski / example_paramiko_notty.py
Created August 19, 2012 19:05
example paramiko script that tries to run an interactive command that needs a terminal
import paramiko
bastion_ip='ip' # you have to edit and provide valid IP address
bastion_pass='pass' # you have to edit it and provide valid password
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
ssh.connect(bastion_ip, username='root', password=bastion_pass)
chan = ssh.invoke_shell()