Skip to content

Instantly share code, notes, and snippets.

@sebastianhaas
sebastianhaas / fridge.md
Last active April 11, 2018 13:52
Tapkey

Unfortunately, the mini fridge for our coffee machine seems to have either a broken power switch or a broken cable. If you move it, it will likely stop working and our milk will turn sour which I find particularly unpleasant. So, if you feel like replacing the milk, take some extra care not to displace the fridge.

@sebastianhaas
sebastianhaas / user.json
Created October 1, 2015 21:10
LoopBack User Friendship
{
"name": "user",
"plural": "users",
"base": "User",
"idInjection": true,
"options": {
"validateUpsert": true
},
"properties": {},
"validations": [],
@sebastianhaas
sebastianhaas / aoc1.py
Created December 3, 2019 13:41
Advent of Code 2019 Day 1
import math
def calc_total_fuel(masses):
fuel_sum = 0
for x in masses:
fuel_sum += calc_fuel(x)
return fuel_sum
def calc_fuel(mass):
fuel = math.floor(mass / 3.0) - 2
@sebastianhaas
sebastianhaas / socketcan-interface.service
Created August 6, 2016 15:02
An example systemd unit file to setup a SocketCAN interface on startup
[Unit]
Description=SocketCAN interface can0 with a baudrate of 250000
After=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set can0 type can bitrate 250000 ; /sbin/ifconfig can0 up
ExecReload=/sbin/ifconfig can0 down ; /sbin/ip link set can0 type can bitrate 250000 ; /sbin/ifconfig can0 up
ExecStop=/sbin/ifconfig can0 down