Skip to content

Instantly share code, notes, and snippets.

@rubiojr
rubiojr / fog_kvm_create_from_template.rb
Created November 29, 2011 17:15
Create KVM guest using fog/libvirt and a QCOW2 template
require 'fog'
require 'net/ssh'
require 'net/scp'
def upload_file(host, user, password, source, dest, print_progress = true)
Net::SSH.start(host, user, :password => password) do |ssh|
puts "Uploading file... (#{File.basename(source)})"
ssh.scp.upload!(source, dest) do |ch, name, sent, total|
if print_progress
mount -uw /
Then we need to load a couple of required system modules. DirectoryServices is only required if you want networking support.
launchctl load /System/Library/LaunchDaemons/com.apple.notifyd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.kextd.plist
launchctl load /System/Library/LaunchDaemons/com.apple.diskarbitrationd.plist
launchctl start com.apple.diskarbitrationd
launchctl load /System/Library/LaunchDaemon/com.apple.DirectoryServices.plist
@MicahElliott
MicahElliott / rbenv-howto.md
Created April 17, 2012 18:11
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev

@nanliu
nanliu / gist:3170626
Created July 24, 2012 15:20
Puppet Installation
#!/bin/bash
# This script is intended to be used with the install action
# of puppet-cloudpack
set -u
set -e
function fedora_repo() {
cat >/etc/yum.repos.d/puppet.repo <<'EOFYUMREPO'
[puppetlabs]
#!/bin/bash
#
# This is the script responsible for updating our Puppet master data,
# which includes modules, manifests, hiera data, etc. All of this data is
# managed in a git repository and upon "deploy" it is synced into the Puppet
# master.
#
# This script mirrors the remote git repository, looking for branches that
# match "env-*" (such as "env-production" or "env-test"). Each of these branches
# is setup as an environment into the Puppet master's data files. The
@rockpapergoat
rockpapergoat / plato_republic_book1_gangsta.markdown
Last active June 13, 2017 15:49
plato's first book of "the republic," as translated by gizoogle

Book 1

I went down yesterdizzle ta tha Piraeus wit Glaucon tha lil hustla of Ariston, dat I might offer up mah lyrics ta tha goddess (Bendis, tha Thracian Artemis.); n' also cuz I wanted ta peep up in what tha fuck manner they would big-up tha festival, which was a freshly smoked up thang. I was delighted wit tha procession of tha inhabitants; but dat of tha Thracians was equally, if not more, dope. When our crazy-ass asses had finished our lyrics n' viewed tha spectacle, our crazy-ass asses turned up in tha direction of tha hood; n' at dat instant Polemarchus tha lil hustla of Cephalus chizzled ta catch sight of our asses from a thugged-out distizzle as our crazy-ass asses was startin on our way home, n' busted some lyrics ta his servant ta run n' bid our asses wait fo' his muthafuckin ass. Da servant took hold of mah crazy ass by tha cloak behind, n' holla'd: Polemarchus desires you ta wait.

I turned round, n' axed his ass where his crazy-ass masta was.

There he is, holla'd tha youth, comin afta y

@rockpapergoat
rockpapergoat / purge_old_kernels.rb
Last active November 3, 2016 13:46
script to provide some kernel purging routines for ubuntu/debian. this is a first pass at a maintenance script.
#!/usr/bin/env ruby
# 130306, nate
# automate purging old kernels from /boot and updating/upgrading
require 'optparse'
def get_installed_kernels
installed = %x(/usr/bin/dpkg --get-selections).split("\n").map! {|e| e.sub!(/\t+install/,"")}
kernels = installed.select {|pkg| pkg =~ %r[linux-image]}
end

How to bake decent bagels

I basically follow this recipe with a few exceptions.

homestyle bagels

Instead of malt syrup, I substitute molasses.

For a standard batch of 8-10 decent sized plain bagels, here's the ingredient list:

@tobstarr
tobstarr / Dockerfile
Last active December 20, 2015 14:29
Dockerfile for running OpenTSDB
FROM ubuntu
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl build-essential git-core
RUN if [ ! $(grep universe /etc/apt/sources.list) ]; then sed 's/main$/main universe/' -i /etc/apt/sources.list && apt-get update; fi
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y openjdk-6-jdk
RUN mkdir -p /opt/downloads && cd /opt/downloads && curl -SsfLO "http://www.apache.org/dist/hbase/hbase-0.94.10/hbase-0.94.10.tar.gz"
RUN cd /opt && tar xvfz /opt/downloads/hbase-0.94.10.tar.gz
RUN mkdir -p /data/hbase
RUN mkdir -p /root/.profile.d
RUN mkdir -p /root && echo Zm9yIHByb2ZpbGVfcGF0aCBpbiAkKGZpbmQgL3Jvb3QvLnByb2ZpbGUuZC8gLXR5cGUgZik7IGRvIHNvdXJjZSAkcHJvZmlsZV9wYXRoOyBkb25lCg== | base64 -d > /tmp/wunderscale.e4e4b9a9fbb0a7813a4707407606ccb195999effc1d27eac75a879113a4a017b && mv /tmp/wunderscale.e4e4b9a9fbb0a7813a4707407606ccb195999effc1d27eac75a879113a4a017b /root/.profile
RUN mkdir -p /root/.profile.d && echo ZXhwb3J0IEpBVkFfSE9NRT0vdXNyL2xpYi9qdm0vamF2YS02LW9wZW5qZGstYW1kNjQK | base64 -d > /tmp/wundersc
@petecheslock
petecheslock / gist:7072317
Last active December 26, 2015 01:38
Grandma Evelyn's Challah
===============
Challah (This Makes 2 Loaves - or one big ass challah.
INGREDIENTS:
- 12 ounces water (105-115 degrees fahrenheit)
- 1/4 cup honey
- 4 1/4 tsp. Active Dry-Yeast
- 32 oz. Bread Flour, by weight (or approx 5-6 cups)
- 1 tablespoon Kosher Salt