A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
from django.core.exceptions import ValidationError | |
from django.forms.utils import ErrorList | |
from wagtail.wagtailcore import blocks | |
class MyLinkBlock(blocks.StructBlock): | |
""" | |
Example validating StructBlock. | |
""" |
say "roses are red" | |
say "violets are blue" | |
if , lie ; : | |
say "if I can beat Hillary" | |
say "so can you" ! | |
else : | |
say "read the verge dot com" | |
say "it's good for you!" ! |
Database: heroku_1ed5a148e6d9415 | |
Table: black_cards | |
[16 entries] | |
+----+--------------------------------------------------------------------------------------------------------------+ | |
| id | content | | |
+----+--------------------------------------------------------------------------------------------------------------+ | |
| 1 | _____ means never having to say you're sorry. | | |
| 2 | The pen tester found _____ in the trash while dumpster diving. | | |
| 3 | Our CIO has a framed a picture of _____. | | |
| 4 | 9 out of 10 experts agree, _____ will increase your security effectiveness. | |
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
Gist title: "Komodo: Run Current File or Selection with PHP" | |
Summary: Save this small JavaScript program to the Toolbox in Komodo Edit (or IDE), assign a key binding to it, and use it to execute the current file (or the selected code if there is any) in a PHP interpreter. |
require "openssl" | |
require "digest" | |
def aes128_cbc_encrypt(key, data, iv) | |
key = Digest::MD5.digest(key) if(key.kind_of?(String) && 16 != key.bytesize) | |
iv = Digest::MD5.digest(iv) if(iv.kind_of?(String) && 16 != iv.bytesize) | |
aes = OpenSSL::Cipher.new('AES-128-CBC') | |
aes.encrypt | |
aes.key = key | |
aes.iv = iv |
""" | |
A sample utility for customizing virtualenv creation based | |
on the postmkvirtualenv hook provided by virtualenvwrapper. | |
This script will generate a Komodo project file suitable for | |
use in Komodo Edit (and presumably Komodo IDE). The project preferences | |
are automatically customized so that the Python path contains the | |
new virtualenv's site-packages directory. | |
(Project Properties -> Languages -> Python in the GUI) |