Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / DevSetup.ps1
Last active December 27, 2016 23:37
Set up new Server 2016 Dev PC
## using Choco
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco feature enable -n=allowGlobalConfirmation
# On Win10 and Server2016 you don't need to install chocolatey
Install-PackageProvider chocolatey -ForceBootstrap -Force
# Dev Tools
Install-Package vcredist2012 -Force
@ShawInnes
ShawInnes / Ng2-Auth0.md
Created May 23, 2017 10:25
Angular2 and Auth0 with API

app.component.ts

import { provideAuth, AuthHttp, AuthConfig } from 'angular2-jwt';

export function authHttpServiceFactory(http: Http, options: RequestOptions) {
  return new AuthHttp( new AuthConfig({}), http, options);
}
@NgModule({
  declarations: [
@ShawInnes
ShawInnes / opencv3_python3.sh
Last active June 17, 2017 08:40
Install openCV3 with Python3 on OSX
#!/bin/sh
## need to make sure current python version is 3.6.1 also
pip install numpy
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/devops/opencv_contrib/modules \
-D PYTHON3_LIBRARY=/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/config-3.6m-darwin/libpython3.6.dylib \
@ShawInnes
ShawInnes / query_gnaf.sql
Created August 8, 2017 12:53
Query the GNAF database
select *
from gnaf_201705."addresses"
where "street_name" = 'ANN'
and "street_type" = 'STREET'
and "locality_name" = 'BRISBANE CITY'
limit 10
select *
from gnaf_201705."localities"
where "locality_name" = 'STAFFORD'
@ShawInnes
ShawInnes / setup.sh
Last active January 31, 2023 09:57
New Mac Setup
#!/bin/sh
touch ~/.zprofile
COMPNAME="Titan"
sudo scutil --set ComputerName "$COMPNAME"
sudo scutil --set HostName "$COMPNAME"
sudo scutil --set LocalHostName "$COMPNAME"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPNAME"
@ShawInnes
ShawInnes / gratitude_conversation_starters.json
Created January 1, 2019 10:20
Gratitude Conversation Starters
[
"What do you love about your home?",
"Describe a hobby or activity that makes you happy",
"Describe one thing you're really good at",
"Who would you like to thank?",
"What is something that you might take for granted that you are grateful for?",
"Describe something you do every day that you're grateful for",
"Name a taste or flavour that makes you happy",
"What do you love about winter?",
"What do you love about summer?",