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 Image | |
imageFile = "zFlowers.jpg" | |
im1 = Image.open(imageFile) | |
width = 500 | |
height = 420 | |
im2 = im1.resize((width, height), Image.BICUBIC) |
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 | |
# coding=utf8 | |
# Copyright (C) 2010 Saúl ibarra Corretgé <[email protected]> | |
# | |
""" | |
pydmesg: dmesg with human-readable timestamps | |
""" |
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
CREATE VIRTUAL TABLE enrondata1 USING fts3(content TEXT); /* FTS3 table */ | |
CREATE TABLE enrondata2(content TEXT); /* Ordinary table */ | |
SELECT count(*) FROM enrondata1 WHERE content MATCH 'linux'; /* 0.03 seconds */ | |
SELECT count(*) FROM enrondata2 WHERE content LIKE '%linux%'; /* 22.5 seconds */ |
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
try: | |
import cjson as jsonlib | |
jsonlib.dumps = jsonlib.encode | |
jsonlib.loads = jsonlib.decode | |
except ImportError: | |
try: | |
from django.utils import simplejson as jsonlib | |
except ImportError: | |
try: | |
import simplejson as jsonlib |
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
saghul@hal:~$ ipython | |
Python 2.6.6rc1+ (r266rc1:83691, Aug 5 2010, 17:07:04) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 0.10 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object'. ?object also works, ?? prints more. | |
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
typedef struct { | |
PyObject_VAR_HEAD | |
/* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ | |
PyObject **ob_item; | |
/* ob_item contains space for 'allocated' elements. The number | |
* currently in use is ob_size. | |
* Invariants: | |
* 0 <= ob_size <= allocated | |
* len(list) == ob_size |
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
typedef struct { | |
long hash; /* cached hash code for the entry key */ | |
PyObject *key; | |
} setentry; | |
/* | |
This data structure is shared by set and frozenset objects. | |
*/ |
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
Log into email server: | |
saghul@hal:~$ openssl s_client -connect mail.example.com:993 | |
Get server capabilities: | |
. capability | |
* CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS AUTH=PLAIN | |
. OK Capability completed. |
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
saghul@hal:~$ cd Downloads/ | |
saghul@hal:~/Downloads$ python -m SimpleHTTPServer | |
Serving HTTP on 0.0.0.0 port 8000 ... |
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
In [1]: f = lambda x: x+1 | |
In [2]: f(1) | |
Out[2]: 2 | |
In [3]: f(3) | |
Out[3]: 4 |
OlderNewer