- All Your Ducks In A Row: Data Structures in the Standard Library and Beyond
- Creating Bomb-Proof Data Importers
- Cache me if you can: memcached, caching patterns and best practices
- Python Scraping Showdown: A performance and accuracy review of top scraping libraries
- The Birth & Death of JavaScript
- Twisted Mixing
- What Is Async, How Does It Work, And When Should I Use It?
- Castle Anthrax: Dungeon Generation Techniques
- Building and breaking a Python sandbox
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, get the names of your displays: | |
$ xrandr | |
LVDS-1 connected 1366x768.... | |
# modes... | |
HDMI-0 connected ... | |
# modes... | |
VGA0 connected... | |
# modes... | |
# LVDS is your laptop display. |
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
# lsusb | |
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub | |
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. | |
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. | |
Bus 001 Device 006: ID 05e3:0606 Genesys Logic, Inc. USB 2.0 Hub / D-Link DUB-H4 USB 2.0 Hub | |
Bus 001 Device 009: ID 1130:f211 Tenx Technology, Inc. TP6911 Audio Headset | |
# cat d.py | |
import pyaudio |
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 test_each_validator(self): | |
passes = { | |
"foo": [1, 2, 3, 4, 5, 6], | |
"bar": [{"qux": 1}, {"qux": 2}] | |
} | |
fails = { | |
"foo": [1, 2, 3, 4, 5, 11], | |
"bar": [{"qux": 3}, {"qux": 4, "zot": 5}] | |
} | |
validation = { |
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
Get the Heroku db as detailed here: | |
http://devcenter.heroku.com/articles/pgbackups#exporting_via_a_backup | |
1. heroku pgbackups:capture | |
2. heroku pgbackups:url <backup_num> #=>backup_url | |
- get backup_num with cmd "heroku pgbackups" | |
3. curl -o latest.dump <backup_url> | |
Then locally do: | |
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U myuser -d mydb latest.dump |
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 uuid | |
import wtforms_json | |
from sqlalchemy import not_ | |
from sqlalchemy.dialects.postgresql import UUID | |
from wtforms import Form | |
from wtforms.fields import FormField, FieldList | |
from wtforms.validators import Length | |
from flask import current_app as app | |
from flask import request, json, jsonify, abort |
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 by_id(id, **kwargs): | |
... print(id, kwargs) | |
... | |
>>> by_id({'id': 1, 'foobaz': 2, 'bazfoo': 3}) | |
{'foobaz': 2, 'bazfoo': 3, 'id': 1} {} | |
>>> by_id(**{'id': 1, 'foobaz': 2, 'bazfoo': 3}) | |
1 {'foobaz': 2, 'bazfoo': 3} | |
>>> by_id(1, **{'id': 1, 'foobaz': 2, 'bazfoo': 3}) |
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
<?php | |
function keyword_shortcode($atts, $content = null) { | |
$custom_factions = array("Chapter", "Legion", "Regiment", "Craftworld", "Masque", "Clan", "Order", "Sept", "Hive Fleet", "Dynasty", "Kabal", "Haemonculus Coven", "Wych Cult", "Ordo"); | |
if (!empty($content)) { | |
$titlecased_content = ucwords(strtolower($content)); | |
if (in_array($titlecased_content, $custom_factions)) { | |
return '<span style="font-variant: small-caps; font-weight: bold;"><' . $titlecased_content . '></span>'; | |
} else { | |
return '<span style="font-variant: small-caps; font-weight: bold;">' . $titlecased_content . '</span>'; | |
} |
In some situations you may want to mount a value from a Secret or ConfigMap as a file in
a directory which contains files you'd rather not overwrite. For this, you can use
a subPath when defining the volume mount. Lets assume we have a secret my-secret
which contains a key ca_bundle.pem
.
volumes:
- name: my-secret-volume
secret: