Skip to content

Instantly share code, notes, and snippets.

othyn /
Last active Sep 9, 2020
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.


If you prefer a simple, automated setup, [Bisa has a really handy init script that will do most of the work for

r0l1 / copy.go
Last active Oct 2, 2020
Copy a directory tree (preserving permissions) in Go.
View copy.go
/* MIT License
* Copyright (c) 2017 Roland Singer []
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
View types.markdown

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

bastman /
Created Mar 31, 2016
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
yang-wei /
Last active Feb 13, 2020
Elm Json.Decode tutorial and cheatsheet

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
yang-wei /
Last active Oct 26, 2020
Elm Destructuring (or Pattern Matching) cheatsheet

Should be work with 0.18

Destructuring(or pattern matching) is a way used to extract data from a data structure(tuple, list, record) that mirros the construction. Compare to other languages, Elm support much less destructuring but let's see what it got !


myTuple = ("A", "B", "C")
myNestedTuple = ("A", "B", "C", ("X", "Y", "Z"))
domenic /
Last active Oct 13, 2020
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this for our purposes, but for your project it might be npm build or gulp make-docs or make or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

jondlm / logger.js
Last active Aug 29, 2015
A flexible console logger for Node.js complete with log levels and color
View logger.js
// Logging levels:
// Usage:
// var log = require('./logger.js');
branneman /
Last active Oct 25, 2020
Better local require() paths for Node.js

Better local require() paths for Node.js


When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

View sed cheatsheet
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
You can’t perform that action at this time.