Skip to content

Instantly share code, notes, and snippets.

@VDK
VDK / Delpher.user.js
Created December 1, 2023 14:56
Delpher.user.js
// ==UserScript==
// @name Delpher met Wikitext
// @supportURL https://nl.wikipedia.org/wiki/Gebruiker:1Veertje/Delpher_userscript
// @namespace https://*.delpher.nl/nl/*
// @version 0.8
// @description Delpher WP improvement
// @author 1Veertje
// @match https://*.delpher.nl/nl/*
// @grant none
@VDK
VDK / add_family_name.py
Last active January 3, 2021 20:23
builds QuickStatments that assigns a family name as a property in Wikidata
# Created by Vera de Kok - aka 1Veertje 01.01.2021
# builds QuickStatments that assigns a family name as a property in Wikidata
# Reads a list of family names from dict.csv
#
# Please carefully check for false positives!
#
from SPARQLWrapper import SPARQLWrapper, JSON
import csv
@VDK
VDK / db_import_textfiles.py
Created November 5, 2020 07:59
importing the txt files from a directory into a mysql database
import os
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="",
database="default"
)
mycursor = mydb.cursor()
sql = "INSERT INTO table (page, filename) VALUES (%s, %s )"
@VDK
VDK / filelist.php
Last active November 5, 2020 08:01
display the filenames in a category on Wikimedia Commons as a bare list. See https://veertje-tools.toolforge.org/filelist/?cmtitle=Category:Test
<?php
$text = '';
if(isset($_GET['cmtitle']) && preg_match('/^Category:(.+)/', $_GET['cmtitle'])){
$cmtitle = str_replace(" ", "_", $_GET['cmtitle']);
$params = array ("cmtitle" => $cmtitle , "action" => "query", "list" => "categorymembers", "cmlimit" => "500", "format" => "json", "cmtype" => "file");
$files = json_decode(file_get_contents("https://commons.wikimedia.org/w/api.php?".http_build_query($params)), true);
$files = $files['query']['categorymembers'];
if (count($files) > 0){
foreach ($files as $file) {
$text .= $file['title']."<br/>";
// ==UserScript==
// @name MUBI id
// @namespace https://mubi.com/
// @version 0.2
// @description show mubi id in the interface
// @author VDK
// @match https://mubi.com/*
// @grant none
// ==/UserScript==
function docReady(fn) {
@VDK
VDK / YouTubeCCfeed.php
Created January 23, 2018 12:15
Filter YouTube rss feed to only let videos through that have a CreativeCommons license.
<?php
$key = 'googleAPIkey';
if (isset($_GET['user'])){
$user = strip_tags($_GET['user']);
$var = 'user';
}
elseif(isset($_GET['channel_id'])){
$user = strip_tags($_GET['channel_id']);
$var = 'channel_id';
@VDK
VDK / redirect_builder.php
Last active September 24, 2015 22:17
Generates a Macros file for the iMacros browser extention that when processed by said extension creates redirects on the Dutch language Wikipedia
<html>
<head><title>Redirects builder</title>
<meta charset="UTF-8">
<script type="text/javascript">
function myFunction(){
document.getElementById('row0').focus();
document.getElementById('row0').click();
}
</script>
<body onLoad="myFunction()">