Skip to content

Instantly share code, notes, and snippets.

View icio's full-sized avatar
💬
icio is typing...

Paul Scott icio

💬
icio is typing...
View GitHub Profile
@icio
icio / gist:2000445
Created March 8, 2012 11:01
Bash function for opening GHI issues in the browser
# usage: ghi | ghi-w
# usage: ghi -u icio | ghi-w
alias ghi-w="awk '{ print substr(\$1,1,length(\$1)-1), \"\n\" }' | cat | xargs -n 1 ghi -w"
@icio
icio / pwnt.sh
Created May 28, 2012 13:34 — forked from anonymous/pwnt.sh
#!/bin/bash
#
# Checks a URI for the existance of a troll link.
#
# EXAMPLE USAGE:
# ./pwnt.sh www.youtube.com/watch?v=oHg5SJYRHA0
#
# TODO:
# Realtime Feedback
# Bayesian inference
@icio
icio / delay.js
Created July 21, 2012 15:20
delay.js
var _log_start = Date.now();
/**
* Helper for logging which prepends a time-offset
*/
function log()
{
console.log.apply(console, ["["+(Date.now()-_log_start)+"]"].concat(args(arguments)));
}
@icio
icio / gist:3166670
Created July 23, 2012 22:33
Python for/else
# For and if
for module in self.modules.values():
ok = True
for f in filters:
if not f(module):
ok = False
break
if ok:
yield module
@icio
icio / _readme.md
Last active October 13, 2015 23:27
Git review

About

A utility for interfacing with reviewable git branches, as per GitHub issues. This is a wrapper around ghi.

Usage

git review [-h | -l [LABEL] | [-w] ISSUE | -s | -u]
   git review            List reviewable issues
   git review -h         Print usage instructions

git review -l Print the review label filtered by

@icio
icio / tiles.py
Created January 5, 2014 07:07
Python command-line tile world for unix terminals
#!/usr/bin/env python
def world():
world = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 0, 0, 0, 1],
@icio
icio / jira-issue-map-copy.js
Created January 10, 2014 14:23
Useful for when you have to move from one JIRA workflow to another but don't want to repeat the mapping for every fucking issue type.
/**
* Duplicate the mapping of Current Status to New Status from the first
* issue type to the subsequent issue types.
*/
var tbody = document.getElementById('workflow-mapping-table').querySelector('tbody');
var cell = tbody.appendChild(document.createElement('tr')).appendChild(document.createElement('td'));
cell.setAttribute("colspan", 3);
cell.style.textAlign = "right";
@icio
icio / azure.txt
Last active January 3, 2016 12:59
Azure IP ranges from http://msdn.microsoft.com/en-us/library/windowsazure/dn175718.aspx converted into a format for Cloudflare's threat control.
65.52.128.0/20
65.52.144.0/20
213.199.128.0/21
213.199.136.0/22
168.63.4.0/22
168.63.8.0/22
168.63.20.0/22
168.63.24.0/21
137.116.204.0/22
168.63.12.0/22
@icio
icio / inputrc
Created January 22, 2014 13:47
Ubuntu input rc
# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
# Be 8 bit clean.
set input-meta on
set output-meta on
set completion-ignore-case on
set expand-tilde off
set mark-directories on
@icio
icio / enter_context.py
Created January 6, 2016 14:20
Python enter_context
"""Imperative enter/exit control for python contextmanagers.
Where you'd prefer to use `with`:
with my_context(123) as f:
do_something()
but only have access to before and after hook-functions (as with Flask):
def before_hook():