This file contains 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
function countPieces() { | |
it = b.pieces(); | |
var i = 0; | |
while (it.current()){ i++; it.next() } | |
return i; | |
} | |
function getRandPiece() { | |
var it = b.pieces(); |
This file contains 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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
This file contains 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
{ | |
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.| | |
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!| | |
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. Thanks.| | |
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|i |
This file contains 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
""" | |
This file contains code that, when run on Python 2.7.5 or earlier, creates | |
a string that should not exist: u'\Udeadbeef'. That's a single "character" | |
that's illegal in Python because it's outside the valid Unicode range. | |
It then uses it to crash various things in the Python standard library and | |
corrupt a database. | |
On Python 3... well, this file is full of syntax errors on Python 3. But | |
if you were to change the print statements and byte literals and stuff: |
This file contains 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
# coding=UTF-8 | |
from __future__ import division | |
import nltk | |
from collections import Counter | |
# This is a simple tool for adding automatic hashtags into an article title | |
# Created by Shlomi Babluki | |
# Sep, 2013 | |
This file contains 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
#!/usr/bin/env python | |
""" | |
Python script that runs one-liner python scripts similarly to how Perl runs them | |
portions based on http://code.activestate.com/recipes/437932-pyline-a-grep-like-sed-like-command-line-tool/ | |
(Graham Fawcett, Jacob Oscarson, Mark Eichin) | |
interface inspired by Perl | |
""" |
This file contains 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
#!/usr/bin/env python | |
from Tkinter import * | |
from random import shuffle | |
things = [ | |
'Make some tea', | |
'Do some pushups', | |
'Do some situps', | |
'Go to the bathroom', |
This file contains 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
#!/usr/bin/env/python | |
# | |
# More of a reference of using jinaj2 without actual template files. | |
# This is great for a simple output transformation to standard out. | |
# | |
# Of course you will need to "sudo pip install jinja2" first! | |
# | |
# I like to refer to the following to remember how to use jinja2 :) | |
# http://jinja.pocoo.org/docs/templates/ | |
# |
This file contains 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
import socket | |
if __name__ == "__main__": | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
sock.connect(("localhost", 9000)) | |
data = "some data" | |
sock.sendall(data) | |
result = sock.recv(1024) | |
print result | |
sock.close() |
This file contains 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
def anagram(string1, string2, ignore_whitespace=False): | |
"""Determines whether two strings are anagrams.""" | |
if ignore_whitespace==True: | |
import re | |
string1, string2 = re.sub('\s', '', string1), re.sub('\s', '', string2) | |
if len(string1) != len(string2): return False | |
list1, list2 = [c for c in string1].sort(), [c for c in string2].sort() | |
if list1 != list2: return False | |
return True |
NewerOlder