Skip to content

Instantly share code, notes, and snippets.

@alexmuller
alexmuller / OCO-contextual-help.html
Created October 16, 2010 10:36
Experimenting with the HTML (and CSS) for some kind of float-y help for OCO
<div class="help" style="border-top-left-radius: 6px 6px; border-top-right-radius: 6px 6px; border-bottom-right-radius: 6px 6px; border-bottom-left-radius: 6px 6px; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgb(246, 246, 246)), to(rgb(225, 226, 238))); background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; float: right; font-size: 12px; padding-top: 4px; padding-right: 6px; padding-bottom: 4px; padding-left: 6px; margin-top: -55px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(0, 0, 0); border-right-color: rgb(0, 0, 0); border-bottom-color: rgb(0, 0, 0); border-left-color: rgb(0, 0, 0); width: 130px; margin-right: 328px; text-shadow: rgb(153, 153, 153) 0px 0px 5px; background-position: initial initial; background-repeat: initial initial; ">Type in your o
@alexmuller
alexmuller / gist:1007870
Created June 4, 2011 12:45
Problem running rake db:migrate
alexmuller@Muller-MacBookPro one-click-orgs $ rake db:migrate
(in /Users/alexmuller/dev/one-click-orgs)
== ConvertProposalsToStateMachine: migrating =================================
-- add_column(:proposals, :state, :string)
-> 0.0010s
rake aborted!
An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such column: members.state: SELECT "members".* FROM "members" WHERE "members"."email" = 'hi@example.com' AND ("members".organisation_id = 6) AND ("members"."state" IN ('active')) LIMIT 1
@alexmuller
alexmuller / hex_md5.js
Last active June 17, 2022 18:48
Display Gravatar when user has finished typing their email address
/*
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
@alexmuller
alexmuller / random-mac.sh
Last active September 28, 2015 19:38
Change MAC address
# Works on a MacBook Pro running OS X 10.6.8 up to 10.8.5 at least
# May break other stuff
# Take a note of your current MAC address to restore it later
ifconfig en1 | grep ether
# Disassociate from any connected Wi-Fi networks
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -z
# Set wireless MAC address to something random
# The Python comes from @pearfalse on Twitter
sudo ifconfig en1 ether $(python -c 'import random;print":".join(["%02x"%random.randint(0,255)for x in range(6)])')
@alexmuller
alexmuller / modalloc.py
Created February 10, 2012 16:18
An algorithm to allocate optional modules to university students
#!/usr/bin/python
from gurobipy import *
from printtable import *
import random, string
print "=========================================================="
print "============ MODULE ALLOCATION: GUROBI SOLVER ============"
print "=========================================================="
@alexmuller
alexmuller / install.md
Created September 23, 2012 07:50
How to install Tweet Nest with OAuth for a protected account

Requirements

Unfortunately, I don't think you can set up multiple accounts in the same Tweet Nest install at the moment. You'll have to have two different directories with the Tweet Nest software, but they can reference the same database as long as you enter a different table name prefix during setup.

Obviously, for your private account, you'll want to password protect the directory it's in. On Apache this is fairly easy, not sure about others.

<title>Feel Good</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<body>
<style type="text/css">
body {
background: #333;
margin: 10px;
}
@alexmuller
alexmuller / lighfe.automysqlbackup.sh
Last active December 18, 2015 10:29
automysqlbackup for my webserver
#!/bin/bash
#
# MySQL Backup Script
# VER. 2.5 - http://sourceforge.net/projects/automysqlbackup/
# Copyright (c) 2002-2003 wipe_out@lycos.co.uk
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
Hook: campfire
alphagov/backdrop-pingdom-collector: Not setup
alphagov/backdrop-ga-realtime-collector: Yep (govuk#Zeitgeist, [redactedtoken])
alphagov/backdropsend: Yep (govuk#Zeitgeist, [redactedtoken])
alphagov/limelight: Yep (govuk#Zeitgeist, [redactedtoken])
alphagov/libretto: Not setup
alphagov/backdrop-ga-collector: Yep (govuk#Zeitgeist, [redactedtoken])
alphagov/backdrop-ga-collector-private: Not setup
alphagov/backdrop-collector: Not setup
alphagov/backdrop-google-spreadsheet-collector: Yep (govuk#Zeitgeist, [redactedtoken])
[
{
"userName": "alphagov",
"repo": "backdrop"
},
{
"userName": "alphagov",
"repo": "backdrop-collector"
},
{