Skip to content

Instantly share code, notes, and snippets.

View oldpatricka's full-sized avatar

Patrick Armstrong oldpatricka

View GitHub Profile
<html>
</head>
<body>
hi ian. Hash of "Message" is:
<span id="hash"></span>
</body>
<head>
<script type="text/javascript">
var CryptoJS = CryptoJS || function(h, s) {
<html>
</head>
<body>
hi ian. Hash of "Message" is:
<span id="hash"></span>
</body>
<head>
<script type="text/javascript">
/*
notesApp = Application('Notes');
notes = notesApp.notes;
var ex = {};
for (var i = 0 ; i < notes.length ; i++) {
ex[notes[i].name()] = notes[i].body();
}
ex
$customdata = Get-Content C:\AzureData\CustomData.bin
$customdataxml = [xml]$customdata
$powershell = $customdataxml.powershell
Invoke-Expression $powershell
@oldpatricka
oldpatricka / slack
Created August 13, 2014 15:13
slack
#!/bin/bash
CHANNEL=$1
MESSAGE=$2
USERNAME=beepboop # set to whatever
APITOKEN="" # generate on https://api.slack.com
# urlencode message
MESSAGE=`python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])" "${MESSAGE}"`

Keybase proof

I hereby claim:

  • I am oldpatricka on github.
  • I am oldpatricka (https://keybase.io/oldpatricka) on keybase.
  • I have a public key whose fingerprint is 7ABE 4191 5190 39DB D4A6 470A D032 3A95 D929 514E

To claim this, I am signing this object:

@oldpatricka
oldpatricka / dummy-pre-commit.sh
Last active February 6, 2017 14:35
Pre-commit hook to check for fixes or todos
#!/bin/sh
. git-sh-setup # for die
git-diff-index -p -M --cached HEAD -- | grep '^+' |
egrep 'TODO|FIXME|PDA' && die Blocking commit because string TODO/FIXME/PDA detected in patch
:
@oldpatricka
oldpatricka / list_instances.py
Last active December 27, 2015 18:59 — forked from priteau/list_instances.py
Use like: $ EC2_HOST=myiaas.example.com AWS_ACCESS_KEY_ID=somekey AWS_SECRET_ACCESS_KEY=somesecret python list_instances.py
#!/usr/bin/env python
import os
from boto.ec2.connection import EC2Connection
from boto.regioninfo import RegionInfo
host = os.environ["EC2_HOST"]
region = RegionInfo(name="Nimbus", endpoint=host)
#!/bin/bash
# chkconfig: 345 99 01
# description: tcollector agent daemon
#
# processname: tcollector.py
# Get TSD_HOST from a file that can be set in ctx
TSD_HOST="nimbus-opentsdb.no-ip.info"
got flow sample json=<{
"sampling_rate": 1,
"app_operation": {
"status": "0",
"resp_bytes": 2193,
"status_descr": "",
"uS": 6421000,
"req_bytes": 52,
"attributes": "ml=6276&pid=visualization_serviceba793eb2a872413fad3c11bd3599972c&ql=0&ps=1",
"operation": "get_realtime_visualization_data"