Skip to content

Instantly share code, notes, and snippets.

Timotheus Pokorra tpokorra

View GitHub Profile
@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/>");
@tpokorra
tpokorra / profile_db_generator.rb
Last active Oct 3, 2018
Discourse generator of a test database
View profile_db_generator.rb
# can be used to generate a mock db for profiling purposes
# we want our script to generate a consistent output, to do so
# we monkey patch array sample so it always uses the same rng
class Array
RNG = Random.new(1098109928029800)
def sample
self[RNG.rand(size)]
end
View exporting-documents-knowledgetree.py
import MySQLdb
import os
import shutil
# KnowledgeTree default place to store documents
ktdocument = '/var/www/ktdms/Documents/'
conn = MySQLdb.connect(user='', passwd='',db='', charset="utf8", use_unicode=True)
cursor = conn.cursor()
@tpokorra
tpokorra / cleanupcyrusmailboxes.sh
Created Jan 17, 2018
only use this as a reference, don't run it
View cleanupcyrusmailboxes.sh
#!/bin/bash
if [ -z "$1" ]
then
echo "$0 <user> <domain> <folder>"
echo "for example: $0"' "my.user" mydomain.com "Anfragen"'
echo "for a deleted mailbox: $0"' "test.test" test.tbits.net "test" "test" 1'
exit
fi
@tpokorra
tpokorra / reverseSEPA.php
Last active May 5, 2017
Reverse a SEPA direct debit file to a direct credit file / Lastschriften in Überweisungen konvertieren
View reverseSEPA.php
<?php
require __DIR__ . '/vendor/autoload.php';
use AbcAeffchen\Sephpa\SephpaCreditTransfer;
$xmlstring = file_get_contents("201704.xml");
$executiondate ='2017-05-08';
$creationdate='2017-05-05:T00:38:44';
$records = new SimpleXMLElement($xmlstring, LIBXML_NOCDATA);
@tpokorra
tpokorra / msbuild.spec
Last active Mar 31, 2017
msbuild spec file for RPM package
View msbuild.spec
# Note: this only works if you are able to modify /etc/os-release!
# for some reason, we cannot build on CentOS7, but only if we pretend to be Ubuntu 16.04!
Name: msbuild
Version: 15.1
Release: 1%{?dist}
Summary: The Microsoft Build Engine is a platform for building applications.
License: MIT
URL: https://github.com/Microsoft/msbuild
You can’t perform that action at this time.