Skip to content

Instantly share code, notes, and snippets.

Avatar

Timotheus Pokorra tpokorra

View GitHub Profile
@tpokorra
tpokorra / update_pgp_wkd.sh
Last active Nov 19, 2021
Update WKD for PGP/GnuPG Keys on Hostsharing
View update_pgp_wkd.sh
#!/bin/bash
if [ -z $1 ]
then
echo "Bitte den Pfad für die Datei mit dem öffentlichen Key mitgeben: z.B. $0 ~/public.txt"
exit
fi
publickeyfile=$(realpath $1)
if [ ! -f $publickeyfile ]
@tpokorra
tpokorra / get_issues.py
Created Oct 26, 2021
get closed issues from a milestone as preparation for OpenPetra release
View get_issues.py
#!/usr/bin/python3
import requests
import json
url = "https://api.github.com/repos/openpetra/openpetra/issues"
milestone = "17"
S = requests.Session()
headers = {'Accept': 'application/vnd.github.v3+json'}
# see https://docs.github.com/en/rest/reference/issues#list-repository-issues
@tpokorra
tpokorra / dyndns.php
Last active Jun 2, 2021
dyndns mit Hostsharing
View dyndns.php
<?php
// zum Aktualisieren der IP Adresse: https://dyndns.example.org/dyndns.php?domain=meinedynamische.example.org
if (!isset($_GET['domain'])) {
die('Die Angabe der Domain fehlt.');
}
$domain = $_GET['domain'];
$filename = "/home/pacs/xyz00/users/dyndns/doms/example.org/etc/pri.example.org";
@tpokorra
tpokorra / fixUmlautMySQLLatin1ToUTF8.py
Created Apr 3, 2021
fix mediawiki mysql database, replace Umlaut, when converting from latin1 to utf-8
View fixUmlautMySQLLatin1ToUTF8.py
#!/usr/bin/python3
# first call:
# mysqldump --add-drop-table database_to_correct | replace CHARSET=latin1 CHARSET=utf8 | iconv -f latin1 -t utf8 | mysql database_to_correct --default_character_set utf8 > fixed.sql
# then run this script
out = open("converted.sql", "w")
with open('fixed.sql', encoding='utf8') as f:
for line in f:
line = line.replace('CHARACTER SET latin1 COLLATE latin1_bin', 'CHARACTER SET utf8 COLLATE utf8_bin')
line = line.replace('â<80><93>', '-')
@tpokorra
tpokorra / arrange_photos_per_day.py
Last active Mar 25, 2021
Arrange Photos into directories per day
View arrange_photos_per_day.py
#!/usr/bin/python3
import os
import pathlib
from datetime import datetime
for file in os.listdir("."):
if file.endswith(".jpg") or file.endswith(".3gp"):
if '_' in file:
date = datetime.strptime(file.split("_", 2)[1], '%Y%m%d')
datestr = date.strftime('%m/%d/%Y')
@tpokorra
tpokorra / builder.cs
Last active Oct 18, 2019
simple c# build tool as alternative to xbuild
View builder.cs
// a simple alternative to xbuild
// parse sln and csproj files, and call mcs to compile the projects.
// can only build libraries at the moment
// Copyright: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
// License: MIT
// to build: mcs builder.cs -r:System.Xml.Linq
using System;
using System.IO;
using System.Diagnostics;
using System.Xml.Linq;
@tpokorra
tpokorra / testSendMail.cs
Created Oct 8, 2019
Test sending Mail with Ict.Common.IO and MimeKit
View testSendMail.cs
// mcs testSendMail.cs -r:System.Data -r:delivery/bin/Ict.Common.IO.dll -r:delivery/bin/Ict.Common.dll -r:delivery/bin/MimeKit.dll
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Collections;
using System.Collections.Specialized;
using System.Dynamic;
using System.Globalization;
@tpokorra
tpokorra / Dockerfile.test
Last active Aug 19, 2019
Fedora Docker image with systemd inside
View Dockerfile.test
# see https://developers.redhat.com/blog/2016/09/13/running-systemd-in-a-non-privileged-container/
FROM fedora:30
ENV container docker
RUN dnf -y install net-tools openssh-server glibc-locale-source passwd
RUN mkdir /var/run/sshd
# create host ssh key
RUN ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
# SSH login fix. Otherwise user is kicked off after login
@tpokorra
tpokorra / build_mono_nuget_mcs.sh
Last active Jul 15, 2019
Build NuGet 5 with Mono and mcs compiler for Fedora
View build_mono_nuget_mcs.sh
#!/bin/bash
path=`pwd`
if [ 1 -eq 1 ]; then
cd $path/build/Shared
echo "**** building `pwd`/ ****"
for f in *.cs
do
sed -i "s/internal/public/g" $f
@tpokorra
tpokorra / session.aspx
Last active Jul 21, 2019
Testing Sessions with aspx on Mono
View session.aspx
<%@ Page Language="C#" src="session.aspx.cs" %>
<html xmlns="www.w3.org/1999/xhtml">
<%@ Import Namespace="System.Threading" %>
<head runat="server">
<title></title>
</head>
<body>
<div>
<%
Response.Write( "Hello World<br/>");