Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / 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 / 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 / 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
Created July 29, 2014 03:56
mesos on Vagrant
# -*- 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 = 'trusty64'
config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box'
@mdaniel
mdaniel / Vagrantfile
Created August 6, 2014 21:22
Kafka on Vagrant
# -*- 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 = 'trusty-server-cloudimg-amd64-vagrant-disk1'
config.vm.box_url = 'http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box'