Skip to content

Instantly share code, notes, and snippets.

View aussielunix's full-sized avatar
🤠
G`Day

Mick Pollard aussielunix

🤠
G`Day
View GitHub Profile
@aussielunix
aussielunix / linux_proc_name.rb
Created November 22, 2011 11:39 — forked from eric/linux_proc_name.rb
Update a process name in linux to change how it shows up in top and lsof
#
# Eric Lindvall <[email protected]>
#
# Update the process name for the process you're running in.
#
# This will allow top, lsof, and killall to see the process as the
# name you specify.
#
# Just use:
#
@aussielunix
aussielunix / httparty.rb
Created December 17, 2011 00:52 — forked from runemadsen/httparty.rb
Creating a repo via the Github API and HTTParty
class Github
include HTTParty
base_uri 'https://api.github.com'
end
Github.post("/user/repos", :query => {
:access_token => @token
},
:body => {
:name => name,
@aussielunix
aussielunix / confluence4r.rb
Created January 20, 2012 06:52 — forked from ccaum/confluence4r.rb
Confluence Puppet Doc Generator
require 'xmlrpc/client'
# A useful helper for running Confluence XML-RPC from Ruby. Takes care of
# adding the token to each method call (so you can call server.getSpaces()
# instead of server.getSpaces(token)). Also takes care of re-logging in
# if your login times out.
#
# Usage:
#
# server = Confluence::Server.new :server => 'http://confluence02.lightningsoure.com'
# Variables goes hither
declare -a FILES
IFS="
"
FILES=$(git diff --cached --name-only --diff-filter=ACM )
# I we don't have puppet-lint, so just exit and leave them be.
which puppet-lint >/dev/null 2>&1 || exit
# I we don't have puppet, so just exit and leave them be.
which puppet >/dev/null 2>&1 || exit
#!/usr/bin/env ruby
require 'rubygems'
require 'pp'
require 'fog'
require 'highline/import'
def get_password(prompt="Enter password:")
ask(prompt) {|q| q.echo = false}
end
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
echo "in git pre-commit hook"
require 'aws/s3' # gem name is 'aws-sdk'
class BucketSyncService
attr_reader :from_bucket, :to_bucket, :logger
attr_accessor :debug
DEFAULT_ACL = :public_read
# from_credentials and to_credentials are both hashes with these keys:
# * :aws_access_key_id
% git rev-list HEAD | xargs -n1 sh -c 'git ls-tree -lr $1 | awk "\$4 > (1024*1024*50) { print \"size:\",\$4, \$5 }" | sed -e "s,^,commit:$1 ,"' -
commit:fd93322c903a49febe8ad454c9e03a7e86327389 size: 69535125 debian/debian/logstash.war

SSH agent forwarding and screen

When connecting to a remote server via SSH it is often convenient to use SSH agent forwarding so that you don't need a separate keypair on that server for connecting to further servers.

This is enabled by adding the

ForwardAgent yes

option to any of your Host entries in ~/.ssh/config (or alternatively with the -A option). Don't set this option in a wildcard Host * section since any user on the remote server that can bypass file permissions can now als use keys loaded in your SSH agent. So only use this with hosts you trust.

For a moment, I'm going to throw away my automation and configuration management hat. I'll let you know when I put it back on. Also, let's ignore that we're talking about Riak specifically for a moment. Also also, let's ignore any (for a brief moment) the proper role of a package manager.

What's your target market?

If you're writing server software, you have two target markets. The system administrator/operations team and the developer.

Why do you want autostart?

The main reason you want autostart is to get people up and running quickly. To do this, you need to ship safe and sane defaults. This means something like a default configuration that listens only on localhost.