Skip to content

Instantly share code, notes, and snippets.

View syntaqx's full-sized avatar
🤷
¯\_(ツ)_/¯

Chase Pierce syntaqx

🤷
¯\_(ツ)_/¯
View GitHub Profile
@syntaqx
syntaqx / main.go
Created June 1, 2019 05:01
Golang SSH connection with hostkey verification
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"golang.org/x/crypto/ssh"
kh "golang.org/x/crypto/ssh/knownhosts"
@syntaqx
syntaqx / cloud-config.tlsyml
Created June 6, 2019 14:03
Hang onto these for me GitHub
#cloud-config
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg2
- software-properties-common
@syntaqx
syntaqx / cloud-config.tls.yml
Created June 6, 2019 14:03
Hang onto these for me GitHub
#cloud-config
package_update: true
package_upgrade: true
packages:
- apt-transport-https
- ca-certificates
- curl
- gnupg2
- software-properties-common
#cloud-config
users:
- default
- name: bastion
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
hostname: ${fqdn}
package_update: true
version: 2.1
executors:
golang:
docker:
- image: syntaqx/ci-golang
docker-publisher:
docker:
- image: circleci/buildpack-deps:19.04
environment:
DOCKER_BUILDKIT: "1"
@syntaqx
syntaqx / isdockerlive.sh
Created July 4, 2019 04:52
A simple shell script that leverages cURL to see if docker is up and running
#!/bin/bash
rep=$(curl -s --unix-socket /var/run/docker.sock http://ping > /dev/null)
status=$?
if [ "$status" == "7" ]; then
echo 'not connected'
exit 1
fi
@syntaqx
syntaqx / docker_gc.sh
Created August 6, 2019 13:15
Garbage collection for Docker, try using it in /etc/cron.hourly/docker_gc.sh
#!/usr/bin/env bash
set -eo pipefail
[[ $TRACE ]] && set -x
# docker_gc.cron - Prunes all unused docker objects
# https://docs.docker.com/config/pruning/
#
# By default, Docker takes a conservative approach to cleaning up unused objects
# (often referred to as "garbage collection"), such as images, containers,
# volumes, and networks. This can cause Docker to use extra disk space,
@syntaqx
syntaqx / logger.go
Created August 6, 2019 22:05
Wraps zap.Logger with some level configuration
package log
import (
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
// NewNop returns a no-op Logger. It never writes out logs or internal errors,
// andf it never runs user-defined hooks.
//
@syntaqx
syntaqx / enum.go
Created August 6, 2019 22:07
Enum flag type for urfave/cli
package flagtype
// github.com/urfave/cli
import (
"fmt"
"strings"
)
type EnumValue struct {
Enum []string
@syntaqx
syntaqx / main.tf
Last active August 7, 2019 13:44
[checkpoint] Just saving where I'm at because I'm resetting this bit
terraform {
required_version = ">= 0.12"
}
#
# @HOWTO: reference another state files output
#
# data "terraform_remote_state" "current" {
# backend = "remote"
#