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 |
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
// Based off an example from node-imap, will output a list of email addresses from your | |
// gmail sent folder (so you can copy/paste to the BCC field and let people know your | |
// sorry for using the same password all over the internet resulting in your buddies | |
// getting a lame spam message) | |
var ImapConnection = require('imap').ImapConnection, | |
imap = new ImapConnection({ | |
username: '{{replace}}@gmail.com', | |
password: '{{replace}}', | |
host: 'imap.gmail.com', |
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
If you ever run across this error again: | |
uninitialized constant Psych::Syck (NameError) | |
sudo gem update --system | |
IS NOT THE FULL ANSWER DUDE. Although it appears to work, worse problems lie ahead. The real cure is downloading/installing libyaml and re-installing ruby. Atleast that solved my hell. | |
$ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz | |
$ tar xzvf yaml-0.1.4.tar.gz |
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
# Objective: An association using STI should only query the db once for the base class | |
class Contact < ActiveRecord::Base | |
has_many :info, :class_name=>'::Contact::ContactInfo' | |
has_many :phones, :class_name=>'::Contact::Phone' | |
has_many :emails, :class_name=>'::Contact::Email' | |
has_many :addresses, :class_name=>'::Contact::Address' | |
# load all info's thorugh info | |
# this is possible due to how associations are mixed into the class via a module |
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
CREATE OR REPLACE FUNCTION dbo.contacts(account_id integer, user_id text, sync text) RETURNS text AS $$ | |
if (typeof DBO !== 'function') executeSql('SELECT dbo.init();'); | |
var Contacts = DBO.Contacts || DBO.extend('Contacts',{ | |
stiContact: function stiContact(contact) { | |
if (contact.type === 'company') { | |
delete contact.first_name; | |
delete contact.last_name; | |
delete contact.title; |