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
First example: no args, lists all suffixes, use defaults for: directory (current working directory), sort order (alphabetical), graph character ('-'), graph width (50 chars). | |
Second example: -n (sort by file count), -t 20 (list only the top 20 suffixes), --width=35 (scale graph width to 35 chars), --imatch="^\w{3,4}$" (case-insensitive regexp -- only print suffixes that are between 3 and for chars in length), -g \* (specify a new graph character). unflagged arguments are assumed to be directories to be scanned. | |
See the source for all options. | |
OTUS-ASIO:face fish$ alias sufs='/wherever/you/put/getfilesuffixes.py' | |
OTUS-ASIO:face fish$ sufs | |
>>> /this/current/directory (total 47846) | |
=== 21 - |
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 | |
# encoding: utf-8 | |
import sys, os, getopt | |
from django.core.management import setup_environ | |
import settings | |
setup_environ(settings) | |
from django.db.models import Q |
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 | |
# encoding: utf-8 | |
def hirelite(i): | |
if not i % 4: | |
if not i % 7: | |
return "rickroll" | |
return "rick" | |
if not i % 7: | |
return "roll" |
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 xrange(b0, b1, quanta) { | |
if (!quanta) { quanta = 1; } | |
if (!b1) { b1 = b0; b0 = 0; } | |
out = []; | |
for (var i = b0, idx = 0; i < b1; i += quanta, idx++) { | |
out[idx] = i; | |
} | |
return out; | |
} |
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
>>> ffeed = feedparser.parse('http://ffffound.com/home/fish2000/recommend/feed?offset=50') | |
>>> [os.path.basename(pq(v).find('img').attr('src')).split('_')[0] for k, v in reduce(lambda a,b: a+b, [fe.items()[0][1].items() for fe in ffeed.entries]) if k == 'value'] | |
['e391fa402eacb755f200a6f85bc6cbf61a0b1e5b', 'c6fea29870500b4a3d2d84669c0b8b43c10cd017', 'f133e22b5c3c4ffcd492582bea01bad49300d102', '1d7dfd992de34ed5d0f0deffcabe918de543b2ee', 'a4d98a1e1d1aad4507c16e1d6fb265eb0256bdee', '9bc393e7832764c4ac50 | |
3f97b4f9817893eaf4a8', 'd81e5468d113dea6b5891b1e0959b952ebd9951b', '9e1655515a57c090fe2e3dfee66b5c40d883c55f', '3001624270c16697ecfe6db5807fcd128772eb3a', 'ed868a5311c985a86970b1770819affc169d3ab8', '48389c1de0ec1cc146b5f9967f32864b397a0f19', | |
'5bd90a15c37fff46f9a057efb722514ca4d509d7', 'c61449bf5937d7461e849734843f6b2b5f9dee10', '2fdc12eaf38a47839ea4f58e9c482a1be5fcaac9', '30f10010e49d7a3544eae5c3d824e188171fed53', '19eba6d9996c7fd112001f1e778b16578552ad99', '462f7d09eb4a3d56cf2c | |
7ed0cb42f1ce297a08ad', '27d8e3a4 |
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 | |
# get it from https://secure.delicious.com/settings/bookmarks/export | |
# use the default options | |
# file will be named with a datestamp, like: 'delicious-YYYYMMDD.htm' | |
import os, re, site, sys | |
from BeautifulSoup import BeautifulSoup | |
try: | |
import json | |
except ImportError: |
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
var deltadata = _(chart_data.get_series()).map(function (i) { | |
return i.data; | |
}).reduceRight(function (a,b) { | |
return a.concat(b); | |
}).map(function (i) { | |
return i[1]; | |
}).reduce(function (a,b) { | |
return a + b; | |
}); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<!-- this goes in a file such as /System/Library/LaunchDaemons/ost.apache2.plist --> | |
<dict> | |
<key>Label</key> | |
<string>ost.apache2</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/usr/local/bin/apachectl</string> |
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
OTUS-ASIO:tmp$ brew install coreutils | |
==> Downloading ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.12.tar.gz | |
File already downloaded in /Users/fish/Library/Caches/Homebrew | |
==> ./configure --prefix=/usr/local/Cellar/coreutils/8.12 --program-prefix=g | |
==> make install | |
make install-recursive | |
Making install in lib | |
GEN arg-nonnull.h | |
GEN alloca.h | |
GEN c++defs.h |
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
>>> {'yo': ('dogg','yodogg', ['i', 'heard', 'you', 'liked'])} | |
{'yo': ('dogg', 'yodogg', ['i', 'heard', 'you', 'liked'])} | |
>>> dic = {'yo': ('dogg','yodogg', ['i', 'heard', 'you', 'liked'])} | |
>>> msgpack.dumps(dic) | |
'\x81\xa2yo\x93\xa4dogg\xa6yodogg\x94\xa1i\xa5heard\xa3you\xa5liked' | |
>>> packitup = msgpack.dumps(dic) | |
>>> msgpack.loads(packitup) | |
{'yo': ('dogg', 'yodogg', ('i', 'heard', 'you', 'liked'))} | |
>>> msgpack.loads(packitup) == dic | |
False |