Skip to content

Instantly share code, notes, and snippets.

View stefan2904's full-sized avatar
🚲
¯\_(ツ)_/¯

Stefan stefan2904

🚲
¯\_(ツ)_/¯
View GitHub Profile
@stefan2904
stefan2904 / FirefoxCookiesToEmacs.py
Last active March 30, 2023 15:56
Sync Firefox Cookies to Emacs' url-cookie (see also README below)
#!/usr/bin/env python3
# ~/.emacs.d/url/cookies
# https://github.com/borisbabic/browser_cookie3
# ;; A cookie is stored internally as a vector of 7 slots
# ;; [ url-cookie NAME VALUE EXPIRES LOCALPART DOMAIN SECURE ]
from datetime import datetime
FROM debian:sid
RUN apt-get update
RUN apt-get install -y git make emacs
RUN git clone --depth 1 --branch release_9.5.5 https://git.savannah.gnu.org/git/emacs/org-mode.git org955
RUN git clone --depth 1 --branch release_9.6 https://git.savannah.gnu.org/git/emacs/org-mode.git org96
RUN cd org955 && make autoloads
RUN cd org96 && make autoloads
FROM debian:sid
RUN apt-get update
RUN apt-get install -y git emacs
RUN git clone --depth 1 --branch 0.4 https://github.com/toshism/org-super-links.git org-super-links-04
RUN git clone --depth 1 --branch fix-time-format https://github.com/akirak/org-super-links.git org-super-links-fix
ADD org-sl-test-04.el .
ADD org-sl-test-fix.el .
CMD ["bash"]
@stefan2904
stefan2904 / chaintest.py
Last active April 14, 2022 10:46
Python Requests Demo: How to handle a web server which serves a misconfigured TLS chain
import requests
# via https://whatsmychaincert.com/?webportal.stromnetz-graz.at
# "Generate the Correct Chain" + "Include Root Certificate"
# --> https://whatsmychaincert.com/generate?include_leaf=1&host=webportal.stromnetz-graz.at&submit_btn=Generate+Chain&include_root=1
CUSTOMSTORE='/tmp/webportal.stromnetz-graz.at.chained+root.crt'
print('without chain:')
try:
requests.get('https://webportal.stromnetz-graz.at/login')
@stefan2904
stefan2904 / generate.js
Last active March 31, 2022 13:07
Generate Ed25519 did:key in JSONWebKey format for usage in Hyperledger Aries
// using https://github.com/transmute-industries/did-key.js
// via https://www.npmjs.com/package/@transmute/did-key-ed25519
const main = async function() {
const k = await require('@transmute/did-key-ed25519').Ed25519KeyPair.generate({
secureRandom: () => {
return Buffer.from(
require('crypto').randomBytes(32),
'hex'
@stefan2904
stefan2904 / pinboard.py
Created January 10, 2022 21:10
Pinboard Orgmode "Importer", adapted from https://github.com/mathcass/pinboard-org
import json
import sys
import requests
import codecs
from requests.utils import get_netrc_auth
TMP_FILE = '/tmp/pinboard.json' # May not exist in all platforms
default_params = {'format': 'json'}
@stefan2904
stefan2904 / dir2org.sh
Created October 7, 2021 16:55
Convert directory of markdown files into orgmode heading
#!/bin/bash
# if [[ -d $PASSED ]]; then
# echo "$PASSED is a directory. Let's convert it."
# elif [[ -f $PASSED ]]; then
# echo "$PASSED is a file. Try md2org instead?"
# exit 2
# else
# echo "$PASSED is not valid?"
# exit 1
@stefan2904
stefan2904 / demo.php
Created June 23, 2021 16:23
PHP: Check if property exists in decoded JSON (using strict types)
<?php declare(strict_types=1);
$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
$j = json_decode($json);
var_dump($j);
var_dump($j->a == NULL);
@stefan2904
stefan2904 / courses.csv
Last active June 1, 2021 12:34
TU Graz courses (study year 2020/21)
We can't make this file beautiful and searchable because it's too large.
id,title,other_uni
BEA.01001PH,"Ästhetik, Kunst und visuelle Kultur (STEOP)",PH_Stmk
BEA.02001PI,Introduction to the subject specific professional field of ARTS Education,PPH_Graz
BEA.03001PH,Grundlagen bildnerischen Gestaltens I,PH_Stmk
BEA.04001PH,Wahrnehmungspsychologie,PH_Stmk
BEA.05001PH,Grundlagen der Fachdidaktik,PH_Stmk
BEA.06001PH,Grundlagen bildnerischen Gestaltens II,PH_Stmk
BEA.07115UB,Introduction to Iconography,Uni Graz
BEB.01001PH,Grafik I,PH_Stmk
BEB.02001PI,Painting I,PPH_Graz