Skip to content

Instantly share code, notes, and snippets.

View bsodmike's full-sized avatar

Michael de Silva bsodmike

View GitHub Profile
@bsodmike
bsodmike / redis.markdown
Created November 4, 2012 18:43 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

#!/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
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
@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",

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] %>