Skip to content

Instantly share code, notes, and snippets.

@kevin-smets
kevin-smets / iterm2-solarized.md
Last active May 7, 2024 09:29
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@aethercowboy
aethercowboy / ExampleGame.cs
Last active May 1, 2024 13:28
Monogame with IHostedService DI
public class ExampleGame : Game, IGame
{
public Game Game => this;
private readonly ISomeDependency _someDependency;
public ExampleGame(ISomeDependency someDependency)
{
_someDependency = someDependency;
}
@othyn
othyn / factorio_headless_guide.md
Last active April 15, 2024 08:27
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

@joni
joni / toUTF8Array.js
Last active June 30, 2023 04:02
toUTF8Array: Javascript function for encoding a string in UTF8.
function toUTF8Array(str) {
var utf8 = [];
for (var i=0; i < str.length; i++) {
var charcode = str.charCodeAt(i);
if (charcode < 0x80) utf8.push(charcode);
else if (charcode < 0x800) {
utf8.push(0xc0 | (charcode >> 6),
0x80 | (charcode & 0x3f));
}
else if (charcode < 0xd800 || charcode >= 0xe000) {
@sheharyarn
sheharyarn / nginx.overrides
Created June 27, 2015 20:31
Restart / Reload Nginx without Entering Sudo Password
# Enter this command to create a sudoers override/include file:
# sudo visudo -f /etc/sudoers.d/nginx.overrides
# (Make sure you actually have this in your /etc/sudoers - Run `sudo visudo` to check)
# #includedir /etc/sudoers.d
# This file assumes your deployment user is `deploy`
# Nginx Commands
Cmnd_Alias NGINX_RESTART = /usr/sbin/service nginx restart
@numberoverzero
numberoverzero / 00. selinux.md
Last active June 17, 2022 16:31
hardened nginx conf, multiple subdomains under different certs using SNI

SELinux, oh god.

Context

You generated some certs, some dhparams, set up cloudflare origin certs, copied all the settings below, added some content to /var/www/ and set up your nginx.conf, and nginx -t says everything's fine.

Let's load some content! Nope, just kidding, nothing works.

@nicolashery
nicolashery / solarized-dark.css
Last active March 25, 2022 08:38 — forked from scotu/solarized.css
Solarized theme stylesheets for Jekyll and Pygments
/* Solarized Dark
For use with Jekyll and Pygments
http://ethanschoonover.com/solarized
SOLARIZED HEX ROLE
--------- -------- ------------------------------------------
base03 #002b36 background
base01 #586e75 comments / secondary content
@numberoverzero
numberoverzero / appendix.rst
Last active November 11, 2021 23:41
semver appendix A

Appendix: Backwards Compatible Bug Fixes

The last point of Semantic Versioning 2.0.0__ has caused much debate around what constitutes a breaking change__. There's no way to strictly define breaking without reducing it to uselessness. Instead, the following tests are applied to determining if a bug fix is backwards compatible. If either of the following holds, fixing the bug is backwards incompatible:

  1. A reasonable user would not notice the unintended behavior; even if it is not covered by, or is directly
@numberoverzero
numberoverzero / 00.bloop_multitable.py
Created November 10, 2021 23:31
Small class to map multiple Bloop models onto a shared table
# bloop 3.0.0
import copy
from typing import Union
from bloop import BaseModel, Column
from bloop.models import subclassof, instanceof
from bloop.types import Type
__all__ = ["Mapper"]
# fragments from evaluating some toolkit classes to build shared models as used
# in DAT401: Advanced Design Patterns for DynamoDB
# https://www.youtube.com/watch?v=HaEPXoXVf2k
import functools
from typing import Type
from bloop.conditions import Condition, iter_columns
from bloop.models import BaseModel, Column, IMeta, bind_column