Skip to content

Instantly share code, notes, and snippets.

Coding stuff

Geoff Hayward GeoffHayward

Coding stuff
Block or report user

Report or block GeoffHayward

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
GeoffHayward / Generic
Last active Aug 20, 2019
java get column of multidimensional array
View Generic
private Object[] getColumn(int address, Object[][] from) {
return -> x[address]).toArray(Object[]::new);
private <T> T[] getColumn(int address, T[][] from) {
return (T[]) -> x[address]).toArray(Object[]::new);
GeoffHayward / Setting up MySQL on Ubuntu 18.04
Last active May 28, 2019
Setting up MySQL on Ubuntu 18.04
View Setting up MySQL on Ubuntu 18.04
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
This seems to lock it down to the Ubuntu root user, therefore login using the Ubuntu root user
and run the following.
sudo mysql -u root
DROP USER 'root'@'%';
CREATE USER 'root'@'localhost' IDENTIFIED BY '';
GeoffHayward / HA Proxy (change a part of a URL)
Last active Jun 19, 2019
Redirect Configuration Examples
View HA Proxy (change a part of a URL)
http-request redirect code 301 location https://%[hdr(host)]%[url,regsub(^/example/,/demo/,)] if { path_beg /example/ }
View Add permission to host shared folders
sudo usermod -aG vboxsf $(whoami)
GeoffHayward / .ebextensions iptables.config
Last active Nov 22, 2018
AWS Config: LB to Elasticbeanstalk over HTTPS
View .ebextensions iptables.config
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
ignoreErrors: true
mode: "000755"
owner: root
group: root
content: |
GeoffHayward /
Last active Feb 9, 2018
Abstract Builder Pattern
public class App {
public static void main(String[] args){
Pizza nypizza = new NyPizza
GeoffHayward /
Created Feb 9, 2018
The Basic Builder Pattern in Java
public class App{
public static void main(String[] args){
Thing t = new Thing.Builder("a", "b", "c").prop5("e").prop4("d").build();
public final class OutputStream{
public static String capture(Consumer consumer){
PrintStream old = System.out;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
return baos.toString();
GeoffHayward /
Last active Oct 27, 2017
Decorator Patten
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<ThingSubscriber> subscribers = new ArrayList<>();
subscribers.add(new ThingSubscriber("Subscriber 1"));
subscribers.add(new ThingSubscriber("Subscriber 2"));
GeoffHayward / pom.xml
Created Aug 2, 2017
Mavan: Runnable Jar with Dependencies
View pom.xml
You can’t perform that action at this time.