Skip to content

Instantly share code, notes, and snippets.

View halkeye's full-sized avatar

Gavin Mogan halkeye

View GitHub Profile
(function() {
if (document.getElementsByClassName('show_more_backings')[0].offsetParent !== null) {
alert("You must click 'Show More Pledges' and load all your pledges before running this bookmarklet");
return false;
};
var collectData = function collectData() {
var nodes = $$('#collected .money');
var ksData = [["Project", "Amount", "Currency", "Got It!"]];
for (var i = 0; i < nodes.length; i++) {
var ksRow = [];
@halkeye
halkeye / nginx.conf
Created March 31, 2015 17:40
nginx+cloudflare redirect
location / {
if ($http_cf_visitor !~ https) {
rewrite ^(.*) https://$http_host$1 permanent;
}
}
@halkeye
halkeye / build_uchiwa_tarball.sh
Created March 19, 2015 18:52
Quick script to build a complete uchiwa tarball
#!/bin/bash
export GOPATH=`pwd`
set -e
# grab and compile soruce code
go get github.com/sensu/uchiwa
cd $GOPATH/src/github.com/sensu/uchiwa
export VERSION=$(head -n 1 CHANGELOG.md | sed 's/#\+ \([0-9.]\+\).*/\1/g')
# parses strings such as: 07-31 09:56:08
DATESTAMP_CP [0-9]{2}-[0-9]{2} %{TIME}
# parses strings such as: '\u001b\[0m' or '^[[0m' or '\e[0m'
METACHAR_CP ((\\u001b|\^\[|\e)\[\d+m)?
# assigns regular expression that matches Java classes to a new variable name.
FACILITY_CP %{JAVACLASS}
@halkeye
halkeye / Gemfile
Created February 14, 2015 07:10
Simple set of scripts to create nfo files from a bunch of youtube-dl files
source 'https://rubygems.org'
gem 'youtube_it', '2.4.0'
@halkeye
halkeye / main.go
Last active August 29, 2015 14:14
package main
import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
#!/usr/bin/env ruby
#
# check-supervisor-socket
#
#
# DESCRIPTION:
# Check that all supervisor processes are running using its UNIX domain socket. See unix_http_server section in
# http://supervisord.org/configuration.html.
#
# OUTPUT:
@halkeye
halkeye / gist:ac60f9edde682b316449
Created November 19, 2014 08:01
Ugly attempt at mocking out static class
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace UnitTestStatic
{
public class Utilities : IUtilities
{
private static IUtilities _instance = new Utilities();
private Utilities() { }
@halkeye
halkeye / cloudflare_ips_nginx.sh
Last active October 5, 2016 20:00
Pull cloudflare ips for nginx
# cat /etc/nginx/conf.d/cloudflare.conf
# sh cloudflare_ips_nginx.sh > /etc/nginx/conf.d/cloudflare.conf && service nginx configtest && service nginx reload
echo "# Cloudflare"
for ip in $(curl -s https://www.cloudflare.com/ips-v4); do
echo "set_real_ip_from $ip;"
done
for ip in $(curl -s https://www.cloudflare.com/ips-v6); do
echo "set_real_ip_from $ip;"
done
import grails.converters.JSON
// Automatically generated. Make future change here.
definition(
name: "gavin_test_pushes",
namespace: "gavin",
author: "Gavin",
description: "Description goes here",
category: "Fun & Social",