Skip to content

Instantly share code, notes, and snippets.

View double16's full-sized avatar

Patrick Double double16

View GitHub Profile
@double16
double16 / ini.sed
Created February 7, 2020 16:36
ini.sed
# this will convert the ini data into this flat format:
#
# owner|name|John Doe
# owner|organization|Acme Widgets Inc.
# database|server|192.0.2.62
# database|port|143
# database|file|payroll.dat
# Configuration bindings found outside any section are given to
# to the default section.
@double16
double16 / aptcache-compose.yml
Created September 9, 2019 11:37
Docker Compose file for apt/yum/http cache
version: '3.7'
services:
aptcache:
image: pdouble16/docker-apt-cacher-ng:latest
restart: always
ports:
- "3142:3142"
volumes:
- /Users/double/aptcache:/var/cache/apt-cacher-ng
@double16
double16 / make-macos-iso.sh
Created May 24, 2019 18:17
make-macos-iso.sh
hdiutil create -o /tmp/HighSierra.cdr -size 5130m -layout SPUD -fs HFS+J
hdiutil attach /tmp/HighSierra.cdr.dmg -noverify -mountpoint /Volumes/install_build
sudo /Applications/Install\ macOS\ High\ Sierra.app/Contents/Resources/createinstallmedia --volume /Volumes/install_build
mv /tmp/HighSierra.cdr.dmg ~/Desktop/InstallSystem.dmg
hdiutil convert /tmp/HighSierra.cdr.dmg -format UDTO -o /tmp/HighSierra.iso
@double16
double16 / MockExecAction.groovy
Created January 15, 2019 18:33
Gradle ExecAction mock for Spock tests
class MockExecAction extends DefaultExecAction {
int exitValue = 0
String output = ''
MockExecAction() {
super(null, null, null)
}
@Override
ExecResult execute() {
@double16
double16 / ImageCopyTask.groovy
Last active January 4, 2019 12:57
Creates a JSON file suitable for deployment using AWS CodePipeline + ECS deploy
import com.bmuschko.gradle.docker.DockerRegistryCredentials
import com.bmuschko.gradle.docker.tasks.AbstractDockerRemoteApiTask
import com.bmuschko.gradle.docker.tasks.RegistryCredentialsAware
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
import groovy.util.logging.Slf4j
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.Nested
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
@double16
double16 / packer.log
Last active September 20, 2018 16:36
Packer log of failing to upload a 5GB vagrant box using vagrant-cloud post-processor
2018/08/23 16:06:07 ui: ==> virtualbox-iso: Running post-processor: vagrant-cloud
2018/08/23 16:06:07 [INFO] (telemetry) Starting post-processor vagrant-cloud
==> virtualbox-iso: Running post-processor: vagrant-cloud
2018/08/23 16:06:07 ui: ==> virtualbox-iso (vagrant-cloud): Verifying box is accessible: double16/linux-dev-workstation
==> virtualbox-iso (vagrant-cloud): Verifying box is accessible: double16/linux-dev-workstation
2018/08/23 16:06:07 packer: 2018/08/23 16:06:07 Post-Processor Vagrant Cloud API GET: https://vagrantcloud.com/api/v1/box/double16/linux-dev-workstation?access_token=ACCESS_TOKEN
2018/08/23 16:06:10 packer: 2018/08/23 16:06:10 Post-Processor Vagrant Cloud API Response:
2018/08/23 16:06:10 packer:
2018/08/23 16:06:10 packer: &{Status:200 OK StatusCode:200 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Date:[Thu, 23 Aug 2018 16:06:09 GMT] Cache-Control:[max-age=0, private, must-revalidate] Set-Cookie:[_atlas_session_data=TmMxSVJCbjFmUGNpSjc2bmdJODlQb0Q0elljcGN5d2M1VUluVXFwWVpSdz0tL
@double16
double16 / ExampleSpec.groovy
Last active June 28, 2018 21:15
Kafka Producer Integration Testing
class ExampleSpec extends spock.lang.Specification {
LoggingProducerOutput output
void setup() {
output = new LoggingProducerOutput(logPath: Paths.get('/tmp/producer.log')).withEmpty()
}
void "records should be produced"() {
when: "a record is produced"
String key = "the_record_key"
@double16
double16 / Vagrantfile.dockerconfig.rb
Last active August 2, 2017 20:49
Test Vagrant Boxes using Docker
override.vm.box = nil
docker.image = "jdeathe/centos-ssh:centos-7-2.2.3"
docker.remains_running = true
@double16
double16 / sh2ju.sh
Last active September 26, 2023 03:26
junit bash commands
#!/bin/bash
### Copyright 2010 Manuel Carrasco Moñino. (manolo at apache.org)
### Copyright 2016 Patrick Double (pat at patdouble.com)
###
### Licensed under the Apache License, Version 2.0.
### You may obtain a copy of it at
### http://www.apache.org/licenses/LICENSE-2.0
###
### A library for shell scripts which creates reports in jUnit format.
@double16
double16 / BootStrap-grailsexample.groovy
Last active August 29, 2015 14:27
Adapt Gson for Grails Object Marshaling
[JSON, XML]*.registerObjectMarshaller(DateTime) {
return it?.toString("yyyy-MM-dd'T'HH:mm:ss'Z'")
}