This file contains hidden or 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
from scrapy.http import Request | |
from scrapy.spider import BaseSpider | |
from scrapy.selector import HtmlXPathSelector | |
class HackernewsSpider(BaseSpider): | |
name = 'hackernews' | |
allowed_domains = [] | |
start_urls = ['http://news.ycombinator.com'] | |
def parse(self, response): | |
if 'news.ycombinator.com' in response.url: |
This file contains hidden or 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
#!/bin/bash | |
for NPA in {201..989}; do | |
NXXX=2000 | |
while [ ${NXXX} -lt 9999 ]; do | |
NXXX1=$[$NXXX+1] | |
NXXX2=$[$NXXX+2] | |
NXXX3=$[$NXXX+3] | |
echo "Checking ${NPA}${NXXX}XXX, ${NPA}${NXXX1}XXX, | |
${NPA}${NXXX2}XXX, ${NPA}${NXXX3}XXX..." | |
URL="http://www.whitepages.com/carrier_lookup?carrier=alltel&name;_0=&number;_0=${NPA}${NXXX}000&name;_1=&number;_1=${NPA}${NXXX1}000&name;_2=&number;_2=${NPA}${NXXX2}000&name;_3=&number;_3=${NPA}${NXXX3}000&localtime;=survey" |
This file contains hidden or 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
<?php // CraigMailer | |
$to_email = '[email protected]'; // the email all postings should be sent to | |
$sqlite_file = 'craigmailer.sqlite'; // sqlite file location | |
$city = 'orlando'; // city to watch (as per cl subdomain) | |
$topics = array('cpg','sad','web','sof','eng'); // topics (three char topics as used in cl urls) | |
$handle = sqlite_open($sqlite_file, 0666, $sqlite_error) or die("Could not open database"); | |
$query = sqlite_query($handle,"SELECT name FROM sqlite_master WHERE type='table'"); | |
if (!sqlite_fetch_array($query)){ | |
sqlite_query($handle,"CREATE TABLE posts (id INTEGER(15) PRIMARY KEY NOT NULL,timestamp DATETIME NOT NULL,topic CHAR(4) NOT NULL, subject CHAR(255) NOT NULL, email CHAR(255) NOT NULL, body TEXT, mail_sent INTEGER(1) DEFAULT 0 NOT NULL);") |
This file contains hidden or 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
/************************************************************************** | |
* Name: EmbedPicasaGallery | |
* Author: Tobias Oetiker <[email protected]> | |
* Demo: http://tobi.oetiker.ch/photo/ | |
* $Id: jquery.EmbedPicasaGallery.js 474 2011-06-16 09:02:45Z oetiker $ | |
************************************************************************** | |
Description: | |
[elided] |
This file contains hidden or 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
<?php | |
$mime_type = "image/png" ; // mime type of file to pretend to be | |
$compression = "95" ; // compression | |
$trimming = "yes" ; // trim canvas after rendering, yes or no | |
$canvas_height = "800" ; // height of entire canvas | |
$canvas_width = "800" ; // width of entire canvas | |
$shadow_color = "black" ; // color of drop shadow | |
$size[0] = "140" ; // size in pixils for top image | |
$size[1] = "120" ; // size in pixils for middle image | |
$size[2] = "100`" ; // size in pixils for bottom image |
This file contains hidden or 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 subset_sum = function(items, target) { | |
var perms = [], layer = 0, depth = 4, attempts = 0, sum, perm, | |
ss = function(items) { | |
var item = items.shift(); | |
for (i = 0; i < items.length; i++) { | |
attempts = attempts + 1; | |
if (attempts <= items.length * items.length) { | |
if (layer === 0) { | |
perm = [items[0], items[i]]; | |
} else { |
This file contains hidden or 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
#include <Wire.h> | |
#include <LiquidCrystal.h> | |
#include <SPI.h> | |
#include <Ethernet.h> | |
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xCA, 0xFE }; | |
EthernetServer server(80); | |
LiquidCrystal lcd(0); |
This file contains hidden or 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
from nltk.probability import ELEProbDist, FreqDist | |
from nltk import NaiveBayesClassifier | |
from collections import defaultdict | |
train_samples = { | |
'I hate you and you are a bad person': 'neg', | |
'I love you and you are a good person': 'pos', | |
'I fail at everything and I want to kill people' : 'neg', | |
'I win at everything and I want to love people' : 'pos', | |
'sad are things are heppening. fml' : 'neg', |
This file contains hidden or 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
from nltk.probability import DictionaryProbDist | |
from nltk import NaiveBayesClassifier | |
from nltk import FreqDist | |
train_samples = { | |
'I hate you and you are a bad person': 'neg', | |
'I love you and you are a good person': 'pos', | |
'I fail at everything and I want to kill people' : 'neg', | |
'I win at everything and I want to love people' : 'pos', | |
'sad are things are heppening. fml' : 'neg', |
This file contains hidden or 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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |