Skip to content

Instantly share code, notes, and snippets.

@moschlar
moschlar / md-accounts-contact-update.py
Last active April 4, 2023 11:55
Change contact email addresses in Apache httpd mod_md account files
#!/usr/bin/env python3
# TODO: File locking using fcntl.lock
import argparse
import base64
import json
import logging
import pathlib
import acme.client
@moschlar
moschlar / keybase.md
Created April 17, 2019 09:30
keybase.md

Keybase proof

I hereby claim:

  • I am moschlar on github.
  • I am moschlar (https://keybase.io/moschlar) on keybase.
  • I have a public key ASD13MtUQOwSqumx3aAnuB8GBSyOcUyFJQPMFkXFBCjU8Qo

To claim this, I am signing this object:

$ grep ku3oghahghiv7aeC -r /fsapp/seafile_data/storage/blocks/9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a/
/fsapp/seafile_data/storage/blocks/9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a/9e/6643d813d6b2910128a5aaa301fca567d82842:ku3oghahghiv7aeC
$ rm /fsapp/seafile_data/storage/blocks/9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a/9e/6643d813d6b2910128a5aaa301fca567d82842
$ sudo -u seafile /opt/seafile/seafile-server-latest/seaf-fsck.sh 9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a
Starting seaf-fsck, please wait ...
[03/09/17 11:33:02] fsck.c(595): Running fsck for repo 9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a.
[03/09/17 11:33:02] fsck.c(422): Checking file system integrity of repo Test(9a06f3f8)...
[03/09/17 11:33:02] fsck.c(97): Block 9a06f3f8-1beb-4ee1-a83b-da7b2074cd4a:9e6643d813d6b2910128a5aaa301fca567d82842 is missing.
# -*- coding: utf-8 -*-
'''
Attributes need to be declared in SHIBBOLETH_ATTRIBUTE_MAP:
SHIBBOLETH_ATTRIBUTE_MAP = {
...
"affiliation": (False, "affiliation"),
"groups": (False, "groups"),
}
@moschlar
moschlar / git-daemon
Created August 4, 2015 06:19
systemd-unit for git-daemon
# conf.d file for git-daemon
#
# Please check man 1 git-daemon for more information about the options
# git-daemon accepts. You MUST edit this to include your repositories you wish
# to serve.
#
# Some of the meaningful options are:
# --syslog --- Enables syslog logging
# --verbose --- Enables verbose logging
# --export-all --- Exports all repositories
@moschlar
moschlar / gitlab.sh-session
Created January 21, 2015 22:22
GitLab Omnibus bundling all dependencies
$ dpkg-deb -c gitlab_7.6.2-omnibus.5.3.0.ci.1-1_amd64.deb | grep -v '/opt/gitlab/'
drwx------ 0/0 0 2015-01-08 10:00 ./
drwxr-xr-x 0/0 0 2015-01-08 10:00 ./opt/
$ dpkg-deb -c gitlab_7.6.2-omnibus.5.3.0.ci.1-1_amd64.deb | grep '/bin/' | egrep -v 'gems?'
drwxr-xr-x 0/0 0 2015-01-08 10:00 ./opt/gitlab/bin/
-rwxr-xr-x 0/0 460 2015-01-08 09:45 ./opt/gitlab/bin/gitlab-ci-rake
-rwxr-xr-x 0/0 461 2015-01-08 09:45 ./opt/gitlab/bin/gitlab-ci-rails
-rwxr-xr-x 0/0 479 2015-01-08 09:57 ./opt/gitlab/bin/gitlab-rails
-rw-r--r-- 0/0 0 2015-01-08 09:11 ./opt/gitlab/bin/.gitkeep
-rwxr-xr-x 0/0 1121 2015-01-08 09:57 ./opt/gitlab/bin/gitlab-ctl
@moschlar
moschlar / README.md
Last active August 29, 2015 14:09
NetBeans on Gentoo Linux

The Netbeans Launcher works not so well with Gentoo Linux' Java environment.

I did install Netbeans trough the Installer and OpenJDK via the package dev-java/icedtea-bin, which installs to e.g. /opt/icedtea-bin-7.2.5.3/.

Now the Netbeans Installer would hardcode netbeans_jdkhome="/opt/icedtea-bin-7.2.5.3" in the ~/.local/opt/netbeans-8.0.1/etc/netbeans.conf file. Of course, this path breaks on the next (minor) update of dev-java/icedtea-bin.

Simply commenting out the netbeans_jdkhome line does not work due to the way Gentoo uses its eselect mechanism for selecting a system/user Java VM implementation from a variety of installed ones. nbexecs autodetecting of the java executable fails because of the run-java-tool.bash script to which /usr/bin/java gets symlinked. I hope the symlinkery gets clear from the shell session below, if not, I'd be happy to supply more information.

@moschlar
moschlar / README.md
Last active March 25, 2019 05:01
Build and install ShareLaTeX in Ubuntu 14.04 LTS

Since the official ShareLaTeX documentation is primarily written with Ubuntu 12.04 LTS in mind, I tried to re-build the provided .deb from scratch using Ubuntu 14.04 TLS with the least amount of non-standard or non-packaged software.

Here are all the steps that were required (with sudo since Ubuntu doesn't want you to be root).

First, install lots of packages - note that no additional repositories are required! (Dependencies):

$ sudo apt-get update
$ sudo apt-get install git build-essential curl python-software-properties zlib1g-dev zip unzip
$ sudo apt-get install ruby-dev
$ sudo apt-get install nodejs npm
@moschlar
moschlar / sproxbug.py
Created November 12, 2014 11:09
Minimal working example to demonstrate issue TurboGears/sprox#4
'''Minimal working example to demonstrate issue TurboGears/sprox#4
Summary:
If the "many" side of a sqlalchemy relationship is also a required field
in sprox, the MultipleSelectField gets a UnicodeString validator, which
simply converts the value to a string, regardless of its type (in this
example, it leads to the repr string being used as the value). For
determining the selected options of the select field, the in operator
is then used on whatever string got generated first, leading to awkwardly
wrong selected values.
@moschlar
moschlar / make.conf
Last active February 5, 2024 10:00
Run Gentoo Portage in a cpu cgroup
PORTAGE_IONICE_COMMAND="/usr/local/sbin/portage-cgroup \${PID}"