Skip to content

Instantly share code, notes, and snippets.

View hartfordfive's full-sized avatar

Alain Lefebvre hartfordfive

View GitHub Profile
@hartfordfive
hartfordfive / java-8-ami.md
Created February 5, 2017 19:45 — forked from rtfpessoa/java-8-ami.md
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami
@hartfordfive
hartfordfive / instance_termination.py
Created January 19, 2017 14:40 — forked from gswallow/instance_termination.py
Crude AWS Lambda to deregister nodes from Chef upon EC2 instance termination
import json
import chef
# Copy your .chef directory into the root folder of the deployment package:
# http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html#deployment-pkg-for-virtualenv
# See also https://github.com/coderanger/pychef/issues/41
print('Loading function')
def lambda_handler(event, context):
@hartfordfive
hartfordfive / com.apple.newsyslog.plist
Created April 19, 2016 15:56
Example newsyslog configuration
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.apple.newsyslog</string>
<key>ProgramArguments</key>
<array>
<string>/usr/sbin/newsyslog</string>
</array>
@hartfordfive
hartfordfive / gist:6db95bef1b2f07f64fca96e5a6436adf
Created April 17, 2016 22:59 — forked from grantr/gist:1105416
Chef mysql master/slave recipes
## mysql::master
ruby_block "store_mysql_master_status" do
block do
node.set[:mysql][:master] = true
m = Mysql.new("localhost", "root", node[:mysql][:server_root_password])
m.query("show master status") do |row|
row.each_hash do |h|
node.set[:mysql][:master_file] = h['File']
node.set[:mysql][:master_position] = h['Position']
end