This file contains hidden or 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
| """ | |
| CTTCX 1.1 | |
| Convert CardioTrainer CSV file to TCX file. | |
| Copyright (c) 2012 Dragan Bosnjak <draganHR@gmail.com> | |
| https://twitter.com/dragan | |
| """ | |
| from optparse import OptionParser | |
| from xml.dom.minidom import Document | |
| import os | |
| import csv |
This file contains hidden or 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 math | |
| import pygeoip | |
| class GeoCityReader(pygeoip.GeoIP): | |
| """ | |
| Extract city data from GeoIP database | |
| Example: | |
| reader = GeoCityReader('~/GeoLiteCity.dat', pygeoip.MEMORY_CACHE) | |
| for record in reader.get_cities(): |
This file contains hidden or 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 | |
| def main(): | |
| os.chdir(os.path.dirname(os.path.dirname(__file__))) | |
| src_path = "resources" | |
| dest_path = "myproject/res" | |
| for filename in os.listdir(src_path): | |
| if not os.path.isfile(os.path.join(src_path, filename)): |
This file contains hidden or 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/python | |
| """ | |
| render.py | |
| Render template by using Django template system. | |
| Copyright (c) 2013 Dragan Bosnjak <draganHR@gmail.com> | |
| License: MIT | |
| """ | |
| import argparse |
This file contains hidden or 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
| from django import template | |
| from django.contrib.staticfiles import storage | |
| from django.core.files.base import ContentFile | |
| __version__ = '1.0.0.4' | |
| class StaticFilesStorage(storage.StaticFilesStorage): | |
| def post_process(self, paths, dry_run=False, **options): |
This file contains hidden or 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 time | |
| import os | |
| FILE_COUNT = 50 | |
| FILE_SIZE = 1 * 1024 * 1024 | |
| PATH = "/tmp/random-files" | |
| TIME = time.time() | |
| os.system("mkdir -p %s" % PATH) | |
| os.system("rm -f %s/*" % PATH) |
This file contains hidden or 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
| (function($) { | |
| var $scripts = []; | |
| $.getScriptOnce = function(url, success){ | |
| if(url instanceof Array && url.length==1) | |
| { | |
| url = url[0]; | |
| } | |
| else if(url instanceof Array) |
This file contains hidden or 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
| wait4(-1, 0x7fffab51b46c, WNOHANG, NULL) = 0 <0.000043> | |
| epoll_wait(18, {}, 1, 1000) = 0 <1.001164> | |
| gettimeofday({1393494074, 871692}, NULL) = 0 <0.000043> | |
| lseek(2, 0, SEEK_CUR) = 7411 <0.000043> | |
| gettimeofday({1393494074, 871989}, NULL) = 0 <0.000040> | |
| wait4(-1, 0x7fffab51b46c, WNOHANG, NULL) = 0 <0.000042> | |
| epoll_wait(18, {}, 1, 1000) = 0 <1.001161> | |
| gettimeofday({1393494075, 873583}, NULL) = 0 <0.000172> | |
| lseek(2, 0, SEEK_CUR) = 7411 <0.000059> | |
| gettimeofday({1393494075, 874026}, NULL) = 0 <0.000044> |
This file contains hidden or 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
| #!/bin/sh | |
| # Makre sure you installed rpm-build | |
| BASEDIR=$(pwd) | |
| REQUIREMENTS=requirements | |
| mkdir -p requirements-source | |
| mkdir -p requirements-rpms | |
| rm -rf requirements-source/* |
This file contains hidden or 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 json | |
| import simplejson | |
| import timeit | |
| data = { | |
| "firstName": "John", | |
| "lastName": "Smith", | |
| "age": 25, | |
| "address": { | |
| "streetAddress": "21 2nd Street", |
OlderNewer