This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| from amqplib import client_0_8 as amqp | |
| import sys | |
| class Pups: | |
| def __init__(self, hostname): | |
| self.conn = amqp.Connection(host="%s:5672" % hostname, | |
| userid="guest", | |
| password="guest", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Handles SENDs to STOMP | |
| * Only tested with the rabbitmq stomp gateway and rabbitmq server 1.4.0 | |
| * Only supports sending message to stomp, no support for other commands | |
| * | |
| * Original source: http://code.google.com/p/simplisticstompclient/ | |
| * | |
| * Changes: Added ability to specify host |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # Stackless Bots | |
| # | |
| # Stackless is a version of python that allows "microthreads" (cooperative multitasking) | |
| # | |
| # OS X: http://www.stackless.com/binaries/stackless-2.6.2-macosx2009-06-09.dmg | |
| # others: http://zope.stackless.com/download/sdocument_view | |
| # | |
| # This is an example of launch 250 bots that simulate a client and make HTTP requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Flushing iptables..." | |
| iptables -F | |
| echo "SSH Allowed" | |
| iptables -A INPUT -p tcp --dport 22 -j ACCEPT | |
| echo "allow from localhost" | |
| iptables -A INPUT -i lo -j ACCEPT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Idea: | |
| If /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I returns an SSID that is my MiFi, then make periodic requests to http://192.168.1.1/getStatus.cgi?dataType=TEXT to show my current status (up/down/signal strength) in firefox's statusbar. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function setTimeout(callback, ms) { | |
| var _timer = Cc['@mozilla.org/timer;1'] | |
| .createInstance(Ci.nsITimer); | |
| _timer.initWithCallback({notify: callback}, ms, Ci.nsITimer.TYPE_ONE_SHOT); | |
| return _timer; | |
| } | |
| function clearTimeout(timer) { | |
| timer.cancel(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % experimenting with erlang (using misultin) to build a crappy S3-like service | |
| -module(s3). | |
| -export([start/1, stop/0, handle_http/1]). | |
| start(Port) -> | |
| misultin:start_link([{port, Port}, {loop, fun(Req) -> handle_http(Req) end}]). | |
| stop() -> | |
| misultin:stop(). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *.pyc | |
| *.beam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'digest/md5' | |
| def gfm(text) | |
| # Extract pre blocks | |
| extractions = {} | |
| text.gsub!(%r{<pre>.*?</pre>}m) do |match| | |
| md5 = Digest::MD5.hexdigest(match) | |
| extractions[md5] = match | |
| "{gfm-extraction-#{md5}}" | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (?xi) | |
| \b | |
| ( # Capture 1: entire matched URL | |
| (?: | |
| [a-z][\w-]+: # URL protocol and colon | |
| (?: | |
| /{1,3} # 1-3 slashes | |
| | # or | |
| [a-z0-9%] # Single letter or digit or '%' | |
| # (Trying not to match e.g. "URI::Escape") |