Skip to content

Instantly share code, notes, and snippets.

from pysqlite2 import dbapi2 as sqlite
import urllib2
from BeautifulSoup import *
from urlparse import urljoin
# Create a list of words to ignore
ignorewords=set(['the','of','to','and','a','in','is','it'])
class crawler:
# Initialize the crawler with the name of database
@csytan
csytan / crawler.py
Created May 11, 2009 06:37
crawler.py
import urllib2
from urlparse import urljoin
import time
import BeautifulSoup
class Crawler:
def __init__(self, parser):
self.parser = parser
self.queue = set()
@hemanth
hemanth / mutt-gmail-conf.bash
Created June 29, 2010 07:31
Mutt+Gamil+SSL+Lables+Auto contact suggestions
# Set the basic credencials
#
set imap_user= 'gmailUser@gmail.com'
set imap_pass= 'password'
set hostname = "gmail.com"
set realname = "gmailUser"
# Set GMAIL specific folders likem sent mail, drafts, All mail
set spoolfile = "imaps://imap.gmail.com/INBOX"
set folder = "imaps://imap.gmail.com/"
@minhajuddin
minhajuddin / focus.start.bash
Created March 22, 2012 05:45
My xmonad config
#!/bin/bash
# load resources
xrdb -merge .Xresources
#xsetroot -solid '#222'&
# map caps lock as extra escape
xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape'&
# start clipboard manager
parcellite&
@jboner
jboner / latency.txt
Last active July 16, 2024 16:04
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@dotdoom
dotdoom / zvv2kml.py
Created March 24, 2016 21:24
ZVV Tarifzonen KML (Google Maps)
#!/usr/bin/env python
# Fetch ZVV Tarifzonen map in SVG and convert to KML.
# You can save the output and import into Google Maps.
# Use at your own risk. The API used is not publicly disclosed,
# improper use may lead to lawsuits.
import sys
import urllib2
import xml.etree.ElementTree as ET

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x