Skip to content

Instantly share code, notes, and snippets.

Avatar
🦄
Why does GitHub need statuses?

Alice wheresalice

🦄
Why does GitHub need statuses?
View GitHub Profile
@wheresalice
wheresalice / gist:112195
Created May 15, 2009
Display open Trac tickets modified in the past 10 days
View gist:112195
SELECT p.value AS __color__,
id AS ticket, summary, component, version, t.type AS type,
owner, status,
time AS created,
changetime AS _changetime, description AS _description,
reporter AS _reporter
FROM ticket t, enum p
WHERE status <> 'closed'
AND unix_timestamp(date_sub(now(), interval 10 day)) < changetime
AND p.name = t.priority AND p.type = 'priority'
@wheresalice
wheresalice / gist:112197
Created May 15, 2009
redacted code which goes through a Drupal database subscribing all new users to a Mailman list on a separate server. Relies upon Drupal Drush module and Mailman XMLRPC2 patch.
View gist:112197
import os
import xmlrpclib
proxy = xmlrpclib.ServerProxy("https://lists.mydomain.org/mailman/RPC2")
def nicepass(alpha=6,numeric=2):
"""
returns a human-readble password (say rol86din instead of
a difficult to remember K8Yn9muL )
"""
@wheresalice
wheresalice / gist:112198
Created May 15, 2009
Training Bogofilter with virtual imap users
View gist:112198
#!/bin/sh
#retrain_bogofilter.sh
#Version 2.0
#jkv@unixcluster.dk - free for all
#kaerast at qvox - modifications, free for all
#Prerequisites:
# - formail
# - bogofilter
@wheresalice
wheresalice / in-out_gui.php
Created Jan 3, 2010
PHP-GTK/CouchDB PoC code to set status of an in/out board
View in-out_gui.php
<?php
$couch_dsn = "http://localhost:5984/";
$couch_db = "inout";
// libraries come from http://github.com/dready92/PHP-on-Couch
require_once "../lib/couch.php";
require_once "../lib/couchClient.php";
require_once "../lib/couchDocument.php";
$client = new couchClient($couch_dsn,$couch_db);
View in-out_status.php
<?php
$couch_dsn = "http://localhost:5984/";
$couch_db = "inout";
require_once "../lib/couch.php";
require_once "../lib/couchClient.php";
require_once "../lib/couchDocument.php";
$client = new couchClient($couch_dsn,$couch_db);
@wheresalice
wheresalice / gist:271161
Created Jan 7, 2010
Select somebody's name or email address, then use this bookmarklet to search for them on Facebook. It can probably be refactored, but I'm not Javascript expert
View gist:271161
javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.facebook.com/search/?ref=ffs&q=',l=d.location,e=encodeURIComponent,p=e(s)+'&o=2048&init=ffs',u=f+p;{a%20=function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=450,height=430'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}void(0);
@wheresalice
wheresalice / Hash Analyzer
Created Apr 2, 2010
PHP code to analyse password hashes. See it running at hash.kaerast.info
View Hash Analyzer
<html>
<body>
<ul>
<?php
$myhash = $_GET['hash'];
$hash = array();
switch ( strlen($myhash)) {
case(0):
$hash[] = "No hash passed";
break;
@wheresalice
wheresalice / drupal.rb
Created Apr 8, 2010
Very basic test suite using Watir to ensure a Drupal site is working
View drupal.rb
#!/usr/bin/ruby1.9.1
require "rubygems"
require "test/unit"
require "watir"
$site = ARGV[0]
puts $site
if ($site[-1,1] != "/")
puts "url must end in a slash"
exit
end
@wheresalice
wheresalice / drupal_spec.rb
Created Apr 8, 2010
rspec file to check the basics of a Drupal site
View drupal_spec.rb
require 'rubygems'
require 'watir'
require 'spec'
Watir::Browser.default = 'firefox'
describe "test Drupal frontend" do
before(:each) do
@browser ||= Watir::Browser.new
@domain ||= 'example.org'
@wheresalice
wheresalice / testgoogle.rb
Created Apr 14, 2010
A really simple example of using webrat and rspec for integration testing
View testgoogle.rb
require 'rubygems'
require 'webrat'
require 'spec/test/unit'
include Webrat::Methods
include Webrat::Matchers
Webrat.configure do |config|
config.mode = :mechanize
end