Skip to content

Instantly share code, notes, and snippets.

View msoutopico's full-sized avatar

Manuel Souto Pico msoutopico

View GitHub Profile
@msoutopico
msoutopico / omtlinux_installer.sh
Last active April 22, 2020 18:49
Bash script to install and customize OmegaT on Linux
#!/bin/bash
# @author: Adrien Mathot
# Script to install OmegaT and then put the PISA 2021 + PIAAC customization atop it
#Changelog
#v1.5 26/08/2019 Have it download the VER zip files + checking if OMT is installed or not before downloading it
#v1.4 22/05/2019 Tweaks for Ubuntu 19.04
#v1.3 25/04/2019 Update to OMT 4.2
@msoutopico
msoutopico / ara2bin.py
Last active February 8, 2020 18:16
Arabic text to numeric representation
# -*- coding: utf-8 -*-
from lang_trans.arabic import buckwalter
import re
from odf import text, teletype
from odf.opendocument import load
# consonants
solar = r"[tvd*rzs$SDTZln]"
lunar = r"['bjHxEgqfkmh]"
import pyinotify
import asyncore # not found when installing in server with pip3
import os
import sys
from pprint import pprint
from datetime import datetime
from file_poster import post_to_xdiff
from get_paths import get_paths_to_folders
import logging # not found when installing in server with pip3
import time # not found when installing in server with pip3
@msoutopico
msoutopico / trend_math_cg_6b.md
Last active October 19, 2020 21:20
trend_math_cg_6b.md

UNIT 234: SEATS IN A CAR

CM936Q02

For security reasons, an extra aisle is created along the centre as shown on the right.

This reduces the number of seats in each row by 3. >

# HTML TAGS
<
/?
(EMPTY|[bui]|sup|sub|strong|strike|small|ul|ol|li|a|em|br\s*/?|img|var|span|div|p|run\d|style|center)
(\s+[^<>]+)?
>
| # PAQ CODE-ONLY SEGMENTS
@msoutopico
msoutopico / tagValidation_removePattern
Last active February 18, 2021 22:04
tagValidation_removePattern
# PISA/PIAAC HTML TAGS BLOCK
(?:<)
# followed by anything that is not
(?!
\s
# space
|(?:<)
# or another opening angle bracket
|(/?(EMPTY|[bui]|sup|sub|strong|strike|small|ul|ol|li|a|em|br\s*/?|img|var|span|div|p|run\d|style|center)(\s+[^>]+)?(?:>))
#!/bin/bash
# Versions
# OmegaT 4.2.0
# openjdk version "1.8.0_252"
# run as:
# bash path/to/xliff_omt2okp_trans2edit.sh -p package_name.omt
path_to_file=$2
echo $path_to_file
@msoutopico
msoutopico / deepl.py
Last active October 22, 2021 15:45
deepl.py
import requests, sys, json, os
import pprint
from os.path import dirname, abspath
# get parent directory of this script
parent_dir = dirname(abspath(__file__))
# get api key
api_key_file = os.path.join(parent_dir, 'api_key.txt')
with open(api_key_file) as f:
@msoutopico
msoutopico / post_md_doc.py
Created September 21, 2021 11:35
post_md_doc.py
import requests
import os
import pathlib
import json
parent_dir_abspath = pathlib.Path(__file__).parent.absolute()
file = os.path.join(parent_dir_abspath, "doc.md")
url = 'https://www.mysite.com/doc/upload_md.php'
@msoutopico
msoutopico / replace_emptyxlat_with_space.sh
Last active November 22, 2021 15:42
replace_emptyxlat_with_space
#!/usr/bin/env bash
# author: @msoutopico
# version: 1.0.0
# date: 2021.11.19
# instructions:
# 1. Put OMT packages and XLIFF files directly in the folder of your preferences
# 2. Get the path to that folder (i.e. path/to/folder)