Skip to content

Instantly share code, notes, and snippets.

View mdaniel's full-sized avatar

Matthew L Daniel mdaniel

View GitHub Profile
@mdaniel
mdaniel / har2maff.py
Created June 27, 2014 00:19
Convert HAR to MAFF
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from bs4 import BeautifulSoup
import hashlib
import logging
import json
import os
import sys
import re
@mdaniel
mdaniel / Vagrantfile
Last active August 29, 2015 14:00
Vagrant to provision a Storm cluster in VirtualBox
# -*- mode: ruby -*-
# vi: set ts=2 sts=2 sw=2 expandtab ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
$JVM =<<JVM
set -x
mkdir -p /usr/lib/jvm
cd /usr/lib/jvm
@mdaniel
mdaniel / Vagrantfile
Last active August 29, 2015 13:57
Vagrantfile for provisioning Sandstorm.io on Ubuntu 13.10
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
$script = <<SCRIPT1
## be aware this script runs as root
set -e
CAPNPROTO_GITROOT="https://github.com/kentonv/capnproto.git"
@mdaniel
mdaniel / org_to_pivotal.py
Created March 20, 2014 20:49
Using ``htmlize-buffer`` one can convert a clock-ed org file into a series of PivotalTracker chores
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
__docformat__ = 'reStructuredText'
"""
To use this:
1. Inside emacs issue ``(require 'htmlize)`` followed by ``M-x htmlize-buffer``
1. Save that buffer to a file
1. Run this script on the file
1. Profit!
@mdaniel
mdaniel / couchdb.yml
Created March 3, 2014 08:42
Ansible script for CouchDB on an Ubuntu Precise box
- hosts: all
sudo: true
vars:
couchdb_version: 1.5.0
couchdb_tar_256sum: abbdb2a6433124a4a4b902856f6a8a070d53bf7a55faa7aa8b6feb7127638fef
erlang_deb: http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_general/esl-erlang_16.b.3-2~ubuntu~precise_amd64.deb
tasks:
- name: apt-dependencies
apt: update_cache=yes pkg={{item}} state=present
with_items:
@mdaniel
mdaniel / Vagrantfile
Created February 19, 2014 00:01
Ansible script to provision GetSentry on a precise (Ubuntu 12.04) machine (or optionally the Vagrantfile); the script will provision to the point where you can run ``sentry init`` and its friends
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = '2'
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = 'precise'
config.vm.hostname = 'sentry1'
config.vm.network :private_network, ip: '192.168.56.105'
@mdaniel
mdaniel / JSoupFrame.java
Created February 17, 2014 06:45
Visualize and run some queries on the tree that JSoup produces
package org.jsoup.examples;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Node;
import org.jsoup.select.Elements;
import javax.swing.*;
import javax.swing.tree.*;
import java.awt.*;
@mdaniel
mdaniel / bs4visualizer.py
Created February 17, 2014 06:41
Use PyQt to visualize what BeautifulSoup4 sees when it ingests the html; the jsoup flavor of this actually allows one to run queries, so hopefully this one will, too (any minute now)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
__docformat__ = 'reStructuredText'
import sys
from bs4 import BeautifulSoup, NavigableString, Tag
from PyQt5.Qt import (
QApplication, QMainWindow, QMenuBar, QMenu, QTreeWidget, QTreeWidgetItem)
@mdaniel
mdaniel / microdata.py
Last active August 29, 2015 13:56
Dump discovered microdata descriptors (optionally along with their values) found in an HTML document
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import sys
from bs4 import BeautifulSoup
def show_em_all(soup, with_values):
# todo: some way of marking a nested itemtype as seen?
# maybe the upward tree traversal would yield a unique path
@mdaniel
mdaniel / bug.sh
Created February 4, 2014 05:01
Reproducible reposurgeon 3.2 unicode path bug
#! /bin/bash
set -e
mkdir orig
cd orig
git init
git fast-import <../original.fi
cd ..
echo -ne "read orig\nexpunge /.jar/\nwrite >bad.fi\n" | reposurgeon
mkdir bad
cd bad