This file contains hidden or 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
| Python 2.7.3 (default, Apr 20 2012, 22:39:59) | |
| [GCC 4.6.3] on linux2 | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> from BeautifulSoup import BeautifulSoup, Tag, CData | |
| >>> s=BeautifulSoup("") | |
| >>> s=BeautifulSoup("<div></div>") | |
| >>> n=s.find('div') | |
| >>> n | |
| <div></div> | |
| >>> n.append(CData('<b>bleh</b>')) |
This file contains hidden or 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
| # BeautifulSoup 3.2.0 | |
| >>> from BeautifulSoup import BeautifulSoup, CData | |
| >>> s = BeautifulSoup("<div></div>") | |
| >>> n = s.find('div') | |
| >>> n.append(CData('<b>bleh</b>')) | |
| >>> n | |
| <div><![CDATA[<b>bleh</b>]]></div> | |
| >>> | |
| ------------- |
This file contains hidden or 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
| from pytz import timezone | |
| from datetime import datetime | |
| # From http://en.wikipedia.org/wiki/Eastern_Time_Zone | |
| # "Places that use Eastern Standard Time (EST) when observing standard time (autumn/winter) | |
| # are 5 hours behind Coordinated Universal Time (UTC−05:00)." | |
| us = timezone('US/Eastern') | |
| # GMT during the winter is exactly UTC if I'm not mistaken | |
| uk = timezone('Europe/London') |
This file contains hidden or 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
| fkochem at WK-6 in ~/workspace/code/sentry/bin exited 1 workon sentry | |
| $ ./sentry --config=/home/fkochem/.sentry/sentry.conf.py createsuperuser | |
| Traceback (most recent call last): | |
| File "./sentry", line 9, in <module> | |
| load_entry_point('sentry==5.4.1', 'console_scripts', 'sentry')() | |
| File "/home/fkochem/workspace/code/sentry/local/lib/python2.7/site-packages/sentry/utils/runner.py", line 191, in main | |
| initializer=initialize_app, | |
| File "/home/fkochem/workspace/code/sentry/local/lib/python2.7/site-packages/logan/runner.py", line 155, in run_app | |
| management.execute_from_command_line([runner_name, command] + command_args) | |
| File "/home/fkochem/workspace/code/sentry/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line |
This file contains hidden or 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
| -(void)connectionDidFinishLoading:(NSURLConnection *)connection { | |
| self.progressLabel.text = @"Unpacking..."; | |
| connection = nil; | |
| // Save to disk, release memory | |
| NSString *temp_file_path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@"/temp.zip"]; | |
| [self.course_data writeToFile:temp_file_path atomically:YES]; | |
| self.course_data = nil; | |
| // Unzip |
This file contains hidden or 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 json | |
| import os | |
| import tornado.httpserver | |
| import tornado.web | |
| import tornado.websocket | |
| import tornado.ioloop | |
| import tornado.gen | |
| import tornadoredis |
This file contains hidden or 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 re | |
| f1 = 'my movie title #12' | |
| f2 = 'my other movie title' | |
| my_regex = re.compile(r'^(?P<movie>.*)( #(?P<version>\d+))$') | |
| result = re.match(my_regex, f1) | |
| if result: | |
| print result.groupdict() |
This file contains hidden or 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
| #!/bin/bash | |
| oldrev=$(git rev-parse $1) | |
| newrev=$(git rev-parse $2) | |
| refname="$3" | |
| case "$refname","$rev_type" in | |
| refs/tags/*,tag) | |
| # annotated tag | |
| refname_type="annotated tag" | |
| function="atag" | |
| short_refname=${refname##refs/tags/} |
This file contains hidden or 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
| [fkochem@FK] ~/temp $ mkdir blubb †: 0 | |
| [fkochem@FK] ~/temp $ cd blubb †: 0 | |
| [fkochem@FK] ~/temp/blubb $ git init †: 0 | |
| Initialized empty Git repository in /Users/fkochem/temp/blubb/.git/ | |
| [fkochem@FK] ~/temp/blubb (git)-[master]$ touch meh †: 0 | |
| [fkochem@FK] ~/temp/blubb (git)-[master]$ cat > meh †: 0 | |
| this | |
| is | |
| my | |
| awesome |
This file contains hidden or 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
| >>> x = {1, 2, 3} | |
| >>> y = [3, 4, 5] | |
| >>> x.intersection(y) | |
| {3} | |
| >>> x & y | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| TypeError: unsupported operand type(s) for &: 'set' and 'list' | |
| >>> |