Skip to content

Instantly share code, notes, and snippets.

View iwillspeak's full-sized avatar
🚲
The status is always bike

Will Speak iwillspeak

🚲
The status is always bike
View GitHub Profile
@iwillspeak
iwillspeak / aliases.ini
Last active April 11, 2017 10:16
Git Config Sections
[alias]
stat = status -sb
graph = log --oneline --decorate --graph --topo-order
desc = log -1 --decorate
leaderboard = shortlog -sne
sync = !git pull --rebase && git push
[push]
default = simple
#include <wordexp.h>
#include <stdio.h>
void expand_word(const char * word) {
wordexp_t words = {0};
puts(word);
wordexp(word, &words, WRDE_NOCMD);
@iwillspeak
iwillspeak / lasm-mode.el
Created August 14, 2013 20:02
Mode files for Emacs
;; Defines a simple generic mode to hilight lasm files
(define-generic-mode 'lasm-mode
;; Comment start marker, we just do single line comments for now
'("//")
;; Keywords, these are just taken verbose from opslist.h
'("pushloc" "pusharg" "pushlitn" "pushlitd" "pushlits" "pushtrue" "pushfalse"
"pushnull" "pushident" "poploc" "poparg" "dup" "pop" "idlook" "ntod" "ntos"
"dtos" "btos" "xton" "xtod" "xtob" "xtos" "add" "sub" "mul" "div" "mod"
"pow" "log" "neg" "inc" "dec" "cat" "slice" "strchar" "strcmp" "lt" "lteq"
"gt" "gteq" "eq" "noteq" "not" "and" "or" "print" "jump" "jumpt" "jumpf"
@iwillspeak
iwillspeak / .inputrc Moved.md
Last active August 26, 2017 15:11
Shell inputrc file, beacause ain't no one got time for incorrect case or extra tabbing.

Moved

Dotfiles are now all together at home

@iwillspeak
iwillspeak / find_config.rb
Last active December 20, 2015 07:39
Find a file in the current directory or in any of it's parents
#! /usr/bin/env ruby
require 'pathname'
def find_config_file(file_name, path)
path = Pathname(path) unless path.is_a? Pathname
path = path.realpath
path.ascend do |subpath|
location = subpath + file_name
@iwillspeak
iwillspeak / md160.c
Last active December 19, 2015 17:19
Just some hashing stuff
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <openssl/ripemd.h>
int main(int argc, const char* argv[]) {
FILE* file;
int length;
unsigned char* buffer;
@iwillspeak
iwillspeak / Moved.md
Last active October 18, 2016 09:39
Emacs initialisation file.
@iwillspeak
iwillspeak / namespace.py
Last active December 18, 2015 20:38
Represents a read-only access to a dictionary through the . operator. Used to allow easy access to options and suchlike. Should be both Python 2.7 and 3.x compatible.
class Namespace(object):
"""Namespace
Represents a read-only access to a dictionary through the . operator. Used
to allow easy access to options and suchlike. Should be both Python 2.7 and
3.x compatible.
"""
def __init__(self, dict):
self.__dict__.update(dict)
@iwillspeak
iwillspeak / writer
Last active December 18, 2015 07:09
Open a file using iA Writer.app, for those who don't want to have to leave the command line to open markdown files.
#! /usr/bin/env bash
# Touch any files that don't exist
for file in "$@"
do
echo "$file"
if [ ! -a "$file" ]; then
touch "${file}"
fi
if [ ! -w "$file" ] || [ ! -r "$file" ]; then
@iwillspeak
iwillspeak / thunker
Last active December 17, 2015 11:09
Automatic wifi router resetter control scripts. Install `thunker` into your `/usr/local/bin` on the RPi and `thunker_daemon` into your *init.d*. You will need Ruby and the `net-ping` and 'wiringpi' gems. See it in action at https://vimeo.com/66365606
#! /usr/bin/ruby
require 'wiringpi'
require 'net/ping'
require 'syslog'
# Constants
OUTPUT_PINA = 0 # RPi Pin 11
OUTPUT_PINB = 1 # RPi Pin 12
ARM_ON_TIME = 0.1