Skip to content

Instantly share code, notes, and snippets.

View leadscloud's full-sized avatar
💭
I may be slow to respond.

LeadsCloud leadscloud

💭
I may be slow to respond.
View GitHub Profile
@leadscloud
leadscloud / KMP.py
Last active August 29, 2015 14:20 — forked from kylebgorman/KMP.py
#!/usr/bin/env python
# Knuth-Morris-Pratt demonstration
# Kyle Gorman <kgorman@ling.upenn.edu>
#
# A naive Python implementation of a function that returns the (first) index of
# a sequence in a supersequence is the following:
def subsequence(needle, haystack):
"""
Naive subsequence indexer; None if not found
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2013 Yannick Albert <http://yckart.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#!/usr/bin/env python
"""
ListeningSocketHandler
======================
A python logging handler.
logging.handlers.SocketHandler is a TCP Socket client that sends log
records to a tcp server.
This class is the opposite.
/**
* browser sinffing
* http://james.padolsey.com/javascript/detect-ie-in-js-using-conditional-comments/
*/
(function(){
var ie = (function(){
var undef,
v = 3,
div = document.createElement('div'),
curl -A "Mozilla" "http://translate.google.com/translate_tts?tl=en&q=hello+world" > hello.mp3