Skip to content

Instantly share code, notes, and snippets.

from django import forms
from django.core.exceptions import ValidationError
from commis.api.cookbook.models import CookbookRecipe
from commis.api.node.models import Node
from commis.api.role.models import Role
class MultipleChoiceAnyField(forms.MultipleChoiceField):
"""A MultipleChoiceField with no validation."""
@coderanger
coderanger / git_plugin.py
Created February 16, 2011 00:21
Display the git branch of the file in the status bar
import itertools
import sublime
import sublime_plugin
import os
import subprocess
import threading
import time
def remove_longest_substring(s1, s2):
for i, (c1, c2) in enumerate(itertools.izip_longest(s1, s2)):
action :append do
execute "cat #{new_resource.line} >>#{new_resource.path}" do
not_if "grep '#{new_resource.line}' #{new_resource.file}"
end
end
import inspect
from django import forms
from django.contrib.auth.forms import UserChangeForm
from django.contrib.auth.models import User
from django.core.paginator import Paginator
from django.shortcuts import get_object_or_404
from django.utils.datastructures import SortedDict
import nexus
@coderanger
coderanger / spng_-_hobopolis_manager.user.js
Created December 15, 2010 20:14
Updated version of the SPNG RaidManager to display Uncle Hobo and Sorority House loot
// SPNG Raid Manager
// Questions, comments, bug reports or donations to: magnet0
//
// Updated points values and current maintenance handled by magnet0
//
// ==UserScript==
// @name SPNG - hobopolis manager
// @namespace http://userscripts.org/scripts/source/86676.user.js
// @description Version 2.41 - modifed from slyz version of Dr3v1's Raid Log Manager
// @include *kingdomofloathing.com/topmenu.php*
include_recipe "collectd"
class ChefCollectdPluginReportHandler < Chef::Handler
def report
Chef::Log.info('Running collectd hander')
node[:last_success_time] = Time.now.to_f
node[:error_count_since_success] = 0
node.save
end
end
@coderanger
coderanger / plans.txt
Created November 21, 2010 02:56
Cell plan prices. Family is for 2 lines, all plans assume "unlimited" data (2GB for AT&T).
T-Mobile:
unlimited - personal = $100
1500 - personal = $80
1000 - personal = $90
500 - personal = $80
unlimited - family = $180
3000 - family = $150
1500 - family = $160
750 - family = $140
# This is the entire preseed config file used on an example Lucid system. See the preseed
# documentation for more information on the options here. This will use US English by default.
#
# https://help.ubuntu.com/10.04/installation-guide/amd64/preseed-contents.html
#
# This preseed will automatically install Ubuntu 10.04 with default options. Understand what
# it is doing before you use it.
#
# Boot Options line:
#
@coderanger
coderanger / bittentest.py
Created October 28, 2010 18:56
XML report generation for Django unittests
import os
from django.conf import settings
from south.management.commands import test
class Command(test.Command):
help = test.Command.help.rstrip('.') + ' with special output for Bitten.'
def handle(self, *test_labels, **options):
@coderanger
coderanger / db_server.rb
Created October 20, 2010 23:29
Create postgres users and databases from Chef
#
# Cookbook Name:: atari
# Recipe:: db_server
#
# Copyright 2010, Atari
#
# All rights reserved
#
include_recipe "postgresql::server"