Skip to content

Instantly share code, notes, and snippets.

View gm3dmo's full-sized avatar

David Morris gm3dmo

  • GitHub Staff
  • York
  • 08:02 (UTC)
View GitHub Profile
@gm3dmo
gm3dmo / gist:0ea14bd0762595a737ec470980a52a8f
Last active June 29, 2018 06:22
Handling Names and Addresses
Do you have a standard set of tests (organisation wide) that relate to handling names and addresses?
Smith
Smith-Jones
Smith Jones
Sir Ranulp Twystleson-Wickham-Fiennes
https://www.mjt.me.uk/posts/falsehoods-programmers-believe-about-addresses/
@gm3dmo
gm3dmo / clock-offset-from-ntp.py
Last active March 6, 2024 12:24
display clock offset from ntp using chrony
#!/usr/bin/env python
import sys
import shlex
import subprocess
def run_cmd():
"""chronyc tracking
Reference ID : 50484330 (PHC0)
Stratum : 1
#!/bin/bash
#set -x
# Name: build_centos_dvd.sh
# Purpose: Customize a Centos DVD
# Author: David Morris
shopt -s -o nounset
import csv
from ldif3 import LDIFParser
from pprint import pprint
def main():
"""
Purpose
=======
Used to read ldif dumped from an AWS Simple AD and report on disabled accounts.
@gm3dmo
gm3dmo / gist:b89c911e00e97b3219d25790343b62c7
Last active February 18, 2019 07:56
use pandas to get min/max values of all columns in a csv
#!/usr/bin/env python3
import pandas as pd
def main():
f = 'test-data/basic.csv'
df = pd.read_csv(f)

DWP Payment Data

https://data.gov.uk/dataset/ccdc397a-3984-453b-a9d7-e285074bba4d/spend-over-25-000-in-the-department-for-work-and-pensions

What happens when somebody downloads a CSV from the above?

  1. Most likely open it with Excel/Google Sheets/Open Office/Numbers? (More likely if an individual or small business).
  2. Upload it into some kind of database/Big Query/AWS (More likely if a company/data scientist working with journalists).

When you upload it and scroll down it looks like there is no data after row 190 which is weird and makes you thing something is very wrong. That turns out to be because 192 - 484 are indeed blank:

import pygame
import time
import sys
CODE = {'A': '.-', 'B': '-...', 'C': '-.-.',
'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..',
'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---',
'P': '.--.', 'Q': '--.-', 'R': '.-.',
@gm3dmo
gm3dmo / github-enterprise-setup.md
Created August 21, 2019 07:47
Notes on setting up GitHub enterprise
What breaks?
Github Connectivity
Configuration
Administrative Access
SSH
SSL Certificate
Authentication
License
Time Synchronisation (NTP)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
"""
Emit Consul environment variables so the can be eval'led
eval `python envsetup.py`
/consul/config/server_details
@gm3dmo
gm3dmo / csv-anonymize.py
Last active November 1, 2019 18:40
Anonymizing data in CSV Files
#!/usr/bin/env python
"""
"""
__author__ = "David Morris"
__version__ = "0.1.0"
__license__ = "MIT"
import os
import sys
import csv
import logzero