Skip to content

Instantly share code, notes, and snippets.

View mbainter's full-sized avatar

Mark Bainter mbainter

View GitHub Profile
@jordansissel
jordansissel / output
Created October 29, 2010 18:09
puppetless puppet (package management of remote hosts)
Usage: puppet-package-over-ssh.rb HOST PACKAGE ACTION
% ruby puppet-package-over-ssh.rb snack sl uninstall
Package[sl] uninstall status: {:status=>"not-installed", :error=>"ok", :desired=>"unknown", :ensure=>:purged, :name=>"sl", :provider=>:apt}
% ruby puppet-package-over-ssh.rb snack sl install
Package[sl] install status: {:status=>"installed", :error=>"ok", :desired=>"install", :ensure=>"3.03-16", :name=>"sl", :provider=>:apt}
% ruby puppet-package-over-ssh.rb snack fancypants install
Could not install package Package[fancypants]: Execution of 'ssh snack sudo "/usr/bin/apt-get" "-q" "-y" "-o" "DPkg::Options::=--force-confold" "install" "fancypants"' returned 100: Reading package lists...
Building dependency tree...
@geemus
geemus / fog_virtualbox.rb
Created March 14, 2011 21:08
simple example of using virtualbox
require 'fog'
compute = Fog::Compute.new(:provider => 'VirtualBox')
server = compute.servers.create(:name => 'lucid', :os => 'Ubuntu')
medium = compute.mediums.create(:device_type => :hard_disk, :location => '/Users/geemus/geemus/virtualbox_poc/lucid.vmdk', :read_only => false)
storage_controller = server.storage_controllers.create(:bus => :sata, :name => 'sata')
storage_controller.attach(medium, 0)
#! /usr/bin/ruby
# Query Foreman
# example usage:
#
# query for hosts
# ~~~~~~~~~~~~~~~
# $myhosts = foreman("hosts","facts.domain ~ lab")
# returns all hosts which have lab as part of their domain.
#
@vvuksan
vvuksan / gist:1124364
Created August 4, 2011 02:19
Using Logstash to generate log metrics
input { whatever }
filter { grok { pattern => "%{COMBINEDAPACHELOG}" } } output { statsd { increment => "apache.status.%{response}" } }
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@halkeye
halkeye / sorted_json.rb
Created April 2, 2012 23:13
Puppet module for outputting json in a sorted consistent way
#
# sorted_json.rb
# Puppet module for outputting json in a sorted consistent way. I use it for creating config files with puppet
require 'json'
def sorted_json(json)
if (json.kind_of? String)
return json.to_json
elsif (json.kind_of? Array)
@4ndrej
4ndrej / SSLPoke.java
Last active September 5, 2024 07:22
Test of java SSL / keystore / cert setup. Check the comment #1 for howto.
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
@dedico
dedico / index_and_queries.bash
Last active April 28, 2020 08:21
Elasticsearch example - index setup and sample queries
# setup
# delete index
curl -XDELETE 'http://localhost:9200/hotels/'
# create index
curl -XPOST 'http://localhost:9200/hotels/'
# create mapping
curl -XPOST localhost:9200/hotels/regular_hotel/_mapping -d '{
"regular_hotel":{
"properties":{
"rooms": {

Boxen uses a bunch of shellscripts to insert itself into your environment on shell load.

These assume a POSIX shell, which fish is not.

Run this script to generate a fish-compatible config file in ~/.config/fish/boxen.fish, which you can source at the end of your ~/.config/fish/config.fish.