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
| def set_trace(): | |
| import pdb, sys | |
| debugger = pdb.Pdb(stdin=sys.__stdin__, | |
| stdout=sys.__stdout__) | |
| debugger.set_trace(sys._getframe().f_back) |
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 datetime import datetime, timedelta | |
| from google.appengine.ext import db | |
| class Foo(db.Model): | |
| value = db.DateTimeProperty() | |
| db.delete(Foo.all()) | |
| Foo(value=None).put() | |
| Foo(value=datetime.now()).put() |
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
| <html> | |
| <head> | |
| <title>client</title> | |
| <script type="text/javascript" src="jquery-1.7.2.js"></script> | |
| <script type="text/javascript" src="jquery.base64.js"></script> | |
| <script type="text/javascript"> | |
| function getinfo() { | |
| $.ajax({ | |
| url: "http://example.com/", | |
| success: function(data){alert('OK');}, |
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
| # coding: utf8 | |
| """pelo | |
| pelo branch management wrapper commands | |
| """ | |
| from datetime import datetime | |
| from mercurial import commands | |
| HELP_DOC = """COMMAND OPERATION [label] |
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
| javascript:( | |
| function(){ | |
| var url = document.location.toString(); | |
| var title_start_pattern = /(#.+)/; | |
| var title_end_pattern = /- [^-]+ - Redmine/; | |
| document.title.match(title_start_pattern); | |
| RegExp.lastMatch.match(title_end_pattern); | |
| var title = RegExp.leftContext; | |
| var elements = document.getElementsByClassName('due-date'); | |
| var due = elements[1].firstChild.nodeValue; |
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
| class DotDict(dict): | |
| """dict class that allows you to access values by dot notation""" | |
| def __init__(self,arg): | |
| for k in arg.keys(): | |
| if (type(arg[k]) is dict): | |
| self[k]=DotDict(arg[k]) | |
| else: | |
| self[k]=arg[k] | |
| def __getattr__(self, attr): |
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 boto.ec2 | |
| c = boto.ec2.connect_to_region('ap-northeast-1', | |
| aws_access_key_id=aws_access_key_id, | |
| aws_secret_access_key=aws_secret_access_key) | |
| reservations = c.get_all_instances() | |
| instances = [item for sublist in reservations for item in sublist.instances] | |
| for instance in instances: | |
| if instance.state != 'running': | |
| continue |
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
| ;;; -*- coding: utf-8 -*- | |
| (custom-set-variables | |
| ;; custom-set-variables was added by Custom. | |
| ;; If you edit it by hand, you could mess it up, so be careful. | |
| ;; Your init file should contain only one such instance. | |
| ;; If there is more than one, they won't work right. | |
| '(column-number-mode t) | |
| '(show-paren-mode t) | |
| '(tool-bar-mode nil) |
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
| div#header-inner div.titlewrapper { | |
| margin-left: 2px; | |
| padding-bottom: 0px; | |
| } | |
| div.header-outer .descriptionwrapper { | |
| width: 500px; | |
| } | |
| div#header-inner div.descriptionwrapper { |
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
| """requests wrapper | |
| >>> import curledrequests as requests | |
| you can use this as requests module, but... | |
| >>> requests.debug = True | |
| >>> requests.get('http://example.com/') | |
| curl http://example.com/ | |
| Hello |