Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jumanjiman on github.
  • I am jumanjiman (https://keybase.io/jumanjiman) on keybase.
  • I have a public key whose fingerprint is 9FCD 849B 8363 BAB9 6D8F 3DDC 7749 19C3 3CA0 083E

To claim this, I am signing this object:

@jumanjiman
jumanjiman / blah
Last active August 29, 2015 13:57
read ip from output file of hponcfg
<!-- HPONCFG VERSION = "4.3.0" -->
<!-- Generated 3/6/2014 15:4:58 -->
<RIBCL VERSION="2.1">
<LOGIN USER_LOGIN="Administrator" PASSWORD="password">
<DIR_INFO MODE="write">
<MOD_DIR_CONFIG>
<DIR_AUTHENTICATION_ENABLED VALUE = "N"/>
<DIR_LOCAL_USER_ACCT VALUE = "Y"/>
<DIR_SERVER_ADDRESS VALUE = ""/>
<DIR_SERVER_PORT VALUE = "636"/>
@jumanjiman
jumanjiman / lookup_arin.sh
Created February 12, 2014 18:46
find out who "owns" an ip
#!/bin/bash
# synopsis: ./lookup_arin.sh <ip-to-lookup> <output-file>
# parse command-line, but fall back to default values
ip=${1:-74.120.84.62}
outfile=${2:-/tmp/lookup_arin.out}
tmpfile=/tmp/$ip.raw
# parse raw data

Docker Cheat Sheet

Why

Why Should I Care (For Developers)

"Docker interests me because it allows simple environment isolation and repeatability. I can create a run-time environment once, package it up, then run it again on any other machine. Furthermore, everything that runs in that environment is isolated from the underlying host (much like a virtual machine). And best of all, everything is fast and simple."

TL;DR, I just want a dev environment

@jumanjiman
jumanjiman / start.sh
Last active December 26, 2015 05:59
start script for coreos EC2 instance to launch a docker container
#!/bin/bash
# 1. Post a shell script at a gist url.
# 2. Paste the URL to the gist in EC2 coreos instance user data as 1st line of user data.
# 3. Launch coreos instance.
#
# For details, see:
# https://github.com/coreos/init/blob/402cc75e0f5f230f0aa9c83947e9c262ee85cb1f/bin/coreos-c10n#L25-37
function log() {
@jumanjiman
jumanjiman / A.md
Last active May 11, 2017 18:40
snapshot of our git workflow
  • README.md provides overview and key concepts

  • CONTRIBUTING.md describes workflow

@jumanjiman
jumanjiman / since.rb
Created March 5, 2013 22:53
trivial demo to save timestamp in a file
#!/usr/bin/env ruby
require 'date'
require 'yaml'
now = DateTime.now
puts 'time is now %s' % now
my_hash = Hash.new
my_hash['last_update'] = now.iso8601
@jumanjiman
jumanjiman / spec_helper.rb
Created February 9, 2013 19:25
demo how to use rspec-hiera-puppet to load hiera.yaml when using dynamic puppet environments
original_verbosity = $VERBOSE
$VERBOSE = nil
require 'rspec-puppet'
require 'rspec-hiera-puppet'
require 'test/unit'
require 'mocha/setup'
module Helpers
extend RSpec::SharedContext
def hiera_config_file
@jumanjiman
jumanjiman / conflicts.rb
Created February 8, 2013 13:44
print conflicting user account info when nsswitch uses multiple sources, such as local and ldap
#!/usr/bin/env ruby
# vim: set ts=2 sw=2 ai et bg=dark:
class Record < Struct.new(:name, :uid, :gid, :dir)
end
records = Array.new
%x!getent passwd!.split("\n").each do |record|
fields = record.split(':')
records << Record.new(
@jumanjiman
jumanjiman / dot-bashrc
Created November 26, 2012 15:21
2 ways to show git branch in PS1 bash prompt
# show git branch in shell prompt
# ref: https://home.regit.org/technical-articles/git-for-the-newbie/
export PS1='[\u@\h:\W$(__git_ps1 " (%s)")]\$ '
# ref: https://fedorahosted.org/pulp/wiki/GitGuide
export PS1="[\u@\h \W\$(git branch 2> /dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1}/')]\$ "