Skip to content

Instantly share code, notes, and snippets.

@simonwistow
simonwistow / md5.wmls
Created May 3, 2023 18:07
Implementations of MD5 and SHA1 in WMLS (WAP Markup Language Script) all carefully constructed to keep them under the size of 1 UDP packet for max compatibility
/*
* A WML Script implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Copyright (C) Simon Wistow, 2001
*/
use url md5aux "md5_aux.wmlsc";
function calcMD5(str)
{
@simonwistow
simonwistow / Banana Tarte Tatin.md
Created November 19, 2019 23:17
Banana Tarte Tatin recipe
  1. Preheat oven to 200°C/400℉
  2. Roll out some puff pastry, store bought is absolutely fine
  3. Get a shallow pie tin or quiche pan (I tend to use 9.5" ones but any size is fine) and use it as a template to cut out a round of pastry
  4. Rub unsalted butter liberally all over the interior of the pan (salted should also be fine but omit the salt in Step 6)
  5. Sprinkle the inside of the pan liberally with brown sugar - I prefer Muscavado but this tart was just made with regular dark brown sugar which made it slightly lighter
  6. Optional Step: sprinkle some salt on the sugar (I use a couple of pinches of Maldon or Kosher salt for a 9.5" pan.) Alternatively some dark rum would be nice here. Or maybe some dark chocolate chips (although I've never tried that)
  7. Slice 2 or 3 bananas about 3cm/1" thick and then layer the slices in concentric circles starting from the outside, get as fancy with the layout as you'd like
  8. Lay the disc of pastry on top and then tuck down the edges inside the pan
  9. Bake for about 20-25 m

Keybase proof

I hereby claim:

  • I am simonwistow on github.
  • I am simonwistow (https://keybase.io/simonwistow) on keybase.
  • I have a public key whose fingerprint is 152C E5E0 FF2E DC34 4A4B F259 B137 98F6 4EA8 AFB0

To claim this, I am signing this object:

@simonwistow
simonwistow / caching_like_buttons.vcl
Last active August 29, 2015 14:04
Caching Like Buttons
#
# All of this can be done easily via the Fastly API but we present it here in VCL for brevity
# Simply create a new "Content" object and attach a request condition with the condition
# req.url ~ "^/like" && req.request == "POST"
# (or whatever your "like" API endpoint is).
#
# Then create a new Logging object and attach the same condition to it.
#
sub vcl_recv {
@simonwistow
simonwistow / tracking_create.pl
Last active August 29, 2015 14:01
Tracking cookie create
sub vcl_recv {
if (req.http.Cookie ~ "mycookie=") {
# The request does have a tracking cookie so store it temporarily
set req.http.Tmp-Set-Cookie = req.http.Cookie;
unset req.http.Cookie;
} else {
# The request doesn't have a tracking cookie so create one
set req.http.Tmp-Set-Cookie = if(req.http.Cookie, req.http.Cookie "; ", "") "mycookie=" digest.hash_md5(now randomstr(32) client.ip);
}
package SchemaLoader;
use strict;
sub schema {
my $class = shift;
my $table = shift;
my $dbh = shift;
my $db_type = $dbh->{'Driver'}{'Name'} or die 'Cannot determine DBI type';
my $sub = lc($db_type);
@simonwistow
simonwistow / tracking.pl
Last active August 29, 2015 14:01
Tracking cookies
sub vcl_recv {
if (req.http.Cookie ~ "mycookie=") {
# The request does have a tracking cookie so store it temporarily
set req.http.Tmp-Set-Cookie = req.http.Cookie;
unset req.http.Cookie;
} else {
# The request doesn't have a tracking cookie so force a miss
set req.hash_always_miss = true;
}
@simonwistow
simonwistow / slavorg2.pl
Created January 9, 2013 15:42
Version 2 (?) of the Slavorg op bot
#!/usr/bin/perl
use warnings;
use strict;
use POE;
use POE::Component::IRC;
use IO::Handle;
open DEBUG, ">>slavorg.log" or die "Can't open log file: $!\n";
DEBUG->autoflush(1);
@simonwistow
simonwistow / hf2k
Created October 19, 2012 16:50
Yahoo's old proprietary front end scripting language - HTML Form Two Thousand
# HF2K Example
<!-- if $^r.uri !="/search/dir_ukie" && $|req[r] && $|req[y] == "n" -->
##redirect http://uk.search.yahoo.com/search/dir_ukie?$^r.args
exit
<!-- endif -->
% cat error.pl
use strict;
use Dancer;
get '/' => sub {
send_error('foo');
};
dance;