This file contains 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
# BruteForceKilla | |
# | |
# A Rack middleware to limit requests by ip address, coded for fun as my first | |
# middleware, thanks http://coderack.org for giving me a reason :) | |
# | |
# For production use, one would want to make a memcache or redis tracker. | |
# | |
# options: | |
# | |
# :tracker => Class name of the tracker to use (default Memory (all there is for now!)) |
This file contains 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
Cursor.prototype.streamRecords = function(callback) { | |
var | |
self = this, | |
stream = new process.EventEmitter(), | |
recordLimitValue = this.limitValue || 0, | |
emittedRecordCount = 0, | |
queryCommand = this.generateQueryCommand(); | |
// see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol | |
queryCommand.numberToReturn = 500; |
This file contains 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
Last login: Fri Aug 13 17:17:35 on ttys003 | |
troy:~ $ history | awk '{print $2}' | sort | uniq -c | sort -rn | head | |
173 node | |
89 git | |
36 cd | |
25 ls | |
20 ./script/server | |
15 sshebara | |
14 sc | |
12 ssh |
This file contains 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
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | |
def ensure_search_path! | |
return true if existing_path = Thread.current[:search_path] and @schema_search_path == Thread.current[:search_path] | |
if existing_path | |
@schema_search_path = Thread.current[:search_path] = existing_path | |
else | |
puts "WARNING::SETTING SEARCH_PATH TO SUB1,PUBLIC CUZ Thread.current[:search_path] is nil" | |
@schema_search_path = Thread.current[:search_path]='sub1,public' | |
end |
This file contains 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
var fs = require("fs"), | |
spawn = require('child_process').spawn; | |
var filename = process.ARGV[2]; | |
if (!filename) | |
return console.log("Usage: node <pgrecon.js> <filename>"); | |
var tail = spawn("tail", ["-f", filename]); | |
console.log("start tailing"); |
This file contains 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
iptables --append OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
# create a new chain | |
iptables --new-chain chk_apache_user | |
# use new chain to process packets generated by apache (replace apache with uid) | |
iptables -A OUTPUT -m owner --uid-owner apache -j chk_apache_user | |
# Allow 143 (IMAP) and 25 so that webmail works :) | |
iptables -A chk_apache_user -p tcp --syn -d 127.0.0.1 --dport 143 -j RETURN |
This file contains 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
# Date.parse() with Ruby 1.9 is now defaulting to the European date style where the format is DD/MM/YYYY, not MM/DD/YYYY | |
# patch it to use US format by default | |
class Date | |
class << self | |
alias :euro_parse :_parse | |
def _parse(str,comp=false) | |
str = str.to_s.strip | |
if str == '' | |
{} | |
elsif str =~ /^(\d{1,2})[-\/](\d{1,2})[-\/](\d{2,4})/ |
This file contains 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 ruby | |
require "whois" | |
require "hirb" | |
$results = [] | |
$alphebet = (97..122).map {|x| x.chr} | |
$base = "fit" | |
$alphebet.each do |letter| | |
["#{letter}#{$base}.com","#{$base}#{letter}.com"].each do |domain| |
This file contains 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
apt-get install gcc g++ build-essential libssl-dev libreadline5-dev zlib1g-dev linux-headers-generic libsqlite3-dev | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p180.tar.gz | |
./configure && make && make install |
This file contains 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
# download ImageMagick source from http://www.imagemagick.org/script/advanced-unix-installation.php | |
# get and install libjpeg | |
curl -O http://www.ijg.org/files/jpegsrc.v8c.tar.gz | |
cd jpeg-8c | |
./configure --enable-shared --prefix=/usr/local | |
make | |
sudo make install | |
# install imagemagick |
OlderNewer