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 build the python package with DEBUG, and then install the resulting python-gdb.py script into a place where gdb will find it. | |
/usr/ports/lang/python27 # make config OPTIONS_FILE_SET=DEBUG | |
/usr/ports/lang/python27 # find . -name python-gdb.py | |
./work/Python-2.7.8/python-gdb.py | |
cp ./work/Python-2.7.8/python-gdb.py \ | |
/usr/local/bin/python2.7-gdb.py | |
# Now install gdb with python support: | |
/usr/ports/devel/gdb # make config OPTIONS_FILE_SET=PYTHON |
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 docutils.frontend | |
# http://docutils.sourceforge.net/docs/dev/hacking.html#parsing-the-document | |
parser = docutils.parsers.rst.Parser() | |
src = """ | |
This is a heading | |
================= |
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 xml.sax | |
class FartHandler(xml.sax.ContentHandler): | |
FART_LEVEL = 3 # the schema is bad and you should feel bad... | |
def __init__(self): | |
self.lvl = 0 | |
self.infarts = False | |
self.curfart = {} |
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
def nextDay(year, month, day): | |
"""Simple version: assume every month has 30 days""" | |
if day < 30: | |
return year, month, day + 1 | |
else: | |
if month == 12: | |
return year + 1, 1, 1 | |
else: | |
return year, month + 1, 1 |
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 TRIGGER "Q_limit_answers_per_question" AFTER INSERT or UPDATE on question_answer | |
FOR EACH ROW EXECUTE PROCEDURE question_answer_insert(); | |
CREATE OR REPLACE FUNCTION question_answer_insert() | |
RETURNS TRIGGER AS | |
$body$ | |
BEGIN | |
-- Lock the existing rows to prevent race condition with other txns. | |
PERFORM * FROM question_answer WHERE question_id = NEW.question_id for UPDATE; |
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
#!/bin/sh | |
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10 << "EOF" | |
# install_certifi.py | |
# | |
# sample script to install or update a set of default Root Certificates | |
# for the ssl module. Uses the certificates provided by the certifi package: | |
# https://pypi.org/project/certifi/ |
OlderNewer