Skip to content

Instantly share code, notes, and snippets.

View sardinecan's full-sized avatar

Josselin Morvan sardinecan

View GitHub Profile
@sardinecan
sardinecan / split.jl
Created October 16, 2024 17:42
Découpage d'images avec Julia
#=
Banaka Split
Ce script Julia a été réalisé dans le cadre de l'[ANR Experts](https://experts.huma-num.fr/) afin
d'évaluer des méthodes de découpage automatique de photographies comportant des double pages et accessibles
depuis [Nakala](https://nakala.fr/).
Fichier image : https://api.nakala.fr/data/10.34847/nkl.027b840e/5c8e77a046216ab6aed848b2f781deb9495fea76
**Note** une clé API est requise pour récupérer les images depuis l'[API Nakala](https://api.nakala.fr/).
=#
@sardinecan
sardinecan / downloadImage.py
Last active October 16, 2024 07:38
Download Image with Python and simulate web browser
## Importing Necessary Modules
import requests # to get image from the web
import shutil # to save it locally
start = 1
stop = 54
range = range(start, stop+1)
for i in range:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Selection Info</title>
</head>
<body>
<div id="example">
<p>With <i>mixed</i> content <u>and</u> text...</p>
<?xml-stylesheet href="../xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Mouse Events in XForms</title>
<style>
@sardinecan
sardinecan / XPath2XForms
Created November 7, 2023 18:19
XPointer
<?xml-stylesheet href="xsltforms/xsltforms.xsl" type="text/xsl"?>
<?xsltforms-options debug="no"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events">
<head>
<title>Mouse Events in XForms</title>
<style>
declare function local:getIndex(){
let $doc :=
<div xml:id="transcription">
<h1 xml:id="c1">Sélectionnez une portion de texte pour obtenir sa position</h1>
<p xml:id="c2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Asperiores cumque dignissimos dolore et, facilis iure iusto laborum neque, officiis quas quis velit? Dolor iure libero non optio repudiandae. Error, nulla.</p>
<p xml:id="c3">Lorem ipsum dolor sit amet, <span>consectetur</span> adipisicing elit. <span>Asperiores</span> cumque dignissimos dolore et, facilis iure iusto laborum neque, officiis quas quis velit? Dolor iure libero non optio repudiandae. Error, nulla.</p>
</div>
(: $xpointer récupéré depuis le doc html avec le couple JS/XForms :)
let $xpointer := ("//p[@xml:id='c3']", "consectetur adipisicing")
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>XPointer test</title>
<style>
span{
color: orangered;
}
</style>
@sardinecan
sardinecan / htmlFromJson2Html
Created June 23, 2022 05:56
HTML from JSON 2 HTML with Svelte Kit
<script>
import { onMount } from 'svelte' ;
let container;
let str = {
"foo": "<h1>Hello World</h1><p>Hello World in a paragraph</p>"
};
onMount(() => {
let newInnerHTML = str.foo
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@jinntec/fore@latest/resources/fore.css" />
</head>
<body>
<fx-fore>
<h2>{for $i in (1, 2, 3) return $i, '… ;) oui oui, c’est bien Xquery qui s’exécute dans le nav’ !'}</h2>
@sardinecan
sardinecan / form.xml
Created February 6, 2021 08:35
[Xforms-XSLTForms] Submission loop
<?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xpr="xpr" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" lang="fr" xpr:bogus="fix Firefox namespace issue">
<head>
<title>Submission loop with Xforms</title>
<xf:model id="model">
<xf:instance id="main">
<person xmlns="xpr">
<name>John Doe</name>
<relations>
<relation ref="local-id-person1"/>