Attach to a running Python process using gdb
:
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 sublime, sublime_plugin | |
class Transpose(sublime_plugin.TextCommand): | |
"""Improve Sublime's transpose command. | |
Make Sublime's transpose command behave more like bash/emacs. | |
For each point: |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script> | |
<script src="profile.js"></script> | |
</head> | |
<body> | |
<pre id="output"></pre> |
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 |
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 |
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
"""Eight queens solver (single solution) | |
Adapted from Wirth's pseudo-Algol 60 algorithm presented in *Program | |
Development by Stepwise Refinement*. | |
http://oberoncore.ru/_media/library/wirth_program_development_by_stepwise_refinement2.pdf | |
""" | |
When I need to remember the spelling for a list comprehension with more than one loop in Python, I find the following mnemonic helpful:
write the for statements in the same order you would write a nested loop
For example, suppose we have a nested list that we wish to flatten:
>>> nested_list = [[1, 2, '5!'], (3, 'sir!')]
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
"""pywin32 native dialog demo | |
Explanation here: http://auralbits.blogspot.com/2014/02/a-native-win32-application-in-python.html #noqa | |
The core of this demo comes from the pywin32 win32gui_dialog demo: | |
http://pywin32.hg.sourceforge.net/hgweb/pywin32/pywin32/file/tip/win32/Demos/win32gui_dialog.py # noqa | |
""" |
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
# ∅MQ multi-publisher message bus | |
# | |
# modeled on http://zguide.zeromq.org/py:msgqueue but with XPUB/XSUB instead | |
# of ROUTER/DEALER | |
# | |
# usage: julia bus.jl <inbound_port> <outbound_port> | |
# | |
using ZMQ |
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 pytest | |
from turbogears.database import get_engine, session | |
@pytest.fixture(autouse=True) | |
def wrap_transaction(request): | |
"""Automatically wrap test cases in a transaction, rolled back on | |
completion. Uses an "external," non-ORM transaction that is durable | |
against inner transactions used by the ORM. Thanks to @sontek |