Skip to content

Instantly share code, notes, and snippets.

import datetime as dt
import time
import unittest
def aws_age_seconds(ec2_launch_time):
"""
Parse the ec2 launch time string and return how old it is in seconds.
"""
# Strip trailing subsecond part
Our supermarket's quest for global reach has prompted us to open a new supermarket - we sell only three products:
Product code | Name | Price
-----------------------------------------
FR1 | Fruit tea | £3.11
SR1 | Strawberries | £5.00
CF1 | Coffee | £11.23
The CEO is a big fan of buy-one-get-one-free offers and of fruit tea. He wants us to add a rule to do this.
@digitales
digitales / gist:11368046
Created April 28, 2014 10:36
FastCGI authentication header fix
<?php
/**
* Plugin Name: Drew FastCGI authentication
* Description: This works along side the .htaccess to support the PHP_AUTH_PW that are stripped by the PHP FastCGI process
* Author: Ross Tweedie
* Author URI: http://drewlondon.co.uk/
* Version: 0.1
* Plugin URI:
*/
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
Current User Status Module
Create a Drupal module in either Drupal 6 or 7 to fulfil the following criteria.
1. We wish to display a simple status on a User's profile page. For example "John Appleseed is currently [STATUS]" or "John Appleseed is currently not [STATUS]". [STATUS] could be replaced by something like "in the office" or "listening to music". This setting should be an on/off toggle switch.
2. The status will need to be a configurable value from its own settings page. Once the status value is set for the site, it should not need to be changed. This could take the form of a drop down menu or radio buttons with pre-configured values or a text box with one value.
3. There should be access restrictions in place to control who is allowed to change this setting.
4. The User Profile page also needs a restriction in place to who can alter the user's status.
5. The complete history of a user's status should be stored in its own database table along with a time reference.
6. A block should be available to
@digitales
digitales / dg-php.txt
Created December 7, 2012 09:51
A tweaked version of the Headshift PHP coding test
Dachis Group's quest for global reach has prompted us to open a supermarket - we sell only three products:
Product code | Name | Price
-----------------------------------------
FR1 | Fruit tea | £3.11
SR1 | Strawberries | £5.00
CF1 | Coffee | £11.23
The CEO is a big fan of buy-one-get-one-free offers and of fruit tea. He wants us to add a rule to do this.