Skip to content

Instantly share code, notes, and snippets.

View flodolo's full-sized avatar

Francesco Lodolo flodolo

View GitHub Profile
@flodolo
flodolo / gist:6df990debff274ad5c86
Last active August 29, 2015 14:03
Check load time, memory usage on langchecker
#! /usr/bin/env python
import os
import urllib2
os.system('clear')
base_langchecker = "http://192.168.133.115/langchecker/"
pages = [
#! /usr/bin/env python
import polib
from BeautifulSoup import BeautifulSoup
def stripAllTags(html):
return ''.join(BeautifulSoup(html).findAll(text = True))
string_count = 0
word_count = 0
@flodolo
flodolo / gist:ae0b111711ab09ad1229
Created March 16, 2015 15:57
Clean XLIFF (php test)
#!/usr/bin/env php
<?php
$command_help = "clean_xliff - Clean localized XLIFF file\n" .
"Usage: clean_xliff [reference_file] [localized file]\n\n" .
"Example: clean_xliff en-US/firefox-ios.xliff it/firefox-ios.xliff\n" .
"(remove obsolete strings from it/firefox-ios.xliff)\n";
$missing_parameter = "This command needs more parameters, please check mark_active --help.\n";
if (php_sapi_name() != 'cli') {
@flodolo
flodolo / update_xliff.py
Created April 14, 2015 16:01
Update XLIFF files
#! /usr/bin/env python
from glob import glob
from lxml import etree
import argparse
import os
NS = {'x':'urn:oasis:names:tc:xliff:document:1.2'}
def main():
@flodolo
flodolo / gist:c982a469943a096ae0d8
Last active August 29, 2015 14:21
Convert SVN mozilla.org to Git
@flodolo
flodolo / gist:575245a97054e99b41e0
Created June 10, 2015 11:24
Check lang file group of tags
#! /usr/bin/env python
import json
import urllib2
# URL to extract activated pages from langchecker's json
filename = 'mozorg/plugincheck.lang'
api_url = 'http://l10n.mozilla-community.org/~pascalc/langchecker/?locale=all&website=0&json&file=' + filename
try:
@flodolo
flodolo / add_resultdomain.py
Created July 29, 2015 13:20
Manage resultdomain
#! /usr/bin/env python
''' This script assumes that localizations are stored in a
structure like the following:
this_script
|__locales
|__locale_code
|__l10n-central
|__mozilla-aurora
@flodolo
flodolo / check_test.sh
Last active August 29, 2015 14:27
POC - Get incomplete locales from Webstatus for iOS
#!/bin/sh
INCOMPLETE_LOCALES_LIST=$(wget -qO- https://l10n.mozilla-community.org/~flod/webstatus/api/?product=firefox-ios\&type=incomplete\&txt)
INCOMPLETE_LOCALES=(${INCOMPLETE_LOCALES_LIST//$'\n'/ })
# In case we need to exclude some locales, even if complete and without errors
ADDITIONAL_LOCALES=(
"da"
)
@flodolo
flodolo / update_central.cmd
Last active September 23, 2015 04:31
[Windows] Script to import mozilla-aurora changesets into l10n-central
:: Update l10n-central repository with mozilla-aurora changesets.
:: Script for Windows. Save as .cmd file, install TortoiseHg or Mercurial
:: to have hg available from command line.
# CONFIGURE THESE PATHS FOR YOUR SYSTEM
Set aurora_repo="c:\repos\mozilla-aurora-clone"
Set central_repo="c:\repos\l10n-central-clone"
:: Make sure mozilla-aurora local clone is up to date
hg pull -R %aurora_repo% -u default
@flodolo
flodolo / update_central.sh
Created September 23, 2015 04:35
[Linux] Script to import mozilla-aurora changesets into l10n-central
#! /usr/bin/env bash
# Update l10n-central repository with mozilla-aurora changesets.
# Script for Linux/OS X.
# CONFIGURE THESE PATHS FOR YOUR SYSTEM
aurora_repo="/repos/mozilla-aurora-clone"
central_repo="/repos/l10n-central-clone"
# Make sure mozilla-aurora local clone is up to date