Skip to content

Instantly share code, notes, and snippets.

View stupidpupil's full-sized avatar
💭
I may be slow to respond.

A Watkins stupidpupil

💭
I may be slow to respond.
View GitHub Profile
#include <stdio.h>
#include <krb5.h>
int main()
{
printf("krb5_principal: %zu chars\n", sizeof(krb5_principal)/sizeof(char));
printf("krb5_creds: %zu chars\n", sizeof(krb5_creds)/sizeof(char));
printf("krb5_verify_init_creds_opt: %zu ints\n", sizeof(krb5_verify_init_creds_opt)/sizeof(int));
return 0;
@stupidpupil
stupidpupil / welshify_kml.rb
Created December 19, 2015 12:06
Reduces UA boundaries from http://idea.ed.ac.uk/data/kmz/ to only Wales and only Polygons
require 'nokogiri'
wales = Nokogiri::XML(File.read('GB.kml')) ; 1
las = {'6B1' => 'Anglesey',
'6C2' => 'Blaenau Gwent',
'6B3' => 'Bridgend',
'6B2' => 'Caerphilly',
'6A8' => 'Cardiff',
'6B7' => 'Carmarthenshire',
@stupidpupil
stupidpupil / welsh_setup.sh
Last active December 19, 2015 12:03
Set of instructions to setup and import Welsh data into OpenPrescribing
python manage.py create_foreign_keys
python manage.py create_indexes
python manage.py create_matviews
python manage.py import_ccg_boundaries --filename data/org_codes/welsh_localities.kml
python manage.py import_welsh_local_health_board_names
python manage.py import_welsh_locality_names
python manage.py fetch_nwssp_prescribing
python manage.py import_nwssp_practices
@stupidpupil
stupidpupil / gist:83be3a5d0daf3db17b2b
Created April 16, 2015 23:59
FreeOTP Tokens.xml Exporter
#!/usr/bin/env ruby
module GoogleBase32
Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" #RFC4648
Digits = Alphabet.chars
Mask = Digits.length - 1
Shift = Digits.length.to_s(2).match(/0*\Z/)[0].length
def self.encode_array(array)