Skip to content

Instantly share code, notes, and snippets.

View dragon3's full-sized avatar
🍺
🍺 🍻 🍺 🍻 🍺

Ryuzo Yamamoto dragon3

🍺
🍺 🍻 🍺 🍻 🍺
View GitHub Profile
@olympum
olympum / BigPipeContinuationServlet.java
Created July 14, 2010 05:38
BigPipeContinuationServlet
public class BigPipeContinuationServlet extends HttpServlet {
private HttpClient httpClient;
@Override
public void init() throws ServletException {
httpClient = new HttpClient();
httpClient.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL);
httpClient.setMaxConnectionsPerAddress(200); // max 200 concurrent connections to every address
httpClient.setThreadPool(new QueuedThreadPool(250)); // max 250 threads
@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',
Starman:
- Preforking standalone HTTP server
- Based on Catalyst::Engine::HTTP::Prefork by Andy Grundma
- Ported to Plack by Tatsuhiko Miyagawa
- Uses Net::Server::PreFork
- Supports HTTP/1.1
- Pipelined requests
- Chunked request/response
- Keep-Alives
- Graceful restart with HUP (No shutdown with QUIT yet)
use inc::Module::Install;
use Module::Install::TestTarget;
name 'MyApp';
all_from 'lib/MyApp.pm';
requires 'DBI';
requires 'JSON';
test_requires 'Test::More';
@samuel
samuel / backup.py
Created November 8, 2010 22:42
A script to automate freezing XFS and locking MongoDB and snapshotting EBS volumes
#!/usr/bin/env python
from __future__ import with_statement
import contextlib
import logging
import os
import sys
import urllib2
from boto.ec2.connection import EC2Connection
> package = stitch.createPackage({ paths: ['basecamp-mobile/lib'] })
> package.findRequires(function(err, requires) { console.log(requires) })
> [ 'cinco/application',
'cinco/date_time',
'cinco/collection',
'cinco/util',
'basecamp/collections/collection',
'basecamp/models/comment',
'basecamp/models/company',
'basecamp/models/milestone',
@hirose31
hirose31 / gist:1006095
Created June 3, 2011 09:32
bash completion for dotcloud
### dotcloud 0.3.1
# must be load .bash_completion (http://bash-completion.alioth.debian.org/)
# before load this file.
# expire_in filename expire_seconds
# expire_in foo.cache 300 # return true if go by 5min from last modification.
expire_in() {
local file=$1
local expire=$2
@makamaka
makamaka / gist:1161799
Created August 22, 2011 06:36
YAPC::Asia Tokyo 2011 上司の説得が必要な方へ

この文章は http://www.adobe.com/jp/joc/max2011/cyb/index.html (Adobe MAX 2011 : 上司の説得が必要な方へ)一般向けテンプレートが元ネタです。ネタを活かしきれていないですがご容赦を。(下記テンプレの文責はmakamakaに帰しますが、実際に使用した結果の責任は負いかねます)

#上司の説得が必要な方へ

「YAPC::Asia Tokyo 2011に参加したいが、上司が首を縦に激しく振ってくれない」という方のために、YAPC::Asiaに参加するメリットをアピールするための文章テンプレートを用意しました。ぜひ、カスタマイズしてご利用ください。っていうか、そのまま使うのはおやめください。

@yyuu
yyuu / find-orphaned-snapshots.py
Created February 17, 2012 08:35
find snapshot which is not referenced from any AMIs
#!/usr/bin/env python
#
# find snapshots which is not referenced from any AMIs
#
import boto.ec2
import boto.ec2.image
import boto.exception
import os
import re