Skip to content

Instantly share code, notes, and snippets.

Writing code one line at a time

Ben othyn

Writing code one line at a time
View GitHub Profile
othyn /
Last active Oct 20, 2021
My top recommended Laravel packages
Package (in Alphabetical Order) Description
othyn /
Last active Oct 19, 2021
How to setup a Factorio Headless Server

[LINUX] Factorio Headless Server Guide

So, with credit to the Factorio wiki and cbednarski's helpful gist, I managed to eventually setup a Factorio headless server. Although, I thought the process could be nailed down/simplified to be a bit more 'tutorialised' and also to document how I got it all working for my future records.

The specific distro/version I'm using for this guide being Ubuntu Server 16.04.1 LTS. Although, that shouldn't matter, as long as your distro supports systemd (just for this guide, not a Factorio headless requirement, although most distros use it as standard now). The version of Factorio I shall be using is 0.14.20, although should work for any version of Factorio 0.14.12 and higher.

Just a note to newcomers: If there are any issues with the installation steps, people in the comments are doing a good job

View youtube_clean_watch_later_videos.js
// This script will remove all videos from watch later list
// Usage
// #1 go to
// #2 run following script
function randomIntFromInterval(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
othyn / Docker connect to remote
Created Jul 15, 2021 — forked from kekru/Docker connect to remote
Connect to another host with your docker client, without modifying your local Docker installation
View Docker connect to remote

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

othyn / LogLevel.php
Last active Sep 15, 2020
RFC 5424 log levels for BenSampo's Laravel Enum package.
View LogLevel.php
namespace App\Enums;
use BenSampo\Enum\Enum;
* @method static static Emergency()
* @method static static Alert()
* @method static static Critical()
othyn /
Last active Aug 21, 2020
Quick script to write a bootable UEFI Windows ISO to USB in macOS
# System: Darwin x86_64 19.6.0 (macOS 10.15.6 19G2021)
# Author: Othyn (
# Source:
# Dependencies: pv, wimlib
# Licence: MIT
othyn / ChangePasswordController.php
Last active Jul 25, 2020
Laravel 6.x change password (Routes, Controller, Request & View)
View ChangePasswordController.php
* app/Http/Controllers/Auth/ChangePasswordController.php
* Made via the command:
* $ php artisan make:controller Auth/ChangePasswordController -r
* This is the custom controller that will do all the heavy lifting for
* changing the users password.
othyn /
Last active Feb 5, 2020
Docker to launch either sh/bash or node depending on the script shebang executable type. This came from a personal circumstance where to save resources, one node image could be used to run shell scripts and node scripts that both performed actions against the same resource. This condensed 4 containers into 1, giving the same result.
set -e
FIRST_LINE=$(head -n 1 "${1}")
# As the scripts can be either JS or shell, determine how to exec!
if [ "${FIRST_LINE}" = "#!/bin/sh" ] || [ "${FIRST_LINE}" = "#!/bin/bash" ]; then
eval "./$@"
othyn / php_cli_table.php
Created Jan 7, 2020
Quick PHP table output for console
View php_cli_table.php
* A quick way, with a bit of overhead, to get nice tabular output
* from a PHP CLI app.
* Sometimes I find myself just requiring very quick and dirty
* tabular output and find this to be the path of least resistance.
* This method utilises Symfony's Console's Table and BufferedOutput
othyn /
Created May 14, 2019
Mount a Raspberry Pi image of your choice :)
# Globals
TIMESTAMP=$(date +%s)
# Usage declaration
display_usage() {