Skip to content

Instantly share code, notes, and snippets.

@sawidis
sawidis / gist:d03556cd850f777009da
Created February 6, 2016 18:41
Multiplication
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
#!/bin/sh
PROJECT_SLUG="myproject"
for resource in $(find trunk/tr/messages -name '*.po' -type f); do
resource_slug=$(basename "$resource" ".po")
resource_identifier="${PROJECT_SLUG}.${resource_slug}"
tx set --auto-local \
-r "$resource_identifier" "trunk/<lang>/messages/${resource_slug}.po" \
@sawidis
sawidis / truncator.py
Created June 13, 2012 17:48
largen number truncator
#!/usr/bin/env python
def humanize_wordcount(value, lower_bound=10**3, upper_bound=10**12):
"""
Similar to humanize's intword. Converts a large integer to a friendly text
representation. For example, 1000 becomes '1K', 1000000 becomes '1M' etc.
"""
try:
value = int(value)
except (TypeError, ValueError):
@sawidis
sawidis / .gitignore
Last active September 14, 2015 15:24
Psoling
messages.htm
messages.json