Skip to content

Instantly share code, notes, and snippets.

@dholth
dholth / vagrant
Created September 15, 2016 18:38
Error compiling CouchDB 2 on a Centos7 Vagrant box
[vagrant@localhost tmp]$ sudo /vagrant/couchdb2.sh
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Including mirror: mirror.oss.ou.edu
Including mirror: mirrors.rit.edu
* epel: mirror.oss.ou.edu
Package autoconf-2.69-11.el7.noarch already installed and latest version
Package autoconf-archive-2016.03.20-1.el7.noarch already installed and latest version
Package automake-1.13.4-3.el7.noarch already installed and latest version
Package libcurl-devel-7.29.0-25.el7.centos.x86_64 already installed and latest version
@dholth
dholth / acmd.py
Last active June 3, 2016 14:27
Write setuptools' setup_requires and tests_require to a file in egg_info. As is always the case with setuptools, it still installs setup_requires as a side effect.
def requires_writer(cmd, basename, filename):
cmd.write_file("setup_requires", filename,
str(cmd.distribution.setup_requires) + '\n' +
str(cmd.distribution.tests_require) + '\n')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Build a pip-compatible sdist for the flit package in the current directory.
"""
import flit, zipfile, os.path
def build_sdist():
# build wheel
@dholth
dholth / setup.py
Created May 18, 2014 13:01
setup.py setup_requires implementation, first stab. To install things that are imported by setup.py itself.
#!/usr/bin/env python
# Install setup-requires before running setup.py
import sys
sys.path[0:0] = ['setup-requires']
import os, subprocess, pkg_resources
try:
requirements = [x.strip() for x in open('setup-requires.txt', 'r').readlines()]
@dholth
dholth / ipgk.info
Created September 13, 2012 15:25
Simple ipkg.info from Bento
{
"executables": {},
"file_sections": [
{
"category": "pythonfiles",
"target_dir": "$sitedir",
"name": "bentest",
"files": [
[
"bentest/__init__.py",
@dholth
dholth / wheeldemo.sh
Created July 2, 2012 13:09
Python bdist_wheel (binary package format) demo
#!/bin/sh
# bdist_wheel demo
# Create environment
virtualenv /tmp/wheeldemo
cd /tmp/wheeldemo
# Install wheel and patched pip, distribute
bin/pip install -e hg+https://bitbucket.org/dholth/wheel#egg=wheel -e hg+https://bitbucket.org/dholth/distribute#egg=distribute -e git+https://github.com/dholth/pip.git#egg=pip
@dholth
dholth / entry_points.txt
Created May 31, 2012 18:51
Find entry points the hard and wrong way
def getname(t):
if isinstance(t, ast.Attribute):
return getname(t.value)
elif isinstance(t, ast.Name):
return t.id
else:
return t
class EntryPointsVisitor(ast.NodeVisitor):
def visit_Assign(self, node):
@dholth
dholth / index.html
Created February 16, 2012 15:03
window.location.reload() / PhoneGap 1.4.0 / Android 3.2.1
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>PhoneGap window.location.reload() on Honeycomb</title>
</head>
<body>
<script>
var reloadMe = function() {
window.localStorage['foobar'] = Number(window.localStorage['foobar'] || 0) + 1;
@dholth
dholth / basic.svg
Created November 16, 2011 21:01
svgweb fail
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dholth
dholth / gradient.js
Created November 15, 2011 20:20
d3.js + svg gradients
var svg = d3.select("body")
.append("svg:svg")
.attr("width", 256)
.attr("height", 256);
var defs = svg.append('svg:defs');
defs.append('svg:linearGradient')
.attr('gradientUnits', 'userSpaceOnUse')
.attr('x1', 0).attr('y1', 0).attr('x2', 20).attr('y2', 0)