Skip to content

Instantly share code, notes, and snippets.

@zgohr
zgohr / email_exists.py
Created April 2, 2012 20:14
Check the existence of email addresses. Error prone.
#!/usr/bin/env python
"""
Check that a particular email address exists.
Adam Blinkinsop <[email protected]>
WARNING:
Checking email addresses in this way is not recommended, and will lead to
your site being listed in RBLs as a source of abusive traffic. Mail server
admins do like it when they get connections that don't result in email being
sent, because spammers often use this technique to verify email addresses.
@zgohr
zgohr / gist:1490812
Created December 17, 2011 17:29
Get screen names from Twitter REST API given file of user ids.
import sys
import urllib2
import simplejson
def get_names(user_ids):
output_file = open('output.txt', 'a')
get_string = 'https://api.twitter.com/1/users/lookup.json?user_id={0}'.format(user_ids)
req = urllib2.Request(get_string)
try:
f = urllib2.urlopen(req)
@zgohr
zgohr / gist:1428134
Created December 3, 2011 20:56
Mining web page content from the command line via node
# traditional method of searching a website for content
# curl contents of a web page, piped to grep to match regex
$ curl "foo.com" -Ls | grep -o bar
# proof of concept, piping to allow node.io to do the matching.
# node.io has a builtin eval method that uses javascript's eval
# to handle the matching
$ curl "foo.com" -Ls | node.io -s eval "input.match(/bar/g)"
# install node.io globally with npm