Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
#!/bin/bash
for d in /sys/kernel/iommu_groups/*/devices/*; do
n=${d#*/iommu_groups/*}; n=${n%%/*}
printf 'IOMMU Group %s ' "$n"
lspci -nns "${d##*/}"
done
@bsodmike
bsodmike / wipe.sh
Created February 16, 2017 14:20 — forked from UmbrielSecurity/wipe.sh
wipe.sh - a disk zeroing utility
#!/bin/bash
# Tool declarations, modify as needed.
AWK="/usr/bin/awk"
CAT="/bin/cat"
COMM="/usr/bin/comm"
CUT="/usr/bin/cut"
DATE=`/bin/date +%Y/%m/%d`
DD="/bin/dd"
GREP="/bin/grep"
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Setting up your own private and secure VPN",
"Mappings": {
"AWSInstanceType2Arch": {
"High.Speed.VPN-Paid": {
"InstanceType": "t2.medium"
},
"Standard.VPN-Free": {
"InstanceType": "t2.micro"
@bsodmike
bsodmike / Contract Killer 3.md
Created April 29, 2016 20:33 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@bsodmike
bsodmike / aws-op-list.rb
Created April 9, 2016 12:30 — forked from kylev/aws-op-list.rb
A script to print all the operations in each AWS service endpoint. Useful for crafting well-formed IAM permissions.
#!/usr/bin/env ruby
# List all the (known) operations on each AWS service API. This is
# incredibly useful for building well-restricted IAM access
# rules. With this list you can quickly see what "s3:Get*" matches, or
# just glance through and look for something that might be missing and
# breaking your app.
# I can't believe I had to write this myself. I'm pretty sure there
# are a lot of people out there with near-god-mode permission on IAM
@bsodmike
bsodmike / snsToSlack.js
Created January 28, 2016 04:07 — forked from terranware/snsToSlack.js
AWS Lambda function to Slack Channel hookup
var https = require('https');
var util = require('util');
exports.handler = function(event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var postData = {
"channel": "#aws-sns",
"username": "AWS SNS via Lamda :: DevQa Cloud",
@bsodmike
bsodmike / API.swift
Last active August 29, 2015 14:23 — forked from higepon/API.swift
//
// API.swift
//
// Created by Taro Minowa on 6/10/14.
// Copyright (c) 2014 Higepon Taro Minowa. All rights reserved.
//
import Foundation
typealias JSONDictionary = Dictionary<String, AnyObject>

Predicting Email Addresses

At AlphaSights, we often want to contact advisors even when we don't know know their email address.

This presents us with the challenge of having to predict what their actual email address will be.

To help with this process, we have the following information available:

  1. The advisor's name.
  2. The domain name of the company he works for.
  3. The names and emails of other advisors in our database that work for the same company (and domain name).

Out of the box, Homebrew does a default installation on Sphinx:

$ brew install sphinx

However, if you're using MySQL, the thinking-sphinx gem won't work because it needs to use MySQL libraries.

If you managed to screw up the first time, uninstall sphinx first:

$ brew remove sphinx

#!/bin/bash
cd <%= @options[:app_dir] %>
exec 2>&1
exec <%= node[:runit][:chpst_bin] %> -e /etc/sv/<%= @options[:service_name] %>/env -u <%= @options[:app_user]%>:unicorn <%= @options[:bundler_binary] %> exec unicorn -E <%= @options[:environment] %> -c <%= @options[:config] %>