Skip to content

Instantly share code, notes, and snippets.

Avatar

Brett Porter brettporter

View GitHub Profile
View github_watch.py
#!/usr/bin/env python
"""Set all repositories of a given GitHub organization name for a given user
to watching.
"""
import argparse
import json
import requests
import os
@brettporter
brettporter / oo2otl.py
Created Jan 3, 2017 — forked from adambyrtek/oo2otl.py
Quick and dirty OmniOutliner to plain-text conversion
View oo2otl.py
#!/usr/bin/env python
import xml.etree.ElementTree as ET
import sys
import re
class OutlinerParser:
def __init__(self):
self.indent = 0
self.is_note = False
View npm-shrinkwrap.json
{
"name": "shrinkwrap-dev-dependency-conflict",
"version": "1.0.0",
"dependencies": {
"ansi-regex": {
"version": "2.0.0",
"from": "ansi-regex@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.0.0.tgz"
},
"ansi-styles": {
View keybase.md

Keybase proof

I hereby claim:

  • I am brettporter on github.
  • I am brettporter (https://keybase.io/brettporter) on keybase.
  • I have a public key whose fingerprint is DA5D DD55 E69D E580 FE98 5E76 E136 088A 1824 BDC1

To claim this, I am signing this object:

View mount.iso.psm1
# Uses http://www.ltr-data.se/opencode.html/#ImDisk virtual disk driver for windows 7 or less
# Tries to use chocolatey to install imdisk
# Sample use case:
# Import-Module ".\mount.iso.psm1"
# Invoke-IsoExe "C:\test.iso" "setup.exe" "/passive"
function Mount-Iso([string] $isoPath)
{
if ( -not (Test-Path $isoPath)) { throw "$isoPath does not exist" }
@brettporter
brettporter / flush-amq-queues.rb
Created Oct 2, 2013
Remove a set of queues from ActiveMQ
View flush-amq-queues.rb
#!/usr/bin/env ruby
require 'json'
require 'httparty'
credentials = {
:username => 'admin',
:password => 'admin',
}
View gist:6758022
Error: Package: nodejs-npm-registry-client-0.2.28-1.el6.noarch (epel)
Requires: npm(semver) >= 2.1.0
Installing: nodejs-semver-2.0.10-1.el6.noarch (epel)
npm(semver) = 2.0.10
Error: Package: nodejs-request-2.21.0-1.el6.noarch (epel)
Requires: npm(form-data) < 0.1
Available: nodejs-form-data-0.1.1-1.el6.noarch (epel)
npm(form-data) = 0.1.1
Error: Package: nodejs-request-2.21.0-1.el6.noarch (epel)
Requires: npm(form-data) < 0.1
@brettporter
brettporter / bower-dependency-licenses.sh
Last active Dec 23, 2015
Get all licenses in list of Bower dependencies using jq
View bower-dependency-licenses.sh
# For each dependency's pkgMeta, get "license" if it exists, otherwise get the "type" field of each of "licenses", or "unknown" if that is also empty
# I'm sure there's a better way to do this with jq
bower list -jq | jq '.dependencies | to_entries[] | { (.key): .value | .pkgMeta | (.license // ((.licenses // [{type: "unknown"}])[] | .type)) }'
View grab_gem_repo.sh
#!/bin/sh
gem_dir=/tmp/gem-grab
gem_repo=http://my.gem.repo
set -e
gem list --source $gem_repo -r -a -u --prerelease | awk '/^[a-z]/' | while read t1
do
name=`echo $t1 | perl -n -e '/^([^\s]+)/ && print $1'`
@brettporter
brettporter / fix_maven_conflicts.rb
Created Feb 2, 2012
Automatically resolve conflicts in Maven POMs after a merge
View fix_maven_conflicts.rb
#!/usr/bin/env ruby
require 'tempfile'
require 'optparse'
def parse_version(text)
if (text.match(/^\s*<version>\s*(.*?)\s*<\/version>\s*$/))
$1
else
nil