Skip to content

Instantly share code, notes, and snippets.

Paul Hammant paul-hammant

Block or report user

Report or block paul-hammant

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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] ------------------------------------------------------------------------
View gist:cda6da1ee075424f28a8a76755f28d32
# RFC 822, updated by RFC 1123 - e.g. Sun, 06 Nov 1994 08:49:37 GMT
Date: ((Mon|Tue|Wed|Thu|Fri|Sat|Sun), [0-9]{2} (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) [0-9]{4} [0-9]{2}:[0-9]{2}:[0-9]{2} GMT)
# RFC 850 (obsoleted by RFC 1036) - e.g. Sunday, 06-Nov-94 08:49:37 GMT
Date: ((Mon|Tues|Wednes|Thurs|Fri|Satur|Sun)day, [0-9]{2}-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} GMT)
# ANSI C's asctime() format - e.g. Sun Nov 6 08:49:37 1994
Date: ((Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) *[0-9]{1,2} [0-9]{1,2}:[0-9]{2}:[0-9]{2} [0-9]{4})
View svgdemo.html
<html>
<body>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" viewBox="139 -165 728 472" width="728pt" height="472pt" xmlns:dc="http://purl.org/dc/elements/1.1/">
<metadata> Produced by OmniGraffle 7.5
<dc:date>2017-12-17 12:55:15 +0000</dc:date>
</metadata>
<defs>
<font-face font-family="Helvetica Neue" font-size="16" panose-1="2 0 5 3 0 0 0 2 0 4" units-per-em="1000" underline-position="-100" underline-thickness="50" slope="0" x-height="517" cap-height="714" ascent="951.9958" descent="-212.99744" font-weight="500">
<font-face-src>
<font-face-name name="HelveticaNeue"/>
@paul-hammant
paul-hammant / certbot-renew.sh
Created Oct 10, 2017 — forked from printminion/certbot-renew.sh
renew ssl letsencrypt certificate on bitnami server
View certbot-renew.sh
#!/bin/bash
#renew ssl letsencrypt certificate on bitnami server
#https://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802/edit
sudo /opt/bitnami/ctlscript.sh stop apache
cd /home/user/certbot
#./certbot-auto certonly --standalone -w /opt/bitnami/apache2/conf/ -d example
.com -d www.example.com
./certbot-auto renew
sudo cp /etc/letsencrypt/live/example.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
You can’t perform that action at this time.