Skip to content

Instantly share code, notes, and snippets.

View rh0dium's full-sized avatar

Steven rh0dium

View GitHub Profile
@rh0dium
rh0dium / fabfile.py
Created February 7, 2013 13:17
fabric file logging
log = logging.getLogger(__name__)
django.settings_module('settings')
from django.conf import settings
# Turn down logging..
l = logging.getLogger("ssh")
l.setLevel(logging.ERROR)
@rh0dium
rh0dium / logger.py
Created January 26, 2013 16:14
Adds a colorizing stream handler..
# -*- coding: utf-8 -*-
"""logging.py: Django www"""
import ctypes
import logging
import platform
import os
__author__ = 'Steven Klass'
__date__ = '2/24/12 10:20 PM'

Welcome to Drift!

Drift is an always-already versioned, cloud-backed text editor. You can use it to take notes, and save them in the GitHub cloud.

Your gists are always saved locally, and any changes you make will get pushed to GitHub's servers.

To name a gist, touch its name in the toolbar.

You can use the share button at the top-right to copy a link to one of your gists, or view it on the web in Safari.

@rh0dium
rh0dium / fabfile.py
Created October 31, 2011 21:32 — forked from onyxfish/fabfile.py
Pivotal Energy
from fabric.api import *
"""
Base configuration
"""
env.project_name = '$(project)'
env.database_password = '$(db_password)'
env.site_media_prefix = "site_media"
env.admin_media_prefix = "admin_media"
env.newsapps_media_prefix = "na_media"
@rh0dium
rh0dium / Calculate Effort Hours
Last active August 29, 2015 14:22
Effort is the measure of what changed divided by the time it took to do it (Man Hours). For this we use the following strategy. If it is programatic code we look at the absolute lines of code that was edited, added and deleted negating comments. In the event it is binary data we look at the absolute file size delta. We divide this by the man ho…
def calculate_effort_hours(**kwargs):
"""Calculate effort hours on a file change.
The best situation is that we have a lines_delta, on known file types (*.c, *.v, *.va, etc.)
In lieu of that use the file size as the file_delta. time_difference is how long the file
was checked out as reported in journal file."""
code_lines_add = kwargs.get('code_lines_add', 0)
code_lines_add = int(code_lines_add) if code_lines_add is not None else 0
code_lines_minus = kwargs.get('code_lines_minus', 0)
@rh0dium
rh0dium / Normalize Man Hours
Created June 4, 2015 22:22
Man hours is simply check-in time minus checkout-time. We normalize this to 8 hours per day (user modifiable) and exclude weekends. Additionally since a person cannot physically work on two files at the same time we divide it out by the number of files in the checkin. It is important to note that man hours is calculated AFTER the event takes pla…
def normalize_man_hours(**kwargs):
"""
If the time_difference is less than 8 hours than return that.
If the time difference is greater than 8 hours we need to limit it to 8 hours per
day excluding weekends.
"""
hours, minutes, seconds = kwargs.get('time_difference', "0:0:0").split(":")