Skip to content

Instantly share code, notes, and snippets.

Avatar

Paul Hammant paul-hammant

View GitHub Profile
View estimation_crt.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View todobackend.md

Interaction 0: GET /todos

Request headers recorded for playback:

accept-language: en-US,en;q=0.9
accept-encoding: gzip, deflate, br
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
origin: https://www.todobackend.com
View doit.py
import tkinter
from tkinter import messagebox
import platform
import os
import subprocess
import sys
import datetime
import sqlite3
from os.path import expanduser
@paul-hammant
paul-hammant / genMavenImpactScript.py
Last active Oct 21, 2019
Generate quickest Maven script for the pending changes in a Git checkout
View genMavenImpactScript.py
#!/bin/python3
# See https://paulhammant.com/2019/10/20/quicker-local-maven-builds
import sh, os
from pathlib import Path
log = sh.git.log("--oneline", "--no-color", "--decorate=short", _tty_out=False)
hashLine = ""
for line in log.split("\n"):
@paul-hammant
paul-hammant / jacoco-coverage-percentage-svg.sh
Created May 11, 2019
Showing JaCoCo coverage percentages inline in GitHub READMEs (Multi module Maven Projects)
View jacoco-coverage-percentage-svg.sh
#!/bin/bash
# You will have needed to have installed 'xmlstarlet' first
#
# Each time you use this, you will have had to run tests "mvn clean install" first.
#
# In your README, have a line like so, to display the coverage.
#
# Code Coverage: ![](coverage-percentage.svg?raw=true&sanitize=true)%
#
@paul-hammant
paul-hammant / Foo.java
Created Apr 12, 2019
MVC example for a single "text field" form
View Foo.java
import javax.swing.*;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.PlainDocument;
public class Foo {
public static void main(String[] args) {
// setup model
@paul-hammant
paul-hammant / Swing_MVC_MultiCounterDemo.java
Last active Apr 5, 2019
Demo of MVC concepts using Java's Swing.
View Swing_MVC_MultiCounterDemo.java
import javax.swing.*;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class Swing_MVC_MultiCounterDemo extends JFrame {
View pizzaMakerServer.rb
# You may have to do:
# sudo gem install sinatra
require 'sinatra'
require 'json'
makers = {}
makers["66463882"] = JSON.parse '{
"name": "Elsie C",
@paul-hammant
paul-hammant / linkedin_alternative_on_github.md
Last active Mar 27, 2019
Linkedin alternative on Github?
View linkedin_alternative_on_github.md

Is anyone interested in an alternative to LinkedIn based on GitHub* (likely to mean a subset to just tech savvy users initially).

Decentralized data-centric GitHub repos

Your GitHub repo is a about you and your claims:

eg. "I worked at FoobarLLC as a Director of Engineering between CCYYMMDD1 and CCYYMMDD2 and did blah blah blah." 

files: claims/roles/foobarllc/CCYYMMDD1.md & claims/roles/all.json
@paul-hammant
paul-hammant / op.txt
Created Feb 6, 2018
Jooby reactor output
View op.txt
[INFO] ------------------------------------------------------------------------
[INFO] Building jooby-project 1.2.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ jooby-project ---
[INFO] org.jooby:jooby-project:pom:1.2.4-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building jooby 1.2.4-SNAPSHOT
[INFO] ------------------------------------------------------------------------