Skip to content

Instantly share code, notes, and snippets.

View gmolveau's full-sized avatar

Grégoire MOLVEAU gmolveau

View GitHub Profile
@gmolveau
gmolveau / dealabs.js
Created December 5, 2019 14:48
dealabs sorted array of prices
[...document.querySelectorAll('span.thread-price')].map(elem => parseFloat(elem.innerText.replace("€","").replace(/,/, '.'))).sort(function(a,b) { return a - b;});
@gmolveau
gmolveau / spotify_top_songs_extract.md
Last active January 22, 2022 14:47
spotify your top songs extract

if you want to backup your top songs of {current_year}, here's a simple way of doing it :

  • open your browser
  • go to your top songs spotify playlist
  • open the console
  • copy the following code, paste it into the console and hit Enter
var songs = [];
document.querySelectorAll('div.tracklist-name').forEach((song) => {
@gmolveau
gmolveau / threader_app_reader_view_clean_export.md
Last active December 7, 2020 09:58
threader app reader-view clean export

Snippet to clean the threader app reader view to print-it easily to PDF

Method 1 : paste this code in the console

document.querySelector("#readability-page-1 > div > div > div > div:last-child").style.display = "none";
document.querySelector("#readability-page-1 > div > div > div p:last-child").style.display = "none";
document.querySelector("#readability-page-1 > div > div > div ul").style.display = "none";
document.querySelector("#modalsignup").style.display = "none";
document.querySelector("#modalaction").style.display = "none";
@gmolveau
gmolveau / nsfwyoutube_snippet.md
Created January 5, 2020 09:06
NSFW youtube bookmarklet redirect

Bookmarklet to redirect from youtube.com to nsfwyoutube.com

  • Create a new bookmark and addd the following code into the Location field :
javascript:(function(){window.location.replace(document.URL.replace('youtube','nsfwyoutube'))})()
  • Now save this bookmark on your toolbar
  • You can now click on it while being on youtube to redirect to nsfwyoutube.com
@gmolveau
gmolveau / recutils_tutorial_example.md
Last active March 25, 2025 18:13
A quick tutorial / example / cheatsheet of recutils https://www.gnu.org/software/recutils

recutils tutorial example

https://www.gnu.org/software/recutils/

GNU Recutils is a set of tools and libraries to access human-editable, plain text databases called recfiles.

TO install on mac : brew install recutils

add this to a new file named books.rec

@gmolveau
gmolveau / fuzzy-find-files.md
Created February 8, 2020 21:18
How to fuzzy find something in text files
@gmolveau
gmolveau / gitbook_publish.sh
Created February 14, 2020 21:45
Gitbook publish bash shell script github-pages
#!/usr/bin/env sh
# add _book and _publish to your .gitginore
REMOTE="origin"
BRANCH="gh-pages"
GITBOOK_FOLDER="_book"
PUBLISH_FOLDER="_publish"
if ! git diff-files --quiet --ignore-submodules --
@gmolveau
gmolveau / fformat.py
Created February 28, 2020 17:16
Python3 file and folder/directory sanitizer/format/renamer
import os, re, unicodedata
def clean(input_str):
# remove accents, only_ascii
nfkd_form = unicodedata.normalize('NFKD', input_str)
only_ascii = nfkd_form.encode('ASCII', 'ignore')
name = str(only_ascii, 'utf-8')
# replace non alphanumeric caracters by underscore
name = re.sub('[^0-9a-zA-Z]+', '_', name)
return name
@gmolveau
gmolveau / docker-compose.yml
Last active June 12, 2022 23:43
docker-compose nextcloud collabora nginx proxy letsencrypt
version: '3'
services:
nextcloud_db:
image: mariadb
container_name: nextcloud_db
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
restart: always
volumes:
- nextcloud_db:/var/lib/mysql
@gmolveau
gmolveau / franceculture.md
Last active April 19, 2020 20:40
France Culture bookmarklet get podcast mp3

Show mp3 location of the podcast + some info :

console.log("archive-download "+ $("button.replay-button").attr("data-asset-source") + ' "' + $("button.replay-button").attr("data-asset-surtitle")+"-"+$("button.replay-button").attr("data-asset-title") + '"');

Bookmarklet :

javascript:alert(%22archive-download%20%22%2B%24(%22button.replay-button%22).attr(%22data-asset-source%22)%2B'%20%22'%2B%24(%22button.replay-button%22).attr(%22data-asset-surtitle%22)%2B%22-%22%2B%24(%22button.replay-button%22).attr(%22data-asset-title%22)%2B'%22')%3Bvoid+0