Skip to content

Instantly share code, notes, and snippets.

View awaxa's full-sized avatar

Greg Kitson awaxa

View GitHub Profile
@acidprime
acidprime / Puppetfile
Last active August 29, 2015 14:17
This is a Puppetfile that will automatically download all supported+approved modules from the forge
#!/usr/bin/ruby
require 'puppet_forge'
# Example of a module from an internal repo co-existing with forge modules.
#mod 'splunk',
# :git => 'https://internal.git.server/example/puppet-splunk.git',
# :commit => '3ca47046a86aef9fbfdf58cc7b418d8e7254ecb9'
@dependencies = []
@approved = []
@acidprime
acidprime / read_resource.rb
Last active August 29, 2015 14:19
Use resource_type to retrieve native ruby objects you can use with to_yaml
#!/opt/puppet/bin/ruby
require 'puppet/face'
require 'yaml'
Puppet.parse_config
resources = Puppet::Face[:resource_type, '0.0.1'].search('.*',{:extra => { 'environment' => 'production' }})
output = Hash.new
resources.each do |resource|
resource.arguments.each do |k,v|
@chrismdp
chrismdp / s3.sh
Last active August 4, 2025 07:29
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@loudnate
loudnate / Dockerfile
Last active October 7, 2017 16:12
DockerHub:loudnate/openaps-dev
# Pull base image
FROM resin/rpi-raspbian:wheezy
MAINTAINER Nathan Racklyeft <[email protected]>
# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
python \
@bpierre
bpierre / README.md
Last active February 15, 2024 18:40
Switch To Vim For Good

Switch To Vim For Good

NOTE: This guide has moved to https://github.com/bpierre/switch-to-vim-for-good

This guide is coming from an email I used to send to newcomers to Vim. It is not intended to be a complete guide, it is about how I switched myself.

My decision to switch to Vim has been made a long time ago. Coming from TextMate 1, I wanted to learn an editor that is Open Source (so I don’t lose my time learning a tool that can be killed), cross platform (so I can use it everywhere), and powerful enough (so I won’t regret TextMate). For these reasons, Vim has always been the editor I wanted to learn, but it took me several years before I did it in a way that works for me. I tried to switch progressively, using the Janus Vim distribution for a few months, then got back to using TextMate 2 for a time, waiting for the next attempt… here is what finally worked for me.

Original gist with comments: https://gist.github.com/bpierre/0a0025d348b6001394e0

@gkbrk
gkbrk / lolcat.asm
Created July 27, 2016 13:26
Lolcat clone in x64 assembly
section .data
char_buffer db 0
section .text
global _start
_start:
mov r12, 0
.loop:
call read_char
#!/usr/bin/env bash
# before running this script:
# manually assign a hostname in System Preferences/Sharing
# optionally, set external facts github_token_ro and github_token_rw
set -evx
sudo mkdir -p /etc/puppetlabs/{puppet,facter/facts.d}
export PATH=$PATH:$HOME/.gem/ruby/2.0.0/bin
@michaelkitson
michaelkitson / totp.sh
Last active September 5, 2024 16:22
A bash function to generate TOTP codes
#!/usr/bin/env bash
set -euo pipefail
# Dependencies: openssl, xxd, base32 (coreutils)
# generate_totp key [time_sec [digits]]
generate_totp() {
key=$1
key_hex=$(base32 -d <<<"$key" | xxd -plain)
time_sec=${2:-$(date +%s)}