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 /
Created Dec 10, 2019
Cucumber Compare two datatables
package step_definitions;
import io.cucumber.datatable.DataTable;
import java.util.ArrayList;
import java.util.List;
View .gitconfig
graph = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
View Docker Restart Policy
# Inspect - Prints out the status for each container's policy
for id in $(docker ps -q); do echo "$id$(docker inspect --format='{{.Name}}' $id)" && docker inspect -f "{{ .HostConfig.RestartPolicy.Name }}" $id && echo "------------"; done
# Update (if unset) - Updates the policy for each container to 'alway' if its policy is unset. It also prints out the status for each container
for id in $(docker ps -q); do echo "$id$(docker inspect --format='{{.Name}}' $id)" && ([ -z "\$(docker inspect -f '{{ .HostConfig.RestartPolicy.Name }}' $id)" ] && docker update --restart=always $id; exit 0 ) && docker inspect -f "{{ .HostConfig.RestartPolicy.Name }}" $id && echo "------------"; done
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();
You can’t perform that action at this time.