Skip to content

Instantly share code, notes, and snippets.

View Gordonei's full-sized avatar

Gordon Inggs Gordonei

View GitHub Profile
@Gordonei
Gordonei / service-alerts.md
Last active February 12, 2024 17:08
Service Alert Links
@Gordonei
Gordonei / invoice_number_hash.py
Created January 24, 2020 11:09
Example of code used to hash invoice numbers for CCT -> EPRU data sharing.
import hashlib
# Input parameters
invoice_number = "<invoice number of bill goes here"
epru_uct_salt = "<salt value goes here>"
invoice_number_hash_string = str.encode(invoice_number + epru_uct_salt)
invoice_number_hashed = hashlib.sha256(invoice_number_hash_string).hexdigest()
print(f"{invoice_number} -> {invoice_number_hashed}")
@Gordonei
Gordonei / float_div.py
Last active March 27, 2019 23:18
Similar to https://github.com/python-visualization/folium/blob/master/folium/plugins/float_image.py , but more generic. Seemed odd that such a thing didn't already exist.
import branca
import jinja2
class FloatDiv(branca.element.MacroElement):
"""Adds a floating div in HTML canvas on top of the map."""
_template = jinja2.Template("""
{% macro header(this,kwargs) %}
<style>
#{{this.get_name()}} {
position:absolute;
@Gordonei
Gordonei / html_tooltips.py
Created February 9, 2019 13:44
Styling folium (Leaflet) tooltips
import folium
# Map pointing at Cape Town
m = folium.Map(
location=[-33.918861, 18.423300],
zoom_start=12
)
# HTML Div with style information
desc_html = f'<div style="white-space: normal"> This is a line,<br> this is another line </div>'
@Gordonei
Gordonei / gitlab_yaml_test.sh
Last active December 11, 2018 16:26
Script for finding invalid YAML config files that might be borking your rails console from starting up
#!/usr/bin/env bash
SEARCH_ROOT=/opt/gitlab/
find "$SEARCH_ROOT" -name *.yml | while read line; do echo $line | ruby -e "require 'yaml';filename=STDIN.read.strip; YAML.load_file filename; puts filename"; done