Skip to content

Instantly share code, notes, and snippets.

View Koenvh1's full-sized avatar
🇳🇱
De zon gaat zinloos onder, morgen moet ze toch weer op.

Koen van Hove Koenvh1

🇳🇱
De zon gaat zinloos onder, morgen moet ze toch weer op.
View GitHub Profile
@Koenvh1
Koenvh1 / m3uconverter.py
Last active April 12, 2021 00:14
A script to convert m3u files with absolute paths to m3u files with relative paths. The original file will be overwritten! Just call using "python m3uconverter.py path/to/folder"
import codecs
import glob
import os
import sys
def parse(file, encoding="utf-8-sig"):
fp = codecs.open(file, "r", encoding=encoding)
lines = fp.readlines()
fp.close()
@Koenvh1
Koenvh1 / canvas-scraper.py
Created April 13, 2019 12:56
Scrape your Canvas website and download all content to a folder. Tested on 2019-04-13.
import argparse
import os
import re
from pathvalidate import sanitize_filename
from canvasapi import Canvas
from canvasapi.course import Course
from canvasapi.exceptions import Unauthorized, ResourceDoesNotExist
from canvasapi.file import File
from canvasapi.module import Module, ModuleItem
@Koenvh1
Koenvh1 / blackboard-scraper.py
Created April 13, 2019 12:55
Scrape your Blackboard website and download all content to a folder. Tested with Blackboard Learn 3100.0.6.
import argparse
import os.path
import shutil
from urllib.parse import unquote
import pathvalidate
import requests_html
class Scraper:
@Koenvh1
Koenvh1 / stitch_images.py
Created March 3, 2018 21:24
Create an album image mosaic
from os import system, listdir, chdir
import random
for current_row in range(9):
images = []
for i in range(16):
images.append("artistart\\" + random.choice(listdir("artistart")))
print(images)
<?php
// Class to send a message via Telegram
class Telegram
{
function sendMessage($id, $text, $location = null)
{
$loop = \React\EventLoop\Factory::create();
$handler = new HttpClientRequestHandler($loop);
$tgLog = new TgLog(TELEGRAM_KEY, $handler);
@Koenvh1
Koenvh1 / FlitsLogic.php
Last active December 11, 2017 12:33
The logic behind Flitsmelder (https://koenvh.nl/flitsmelder), a system that notifies you when a mobile radar is on your route. This is just the logic to check whether a radar is in range.
<?php
/**
* Class FlitsLogic
*
* Class to get radars from flitsservice.nl, and parse the points to check whether they are within a certain distance.
*
* @author Koen van Hove
* @license MIT
* (Though it would be really nice if you left a message if you decided to use this, and perhaps even credited me)
*/
@Koenvh1
Koenvh1 / streamtheworld-parser.php
Created January 14, 2017 16:57
Convert StreamTheWorld.com callsign to actual stream URL
<?php
/*
* Because the actual streaming URLs from StreamTheWorld.com stations change often,
* this script will dynamically redirect you to the stream URL.
*
* Do with it what you want :-)
* Koen (koenvh.nl)
*
* Usage: Provide a "sign" argument in your get request.
* This is the station's sign, which is the part after the slash without the (AAC)_SC part.