Skip to content

Instantly share code, notes, and snippets.

View chizmw's full-sized avatar

Chisel Malik-Wright chizmw

View GitHub Profile
@chizmw
chizmw / mac-adduser
Last active August 29, 2015 14:24
mac-adduser
#!/bin/bash
# username needs to be specified
if [ -z "$1" ]; then
echo "usage: $(basename $0) username";
exit;
fi
username=$1;
# we need to be running as root
@chizmw
chizmw / neo4lul
Last active August 29, 2015 14:03
LUL
= LUL
:author: Chisel Wright
:twitter: @chizcw
Some intro will go here
Data mostly from: http://en.wikipedia.org/wiki/List_of_London_Underground_stations#Stations
vim search/replace:
* s!^\([a-z]\+\) \(.\+\)$!CREATE (\1:Station { name:"\2" } )!

The World Cup Graph

Initial Data Setup

@chizmw
chizmw / git-aliases
Created November 13, 2013 17:14
A bash script that ensures all my git aliases are set-up as I like them
#!/usr/bin/env bash
# vim: ts=8 sts=4 et sw=4 sr sta
# only do the updates if this file is newer than our git config file
# (that means we've some something here)
if test $BASH_SOURCE -nt $HOME/.gitconfig; then
echo "[Updating git aliases...]";
# exit immediately if we have the lockfile
if [ -f $HOME/.bashrcd.gitalias.lock ]; then
@chizmw
chizmw / copy_db.java
Created July 17, 2013 14:23
Extending Wheeler's example for copying a sqlite3 database to somewhere accessible (and examinable)
public void copy_db() {
// copy the db to the sdcard
try {
File sd = Environment.getExternalStorageDirectory();
if (sd.canWrite()) {
String currentDBPath = this.myContext.getDatabasePath(this.getDatabaseName()).toString();
// use out package as the place to store files
String backupDirectory = "/" + this.myContext.getPackageName();
@chizmw
chizmw / cmp_versions.pl
Created January 30, 2013 23:31
Comparing some version numbers for a post on http://blogs.perl.org/users/chisel
#!/usr/bin/env perl
use strict;
use warnings;
use feature ':5.12';
use version;
use Text::SimpleTable;
my @versionstrings = (
'0.0.4',
@chizmw
chizmw / cmd_availability.pl
Last active December 10, 2015 23:28
An irssi plugin that makes it easier to change your nick and away status to make your availability really obvious (used at $work)
#!/usr/bin/env perl
# An irssi plugin that makes it easier to change your nick and away status to
# make your availability really obvious (used at $work)
#
# Simple examples are:
# gone --> gone = "/availability gone";
# idme = "/msg NickServ IDENTIFY s3kritw0rd";
# here --> here = "/availability here; /idme";
@chizmw
chizmw / odd_behaviour.t
Created August 16, 2012 13:39
Strange type checking behaviour
package My::Class;
use strict;
use warnings;
use Moose;
use MooseX::AttributeHelpers;
use MooseX::Types::Moose qw/ArrayRef Int/;
use MooseX::Types -declare => [qw(Thingy ThingyList)];
subtype Thingy,
@chizmw
chizmw / .gitignore
Created August 13, 2012 19:54
MooseX::Types::Structured validation example
*.sw?
@chizmw
chizmw / cmd_availability.pl
Created July 24, 2012 11:06
irssi 'availability' plugin script
#!/usr/bin/env perl
# Usage: /AVAILABILITY [here|lunch|meeting]
sub cmd_availability {
# data - contains the parameters for /HELLO
# server - the active server in window
# witem - the active window item (eg. channel, query)
# or undef if the window is empty
my ($data, $server, $witem) = @_;