Skip to content

Instantly share code, notes, and snippets.


maxlath maxlath

View GitHub Profile
maxlath / userChrome.css
Last active Oct 12, 2021
Hide "Firefox suggests" text in Firefox 93 search menu
View userChrome.css
Create or edit userChrome.css in your Firefox profile folder,
typically found on Linux at ~/.mozilla/firefox/[your firefox profile folder]/chrome/userChrome.css
margin-block-start: 0 !important;
maxlath / wd_config_from_environment
Created Sep 3, 2021
Setup Wikidata OAuth credentials for wikibase-cli from environment variables
View wd_config_from_environment
#!/usr/bin/env bash
# Assuming that the workflow yaml file sets the following
# env:
# WD_TOKEN: ${{ secrets.WD_TOKEN }}
echo "{
maxlath / handlebars2svelte.js
Last active Mar 4, 2021
Convert a Handlebars template to Svelte
View handlebars2svelte.js
#!/usr/bin/env node
// Handlebars and Svelte templates are quite similar (that is, looking a lot like plain HTML),
// so converting from Handlebars to Svelte is mostly a matter of converting handlebars helpers argument syntax
// into Svelte JS-based syntax, and importing the helper functions.
// WARNING: if you have been using named arguments in Handlebars (a.k.a. 'hash' arguments),
// the helper function interface will need to be updated (or the arguments passed as `{ hash: argsObject }`)
maxlath /
Last active Jan 13, 2021
add publishers to editions on using curl
# Use your username and password to get session cookies
INV_SESSION_COOKIES=$(curl -v '' -d "{\"username\":\"$INV_USERNAME\",\"password\":\"$INV_PASSWORD\"}" 2>&1 | grep 'Set-Cookie: inventaire:session' | awk '{print $3}' | xargs echo)
curl -s -XPUT "" -H "Cookie: $INV_SESSION_COOKIES" -H "Content-Type: application/json" -d "{\"uri\":\"${uri}\",\"property\":\"${property}\",\"new-value\":\"${value}\"}"
maxlath / update_commit_previous_hashes_list
Last active Oct 30, 2020
Keep a list of the hashes by which a commit was previously known
View update_commit_previous_hashes_list
#!/usr/bin/env sh
# A script to keep a list of the hashes by which a commit was previously known
# Adapted from
# Installation:
# - copy this script to a directory in your $PATH
# - make it executable:
# chmod +x ./update_commit_previous_hashes_list
# - it should now be accessible from any directory, which can be checked like this:
maxlath / branches-diff
Last active Aug 31, 2020
Display changes made to a file in all the active branches
View branches-diff
#!/usr/bin/env bash
# Display changes made to a file in all the active branches
if [[ $1 == "" ]] ; then
echo "branches-diff <files...|folders...>"
exit 1
View .aliases
# Initialize the array of favs
source ~/.favs
# Create an alias for each of the favs
for key in $favs
alias $key="cd $directory"
maxlath / test_sorting.js
Last active Feb 23, 2020
testing performance of sorting with or without pre-sorting
View test_sorting.js
#!/usr/bin/env node
// Environment
// ------------------
// NodeJS: v12.14.0
// CPU: 2.50GHz
// arrays length = 1000 (that is, sorting 1000^2 elements)
// Results
// ------------------
maxlath / decaffeinate_cleanup.js
Last active Nov 10, 2019
completing bulk-decaffeinate and eslint --fix
View decaffeinate_cleanup.js
#!/usr/bin/env node
// To be run after bulk-decaffeinate is done
// bulk-decaffeinate convert --num-workers 8 --config ~/bulk-decaffeinate.config.js
// cleanup(){
// decaffeinate_cleanup.js "$@" && npm run lint-fix "$@"
// }
// cleanup **/*.js
maxlath / index.html
Created Nov 3, 2016
allow to add MediaChain as a search engine
View index.html
<!doctype html>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="MediaChain Search" />