Skip to content

Instantly share code, notes, and snippets.

centauri :: ~/test » cat x.txt
lkdjafs
lsjdkflkasjdf;lkajsdf
ajdsf
akjsdf
dsjflkasdfj
Installed Groups
a
Facter.add('yum_installed_groups') do
setcode do
state = -1
groups = [[], []]
%x{/usr/bin/yum grouplist -v}.each_line do |line|
if line.match('Installed Groups')
state = 0
elsif line.match('Available Groups')
state = 1
end
@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)
@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 / 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 / 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 / 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 / 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 / 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()]
#!/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