- Update HISTORY.rst
- Update version number in
my_project/__init__.py
- Update version number in
setup.py
- Run the tests:
python setup.py test
tox
- Commit the changes:
// Playbook: http://play.golang.org/p/kp5uL_mMGk | |
// Note: Type assertion like "someVariable.(string)" is useful when you are dealing with interface{} (empty interface) | |
package main | |
import ( | |
"fmt" | |
"strconv" | |
) |
# Default timezone is UTC and precisions is up to microseconds | |
#====================================== | |
# Workflow | |
#====================================== | |
# 1) Convert string to it's native datetime type. | |
# 2) Do all manipulation when the value is in datetime type | |
# 3) Convert it back to the type you need(if needed). | |
# This means that if you want to convert string "1970-01-01" to |
# Exclusive or is a logical operation that outputs true whenever both inputs differ | |
# Truth Table | |
A = 0, B = 0, Output = 0 | |
A = 1, B = 0, Output = 1 | |
A = 0, B = 1, Output = 1 | |
A = 1, B = 1, Output = 0 | |
# Example of logical xor | |
# Logical xor evaluates expression logically(like how humans would read it) |
# 2 options in formatting html strings in python | |
# 1) You don't care about excess whitespace - Use triple quotes | |
# 2) You want to get rid of excess whitespace - Use standard escape quotes method | |
############################## | |
# Triple quotes method | |
############################## | |
url = "http://example.com" | |
width = "100" |
users = [{ | |
"user_id": 1, | |
"hobby": "Play Football" | |
}, { | |
"user_id": 1, | |
"hobby": "Play Basketball" | |
}] | |
# Given data above, if you want loop through the JSON and check if a specific user exist, | |
# you can do it with the code below. |
my_project/__init__.py
setup.py
python setup.py test
tox
# Redirect STDOUT/STDERR into syslog | |
exec > >(logger -p user.info) 2> >(logger -p user.warn) |
SSH agent forwarding is great. It allows you to ssh from one server to | |
another all the while using the ssh-agent running on your local | |
workstation. The benefit is you don't need to generate ssh key pairs | |
on the servers you are connecting to in order to hop around. | |
When you ssh to a remote machine the remote machine talks to your | |
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK | |
environment variable. | |
So you the remote server you can do something like: |
% non-blocking gen_server erlang | |
% By default handle_call is blocks the gen_server. | |
% Using a dispatcher-worker style, we can make | |
% handle_call non blocking | |
% The call below blocks | |
handle_call({get, Param}, From, State = #state{sock = Sock}) -> | |
Reply = do_time_consuming_remote_operation(Param, Sock), | |
{reply, Reply, State}; |
############################################################################### | |
# Copyright 2012 Jakub Jirutka. All rights reserved. | |
# | |
# "THE KOFOLA-WARE LICENSE" (Revision 1): | |
# Jakub Jirutka originally wrote this file. As long as you retain this notice you | |
# can do whatever you want with this stuff. If we meet some day, and you think | |
# this stuff is worth it, you can buy me a Kofola in return. <[email protected]> | |
# | |
############################################################################### |