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
import java.io.FileDescriptor; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.io.PrintStream; | |
public class HelloWorld{ | |
private static HelloWorld instance; | |
public static void main(String[] args){ | |
instantiateHelloWorldMainClassAndRun(); |
#!/bin/sh | |
export MYSQL_HOST=<your-mysql-host> | |
export MYSQL_USER=<your-mysql-username> | |
export MYSQL_PASSWORD=<your-mysql-password> | |
export NAME=<name-of-backup> | |
export DATE=`date +"%Y%m%d"` | |
export BACKUP_FILE=$NAME.$DATE.sql.gz | |
export DATABASE_SCHEMA_NAME=<database-name> | |
export S3_BUCKET=<s3-bucket-name> |
var isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |
#!/usr/bin/env zsh | |
if [[ $# != 1 ]]; then | |
cat - << USAGE | |
Usage: `basename $0` <branch> | |
USAGE | |
return 1 | |
fi | |
local old_branch=$(git rev-parse --abbrev-ref HEAD) |
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
Note: This was written using elasticsearch 0.9.
Elasticsearch will automatically create an index (with basic settings and mappings) for you if you post a first document:
$ curl -X POST 'http://localhost:9200/thegame/weapons/1' -d \
'{
"_id": 1,
import cProfile | |
import os | |
import pstats | |
import time | |
from datetime import datetime | |
from functools import wraps | |
from io import StringIO | |
from logging import getLogger | |
logger = getLogger(__name__) |
- name: Group by Distribution | |
hosts: all | |
tasks: | |
- group_by: key=${ansible_distribution} | |
- name: Set Time Zone | |
hosts: Ubuntu | |
gather_facts: False | |
tasks: | |
- name: Set timezone variables |
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime | |
from tzlocal import get_localzone | |
local_tz = get_localzone() | |
local_dt = datetime.now(local_tz) |