Skip to content

Instantly share code, notes, and snippets.

View RayBB's full-sized avatar

Raymond Berger RayBB

View GitHub Profile
/*
A script to auto generate this page: https://openlibrary.org/collections/kingdom-of-hawai'i-people
*/
class SPARQLQueryDispatcher {
constructor(endpoint) {
this.endpoint = endpoint;
}
query(sparqlQuery) {
@RayBB
RayBB / smallfixes.user.js
Last active December 6, 2023 19:01
Small website fixes
// ==UserScript==
// @name ! Small Website Fixes
// @namespace Small Fixes
// @match *://*/*
// @grant none
// @version 0.0.4
// @author RayBB
// @updateURL https://gist.github.com/RayBB/3cc8d1609b83235ecea97477b447aa44/raw/e09ca5366af0d4369d79bdcd450fcde937ecce8a/smallfixes.user.js
// @downloadURL https://gist.github.com/RayBB/3cc8d1609b83235ecea97477b447aa44/raw/e09ca5366af0d4369d79bdcd450fcde937ecce8a/smallfixes.user.js
// @description Autofills passwords on some sites once they've been entered once.
@RayBB
RayBB / porkbun.js
Last active December 3, 2023 16:54
Cleanup domain search results on porkbun
const MAX_RENEWAL = 20;
const MAX_INITIAL = 100;
function isUnavailable(e){return e.innerHTML.includes("unavailable")}
function highRenewalPrice(e){
const container = e.querySelector(".searchResultRowTable .renewsAtContainer");
if (!container) return false;
return (parseInt(container.innerText.match(/\d+/)[0]) || 0) > MAX_RENEWAL;
}
import os
import re
def findfiles(path, regex):
regObj = re.compile(regex)
res = []
for root, dirs, fnames in os.walk(path):
for fname in fnames:
if regObj.match(fname):
res.append(os.path.join(root, fname))
@RayBB
RayBB / emjmd.js
Created June 26, 2021 05:30
EMJMD Catalogue Scraper
// For https://www.eacea.ec.europa.eu/scholarships/emjmd-catalogue_en?f%5B0%5D=years_for_emjmd_years_for_emjmd%3A14
// Run in console
Array.from(document.querySelectorAll(".ecl-u-flex-grow-1"))
.filter(e => e.innerText.includes("locations"))
.map(e => {
const name = e.querySelector(".ecl-u-type-heading-5").innerText;
const website = e.querySelector(".ecl-content-item__description a").href;
const countries = e.querySelector(".ecl-description-list__definition").innerText.split("\n");
return `${name}\t${website}\t${countries.join(',')}`
@RayBB
RayBB / miniflux.js
Created August 5, 2020 14:59
Hide feeds with no new items in miniflux
/*
Run this on https://reader.miniflux.app/feeds or whatever feeds page you have.
All of the feeds with 0 unread entries will be hidden.
*/
const items = Array.from(document.querySelectorAll(".item"))
items.forEach((item)=>{ if(item.querySelector('[title="Number of unread entries"]').innerText == '0') item.style.display = 'none' })
/*
Go to this page: https://www.youtube.com/playlist?list=WL
Run the command in the console
Paste the output in the terminal and enjoy your downloaded videos
*/
copy(
Array.from(document.querySelectorAll("#content #thumbnail"))
.map(a => a.href)
.filter(a=>a!=undefined)
@RayBB
RayBB / tmdb_importer.js
Created July 25, 2020 01:53
Import episodes to The Movie Database
/*
The Movie Database Episode Importer
This is a small script that can be run in the console of https://www.themoviedb.org/ to create episodes for a show.
*/
function buildFormData(dateString, title, episodeNumber) {
const formData = new FormData();
const air_date = (new Date(dateString)).toISOString();
const data = {
@RayBB
RayBB / wait_for_gae.sh
Created July 16, 2020 14:41
Wait for all Google App Engine operations to finish before continuing
#!/bin/bash
set -x
printf "%s" "$GAE_CREDENTIALS" > ~/gaecreds.json
gcloud auth activate-service-account --key-file ~/gaecreds.json
gcloud config set project "$GCLOUD_PROJECT"
DEBIAN_FRONTEND=noninteractive
# send install logs to null for cleaner logs
apt-get install jq >/dev/null
@RayBB
RayBB / wikipedia.applescript
Created April 12, 2020 17:11
Helps me edit Wikipedia faster
property comment : "adding links to other articles"
on run {input, parameters}
(*
Follow the steps here to get this setup:
https://apple.stackexchange.com/questions/175215/how-do-i-assign-a-keyboard-shortcut-to-an-applescript-i-wrote
Wikipedia hotkeys here:
https://en.wikipedia.org/wiki/Wikipedia:Keyboard_shortcuts
This is a small script to help make editing Wikipedia faster