Skip to content

Instantly share code, notes, and snippets.

View grahamg's full-sized avatar

Graham Greenfield grahamg

View GitHub Profile
@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);}
@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);
@mtigas
mtigas / README.md
Last active December 16, 2022 02:12
this is the nginx config for https://mike.tig.as/, with config to avoid the BEAST exploit (by using TLS 1.2+ ciphers or RC4) and enable SSL perfect forward secrecy (by preferring ECDHE ciphers)

[mike.tig.as][mta] server configuration

This gist contains the nginx and tor configurations for the [mike.tig.as][mta] servers, mainly to show:

  • Use of the chris-lea/nginx-devel PPA to allow use of SPDY.
  • ssl_ciphers selection to mitigate BEAST attack, enable [perfect forward secrecy][pfs] if possible and select the strongest possible ciphers within those bounds. (Exception is made for several ciphers at the end of list, for compatibility reasons.)
/**
* 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") {
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@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()
@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 -
@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'
"""
@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
@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)