Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://gitlab.wikimedia.org/diegodlh/w2c-core/-/blob/main/tests.schema.json",
"title": "Domain translation tests configuration for Web2Cit",
"description": "Each translation test defines translation output goals for a specific test webpage (see https://meta.wikimedia.org/wiki/Web2Cit/Early_adopters#tests.json)",
"type": "array",
"format": "tabs-top",
"items": {
"title": "Translation test",
"type": "object",
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"selections": {
"type": "array",
"items": {
"oneOf": [
{
"type": "string"
@diegodlh
diegodlh / pdf_js_textLayer_selection
Last active September 21, 2023 20:11
How to see text selected in pdf files with pdf.js?
Sometimes, text that can be selected in pdf files (text overlay) does't match exactly the text as it is shown in the canvas layer. As a result, if one wants to select some text (for copy-pasting, for example) it is difficult to say if one has selected the right characters.
Here I show one way to see the text selected using pdf.js, the pdf reader that is used, for example, in Firefox.
1) Find the path to your profile directory: In Firefox, press Tab to see the menu bar, go to Help > Troubleshooting information. Click "Open Directory" next to "Profile directory".
2) Create a folder named "chrome" in your profile folder and a userContent.css file inside.
3) Write this in the userContent.css file that you created, and save it:
@-moz-document regexp('.*\.(p|P)(d|D)(f|F)') {
.textLayer ::selection {
color: white;
@diegodlh
diegodlh / redes_interdependientes.txt
Created July 2, 2019 13:13
Modificaciones propuestas al artículo Redes interdependientes en Wikipedia
El estudio de las '''redes interdependientes''' es un subcampo de estudio de la [[Análisis de redes|ciencia de redes]] que se ocupa de los fenómenos causados por las interacciones entre [[Red compleja|redes complejas]]. Aunque existe una amplia variedad de interacciones entre redes, el estudio de redes interdependientes se enfoca en los escenarios en que los nodos de una red dependen del soporte de los nodos de otra red.<ref name="Nature2010">{{Cita publicación|url=http://havlin.biu.ac.il/Publications.php?keyword=Catastrophic+cascade+of+failures+in+interdependent+networks&year=*&match=all|título=Catastrophic cascade of failures in interdependent networks|apellidos=Buldyrev|nombre=Sergey V.|apellidos2=Parshani|nombre2=Roni|fecha=|publicación=Nature|volumen=464|número=7291|páginas=1025–1028|fechaacceso=|bibcode=2010Natur.464.1025B|issn=0028-0836|doi=10.1038/nature08932|pmid=20393559|apellidos3=Paul|nombre3=Gerald|apellidos4=Stanley|nombre4=H. Eugene|apellidos5=Havlin|nombre5=Shlomo|año=2010}}</ref><ref name="V
@diegodlh
diegodlh / custom_function.js
Last active June 21, 2019 00:15
Header Editor custom function to include Hypothesis as trusted source in CSP
// CSP directives to which Hypothesis will be added as trusted source
let directives = ['script-src', 'style-src', 'font-src', 'frame-src'];
// Hypothesis sources
let hyp_sources = ['hypothes.is', '*.hypothes.is'];
for (const i in val) {
// where val is the list of http response headers,
// for each header check if it is a Content Security Policy header
if (val[i].name.toLowerCase() === 'content-security-policy') {
@diegodlh
diegodlh / hocr-printspace
Created September 3, 2016 16:02 — forked from zuphilip/hocr-printspace
hocr-tools extension finding the print space of a page w/o margin notes
#!/usr/bin/env python
# Find the print space of a page, without margin notes
import sys,os,string,re
from lxml import html
import argparse
from PIL import Image, ImageDraw
def get_prop(node,name):