Skip to content

Instantly share code, notes, and snippets.

View burythehammer's full-sized avatar
🐝

Matt Long burythehammer

🐝
View GitHub Profile
@burythehammer
burythehammer / selectCheckbox.java
Created July 4, 2018 10:51
Selecting a checkbox in selenium
private final WebDriver driver;
protected void setCheckbox(By locator, boolean desiredState) {
WebElement element = driver.findElement(locator);
boolean selected = element.isSelected();
if (checkboxNeedsToBeClicked(selected, desiredState)) {
element.click();
}
}
@burythehammer
burythehammer / Nonchalantly.java
Created June 2, 2017 17:22 — forked from poetix/Nonchalantly.java
A Java 8 class for when you just don't give a fuck about that checked exception
public interface Nonchalantly<T> {
static <T, E extends Throwable> T invoke(Nonchalantly<T> f) throws E {
try {
return f.run();
} catch (Throwable e) {
throw (E) e;
}
}
T run() throws Throwable;
@burythehammer
burythehammer / ec2_spec.rb
Created March 20, 2017 12:42
Example AWS Spec testing
require "spec_helper"
before do
@client = Aws::EC2::Client.new
@ec2 = Aws::EC2::Resource.new(client: @client)
end
describe "Instances" do
subject { @ec2.instances.count }
it { is_expected.to eq(3) }
@burythehammer
burythehammer / aws-centos.tf
Last active March 17, 2017 13:09
Example terraform code for provisioning 3 aws centos nodes
resource "aws_instance" "etcd-node" {
count = 3
ami = "ami-7abd0209"
instance_type = "t2.micro"
}
@burythehammer
burythehammer / etcd.yaml
Created March 17, 2017 13:08
Example ansible playbook for configuring etcd
---
- hosts: all
remote_user: centos
vars_files:
- variables.yaml
tasks:
- name: install etcd
@burythehammer
burythehammer / goss-test.sh
Last active January 23, 2017 17:25
Running Goss on a remote server
# run this file to install goss onto a remote target and run a test script on it
# example usage:
# ./goss-test.sh 34.248.91.167
TARGET='centos@'$1 # change user as required - this is for centos
SSH_KEY_PATH=~/.ssh/aws # change ssh key as required
ssh -t -t -i $SSH_KEY_PATH $TARGET 'curl -fsSL https://goss.rocks/install | sudo sh'
scp ./goss.json $TARGET:~/goss.yaml
@burythehammer
burythehammer / Benchmark.java
Last active November 23, 2016 11:54
Benchmarking functional interface in Java 8
public interface Benchmark {
static long invoke(Benchmark f) {
final long before = System.nanoTime();
f.run();
final long after = System.nanoTime();
return after - before;
}
void run();

Keybase proof

I hereby claim:

  • I am burythehammer on github.
  • I am burythehammer (https://keybase.io/burythehammer) on keybase.
  • I have a public key whose fingerprint is CED0 B839 8DCC A533 DD41 6F43 2D8E E494 6923 26D0

To claim this, I am signing this object: