Skip to content

Instantly share code, notes, and snippets.

View stephenwithav's full-sized avatar

Steven Edwards stephenwithav

View GitHub Profile
@stephenwithav
stephenwithav / custom-org.el
Created November 24, 2013 23:36
Code to execute custom hooks before clocking out in org-mode. (save-excursion) fails to return me to the proper screen, e.g., the agenda.
(defvar org-pre-clock-cancel-hook nil
"Hooks to run immediately before canceling a clock.")
(defun rand/org-clock-cancel ()
(interactive)
(save-excursion
(org-clock-goto)
(run-hooks 'org-pre-clock-cancel-hook)
(org-clock-cancel)))
@stephenwithav
stephenwithav / Vagrantfile
Created November 1, 2014 20:12
Proposed Vagrant file with force-read support
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know wh
@stephenwithav
stephenwithav / gist:92bc5d6faed347865fff
Created November 3, 2014 17:05
vagrant_ansible_inventory
# Generated by Vagrant
db ansible_ssh_host=127.0.0.1 ansible_ssh_port=2201
web ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222
@stephenwithav
stephenwithav / nsqc.go
Created January 10, 2015 23:40
sample nsq
package main
import (
"fmt"
"log"
"os"
"os/signal"
"time"
"github.com/bitly/go-nsq"
@stephenwithav
stephenwithav / googlealertsfail.go
Last active August 29, 2015 14:13
Fails with "invalid UTF-8 on line 1"
package main
import (
"bytes"
"log"
"net/http"
"strings"
"launchpad.net/xmlpath"
)
@stephenwithav
stephenwithav / main.go
Last active August 29, 2015 14:18
example of using text/template
package main
import (
"os"
"text/template"
)
var peoplePage *template.Template
var peopleTemplate string = `{{range .}}
@stephenwithav
stephenwithav / gist:262ae03755c314465a47
Last active September 1, 2015 11:17 — forked from bradleypeabody/gist:185b1d7ed6c0c2ab6cec
golang, convert UTF-16 to UTF-8 string
package main
// http://play.golang.org/p/fVf7duRtdH
import "fmt"
import "unicode/utf16"
import "encoding/binary"
func main() {
@stephenwithav
stephenwithav / cac buk coupon
Last active December 1, 2015 10:00
cac test
var items=$("a[onclick^='cart.apply']").map(function(i,el){return $(el).attr('onclick')});
var itemids = new Array(items.length)
for (var i=0;i<items.length;i++){ var s=new String(items[i]); itemids[i]=s.substring(18,31); }
for (var i=0;i<itemids.length;i++){ var url="https://members.cloudatcost.com/index.php?fuse=admin&controller=signup&action=validatecoupon&couponCode="+coupon+"&itemID="+itemids[i]; $.get(url) }
func Round(f float64) float64 {
return math.Floor(f+.5)
}
@stephenwithav
stephenwithav / README.md
Created December 2, 2016 12:04 — forked from fhernand/README.md
Visualization of passes in a soccer game

A graph of passes done between players of Real Madrid in the 1st half of the 23.09.2014 game vs. Elche.