Skip to content

Instantly share code, notes, and snippets.

@mala
mala / memcachedos.pl
Created August 13, 2010 11:49
DoS for memcached
#!/usr/local/bin/perl
# DoS tool for memcached
# ulimit -n 15000; perl memcachedos.pl 127.0.0.1 11211 3
# original: http://gist.github.com/522741
# This is Public Domain Software
use strict;
use warnings;
use AnyEvent;
# vim: ft=perl:
use strict;
use warnings;
use Plack::Builder;
use Plack::App::WrapCGI;
use Plack::App::URLMap;
builder {
enable 'Static',
diff --git a/lib/Starman/InputStream.pm b/lib/Starman/InputStream.pm
new file mode 100644
index 0000000..e0cfc38
--- /dev/null
+++ b/lib/Starman/InputStream.pm
@@ -0,0 +1,121 @@
+use strict;
+use warnings;
+
+# -----------------------------------
=head1 NAME
Plack::Loader - (auto)load PSGI/Plack Servers
=head1 SYNOPSIS
#!/usr/bin/env perl
# printenv-like app in PSGI, F?CGI, AnyEvent, Coro, POE or Danga::Socket
use strict;
use warnings;
use Data::Dumper;
my @r;
my $text = q{@hoge http://example.com/#@hoge/ aaa #hash aaa @hogehoge aaa http://example.com/};
my $re = qr{(http://[A-Za-z0-9_\-\~\.\%\?\#\@/]+(?{push @r, ["HTTP", @-,@+] })|(?:^|\s)\@[A-Za-z0-9_]+(?{push @r,["AT", @-,@+]})|(?:^|\s)#[A-Za-z0-9_]+(?{push @r,["HashTag",@-,@+]}))};
warn $text;
() = $text =~/$re/g;
warn Dumper @r;
#!/usr/bin/env perl
use strict;
use warnings;
my $input = shift or die "Usage: $0 Masayoshi";
my %phoetic_alphabet;
while(<DATA>) {
chomp;
my ($letter, $word) = split(/\s+/, $_, 2);
@octplane
octplane / mongo_pubsub.rb
Created November 9, 2010 16:17
Simple Pub/Sub system using MongoDB, capped collections and tailable cursors in ruby
require 'rubygems'
require 'mongo'
module MongoPubSub
QUEUES_COLLECTION = 'queues'
class EndSubscriptionException < Exception; end
class Publisher
def initialize(queue_name, mongo_connection)
# Initialize queue collection as a capped collection
if not mongo_connection[QUEUES_COLLECTION].collection_names.include?(queue_name)
#!/usr/bin/env perl
use strict;
use warnings;
use Pod::Usage;
use Text::Markdown 'markdown';
use HTML::TreeBuilder;
use List::Util 'max';
@sekimura
sekimura / infinite-scroll-typepad-entries.html
Created February 9, 2011 21:32
infinite scroll typepad blog entries
<div id="post-assets"></div>
<div class="module-header" id="loading-more-assets"><img src="http://static.typepad.com/.shared:v20110208.01-0-gebb190b:typepad:en_us/images/spinner.gif"/></div>
<style>
.entry-content {
border-bottom: solid 1px #CCC;
padding-bottom: 10px;
margin-bottom: 10px;
padding-top: 10px;
}
@audreyt
audreyt / gist:834671
Created February 19, 2011 00:31 — forked from fujiwara/gist:732822
mt.psgi (for both Melody and MT5)
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
use Plack::Builder;
use Plack::App::CGIBin;
my $basedir = dirname(__FILE__);