Skip to content

Instantly share code, notes, and snippets.

View cmndrsp0ck's full-sized avatar
🖖
Fascinating

Fabian B. cmndrsp0ck

🖖
Fascinating
View GitHub Profile
@cmndrsp0ck
cmndrsp0ck / deploy-docker-and-rancher.yaml
Last active March 3, 2017 18:59
pass in as user-data to deploy docker and rancher on Ubuntu 16.04 LTS
#cloud-config
packages:
- apt-transport-https
- ca-certificates
apt_sources:
- source: deb https://apt.dockerproject.org/repo ubuntu-xenial main
keyserver: 'hkp://p80.pool.sks-keyservers.net:80'
keyid: 58118E89F3A912897C070ADBF76221572C52609D
@cmndrsp0ck
cmndrsp0ck / monokai-exteded.xml
Created August 29, 2017 21:26 — forked from LeoIannacone/monokai-exteded.xml
Monokai Extended - GtkSourceView Theme
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2014 Leo Iannacone <info@leoiannacone.com>
This file was generated from a textmate theme named Monokai Extended
with tm2gtksw2 tool. (Alexandre da Silva)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
@cmndrsp0ck
cmndrsp0ck / nodejs-install.yml
Created January 14, 2018 00:48
install a specific version of nodejs
---
- name: nodejs install block
block:
- name: Check for nodejs
stat:
path: "{{ node_path }}/node"
register: node_check
- name: Install nodejs
unarchive:
@cmndrsp0ck
cmndrsp0ck / config
Created February 3, 2018 15:34
terminator config settings for monokai color palette located in ~/.config/terminator/config
[[monokai-soda]]
palette = "#1a1a1a:#f4005f:#98e024:#fa8419:#9d65ff:#f4005f:#58d1eb:#c4c5b5:#625e4c:#f4005f:#98e024:#e0d561:#9d65ff:#f4005f:#58d1eb:#f6f6ef"
background_color = "#1a1a1a"
cursor_color = "#f6f7ec"
foreground_color = "#c4c5b5"
background_image = None
background_darkness = 0.8
background_type = transparent
font = Monospace 11
scrollback_lines = 5000
@cmndrsp0ck
cmndrsp0ck / cloud-config.yaml
Last active February 12, 2018 15:37
spin up an ubuntu 16.04 server> install git, ansible, terraform, terraform-inventory
#cloud-config
users:
- name: <username>
groups: sudo
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- <enter_public_key_here>
@cmndrsp0ck
cmndrsp0ck / saltmine.sh
Created May 23, 2018 17:24
Function to generate WordPress auth salt that's safe to pass through Jinja template
function makeSalt() {
# Create variable length passwords
LC_CTYPE=C;
local saltine=$(tr -dc 'A-Za-z0-9_@#$%^&*~!?;`./|:{} <>[]()-+=' < /dev/urandom | head -c 64)
if [[ $(echo ${saltine} | grep -P '({%|%}|{#|#}|{{|}}|##)') ]]; then
makeSalt;
else
echo "${saltine}";
fi
}
@cmndrsp0ck
cmndrsp0ck / randnum.sh
Created May 23, 2018 17:28
Generate random number of variable digit length
function randNum() {
# Generate random number of variable length with a default of 5 digits
local val
local len=${1:-5}
for (( x=0; x<${len}; x++ )); do
val+=($(echo $((RANDOM%9))));
done
printf -- "%s" "${val[@]}"
}
@cmndrsp0ck
cmndrsp0ck / get-latest-tag-on-git.sh
Created July 9, 2018 18:34 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
@cmndrsp0ck
cmndrsp0ck / consul-template.service
Created September 10, 2018 06:17 — forked from yunano/consul-template.service
/etc/systemd/system/consul-template.service
[Unit]
Description=consul-template
Requires=network-online.target
After=network-online.target consul.service vault.service
[Service]
EnvironmentFile=-/etc/sysconfig/consul-template
Restart=on-failure
ExecStart=/usr/local/sbin/consul-template $OPTIONS -config=/etc/consul-template.d
@cmndrsp0ck
cmndrsp0ck / consul.service
Created September 10, 2018 06:17 — forked from yunano/consul.service
/etc/systemd/system/consul.service
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Environment=GOMAXPROCS=2
Restart=on-failure
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d