Skip to content

Instantly share code, notes, and snippets.

View justinclayton's full-sized avatar

Justin Clayton justinclayton

View GitHub Profile
@vStone
vStone / test.txt.erb
Created December 4, 2012 07:05
Puppet Template Headers
Original header used now:
### File managed with puppet ###
## Served by: '<%= scope.lookupvar('::servername') %>'
## Module: '<%= scope.to_hash['module_name'] %>'
## Template source: 'MODULES<%= template_source.gsub(Regexp.new("^#{Puppet::Node::Environment.current[:modulepath].gsub(':','|')}"),"") %>'
Problem: When using puppet apply with relative modulepath, the information can be wrong or messy.
Alternative 1:
@X0nic
X0nic / disable-vagrant-time-sync.sh
Last active February 4, 2022 04:52
Disable vagrant time sync
#List vms
VBoxManage list vms
#get status of time sync
VBoxManage getextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled
#NOTE: Make sure to restart the VM after changing these settings.
#disable time sync
VBoxManage setextradata <vm-name> VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled 1
@arunoda
arunoda / gist:7790979
Last active February 16, 2024 14:05
Installing SSHPass

Installing SSHPASS

SSHPass is a tiny utility, which allows you to provide the ssh password without using the prompt. This will very helpful for scripting. SSHPass is not good to use in multi-user environment. If you use SSHPass on your development machine, it don't do anything evil.

Installing on Ubuntu

apt-get install sshpass

Installing on OS X

@rothgar
rothgar / main.yml
Last active March 8, 2024 07:16
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']
@lutter
lutter / README.md
Created June 25, 2014 12:17
Hook design document

Hooks

Hooks provide a way to be notified of certain events during the operation of the Razor server; the behavior of a hook is defined by a hook type.

File layout for a hook type

Similar to brokers and tasks, hook types are defined through a .hook directory and files within that directory:

@curator
curator / YAML.tmLanguage
Created June 26, 2014 22:18
Updated YAML that deals with hiera data a bit better (double colons)
<?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">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>yaml</string>
<string>yml</string>
</array>
<key>foldingStartMarker</key>
#!/usr/bin/env ruby
require 'fileutils'
class VmList
@@cache_file = ENV['vm_list_cache_file'] || '/tmp/vm_list_cache'
@@cache_ttl = ENV['vm_list_cache_ttl'] || 60
def self.get_vm_list
vmware = %x{"/Applications/VMware\ Fusion.app/Contents/Library/vmrun" list | grep -v Total}.split("\n")
<?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">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.20784313976764679</real>
@stevschmid
stevschmid / api-doc.md
Created September 5, 2015 15:26
How the Track-o-Bot API works

Authentication

Access any profile page by providing the username and API key (generated in the settings -> API) , e.g. https://trackobot.com/profile/history.json?username=cool-ancient-tree-1337&token=fhyf238cv2eh879

JSON

Any profile page can be requested as JSON. Simply add .json at the end of the url (but before the query string which starts with ?), see example above.

Use the browser to see the JSON structure. JSONView is an excellent browser extension which shows JSON in a nice way.

@apolloclark
apolloclark / reverse-engineer a server build
Last active October 29, 2021 17:57
Audit Debian and Ubuntu servers
#!/usr/bin/env bash
# Script to reverse engineer the build of a given Debian / Ubuntu server
# I do this all the time: take an existing server, create a Bash / Ansible / Puppet / Chef
# built script, to allow Continuous Depoyment.
# It's tedious, but this script will give you the basics to get started.
# Make sure you have "sudo" access to get all the details.
# setup folders