You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
🏢
I died! …well, I got better…
Alice Zoë Bevan–McGregor
amcgregor
🏢
I died! …well, I got better…
Do not contact me in relation to blockchain, crypto, NFT, or “Web3” unless you wish to be mercilessly mocked; possibly publicly. HashCash is not.
Thank you.
An example filesystem structure that loosely follows the File Hierarchy Standard.
FHS-Based Python Web Application Deployment
The following is based off of one client application deployment scenario, with all of the files described herein managed in a Git repository.
This is NOT a proposed standard; if this is used at all, it’ll be used at the application server level and will be transparent to the underlying (embedded/mounted/mapped/attached/installed) application.
/home/<user>/apps/<application>/ — Git Root
.gitignore — Ignore almost everything.
README.textile — Fancy GitHub notice.
restart — Progressive upgrade / roll-out script. This and the start/stop scripts, below, are venv aware and do not require the venv to be active.
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
Utilizing marrow.mailer in your Pyramid application.
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
A blog-ish post about bitfield data design in Python.
Enumerated Bitfield Data Type
If it’s worth doing once, it’s worth writing a system to do it.
So I’m exploring writing a DNS server in Python, and while there are a number of solutions for reading and writing DNS data in a variety of formats (such as BIND configuration files, over-the-wire encoding, etc.) I learn best by doing, not by using someone else’s code. Calling it “not invented here” is naïve at best, so let’s get started with the first over-engineered bit I’ve written.
Flags
DNS is a binary protocol, which is a seriously good thing compared to protocols such as SMTP, NNTP, POP, and IMAP. It makes rather extensive use of bit masks to represent flags, thus we’ll need a method to encode and decode these bit masks, and a convenient way to display them in a human-readable way. Also attached to this Gist is a copy of the flags.py file from the dnspython package, a quite complete and mature package by any standard. Unfortunately, it followed in twisted.names’ footsteps. If you exam
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
Where asking a simple question, and not accepting useless and insulting answers, gets you banned from an IRC channel.
Cleaned IRC log of #python starting Monday, 25 July, 2011 at 17:13:55 EDT.
Gems are highlighted in bold.
GothAlice
How do I determine if a given object is a @classmethod, and, additionally, how do I determine if it is a @staticmethod? 1
KirkMcDonald
GothAlice: Why would you care?
GothAlice
KirkMcDonald: Enforcing interfaces, not that it matters.
dash
GothAlice: you’re right, it doesn’t matter
_habnabit
GothAlice, if you wanted an answer to the question as asked, why don’t you try ##python-friendly? #python is about writing better code.
nedbat
GothAlice: what KirkMcDonald should have said was, “The Python culture is to not check ahead of time, do you have an unusual requirement that means you really have to know?”
Example router implementation and example for WebCore 2.
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
An example response registry for WebCore 2, eliminating the need for the hard-coded response handlers in web.core.application and the weirdness of the templating middleware.
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