Skip to content

Instantly share code, notes, and snippets.

View weppos's full-sized avatar

Simone Carletti weppos

View GitHub Profile
MongoDb vs PostgreSQL (single table with 777,229 records)
--------------------------------------------------------
# Number of Records in the table
=> 777229
# Size of the Table
# PostgreSQL (Data + Indexes)
+----------------+
$ cloc robodomain robowhois robofinance whois
1824 text files.
1695 unique files.
920 files ignored.
http://cloc.sourceforge.net v 1.51 T=2.0 s (433.5 files/s, 50222.5 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
Ruby 747 12136 7589 41135
(function($){
$.fn.ifdo = function(fn) {
if (this.length > 0) {
fn.call(this);
}
};
})(jQuery);
@weppos
weppos / whois-properties.php
Created April 2, 2012 08:50
RoboWhois + PHP example: get the parsed WHOIS record for a domain.
<?php
/* Requests the parsed WHOIS record for the domain
* and returns an Array containing the parsed WHOIS properties.
*
* @param string $domain The domain to lookup.
*
* @return array
*/
function whoisProperties($domain)
@weppos
weppos / whois-properties.asp
Created April 15, 2012 18:23
RoboWhois + ASP example: get the parsed WHOIS record for a domain.
<%
' Requests the parsed WHOIS record for the domain
' and returns a String containing the JSON-encoded parsed WHOIS properties.
Function WhoisProperties(url)
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.Open "GET", url, False, "YOUR_API_KEY", "X"
@weppos
weppos / robowhois.py
Created June 7, 2012 18:30
RoboWhois + Python example: get the WHOIS record for a domain.
import urllib2
class RoboWhois:
def __init__(self, api_key):
self.username = api_key
self.password = "X"
def whois(self, domain):
template = "http://api.robowhois.com/whois/%s"
@weppos
weppos / example.py
Created June 7, 2012 18:28
RoboWhois + Python example: get the WHOIS record for a domain.
import urllib2
def whois(domain):
api_key = "YOUR_API_KEY"
template = "http://api.robowhois.com/whois/%s"
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
passman.add_password(None, "http://api.robowhois.com/", api_key, "X")
handler = urllib2.HTTPBasicAuthHandler(passman)
opener = urllib2.build_opener(handler)
@weppos
weppos / whois.asp
Created June 7, 2012 18:38
RoboWhois + ASP example: get the WHOIS record for a domain.
<%
' Requests the WHOIS record for the domain
' and returns a String containing the WHOIS response.
Function Whois(url)
Dim objXmlHttp
Set objXmlHttp = Server.CreateObject("Microsoft.XMLHTTP")
objXmlHttp.Open "GET", url, False, "YOUR_API_KEY", "X"
@weppos
weppos / tlds.yml
Last active October 11, 2015 19:18
Whois fixtures
ae.org:
_server: whois.centralnic.com
_subdir: ae.org
status_available: u34jedzcq.ae.org
status_registered: kidzlink.ae.org
ar.com:
_server: whois.centralnic.com
_subdir: ar.com
status_available: u34jedzcq.ar.com
status_registered: hotel.ar.com
@weppos
weppos / fliwn.rb
Created December 6, 2012 16:38
Script to download a Flickr photoset.
#!/usr/bin/env ruby -wKU
require 'rubygems'
require 'flickraw'
require 'open-uri'
require 'fileutils'
FlickRaw.api_key = "YOUR_API_KEY"
FlickRaw.shared_secret = "YOUR_SHARED_SECRET"