Skip to content

Instantly share code, notes, and snippets.

@aalbertson
aalbertson / gist:e2f3a63ff92800a16c6251de0a0a1f85
Created Feb 5, 2019
example disable audio - vagrant mac virtualbox v2 config
View gist:e2f3a63ff92800a16c6251de0a0a1f85
$ cat Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-16.04"
config.vm.define "LogsParsing"
config.vm.network "forwarded_port", guest: 8080, host: 8080, auto_correct: true
config.vm.provision :file, source: './provision.sh', destination: '~/provision.sh'
config.vm.provision "shell", run: 'always', path: "./provision.sh", privileged: false
@aalbertson
aalbertson / sns_to_slack.js
Last active Dec 4, 2017 — forked from vgeshel/function.js
AWS Lambda function for forwarding SNS notifications to Slack
View sns_to_slack.js
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'};
slack_notify = '<!channel>' // notification control: !channel = @channel, !here = @here, etc...
View gist:51e7719d76979c4bdd22
# Simple for loop leveraging both filters and query params off the default "Name" tag:
for i in $(aws ec2 describe-instances --region us-west-2 --filters "Name=tag:Name,Values={replace-with-name-tag-value}" --query "Reservations[].Instances[].PrivateIpAddress[]" --output text); do echo -e "ip: $i"; done
@aalbertson
aalbertson / windows_2k8_2k12r2_ephemeral_stripe.ps1
Created Jul 16, 2015
This code can slip right into user-data for an AWS ec2 instance for both win2k8 and win2k12r2 as is to stripe your ephemeral volumes. This works on more than 2 ephemerals as well (tested on a d2.xlarge with 3 1.8TB drives)
View windows_2k8_2k12r2_ephemeral_stripe.ps1
<powershell>
#################################################
# Detect the Ephemeral drives and stripe them
#################################################
$DriveLetterToAssign = "Z:" # Be sure to choose a drive letter that will not already be assigned
#################################################
# Given a device (e.g. xvda), strip off "xvd" and convert the remainder to the appripriate SCSI ID
#################################################
You can’t perform that action at this time.