Skip to content

Instantly share code, notes, and snippets.

View hamiltont's full-sized avatar
🕵️‍♂️
huntin' wabbits

Hamilton Turner hamiltont

🕵️‍♂️
huntin' wabbits
View GitHub Profile
@hamiltont
hamiltont / bex2csv.py
Last active December 15, 2021 14:37 — forked from shanewholloway/gist:3536969
Converts Billings 3 Slips into CSV readable. Export entire Slip Log by right-clicking on slips, choosing to export, saving as bex. Run this script in any folders containing the bex files. They will be found, parsed, and the output will be written to a CSV file in the same folder
import csv
import glob
import plistlib
clientProject = 'My Project'
for filename in glob.glob("*.bex"):
root = plistlib.readPlist(filename)
with open(filename+'.csv', 'wb') as out:
out = csv.writer(out, delimiter='|')
out.writerow(['Slip', 'Start', 'End', 'Duration (minutes)'])
{
"resourceName": "people/109541090636104663422",
"phoneNumbers": [
{
"formattedType": "Home",
"type": "home",
"value": "11234561234",
"metadata": {
"source": {
"type": "PROFILE",
@hamiltont
hamiltont / gist:ec83dd0becda8b11e7823651007fe8ca
Created August 9, 2019 00:58
Docker Experimental Prometheus Metrics
# HELP builder_builds_failed_total Number of failed image builds
# TYPE builder_builds_failed_total counter
builder_builds_failed_total{reason="build_canceled"} 0
builder_builds_failed_total{reason="build_target_not_reachable_error"} 0
builder_builds_failed_total{reason="command_not_supported_error"} 0
builder_builds_failed_total{reason="dockerfile_empty_error"} 0
builder_builds_failed_total{reason="dockerfile_syntax_error"} 0
builder_builds_failed_total{reason="error_processing_commands_error"} 0
builder_builds_failed_total{reason="missing_onbuild_arguments_error"} 0
builder_builds_failed_total{reason="unknown_instruction_error"} 0
stages:
- build
- test
- push
- deploy
default:
image: docker:19.03
variables:
# When using dind, it's wise to use the overlayfs driver for
@hamiltont
hamiltont / .bash_profile
Last active February 3, 2019 22:41
Dump basic shell description on .bashrc / .bash_profile load
# Dump some basic info
# See https://unix.stackexchange.com/a/26782/54389
[[ $- == *i* ]] && i='interactive' || i='non-interactive'
shopt -q login_shell && l='login' || l='non-login'
echo ".bash_profile: Running for $i,$l shell"
@hamiltont
hamiltont / update.sh
Created January 21, 2014 22:22
Update dnsimple.com using domain token and record ID (more secure than storing username and password in script)
#!/bin/bash
DOMAIN_ID="yourdomain.com"
RECORD_ID="9348341"
DOMAIN_TOKEN="8339c723c223445f6c876bca3fafffd3345"
IP="`curl http://ipv4.icanhazip.com/`"
JSON="{\"record\":{\"content\":\"$IP\"}}"
curl -H "X-DNSimple-Domain-Token: $DOMAIN_TOKEN" \
-H "Accept: application/json" \
--- mainWindow.js 2016-01-02 19:05:37.556205523 -0500
+++ /usr/share/nemo-preview/js/ui/mainWindow.js 2016-01-02 20:04:04.704105784 -0500
@@ -283,6 +283,8 @@
yFactor = 0.92;
}
+ yFactor = 0;
+
this._texture.set_size(textureSize[0], textureSize[1]);
this._textureYAlign.factor = yFactor;
@hamiltont
hamiltont / dynamic_dnsimple.sh
Created December 18, 2013 05:38 — forked from mislav/dynamic_dnsimple.sh
Using username and password authentication
#!/bin/bash
set -e
domain=mislav.net
record=511770 # mysubdomain.mislav.net
ip="$( curl -s icanhazip.com )"
payload="{ \"record\": { \"content\": \"${ip}\" } }"
curl -fsS --netrc \
@hamiltont
hamiltont / walk.py
Created November 17, 2013 21:00
Testing performance of os.walk vs glob for FrameworkBenchmarks My results: gather_tests function took 400.566 ms glob_tests function took 10.128 ms
import os
import json
import time
import importlib
import sys
import glob
# From http://stackoverflow.com/a/5478448/119592
def timing(f):
def wrap(*args):
@hamiltont
hamiltont / QuickLogger.java
Created November 16, 2013 01:28
A one-file logger. Can easily be replaced with a more advanced system, but useful for starting
/**
* <p>
* This is a one-file logger that can be used to get you started quickly. You
* can send it any array of objects that it will print to stdout/stderr.
* Reflection is used to print the class/line/method. QuickLogger is pretty darn
* slow, so don't use it in production.
* </p>
* <p>
* All methods are static, and you can (if your IDE supports it, which most do)
* use static imports to make your life even easier