This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import ConfigParser | |
def createConfig(path): | |
""" | |
Create a config file | |
""" | |
config = ConfigParser.ConfigParser() | |
config.add_section("Settings") | |
config.set("Settings", "font", "Courier") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os, time, sys, datetime | |
path = "/foo/bar" | |
days = 30 | |
threshold = days * 86400 | |
now = time.time() | |
timestamp = datetime.datetime.fromtimestamp(now).strftime('%Y-%m-%d %H:%M:%S') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Example of x-out of-y rating using stars | |
% http://tex.stackexchange.com/questions/11390/drawing-stars-similar-with-tikz | |
\documentclass{minimal} | |
\usepackage{tikz} | |
\usetikzlibrary{shapes.geometric} | |
\newcommand\score[2]{ | |
\pgfmathsetmacro\pgfxa{#1+1} | |
\tikzstyle{scorestars}=[star, star points=5, star point ratio=2.25, draw, inner sep=1.3pt, anchor=outer point 3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from PyQt4 import QtCore, QtGui | |
class TreeItem(object): | |
def __init__(self, data, parent=None): | |
self.parentItem = parent | |
self.itemData = data | |
self.childItems = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Log; | |
my $filename = ''; | |
sub start { | |
shift @_; | |
($filename) = @_; | |
return (-1, "Filename missing") if (!$filename); | |
open (F_LOG, ">>$filename") || return (-1, "Error in file $filename: $!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from os import walk, sep | |
from os.path import basename, isdir | |
from sys import argv | |
def tree(startpath, print_files=False): | |
for root, subdirs, files in walk(startpath): | |
level = root.replace(startpath, '').count(sep) | |
indent = ' |' * (level-1) + ' +- ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- encoding: utf-8 -*- | |
import math | |
import csv | |
plate = 2.5 | |
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'] | |
exercises = ['Squat', 'Bench', 'Deadlift', 'Bench', 'Squat'] | |
tier1 = [[85, 1, 3], [87.5, 2, 2], [90, 3, 1]] | |
tier2 = [[70, 7, 5], [75, 6, 4], [80, 10, 3], [60, 3, 10]] |