Skip to content

Instantly share code, notes, and snippets.

View ozbillwang's full-sized avatar
:octocat:

Bill Wang ozbillwang

:octocat:
View GitHub Profile
@ozbillwang
ozbillwang / gist:1533bba1dcd66747d3f9
Created March 8, 2016 00:47 — forked from ahonor/gist:1006584
job run example via curl
#!/bin/bash
#!/bin/bash
#Utility to log into the RunDeck server and store cookie file for later use
errorMsg() {
echo "$*" 1>&2
}
@ozbillwang
ozbillwang / README.md
Last active April 14, 2023 13:42 — forked from igorlg/aws_tags.rb
Facter for AWS EC2 Instance Tags
console.log('Loading event');
var AWS = require('aws-sdk');
var dynamodb = new AWS.DynamoDB();
exports.handler = function(event, context) {
console.log("Request received:\n", JSON.stringify(event));
console.log("Context received:\n", JSON.stringify(context));
var tableName = "OurBlogDemo";
var datetime = new Date().getTime().toString();
#!/usr/bin/env python
"""
Recipe for creating and updating security groups programmatically.
"""
import collections
import boto
@ozbillwang
ozbillwang / vm-resize-hard-disk.md
Last active August 29, 2015 14:16 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine

The repository below resizes the vagrant box automatically, and I prefer this way.

https://github.com/SydOps/vagrant-box-resize

Here are the manual tasks with my updates and fork from christopher-hopper/vm-resize-hard-disk.md. But one issue is, after I manually resize, I found I can't use packer to re-baker vagrant box again.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

@ozbillwang
ozbillwang / ruby-one-liners.md
Last active August 29, 2015 14:13 — forked from KL-7/one-liners.md
ruby one liner collection

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

# lib/puppet/parser/functions/pw_hash.rb
module Puppet::Parser::Functions
newfunction(:pw_hash, type: :rvalue) do |args|
raise Puppet::ParseError, "pw_hash takes exactly two arguments, #{args.length} provided" if args.length != 2
# SHA512 ($6), default number of rounds (5000)
# rounds could be specified by prepending rounds=<n>$ parameter before the salt, i.e.
# args[0].crypt("$6$rounds=50000$#{args[1]}")
args[0].crypt("$6$#{args[1]}")
end
@ozbillwang
ozbillwang / servers.yaml
Last active July 1, 2017 23:48 — forked from scottslowe/yaml-vagrantfile
This Vagrantfile works with an external data file (a YAML file, named servers.yaml) to create multiple Vagrant boxes easily. The servers.yaml file contains all the specifics and can be easily edited to change the number and type of boxes to create. The Vagrantfile remains unchanged. http://blog.scottlowe.org/2014/10/22/multi-machine-vagrant-with…
---
- name: coreos-01
box: coreos-alpha
ram: 512
ip: 172.17.8.101
- name: coreos-02
box: coreos-alpha
ram: 512
ip: 172.17.8.102
- name: coreos-03
---
- name: coreos-01
box: coreos-alpha
ram: 512
ip: 172.17.8.101
- name: coreos-02
box: coreos-alpha
ram: 512
ip: 172.17.8.102
- name: coreos-03
require('http').createServer(function(q, s){s.end('ok');}).listen(51160);