Tracing Functions in Python

DateTagspython

Sometimes I want to debug the inputs and outputs of function calls to visualize flow or to follow execution passively.

Rather than adding logging statements and littering them around the code, a single decorator can be crafted to show the life cycle of a function:

def trace_args(f):
    def wrapper …
more ...

Pushing to pypi

Instructions

  1. Make setup.py in your project

    from setuptools import setup
    
    setup(name='project',
          version='1.0',
          description='thing do-er',
          author='Your Name',
          url='http://path.to.website',
          py_modules=[''],
          classifiers=['Environment :: Console',
                       'Intended Audience :: Developers',
                       'License :: OSI Approved :: MIT License',
                       'Programming Language :: Python :: 3.4',
                       'Operating System :: POSIX :: Linux',
                       'Topic …
more ...

Setting up kippo on Raspberry Pi

Downloading Kippo

  1. Download tarball from Google code.
wget https://code.google.com/p/kippo/downloads/detail?name=kippo-0.8.tar.gz
note:the project has since moved to github

2. In my case most of the traffic was attempting a sftp connection. The version of kippo that I acquired from …

more ...


Digital Ocean API Wrapper

I found myself wanting to take snapshots of my digital ocean droplets. I wrote a quick python script that wraps the api and allows me to snapshot my droplet on a regular basis.

#! /usr/bin/env python

import requests
import time

API_KEY=''
CLI_ID=''

def fetch(path, opts={}):
    opts['api_key'] = API_KEY …
more ...