Skip to content

Instantly share code, notes, and snippets.

@sgzijl
sgzijl / ohmy_aws_profile.txt
Last active August 29, 2015 14:20
ohmyzsh aws profile switcher
~ .aws/config (remove default profile, define region/output for each customer)
[profile customer_a]
region = eu-west-1
output=text
[profile customer_b]
region = eu-west-1
output=text
@sgzijl
sgzijl / gist:c4d0ec569e1e0a5fcb1f
Last active August 29, 2015 14:08
Quick&dirty modulefile2metadata.json script for puppet 3.6+
#!/usr/bin/env ruby
# Very quick&dirty script to quickly migrate puppet's modulefile to metadata.json files
# (Puppet >= 3.6 deprecated the Modulefile)
#
# Usage: check-out all your modules to a current directory and run ./modulefile2metadatajson.rb
#
# After completion, a proper metadata.json file should remain in each module directory.
require 'json'
Dir.glob('**/Modulefile') do | module_file |
## Ruby 2.0.0 p451 own package
[root@management ~]# which ruby
/usr/local/puppet/bin/ruby
[root@management ~]# which gem
/usr/local/puppet/bin/gem
## Installing manually works
# export HOMEGEMS="$(ruby -rubygems -e 'puts Gem.user_dir')"
# export OLDPATH="$PATH"
# export PATH="${HOMEGEMS}/bin:${PATH}"
@sgzijl
sgzijl / console log resize2fs
Last active December 25, 2015 10:09
XFS resize test (Ubuntu 13.04, xfsprogs 3.1.9)
# resize2fs allows offline & online resizing.
root@test:~# lvcreate -n test -L100M vg00
Logical volume "test" created
root@test:~# mkfs.ext4 /dev/vg00/test
mke2fs 1.42.5 (29-Jul-2012)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
@sgzijl
sgzijl / gist:6470712
Created September 6, 2013 22:16
datastructure to yaml & json (including a multiliner).
#!/usr/bin/env ruby
require 'yaml'
require 'json'
data = {
'somekey' => 'a value',
'another key' => [ 'an', 'array', 'of', 'values' ],
'multiliner key' => "line 1\n line 2\n line 3\n",
'a final key' => 'last value',
}