Skip to content

Instantly share code, notes, and snippets.

View gkhays's full-sized avatar

Garve Hays gkhays

View GitHub Profile
@gkhays
gkhays / TestTimeStampUtils.java
Last active June 2, 2021 12:06 — forked from kristopherjohnson/TimestampUtils.java
Methods for generating ISO 8601 timestamps in Java/Android
package net.kristopherjohnson.util.test;
import static org.junit.Assert.*;
import java.util.Date;
import net.kristopherjohnson.util.TimestampUtils;
import org.junit.Before;
import org.junit.Test;
@gkhays
gkhays / docker-maintenance.sh
Created August 23, 2016 19:32 — forked from macropin/docker-maintenance.sh
Docker Maintenance Script
#!/usr/bin/env bash
#
# Docker Cleanup / Update Script
#
# Usage Example:
# curl --silent https://gist.githubusercontent.com/macropin/3d06cd315a07c9d8530f/raw | bash -s rm-dangling
#
set -e
@gkhays
gkhays / README-Template.md
Created April 21, 2020 23:18 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@gkhays
gkhays / pom.xml
Created March 9, 2017 03:16 — forked from cgruber/pom.xml
Example enforcer rule to exclude commons-collections 3.2.1 from the build
<!-- Avoid the M.A.D. Gadget vulnerability in certain apache commons-collections versions -->
<project>
<!-- ... -->
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<goals><goal>enforce</goal></goals>
@gkhays
gkhays / pedantically_commented_playbook.yml
Created July 2, 2016 13:13 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
@gkhays
gkhays / main.yml
Created June 30, 2016 21:10 — forked from rothgar/main.yml
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
## credit: http://fabian-affolter.ch/blog/the-lineinfile-module-of-ansible/
---
- hosts: alpine_install
user: root
tasks:
# - name: create a complete empty file
# command: /usr/bin/touch /test/test.conf
- name: create a new file with lineinfile
---
# vim: set ft=ansible et ts=2 sw=2:
#
# Create a new VM to kickstart install
- hosts: vmcreate
gather_facts: false
connection: local
vars:
vcenter_hostname: esx1.box
@gkhays
gkhays / pom.xml
Created May 26, 2016 18:01 — forked from codahale/pom.xml
Take this and save it as pom.xml in your project directory.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>my-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<!-- none yet -->
@gkhays
gkhays / CollectionUtils.java
Last active April 3, 2016 16:29 — forked from milingo/CollectionUtils.java
Java Collections
// Init
new String[]{"a", "b"}
List<String> list = new ArrayList<String>(
Arrays.asList("String A", "String B", "String C")
);
Map<String, Owner> owners = new HashMap<String, Owner>() {{
put("no-money", createOwnerWithoutMoney());