Skip to content

Instantly share code, notes, and snippets.

@graymouser
graymouser / hb_all_books_dl.js
Created February 28, 2016 14:09
Humble bundle book bundles - download all books at once
/*
After purchasing a humble book bundle, go to your download page for that bundle.
Open a console window for the page and paste in the below javascript
*/
$('a').each(function(i){
if ($.trim($(this).text()) == 'MOBI') {
$('body').append('<iframe id="dl_iframe_'+i+'" style="display:none;">');
document.getElementById('dl_iframe_'+i).src = $(this).data('web');
}
});
@Util
Util / hyper_benchmark.p6
Created February 11, 2016 13:51
Perl 6 benchmark for Atlanta.pm to play with on new massive multicore server
use v6;
# 2016-02-09 <bruce.gray@acm.org>
my $length = @*ARGS.shift;
say "Length = $length";
my @x = 1..$length;
my @y = @x.reverse;
@Util
Util / Notes
Last active December 19, 2015 01:58 — forked from Woody2143/Schwartzian.pl
A reply to the original (prefork) version.
1. Spelling corrected: Schwartzian transform
2. No need to use parens around \d{8}.
3. I like ST better, but GRT is faster for large lists:
http://www.perlmonks.org/?node_id=145659
4. Need to warn or die to show bad data when regex fails.
5. Perl 6 automatically does ST for you:
my @sorted = @files.sort({ / SWITCH _ \d**8 _ (\d**6) / or die; $0; });
@Woody2143
Woody2143 / Index.pm
Created October 16, 2012 14:07
Moose Customer Error on Type Constraint Violation
package Index;
use Mouse;
use namespace::autoclean;
use Index::Types;
has 'date' => (
is => 'rw',
isa => 'Index::Types::Date',
@zigorou
zigorou / pf_with_data_structure.pl
Created December 19, 2011 18:03
Parallel::ForkManager and aggregate results
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dump qw(dump);
use Parallel::ForkManager 0.7.6;
my @servers = map { sprintf("svr%03d", $_) } (1 .. 1000);
my %results;
@mvickers
mvickers / some_website
Created October 20, 2011 05:05
Basic Centos init script for Dancer apps
#!/bin/sh
#
# some_website - this script starts and stops some_website
#
# chkconfig: - 85 15
# description: Some website description
# pidfile: /var/run/plackup.some_website.pid
PID=/var/run/plackup.some_website.pid
@ironcamel
ironcamel / index.tt
Created December 20, 2010 09:01
A simple websocket web app using the Dancer web framework http://perldancer.org
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
var socket;
$(function() {
// ws_path should be of the form ws://host/_hippie/ws
var ws_path = "ws:<% request.base.opaque %>_hippie/ws";