Skip to content

Instantly share code, notes, and snippets.

@troeger
troeger / rpipypy.md
Last active August 29, 2019 14:56
Cross-compilation of PyPy for RaspberryPi
@troeger
troeger / cpython2pypy_minimal.py
Last active February 24, 2016 21:36
A minimal example for calling the PyPy interpreter from CPython.
#!/usr/bin/env python
'''
A minimal example for calling the PyPy interpreter from CPython.
Derived from pyinteractive.py.
This only intended to understand what is going on when.
PyPy triggers arbitary C compiler runs in between ...
'''
source="print 'Hello World'"
@troeger
troeger / raidcheck.py
Last active September 6, 2016 18:29
Draft for a Python script that checks an Adaptec HW RAID controller through the arcconf utility
#!/usr/bin/python
'''
Check status of an Adaptec HW RAID controller and sends an email
if something looks bad.
Intended for being used as cron job, so no screen output is generated.
'''
# Configuration section
notify_email="root"
@troeger
troeger / latexmkrc
Created October 13, 2016 09:32
Let "latexmk" consider extra files from another directory
$ENV{'TEXINPUTS'}='.:../../../Common//:../Include/:' . $ENV{'TEXINPUTS'};
$pdflatex="pdflatex -shell-escape -file-line-error --synctex=1 %O %S";
$pdf_mode=1;
@troeger
troeger / minecraft-server
Last active April 5, 2023 17:22
Running a Minecraft server as daemon on Amazon Linux
#!/bin/bash
#
# chkconfig: 2345 95 05
#
### BEGIN INIT INFO
# Provides: minecraft-server
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog
# Should-Stop: $syslog
@troeger
troeger / domain_list.py
Created March 8, 2017 23:14
Using the SchlundTech XML interface from Python
import schlundtech
auth={"user":"xxxxxx", "password":"yyyyy", "context":"zzz"}
all_domains=schlundtech.domain_info(auth)
for domain in all_domains:
print("\n{name} (last update: {updated})".format(**domain))
info=schlundtech.zone_info(auth, domain['name'])
for rr in info:
print("{name}\t\t{type}\t{value}".format(**rr))
@troeger
troeger / zot5exp2bbt.py
Last active August 7, 2017 06:15
Script for emulating the Zotero BetterBibtex stable citation key feature
#!/usr/bin/env python
'''
Script for emulating the BetterBibtex stable citation key feature.
(see https://github.com/retorquere/zotero-better-bibtex)
input.bib: A BibLatex export from a Zotero 5 library that has "Extra" field
entries for stable BibTex keys ("bibtex: <my_key>"). They end up in the
note field of the standard Zotero 5 export.
output.bib: A BibTex file where the citation keys from the Extra/note field are

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@troeger
troeger / checkqueue.py
Created December 9, 2017 14:20
Find hacked mail account used for spam sending (Postfix)
'''
This script checks the current Postfix mail queue for mails that
where delivered through SMTP authentication. It then shows both
the authentication user name and the sender mail adress.
Since spammers normally don't use a valid sender adress in your
administrative domain, you quickly see the problem.
Run with "python3 checkqueue.py"
'''
root@datexis-master2:/data/brick1# gluster volume get fast all
Option Value
------ -----
cluster.lookup-unhashed on
cluster.lookup-optimize on
cluster.min-free-disk 10%
cluster.min-free-inodes 5%
cluster.rebalance-stats off
cluster.subvols-per-directory (null)
cluster.readdir-optimize off