Skip to content

Instantly share code, notes, and snippets.

View awaxa's full-sized avatar

Greg Kitson awaxa

View GitHub Profile
#!/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
@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
@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

@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 <loudnate@gmail.com>
# Install dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
python \
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
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
@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|
@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 = []
@jareware
jareware / s3-curl-backups.md
Last active August 29, 2021 00:56
Simple, semi-anonymous backups with S3 and curl

⇐ back to the gist-blog at jrw.fi

Simple, semi-anonymous backups with S3 and curl

Backing stuff up is a bit of a hassle, to set up and to maintain. While full-blown backup suites such as duplicity or CrashPlan will do all kinds of clever things for you (and I'd recommend either for more complex setups), sometimes you just want to put that daily database dump somewhere off-site and be done with it. This is what I've done, with an Amazon S3 bucket and curl. Hold onto your hats, there's some Bucket Policy acrobatics ahead.

There's also a tl;dr at the very end if you just want the delicious copy-pasta.

Bucket setup

@fvoges
fvoges / change_passwords.sh
Last active August 29, 2015 14:09
Script to generate random passwords for the PE answer files
#!/bin/bash
# Created: Tue Nov 11 09:45:31 2014
# Author: Federico Voges <federico@puppetlabs.com>
#
# Simple script to change all the passwords in the PE answer files.
# It should run from a directory containing the answer files.
# It will scan all .txt files looking for "q_.*password", generate a new
# password for each unique answer and replace the password on all files
# The console admin user password is hardcoded to "puppetlabs"
# Make sure that all channels are subscribed to before any packages are installed.
# This is evil and horrible and not right. But it's really the only way right now.
# TODO: use a whit to coalesce relationships for performance reasons. This won't
# really matter until you have many channels subscribed.
def autorequire(rel_catalog = nil)
rel_catalog ||= catalog
raise(Puppet::DevError, "You cannot add relationship without a catalog") unless rel_catalog
reqs = super
rel_catalog.resources.select{|x| x.is_a? Puppet::Type::Package}.each do |res|