Skip to content

Instantly share code, notes, and snippets.

@ShawInnes
ShawInnes / aws_ips.py
Created August 28, 2016 06:44
Python Script to Nicely format AWS IP Ranges
import requests
from prettytable import PrettyTable
url_ips = requests.get('https://ip-ranges.amazonaws.com/ip-ranges.json')
ip_range = url_ips.json()
table = PrettyTable(['service', 'region', 'ip_prefix'])
table.align = "l"
for prefix in ip_range['prefixes']:
@ShawInnes
ShawInnes / CoreMidi.cs
Created August 20, 2016 06:13
Mac CoreMidi CSharp Example (APC40)
using System;
using System.Runtime.InteropServices;
using AppKit;
using CoreMidi;
using Foundation;
namespace WireCastMidi
{
public partial class ViewController : NSViewController
{
@ShawInnes
ShawInnes / QueryAD.cs
Created January 30, 2016 07:00
Some AD Querying Magic
using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.DirectoryServices;
namespace ADQuery
{
@ShawInnes
ShawInnes / masstransit4node.js
Created April 21, 2015 12:36
Node.js MassTransit Listener
var amqp = require('amqp');
console.log('create connection');
var connection = amqp.createConnection({ host: '10.0.1.59' });
console.log('done');
// Wait for connection to become established.
connection.on('ready', function () {
//// define this on the app module
.factory('notify', ['$rootScope', function($rootScope) {
var sharedService = {};
sharedService.message = '';
sharedService.prepForBroadcast = function(msg) {
this.message = msg;
this.broadcastItem();
};
@ShawInnes
ShawInnes / background.less
Created April 20, 2015 10:30
Background Gradient
@background: #0A10AB;
html {
background: @background;
background: linear-gradient(to bottom, lighten(@background, 0%), darken(@background, 100%));
min-height: 100%;
}
body {
@ShawInnes
ShawInnes / sff2015.md
Last active August 29, 2015 14:17
Spanish Film Festival 2015
@ShawInnes
ShawInnes / .gitignore
Last active August 29, 2015 14:16
logstash api importer
.DS_Store
data/
@ShawInnes
ShawInnes / LambdaGenericPropertySetter.cs
Created July 17, 2014 05:53
Lambda Generic Property Setter
void Main()
{
Test instance = new Test();
instance.Dump("Before");
instance.GetSetting(p => p.Thing);
instance.GetSetting(p => p.AnotherThing);
instance.GetSetting(p => p.StringThing);
instance.Dump("After");
}