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
#!/home/rkitover/.rvm/rubies/ruby-2.0.0-p0/bin/ruby | |
require 'sinatra/base' | |
class MyApp < Sinatra::Base | |
get '/' do | |
'Hello, World!' | |
end | |
end |
People
![]() :bowtie: |
😄 :smile: |
😆 :laughing: |
---|---|---|
😊 :blush: |
😃 :smiley: |
:relaxed: |
😏 :smirk: |
😍 :heart_eyes: |
😘 :kissing_heart: |
😚 :kissing_closed_eyes: |
😳 :flushed: |
😌 :relieved: |
😆 :satisfied: |
😁 :grin: |
😉 :wink: |
😜 :stuck_out_tongue_winking_eye: |
😝 :stuck_out_tongue_closed_eyes: |
😀 :grinning: |
😗 :kissing: |
😙 :kissing_smiling_eyes: |
😛 :stuck_out_tongue: |
#!/bin/bash | |
usage() { | |
cat << EOF | |
Usage: $0 [OPTION]... COMMAND | |
Execute the given command in a way that works safely with cron. This should | |
typically be used inside of a cron job definition like so: | |
* * * * * $(which "$0") [OPTION]... COMMAND | |
Arguments: |
import boto | |
ec2 = boto.connect_ec2() | |
groups = ec2.get_all_security_groups() | |
def get_groups_that_have_ingress_rules_to(groups, group_id): | |
result = [] | |
for group in groups: | |
for rule in group.rules: | |
for grant in rule.grants: |
# /tmp/test = EBS-SSD | |
# /mnt/test = instance-store | |
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test | |
256+0 records in | |
256+0 records out | |
268435456 bytes (268 MB) copied, 3.26957 s, 82.1 MB/s | |
root@ip-10-0-2-6:~# dd bs=1M count=256 if=/dev/zero of=/tmp/test | |
256+0 records in | |
256+0 records out |
/** | |
* Fancy ID generator that creates 20-character string identifiers with the following properties: | |
* | |
* 1. They're based on timestamp so that they sort *after* any existing ids. | |
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs. | |
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly). | |
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the | |
* latter ones will sort after the former ones. We do this by using the previous random bits | |
* but "incrementing" them by 1 (only in the case of a timestamp collision). | |
*/ |
SELECT table_name AS "Tables", | |
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB", | |
round(((data_length + index_length) / 1024 / 1024 / 1024), 2) "Size in GB" | |
FROM information_schema.TABLES | |
WHERE table_schema = "PUT_DATABASE_NAME_HERE" | |
ORDER BY (data_length + index_length) DESC; |
Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.
This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.
There is a companion feature matrix of various tools. Comments are welcome in the same manner.
#!/bin/bash | |
###################################################################### | |
# Useful script when you want to run `pip` in virtual environments # | |
# you have in a common directory with a provided Python package. # | |
# Note: Requires VirtualWrapper to be managing your environments # | |
# # | |
# Usage: # | |
# ./pip_virtualenvs.sh [-i | -u | -z] pkg_name [-a | -l] [env1 env2] # | |
# # | |
# Example: # |