Skip to content

Instantly share code, notes, and snippets.

View msoutopico's full-sized avatar

Manuel Souto Pico msoutopico

View GitHub Profile
@msoutopico
msoutopico / move_target_files_to_final_repo.sh
Last active December 15, 2023 14:54
move_target_files_to_final_repo.sh
#!/usr/bin/env bash
# run this script as:
# bash move_target_files_to_final_repo.sh -i /path/to/project -o /path/to/final/repo
# e.g.
# bash move_target_files_to_final_repo.sh -i /home/souto/Repos/ACER-PISA-2025-FT/pisa_2025ft_translation_it-IT_trend-prepare-files -o /home/souto/Repos/ACER-PISA-2025-FT/pisa_2025ft_translation_final
# flag -i/--input: $1
@msoutopico
msoutopico / find_overlap_qqs_vs_qqa.sh
Last active September 8, 2023 09:00
Find common labels between adult and student QQ xml files
#!/usr/bin/env bash
ROOT="/home/souto/Sync/PISA25/Tech/QQ/QQ_overlap"
cd ${ROOT}
for f in $(find $ROOT -name "*.xml")
do
f_basename="$(basename -- $f .xml)"
output_fname=${f_basename}.txt
@msoutopico
msoutopico / xlf2tmx_gVhEaiQ.xsl
Created June 11, 2023 23:17
xlf2tmx_gVhEaiQ.xsl
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<!-- run as:
java -jar saxon-he-12.2.jar -s:path/to/file.xlf -xsl:xlf2tmx_gVhEaiQ.xsl -o:path/to/file.tmx
-->
<xsl:template match="xliff">
<xsl:element name="tmx">
<xsl:attribute name="version">1.4</xsl:attribute>
@msoutopico
msoutopico / xliff2tmx_v2.xsl
Created June 11, 2023 22:32
xliff2tmx_v2.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="urn:oasis:names:tc:xliff:document:1.1"
xmlns:copyright="http://www.w3.org/1999/xhtml">
<copyright:info>
<!-- authors make it -->
<copyright:author name="Manuel Souto Pico" />
@msoutopico
msoutopico / pisa25-cdata-wrap.groovy
Created May 26, 2023 08:20
pisa25-cdata-wrap.groovy
/**
* Usage : Put this script in <ScriptsDir>/project_changed folder. Create a folder if it doesn't exists.
*
* @authors Yu Tang, Manuel Souto Pico
* @version 0.5.6 (dynamic) -- match only XML files for PISA
* @date 2023.05.25
*/
import static org.omegat.core.events.IProjectEventListener.PROJECT_CHANGE_TYPE.*
@msoutopico
msoutopico / ysc-resx-html.groovy
Created April 24, 2023 15:25
ysc-resx-html.groovy
/**
* Usage : Put this script in <ScriptsDir>/project_changed folder. Create a folder if it doesn't exists.
*
* @authors Yu Tang, Manuel Souto Pico
* @version 0.5.5 (dynamic) -- match only ResX files for YSC
* @date 2023.04.19
*/
import static org.omegat.core.events.IProjectEventListener.PROJECT_CHANGE_TYPE.*
@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)
@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 / 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:
#!/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