Skip to content

Instantly share code, notes, and snippets.

@Romern
Romern / Dockerfile
Created August 12, 2021 10:02
Dockerfile for verifiable-image-redacting
FROM rust:slim-buster
RUN apt-get update
RUN apt-get install -y \
wget unzip curl \
build-essential cmake git libgmp3-dev libprocps-dev python-markdown libboost-all-dev libssl-dev pkg-config libopencv-dev
# install verifiable image redacting library with workaround for now (see https://github.com/snp-labs/verifiable-image-redacting/issues/1 )
RUN git clone https://github.com/Romern/verifiable-image-redacting \
&& cd verifiable-image-redacting \
@Romern
Romern / app.js
Created August 1, 2021 14:54
Short nodejs script which dumps all menus for lieferando restaurants in your area, and python script which puts them crudely into a csv file for eaier inspection.
import {inspect} from 'util';
import {Takeaway, TakeawayConfig} from 'takeaway';
(async () => {
try {
const plz = "52080";
const coordLNG = '50.7';
const coordLAT = '6.0';
// Initialize configuration
@Romern
Romern / downloadL2p.sh
Last active June 29, 2021 09:07
Downloads all materials from l2p using curl and wget
#!/bin/bash
USER="AB12345"
PASS="hunter2"
echo "Getting courses..."
COURSES=$(curl -s --ntlm -u "${USER}:${PASS}" https://www3.elearning.rwth-aachen.de/l2p/foyer/SitePages/PastCourses.aspx | grep -oE "https://www[0-9].elearning.rwth-aachen.de/(ws|ss)[0-9]{2}/[0-9]{2}(ws|ss)-[0-9]*")
echo "Recursively download all courses using wget..."
while IFS= read -r c
@Romern
Romern / MoodleParser.java
Created June 4, 2021 17:03
old moodle parser
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.jsoup.nodes.Attributes;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
<?xml version="1.0" encoding="UTF-8"?>
<Mpeg7
xmlns="urn:mpeg:mpeg7:schema:2001"
xmlns:mpeg7="urn:mpeg7:schema:2001"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Description xsi:type="ContentEntityType">
<MultimediaContent xsi:type="VideoType">
<Video id="videosegment">
<MediaLocator>
<MediaUri>https://admin.streaming.rwth-aachen.de/files/mediapackage/e97569b7-9bb9-4ed0-bd4f-9adbb66595cc/db24fdd6-6d07-44bf-9677-f663fce8e2c0/IDS_01_intro.mp4</MediaUri>
import pikepdf
import sys
if len(sys.argv)<3:
print(f"Usage {sys.argv[0]} input.pdf output.pdf")
exit(1)
input = sys.argv[1]
output = sys.argv[2]
@Romern
Romern / napsterdl.py
Created March 3, 2021 19:38
Napster stream API used in android app (no drm)
import requests
from requests.auth import HTTPBasicAuth
import json
from pathlib import Path
apikey = 'ZTJlOWNhZGUtNzlmZS00ZGU2LTkwYjMtZDk1ODRlMDkwODM5' #from the APK
secret = 'MTRjZTVjM2EtOGVlZi00OTU3LWFmNjktNTllODFhNmYyNzI5' #from the APK
def download_file(url, filename):
with requests.get(url, stream=True) as r:
@Romern
Romern / takeawayaway.py
Created February 7, 2021 21:14
Base function for the takeaway (lieferando) API. For the spec see https://github.com/TakeawayAPI/takeaway-spec
import requests
from hashlib import md5
import json
import sys
headers = {
'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
"Accept": "application/json"
}
default_params = {
@Romern
Romern / swagger-nina.yaml
Created February 3, 2021 14:41
Swaggerfile for some NINA API's
swagger: "2.0"
info:
description: ""
version: "1.0.0"
title: "NINA Warnmeldungen"
license:
name: "Proprietary"
host: "warnung.bund.de"
basePath: "/api31"
schemes:
@Romern
Romern / subscraper.py
Created January 30, 2021 16:26
Scrape all submissions of a subreddit via pushshift.io
import sys
import json
import requests
import traceback
if len(sys.argv)<4:
print("Scrape whole subreddit's submissions.")
print(f"Usage: {sys.argv[0]} SUBREDDIT BEFORETIMESTAMP OUTPUTFILE")
exit()