Skip to content

Instantly share code, notes, and snippets.

View pfrenssen's full-sized avatar

Pieter Frenssen pfrenssen

  • Sofia, Bulgaria
View GitHub Profile

Factorio Modular Rail System

All blueprints are RHD (right-hand drive)

Modules are 42x42 (big electric poles overlap on neighboring modules)

Included blueprint books:

  • MRS - 2 Lane - RHD - 20 blueprints
  • MRS - 2 Lane Single - RHD - 34 blueprints
  • MRS - 4 Lane - RHD - 25 blueprints
@pfrenssen
pfrenssen / real-estate-company-financial-estimation.php
Created September 6, 2020 14:37
Calculates estimated ROI of a real estate investment company.
<?php
$investors = [];
for ($i = 1; $i < 4; $i++) {
$starting_capital = (int) ($_POST["investor_{$i}_starting_capital"] ?? 0);
$investors[] = [
'name' => "Inv. $i",
'starting_capital' => $starting_capital,
'contributions' => (int) ($_POST["investor_{$i}_contributions"] ?? 0),
@pfrenssen
pfrenssen / launch-ethminer.service
Last active December 8, 2019 17:15
Launches ethminer when the display goes to sleep
# ~/.config/systemd/user/launch-ethminer.service
[Unit]
Description=Launches ethminer when the display goes to sleep.
[Service]
ExecStart=bash /home/pieter/v/launchminer.sh
KillMode=process
[Install]
WantedBy=multi-user.target
@pfrenssen
pfrenssen / workrave-notification.service
Created November 3, 2019 17:32
Notify workrave timers
# /home/pieter/.config/systemd/user/workrave-notification.service
[Unit]
Description=Show a notification with the remaining Workrave time
[Service]
ExecStart=python /home/pieter/v/python/workrave-timer.py
[Install]
WantedBy=multi-user.target
@pfrenssen
pfrenssen / namespace-info-files.php
Created July 5, 2019 14:21
Provides project namespaces for Drupal module dependencies in info.yml files
<?php
$webroot = '/home/pieter/v/joinup-dev/web/';
$source_folders = [
'core/modules/' => 'drupal',
'modules/custom/' => 'joinup',
'modules/contrib/' => 'contrib',
];
// Compile a namespaced list of all modules.
#!/bin/bash -ex
./sync.sh
if [ ! -f sync.config ]; then
echo 'error: sync.config does not exist.'
exit 1
fi
. sync.config
#!/bin/bash -e
# Mount the backup drive.
if ! grep -qs '/mnt/workspace ' /proc/mounts; then
sudo mount /dev/sdc1 /mnt/workspace/
fi
# Update code base.
./vendor/bin/composer install --prefer-source
#!/bin/bash -e
# Making a backup makes most sense if we are on the develop branch. Ask for
# confirmation if we aren't.
if [ $(git rev-parse --abbrev-ref HEAD) != "develop" ] ; then
read -p "The develop branch is not checked out. Continue? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]] ; then
exit 1
fi
commit a4d0d2dd43d09b3d44031ce43165d4fad4078018
Author: Pieter Frenssen <pieter@frenssen.be>
Date: Sun Jul 22 15:42:02 2018 +0300
Revert "Fixed unwanted trailing tab in chrome 53 (#244)"
This reverts commit 67c5b8a20274c53ec2f85fabda7005a6ac2dd1b9.
diff --git a/src/Selenium2Driver.php b/src/Selenium2Driver.php
index cabdb60..0d54042 100755
@pfrenssen
pfrenssen / xpath.md
Last active April 17, 2018 09:55
Why does XPath return an empty set?

Update: this was caused by a bug in libxml2, which has in the meantime been reported and fixed. https://bugzilla.gnome.org/show_bug.cgi?id=795299

I have an HTML page with two tables, one of which has a row with mixed header and data cells, the second having only data cells:

<html>
  <head>
    <title>Table test page</title>
  </head>