Skip to content

Instantly share code, notes, and snippets.

Christoph Mewes xrstf

Block or report user

Report or block xrstf

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@xrstf
xrstf / README-setup-tunnel-as-systemd-service.md
Created Nov 11, 2017 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward
View README-setup-tunnel-as-systemd-service.md

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@xrstf
xrstf / letsencrypt.md
Last active Sep 27, 2019
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth
View letsencrypt.md

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

View keybase.md

Keybase proof

I hereby claim:

  • I am xrstf on github.
  • I am xrstf (https://keybase.io/xrstf) on keybase.
  • I have a public key whose fingerprint is C642 F564 4F2E 15B1 7B90 1AB7 3CB6 C042 20FF 1254

To claim this, I am signing this object:

@xrstf
xrstf / setup.md
Last active Nov 4, 2019
Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 Setup
View setup.md

Info

This guide sets up a non-clustered Nutch crawler, which stores its data via HBase. We will not learn how to setup Hadoop et al., but just the bare minimum to crawl and index websites on a single machine.

Terms

  • Nutch - the crawler (fetches and parses websites)
  • HBase - filesystem storage for Nutch (Hadoop component, basically)
@xrstf
xrstf / IncrementableInterface.markdown
Last active Dec 17, 2015
Proposal for additional notes on the increment/decrement operations.
View IncrementableInterface.markdown

2.4 IncrementableInterface

This interface provides the ability to increment and decrement cache entries by their specified value. Some cache backends support this natively so that you don't have to read the item and then increment it and write it back to the cache server, this can be done in a single call to the cache server since it's natively supported by many modern cache servers.

  • Implementations MUST allow any integer to be incremented and decremented (i.e. decrementing 0 yields -1) by any [positive?] integer.
  • If a key does not exist, implementations MUST NOT create a new cache item and instead return false.
@xrstf
xrstf / bitbucket-proxy.php
Created Feb 28, 2013
This script can be used with Bitbucket's POST service to update packages on packagist.org.
View bitbucket-proxy.php
<?php
/*
* Dieses Script dient als "Proxy" zwischen Bitbucket und Packagist. Es empfängt
* einen POST-Request über den generischen POST-Service von Bitbucket und leitet
* diesen als PUT-Request an Packagist weiter, um das dazugehörige Paket zu
* aktualisieren.
*/
function clean($var) {
return get_magic_quotes_gpc() ? stripslashes($var) : $var;
@xrstf
xrstf / WebTestCase.php
Created Sep 14, 2012
Load Doctrine2 fixtures with foreign keys disabled
View WebTestCase.php
<?php
use Doctrine\Common\DataFixtures\Loader;
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as SfWebTestCase;
use Project\DummyBundle\DataFixtures\ORM\MyFixture;
abstract class WebTestCase extends SfWebTestCase {
public function setUp() {
@xrstf
xrstf / migrate.php
Created Aug 25, 2012
Migrationsscript für Sally 0.5/0.6/0.7-Updates
View migrate.php
<?php
/*
* Copyright (c) 2012, webvariants GbR, http://www.webvariants.de
*
* This file is released under the terms of the MIT license. You can find the
* complete text in the attached LICENSE file or online at:
*
* http://www.opensource.org/licenses/mit-license.php
*/
@xrstf
xrstf / gist:3459300
Created Aug 25, 2012
Sally 0.7 Controller-Erweiterung
View gist:3459300

Problem

Konkret ist der Content-Controller vom Sally-Backend problematisch. Er verlässt sich u.a. darauf, dass der nette Sally-Dispatcher seine Exceptions fängt. Das führt allerdings auch dazu, dass anstatt der "Inhalt"-Überschrift die "Unterwartete Exception"-Meldung auftaucht. Was nicht wirklich stimmt, da einige der Exceptions bewusst vom Controller geworfen werden (also nicht unerwartet sind).

Gleichzeitig taucht in vielen Controllern immer wieder das Muster auf, dass eine allgemeine init()-Methode angelegt wird, die von jeder Action als erstes aufgerufen wird. Teils ist die Methode so komplex, dass sie a) nicht mehrmals aufgerufen werden darf und b) die Ausführung der eigentlichen Action stoppen kann.

Vorschlag

@xrstf
xrstf / PasswordStrength.php
Created Jun 13, 2012
Wolfram|Alpha password strength calculation in PHP 5.2+
View PasswordStrength.php
<?php
/**
* Wolfram|Alpha password strength calculation
*
* @see https://gist.github.com/1514997 (original source this class is based on)
* @see http://www.wolframalpha.com/input/?i=password+strength+for+god
* @see https://github.com/rchouinard/phpass
* @license MIT
*/
You can’t perform that action at this time.