Skip to content

Instantly share code, notes, and snippets.

View yyolk's full-sized avatar
🍯
𝙧𝙚𝙘𝙪𝙧𝙨𝙞𝙫𝙚 𝙩𝙖𝙪𝙩𝙤𝙡𝙤𝙜𝙮

Joseph Chiocchi yyolk

🍯
𝙧𝙚𝙘𝙪𝙧𝙨𝙞𝙫𝙚 𝙩𝙖𝙪𝙩𝙤𝙡𝙤𝙜𝙮
View GitHub Profile
@yyolk
yyolk / BundleConfig.ps1
Created March 4, 2016 21:14 — forked from mefellows/BundleConfig.ps1
Sysprepped Windows AMI using Packer
$EC2SettingsFile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Settings\\BundleConfig.xml"
$xml = [xml](get-content $EC2SettingsFile)
$xmlElement = $xml.get_DocumentElement()
foreach ($element in $xmlElement.Property)
{
if ($element.Name -eq "AutoSysprep")
{
$element.Value="Yes"
}
@yyolk
yyolk / cloudwatch-spot-price-metrics.sh
Created February 23, 2016 22:51 — forked from muhqu/cloudwatch-spot-price-metrics.sh
Shell Script to bring EC2 SpotInstance Prices to CloudWatch.
#!/bin/bash
#
# The MIT License (MIT)
#
# Copyright (c) 2013 Mathias Leppich <mleppich@muhqu.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@yyolk
yyolk / packer-ebs-snapshot-id
Created February 11, 2016 21:39 — forked from stefanteixeira/packer-ebs-snapshot-id
Get EBS Snapshot ID from a Packer build
packer build -machine-readable packer.json | tee build.log
grep 'artifact,0,id' build.log | cut -d, -f6 | cut -d: -f2
@yyolk
yyolk / AWS CloudFormation SNS Subscription.json
Created December 4, 2015 23:54
AWS CloudFormation SNS Subscription
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"Topic": {
"Type": "AWS::SNS::Topic",
"Properties": {
}
},
"Queue": {
"Type": "AWS::SQS::Queue",
@yyolk
yyolk / sns-pushover.php
Created November 8, 2015 00:45 — forked from richardbenson/sns-pushover.php
Simple script to send SNS notifications to your smartphone via Pushover. Requires signing up for Pushover and getting an API key. Then host anywhere and add the URL as subscription to your topic.
<?php
define('PUSHOVER_API_KEY', '<API KEY>'); //Replace with your API Key
$userKey = (isset($_GET['u']) ? $_GET['u'] : '<DEFAULT USER ID>'); //Default user or group
$response = json_decode(file_get_contents('php://input'), true);
switch ($response["Type"]) {
case "SubscriptionConfirmation":
//For this use case, we will just automatically subscribe, we could forward this via email,
@yyolk
yyolk / gist:e818c7ce5696f8f624ad
Created September 29, 2015 20:38 — forked from ericandrewlewis/gist:95239573dc97c0e86714
Setting up a WordPress site on AWS

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.

@yyolk
yyolk / index.js
Last active September 29, 2018 02:28 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
console.log('Loading function');
const https = require('https');
const url = require('url');
// to get the slack hook url, go into slack admin and create a new "Incoming Webhook" integration
const slack_url = 'https://hooks.slack.com/services/...';
const slack_req_opts = url.parse(slack_url);
slack_req_opts.method = 'POST';
slack_req_opts.headers = {'Content-Type': 'application/json'};
@yyolk
yyolk / gist:fbfe87aae7190600ff70
Last active August 29, 2015 14:25 — forked from andersonfreitas/gist:4355992
Installing nmon on Amazon Linux AMI

Installing nmon on Amazon Linux AMI

nmon is an excellent performance monitor for Linux systems.

Since Amazon Linux AMI is compatible with RHEL5, I've downloaded a binary RPM from:

http://pkgs.repoforge.org/nmon/

64bit

var compiled, exFunc;
exFunc = (function() {
function exFunc() {}
constructor(function(path) {
this.url = path.replace(/[]/g, '/');
this.index = path;
if (path === home) {
this.url = '';
@yyolk
yyolk / gist:7866266
Created December 9, 2013 01:43 — forked from jacobhak/gist:4996785
pushover from rtorrent
require "net/https"
url = URI.parse("https://api.pushover.net/1/messages")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
:token => "application_api_key", #replace with your api key
:user => "the_user_key", #replace with your user key
:message => "Torrent finished: "+ARGV[0],
})
res = Net::HTTP.new(url.host, url.port)