Skip to content

Instantly share code, notes, and snippets.

@mdaniel
mdaniel / gradle-2.x.patch
Created January 13, 2016 02:24
Gradle patches that permit the use of a jarsigned plugin (as well as fixing two NPEs)
This patch was tested against every 2.x release tag in https://github.com/gradle/gradle.git and applies cleanly to all of them,
except for the following error message:
> warning: inexact rename detection was skipped due to too many files.
> warning: you may want to set your merge.renamelimit variable to at least 4384 and retry the command.
diff --git a/subprojects/core/src/main/groovy/org/gradle/api/internal/AsmBackedClassGenerator.java b/subprojects/core/src/main/groovy/org/gradle/api/internal/AsmBackedClassGenerator.java
index abbb13b..6e9f26d 100644
--- a/subprojects/core/src/main/groovy/org/gradle/api/internal/AsmBackedClassGenerator.java
+++ b/subprojects/core/src/main/groovy/org/gradle/api/internal/AsmBackedClassGenerator.java
@mdaniel
mdaniel / __main__.py
Created January 6, 2016 08:15
Driver for https://github.com/Roguelazer/onepasswordpy.git; ```mkdir onepassword/cli; touch onepassword/cli/__init__.py``` then put this `__main__.py` into `onepassword/cli` and invoke it with `python -m onepassword.cli -k path/to/my/keystore --list`
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import json
import sys
from getopt import getopt
from getpass import getpass
# this is a factory method that one can find in "keychain.patch" below
from ..keychain import load_keychain
@mdaniel
mdaniel / ec2-fingerprint-key.sh
Created January 5, 2016 20:09
Create EC2 fingerprints for local PEM files
#! /bin/sh
# q.v. http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html#verify-key-pair-fingerprints
for i in "$@"
do
echo "== $i =="
echo " if *AWS* generated the key, it's fingerprint will be:"
openssl pkcs8 -in "$i" -inform PEM -outform DER -topk8 -nocrypt | openssl sha1 -c
echo " if *you* generated the key, it's fingerprint will be:"
openssl rsa -in "$i" -pubout -outform DER 2>/dev/null | openssl md5 -c
echo
@mdaniel
mdaniel / update-alternatives-for-jdk.sh
Last active December 8, 2015 21:40
Uses the Debian/Ubuntu update-alternatives system to wire in a Sun/Oracle JDK as preferential
#! /bin/sh
set -e
# --install link name path priority
# --slave link name path
## link := the fully-qualified symlink path /usr/bin/java
## name := `basename $link` (for the most part)
## path := the fully-qualified alternative path
## openjdk priority is 1700017
target_java=$1
@mdaniel
mdaniel / Dockerfile.sentry
Last active November 28, 2015 08:43
Just what the filename says; I much prefer the "I can upgrade whenever I'd like" model to the "wait for the magic docker-hub version to rain down from our sentry.com overloads" version, what with it being an Open Source and on-premise model, and all that. Plus, mine is 327MB - without even trying to optimize it - and theirs is 837MB so ppfffttt.
FROM debian:jessie
# you are welcome to skip these, they just make cycle times faster
# plus, you'll need those libxml2-dev (etc) dependencies and about 15 minutes
# while it rebuilds everything from scratch
## ADD debian_jessie_var_cache_apt.tar /
# pip/wheels/2d/f6/d6/158b79cc088e551305968e312953c9767855a36f39d4e16054/lxml-3.5.0-cp27-none-linux_x86_64.whl
# just be aware that /root/.cache/pip
# must be owned by root or pip won't use them
## ADD root_cache_pip.linux.tar /root
@mdaniel
mdaniel / Vagrantfile
Created November 20, 2015 02:02
Vagrant to bring up sonarqube
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/wily64"
config.vm.hostname = "sonarqube"
config.vm.network "private_network", ip: "192.168.99.101"
config.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
end
@mdaniel
mdaniel / fetch_confluence.sh
Created July 24, 2015 01:18
Mirror a Confluence repo, one dir at a time
#! /bin/bash
set -eu
: '
`http://<confluenceURL>/plugins/servlet/confluence/default`
For example if your Confluence URL is
`http://foo.atlassian.net/wiki`
you would enter:
`http://foo.atlassian.net/wiki/plugins/servlet/confluence/default`
This script is designed to action "index.html", so to bootstrap the
@mdaniel
mdaniel / Vagrantfile
Created July 7, 2015 03:39
Vagrantup pg_shard
# -*- mode: ruby -*-
# vi: set ft=ruby sw=2 sts=2:
# this controls which are implictly trusted by pg
my_subnet = "192.168.33.0/24"
host_by_ip = {
"192.168.33.10" => "pg-master",
"192.168.33.11" => "pg-slave-1",
"192.168.33.12" => "pg-slave-2",
}
2015-05-27 15:36:49 -0700
hack/make.sh
dynbinary
# WARNING! I don't seem to be running in the Docker container.
# The result of this command might be an incorrect build, and will not be
# officially supported.
#
# Try this instead: make all
@mdaniel
mdaniel / hidemyass_proxylist.py
Created May 10, 2015 20:17
Extracts the proxy list from proxylist.hidemyass.com
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
__docformat__ = 'reStructureText'
import logging
import re
import sys
import html5lib
from xml.etree.ElementTree import tostring