Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -o nounset
##########################################
# Defaults
##########################################
: ${recipient:=}
: ${host:=localhost}
: ${port:=5432}
: ${databases:=}
@joaocc
joaocc / .gitattributes
Created November 24, 2017 15:47 — forked from nemotoo/.gitattributes
.gitattributes for Unity3D with git-lfs
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge eol=lf
*.anim merge=unityyamlmerge eol=lf
*.unity merge=unityyamlmerge eol=lf
*.prefab merge=unityyamlmerge eol=lf
@joaocc
joaocc / run-gitlab-as-dind.multi.sh
Last active November 15, 2017 23:08
Gitlab-runner as dind
#!/usr/bin/env bash
set -e
set -o pipefail
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
T_STAMP=$(date -u +"%Y%m%d_%H%M%SZ")
set -x
# docker rm -f gitlab-runner-dind gitlab-dind-host
@joaocc
joaocc / mk-zfs.external-drives.sh
Last active November 27, 2016 03:48
mac osx zfs ops
#!/usr/bin/env bash
set -e
set -x
MY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
pushd "${MY_DIR}"
MY_SDXC=/var/run/disk/by-serial/SD_Card_Reader-000000000000
diskutil info $MY_SDXC
@joaocc
joaocc / ConfigureRemotingForAnsible.ps1
Last active November 10, 2016 11:02
Windows-Easy-Bootstrapping (2016-11)
# Configure a Windows host for remote management with Ansible
# -----------------------------------------------------------
#
# This script checks the current WinRM/PSRemoting configuration and makes the
# necessary changes to allow Ansible to connect, authenticate and execute
# PowerShell commands.
#
# Set $VerbosePreference = "Continue" before running the script in order to
# see the output messages.
# Set $SkipNetworkProfileCheck to skip the network profile check. Without
@joaocc
joaocc / gist:137f6b44ceefb864e0c09b2dcaa28a5f
Created September 10, 2016 11:02
Terraform panic on "terraform state show"
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x30 pc=0x4bc772]
goroutine 1 [running]:
panic(0x33b5860, 0xc820012090)
/opt/go/src/runtime/panic.go:481 +0x3e6
github.com/hashicorp/terraform/command.(*StateShowCommand).Run(0xc8201ad200, 0xc82000a1c0, 0x0, 0x0, 0xc8202227d0)
/opt/gopath/src/github.com/hashicorp/terraform/command/state_show.go:53 +0x702
github.com/hashicorp/terraform/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc8201ca900, 0xc8202e0360, 0x0, 0x0)
/opt/gopath/src/github.com/hashicorp/terraform/vendor/github.com/mitchellh/cli/cli.go:153 +0x56e
#!/bin/bash
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
cat <<MAXFILES > /Library/LaunchDaemons/limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@joaocc
joaocc / win2012r2--hyperv.boxst
Last active November 6, 2016 09:40
Deploy--boxstarter--win2012r2
#
# v1.1.5 2015-08-28 HighSkillz Ltd
#
# START http://goo.gl/bVJNzp
# START http://boxstarter.org/package/url?https://bitbucket.org/api/2.0/snippets/highskillz-deploy/KAMLg/files/win2012r2--hyperv.boxst
#
# START http://goo.gl/yVuh3L
# START http://boxstarter.org/package/url?https://gist.githubusercontent.com/joaocc/f61f9a8e59a5575220ce/raw/win2012r2--hyperv.boxst
# ================================================================
---
# ^^^ 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.
# filename: install-nvm-npm-node
# author: Lex Sheehan
# purpose: To cleanly install NVM, NODE and NPM
# dependencies: brew
# references: http://lexsheehan.blogspot.com/2015/04/cleanly-install-nvm-node-and-npm.html
NOW=$(date +%x\ %H:%M:%S)
CR=$'\n'
REV=$(tput rev)
OFF=$(tput sgr0)