Skip to content

Instantly share code, notes, and snippets.

View jpignata's full-sized avatar

John Pignata jpignata

View GitHub Profile
#!/usr/bin/env ruby
require 'pcaplet'
Pcaplet.new('-i en1 -s 1500').each do |packet|
if packet.class == Pcap::TCPPacket and !packet.tcp_data.nil?
words = packet.tcp_data.split
words.reject! { |word| word.match(/[^A-Za-z]/) || word.length < 5 }
random_word = words[rand(words.size)]
system("clear && figlet -c #{random_word}") if random_word
end
@jpignata
jpignata / isreg.sh
Created October 24, 2009 23:36 — forked from jseifer/gist:217637
isreg() { test "`dig +short soa $1`" && echo "Yes" || echo "No"; }
# jp@populuxe:~$ isreg pivotallabs.com
# Yes
# jp@populuxe:~$ isreg everydayhealth.com
# Yes
# jp@populuxe:~$ isreg gov
# Yes
# jp@populuxe:~$ isreg mcfakester.fake
# No
ws() { dig +short txt `echo $* | sed 's/ /_/g'`.wp.dg.cx | sed 's/" "//g'; }
# jp@populuxe:~$ ws Root Beer
# "Root beer is a carbonated beverage originally brewed using sassafras. Root beer, popularized in North
# America, comes in two forms: alcoholic and soft drink. The historical root beer was analagous to small
# beer, in that the process provided a beverage with a very low alcohol content.
# http://en.wikipedia.org/wiki/Root_beer"
require 'nokogiri'
module Rack
class Geocities
UC_IMAGES = ['HeHeartlandForest8728imagesunderconstruction.gif','CoCollegePark8762construct.gif','HeHeartlandFlats7015underconstruction.gif','SunsetStripUnderground1358YellowandBlackconstructiontape.gif','AtAthensAcropolis6558underconstruction.gif','CoColosseumField1484lconstruct2.gif','CoColosseumSlope5759_themesconstruction-zonesurbhorsa.gif','AtAthensStyx4519under_construction.gif','Atlantis8384CONSTRUCTION.gif','CaCapeCanaveral3537construct_line_2.gif','Chamber6387artconstruct_line_1.gif','HeHeartland5384construct_line_bird.gif','HoHollywoodHeights8983construct_line_1.gif','HoHollywoodLot6593picturesconstruction_line.gif','ReResearchTriangleThinktank5966graphicconstruct_line_1.gif','SiSiliconValleyHeights6393construct1.gif','knknrlrthmlrmiscconstructionbanner.gif','mmmmcloggersPicturesextrasconstructionline.gif','AtAthensAcademy9957construction_line.gif','EnEnchantedForestDell2878ConstructionLine.gif','CaCapeCanaveralCampus4717construction1.gif','HoHo
begin
mysql = DBI.connect("DBI:Mysql:source:localhost", "username", "password")
pg = DBI.connect("DBI:Pg:destination:localhost", "username", "password")
mysql.execute("SET NAMES 'UTF8'")
mysql.select_all("SHOW TABLES") do |table|
next if ['schema_migrations', 'sessions'].include?(table.to_s)
select = mysql.execute("SELECT * FROM #{table}")
columns = select.column_names.map { |key| "\"#{key}\"" }.join(', ')
insert = pg.prepare("INSERT INTO #{table} (#{columns}) VALUES(#{(['?'] * select.column_names.size).join(',')})")
We couldn’t find that file to show.
#!/usr/bin/env node
var tcp = require("tcp");
var sys = require("sys");
var posix = require("posix");
var file = process.ARGV[2].toString();
Array.prototype.remove = function(e) {
for(var i = 0; i < this.length; i++)
class ActiveRecord::Base
class << self
def use_ilike_in_conditions_for_postgres(*conditions)
conditions = conditions.dup
@postgres_database ||= connection &&
connection.class.to_s.include?("PostgreSQLAdapter")
if @postgres_database && has_like_operator?(conditions)
conditions.each { |condition| replace_like_operator(condition) }
class Object
def attribute(attribute, &block)
attribute, default_value = attribute.to_a.first if attribute.is_a?(Hash)
define_method(:"#{attribute}") do
if instance_variables.include?("@#{attribute}")
instance_variable_get("@#{attribute}")
elsif block_given?
instance_eval(&block)
module Minimal
module Tidy
def to_tidy
pipe = IO.popen("tidy -q 2>/dev/null", "r+")
pipe.write to_s
pipe.close_write
pipe.read
end
end
end