Skip to content

Instantly share code, notes, and snippets.

@robshep
robshep / vol.c
Last active December 28, 2017 13:31
Wrapper to raise/lower volume on OS X in increments of 5
/**
* sudo vol + # increase by 5
* sudo vol - # decrease by 5
* sudo vol ++ # increase by 10
* sudo vol --- # decrease by 15
*
* Public domain.
*/
#include <stdio.h>
#include <stdlib.h>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BCrypt in your browser</title>
</head>
<body>
<h1>Browser/Client side Bcrypt hash generator</h1>
<p>
<em>Most Bcrypt hash generators use server side processing (so you're sharing your plaintext password with an untrusted third party). <br> This version stays right in your browser, thanks to <a href="https://github.com/dcodeIO/bcrypt.js">BCrypt.JS from DCodeIO</a></em>
@robshep
robshep / function_get_geom_from_gridref.sql
Last active March 12, 2019 13:37
PL/PGSQL function to convert text Grid Reference into OSGB Geometry
-- convert a grid-reference E.g. SH123456 into a northing easting geometry for postgis with SRID=27700 (OSGB36)
-- standing on the shoulders of...
-- http://www.movable-type.co.uk/scripts/latlong-os-gridref.html
-- https://github.com/chrisveness/geodesy/blob/master/osgridref.js [MIT]
-- consider this MIT licensed also.
CREATE OR REPLACE FUNCTION get_geom_from_grid_ref(IN grid_ref character varying)
RETURNS public.geometry
LANGUAGE 'plpgsql'
AS $BODY$
Single tapes recorded at Phobia 'A Sensory Assault Of The Unexpected' at Leeds University on 14th March 1992.
Tapes released:
DJ Sy
Jumping Jack Frost
Nipper (808 State)
DJ Sy
@robshep
robshep / PGPCrypto.java
Created June 6, 2017 17:36
PostgreSQL/Java - interoperable PGP encryption
import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
import org.bouncycastle.openpgp.examples.ByteArrayHandler;
/**
* Crypto utilities using both pure-Java (from bouncycastle's OpenPGP implementation) and
@robshep
robshep / README.md
Last active April 28, 2017 12:13
Interactive Tax Efficiency

Tax Calc

@robshep
robshep / info.groovy
Created March 17, 2017 11:30
simple groovy servlet (groovlet) server
// put in ./servlets/ directory
def method = request.method
if (!session) {
session = request.getSession(true)
}
if (!session.groovlet) {
session.groovlet = 'Groovlets rock!'
}
sudo lpadmin -p HP_LaserJet_1022 -o usb-no-reattach-default=true
sudo lpadmin -p HP_LaserJet_1022 -o usb-unidir-default=true
@robshep
robshep / LICENSE.txt
Created November 15, 2016 23:51
FizzBuzz with unit test in Ruby
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@robshep
robshep / docker_datasource.rb
Last active December 31, 2016 09:54
Use dockered databases for rails development
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit