Skip to content

Instantly share code, notes, and snippets.

@hawx
hawx / send.sh
Created March 31, 2014 09:39
send
#!/usr/bin/env sh
#
# Usage: send <username> <password> <accountReference> <recipient> < file
# eg. send john.doe@example.com secretPassword EX00000 44132133113213 < mymessage.txt
body=$(cat)
curl -X POST --user "$1:$2" -d@- "https://api.esendex.com/v1.0/messagedispatcher" <<EOS
<?xml version="1.0" encoding="utf-8"?>
<messages>
@hawx
hawx / chunkyrequest.cs
Created February 25, 2014 15:02
ChunkyRequest
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using ShiftIt.Http;
namespace Chunkyness
{
public class ChunkyRequest
@hawx
hawx / .bashrc
Last active April 26, 2017 15:57
.files
git_author() {
if [ -z "$GIT_AUTHOR_NAME" ]; then
echo "developer"
else
echo "$GIT_AUTHOR_NAME"
fi
}
export PS1='\[\033]0;$MSYSTEM:\w\007\]\n\[\033[32m\]$(git_author) @ \h \[\033[33m\]\w$(__git_ps1) \[\033[0m\]\n$ '
@hawx
hawx / tapandinto.cs
Last active December 31, 2015 17:38
public static class Exts
{
public static T Tap<T>(this T that, Action<T> action)
{
action(that);
return that;
}
public static TOut Into<TIn, TOut>(this TIn that, Func<TIn, TOut> func)
{
@hawx
hawx / deserialisable.rb
Created September 17, 2013 09:42
Idea for deserialising xml to ruby objects.
require 'nokogiri'
module Deserialisable
def root(selector)
@__root = selector
@__elements = {}
end
def element(name, selector, type=String)
@__elements[name] = [selector, type]
@hawx
hawx / widen-github.js
Last active December 22, 2015 05:39
Widen Github .bookmarklet
javascript: (
function() {
var widenGithubs = '.container { width: 1280px; } ' +
'.container .repository-content { width: 1230px; } ' +
'.container .repository-with-sidebar.with-full-navigation .repository-content { width: 1080px; } ' +
'.container .column { width: 1092px; } ' +
'#files .diffstat+.css-truncate-target { max-width: 855px !important;} ' +
'.discussion-timeline { width: 1055px; } ' +
'.comment-holder { width: 952px !important; } ' +
'.inline-comments .comment-holder { width: 1100px !important; max-width: 1100px !important; } ' +
@hawx
hawx / README.md
Created May 8, 2013 11:16
My screensaver, shows random faved tweets on a loop.

Favtwit

My (mac) screensaver. Download and install the IdleWeb screensaver. Put the files above into a folder somewhere along with twitterlib.min.js. Then setup.

@hawx
hawx / hooks.rb
Created April 30, 2013 18:38
Additions to minitest
module MiniTestWithHooks
class Unit < MiniTest::Unit
attr_reader :before_suites, :after_suites
def before_suites(&block)
(@before_suites ||= []) << block
end
def after_suites(&block)
@hawx
hawx / test.go
Created March 12, 2013 10:18
Test of hadfield.
package main
import (
"github.com/hawx/hadfield"
"fmt"
"os"
)
var cmdGreet = &hadfield.Command{
Usage: "greet [options]",
@hawx
hawx / img-lomo
Created February 27, 2013 11:53
Extends img with a lomo command. Requires imagemagick to generate a mask then adjusts and composes the final image with img.
#!/usr/bin/env sh
function usage {
echo "lomo [options]"
}
function short {
echo "applies a simple lomo effect to the image."
}