Skip to content

Instantly share code, notes, and snippets.

@jordan-thoms
jordan-thoms / gist:d14cd1a2efeb2b5fab01174d9de2bea9
Last active January 11, 2019 08:14
Postgres Function to convert timestamp to excel formatted date
CREATE OR REPLACE FUNCTION excel_time(in timestamp, out double precision)
AS $$
SELECT (EXTRACT(epoch FROM $1)/86400) + 25569
$$
LANGUAGE SQL IMMUTABLE PARALLEL SAFE;
CREATE OR REPLACE FUNCTION excel_time(in timestamptz, out double precision)
AS $$
@jordan-thoms
jordan-thoms / gist:6224795
Created August 13, 2013 19:31
Remove remote branches (place in bash profile)
function rmb {
current_branch=$(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [ "$current_branch" != "master" ]; then
echo "WARNING: You are on branch $current_branch, NOT master."
fi
echo "Fetching merged branches..."
git remote prune origin
remote_branches=$(git branch -r --merged | grep -v '/master$' | grep -v "/$current_branch$")
local_branches=$(git branch --merged | grep -v 'master$' | grep -v "$current_branch$")
if [ -z "$remote_branches" ] && [ -z "$local_branches" ]; then
#!/usr/bin/python
import sys
import argparse
import os
import re
'''
A simple script to create lower-resolution Android drawables from higher-resolution ones.
@jordan-thoms
jordan-thoms / convertjsoncsv.rb
Last active December 15, 2022 21:51
Code to convert json to csv, with correct headings Usage: ruby convertjsoncsv.rb <input file> <output file>
require 'csv'
require 'json'
require "set"
json = JSON.parse(File.open(ARGV[0]).read)["results"]
# Pass 1: Collect headings
headings = SortedSet.new
json.each do |hash|
headings.merge(hash.keys)
end
smartctl 5.40 2010-10-16 r3189 [i686-pc-linux-gnu] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net
=== START OF INFORMATION SECTION ===
Model Family: Western Digital Caviar Green family
Device Model: WDC WD15EADS-00P8B0
Serial Number: WD-WCAVU0228059
Firmware Version: 01.00A01
User Capacity: 1,500,301,910,016 bytes
Device is: In smartctl database [for details use: -P show]
Dear all
I am writing to alert you to changes in the BE(Hons) to be implemented from 2012, which will see all current 4XX-level courses re-coded to become 7XX-level courses (with the exception of ENGGEN 403).
The reason for the change in number code is due to an anomaly which has seen these 400-level courses placed at Level 7 on the NZQA’s National Qualifications Framework.
The above conflicts with the NZVCC’s Committee on University Academic Programmes (CUAP) requirement for all Masters degree programmes to comprise Level 8 courses only and the requirement for Bachelors (Honours) degree programmes to include a minimum of 105 points at Level 8.
This has potential ramifications for those students needing to have their qualification officially benchmarked and verified for overseas study or work purposes. It also meant that, on paper, the BE(Hons) could be deemed to be of a lower intellectual standard than all of the University’s other Honours degrees – something which is clearly not the case.