Skip to content

Instantly share code, notes, and snippets.

View OhMeadhbh's full-sized avatar

Meadhbh Hamrick OhMeadhbh

View GitHub Profile
@OhMeadhbh
OhMeadhbh / subsector.js
Created December 26, 2011 10:25
simple canvas renderer for traveller subsector data
// Copyright (c) 2011 Meadhbh S. Hamrick
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
@OhMeadhbh
OhMeadhbh / gssc
Last active January 15, 2023 18:56
This is the script I made a long time ago to generate self-signed certificates. While I was using it recently I realized other people might find it useful. Standard disclaimers apply: never use a self signed cert unless you know what you're doing; use at your own risk -- if it causes any damage, it's not my fault; feel free to use & copy it, jus…
#!/bin/bash
# Copyright (c) 2003-2013, Meadhbh S. Hamrick. All Rights Reserved.
# Released under a BSD License. See http://opensource.org/licenses/BSD-2-Clause
#
# This script uses openssl to generate a self-signed certificate. Usage is
# like this:
# gssc <host name> [-p password] [-s subject] [-b bitlength]
# The host name parameter is the subject name of the certificate; i.e. - the
# FQDN of the host you're generating a certificate for. This is also the base
# name for the key, certificate signing request and certificate files. If you
@OhMeadhbh
OhMeadhbh / ledtest.js
Last active August 29, 2015 14:00
send a morse code signal by way of the OK LED on a raspberry pi
// Copyright (c) 2014, Meadhbh S. Hamrick
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
@OhMeadhbh
OhMeadhbh / dysfunction.dys
Last active August 29, 2015 14:03
Dysfunction : a transfer syntax indented to irritate everyone
; dysfunction.dys
;
; Dysfunction is a new specification for communicating typed, structured,
; dynamic data between computing systems (or processes on the same system.)
; It defines a transfer syntax and processing expectations for systems which
; produce and consume formated data. This file is a brief introduction to
; Dysfunction, along with a few examples.
;
; Dysfunction is used in the same way JSON or XML might be used to store or
; communicate human readable representations of structured data. It is designed
@OhMeadhbh
OhMeadhbh / gist:21508f6fe4210b9f0877
Created July 14, 2014 19:22
javascript utility functions
// function _pad()
//
// pads the input with count numbers of char characters. Examples:
// _pad( "7" ) => "7"
// _pad( "A", 4 ) => " A"
// _pad( "7", 4, "*" ) => "***7"
function _pad( input, count, char ) {
count = count ? count : 0;
return String( Array( count ).join( ( char ? char : ' ' ) ) + input ).slice( - count );
@OhMeadhbh
OhMeadhbh / SonOfDysfunction.sod
Last active August 29, 2015 14:06
About SON of Dysfunction
; SonOfDysfunction.sod
;
; "SON of Dysfunction" is a serializable object notation (SON) built
; after the experimental "Dysfunction" transfer syntax. "SON of Dysfunction"
; (aka SOD) defines a transfer syntax, a type system, a set of XPath-ish macros
; to identify a nodes in transferred data structures and several recommended
; utility macros.
;
; The primary objective of SOD mostly to have a flexible object notation which
; worked like JSON but allowed comments. Like JSON, SOD targets systems with
@OhMeadhbh
OhMeadhbh / Raspbian Image Munging Utilities
Last active August 29, 2015 14:07
Shell scripts to modify a Raspbian image
Copyright (c) 2014, Smithee, Spelvin, Agnew & Plinge, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
@OhMeadhbh
OhMeadhbh / ddn.ddn
Created December 22, 2014 11:34
DDN: Son of Son of Dysfunction
; ddn.ddn
;
; This document describes the Dynamic Data Notation (DDN). DDN is a superset
; of JavaScript Object Notation and fills a similar role. It differs from JSON
; in a few important ways:
;
; * DDN supports comments. Semi-colons (;), hash markes (#) and C++ style
; "slash slash" di-graphs (//) all begin a "to the end of the line" style
; comment. C-style "slash splat" (/*) and "splat slash" (*/) digraphs
; enclose bounded comments.
@OhMeadhbh
OhMeadhbh / cropify.sh
Created December 24, 2014 00:20
chop the top & bottom from a noisy screenshot
# Figure out how big the input image is
GEO_INPUT=`identify $1 | cut -f 3 -d ' '`
X_INPUT=`echo $GEO_INPUT | cut -f 1 -d x`
Y_INPUT=`echo $GEO_INPUT | cut -f 2 -d x`
# Slice off a 2 pixel wide strip from the left side of the image
# Store as temp.jpg
convert $1 -crop 2x${Y_INPUT}+0+0 temp.jpg
# Now trim off the top of the temp.jpg. But we have to create a new image
@OhMeadhbh
OhMeadhbh / raspiuser
Last active August 29, 2015 14:12
Unhorking Raspbian
# raspiuser
#
# Having a fixed username / password combination is generally considered
# insecure. This script renames the default 'pi' user to one of your own
# choosing (please choose a name other than 'pi'.) Run it as root, passing
# the new username as the first parameter:
#
# sudo ./raspihork testuser
#