Skip to content

Instantly share code, notes, and snippets.

# Create system user without home directory
sudo adduser --system --group --no-create-home <user>
# We want to avoid typing sudo whenever we run the docker command
sudo usermod -aG docker <user>
# List ids
id -u homebridge
id -g homebridge
[Unit]
Description=<user> docker container
After=docker.service
Requires=docker.service
[Service]
User=<user>
TimeoutStartSec=0
ExecStartPre=-/usr/bin/docker kill <user>
ExecStartPre=-/usr/bin/docker rm <user>
@stefanahman
stefanahman / nokogiri.bash
Created October 26, 2016 08:32
Install Nokogiri on macOS Sierra
bundle config build.nokogiri --use-system-libraries --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2
@stefanahman
stefanahman / Stockholm-Test.txt
Last active November 20, 2016 22:22
Python lab
# STOCKHOLM 1.0
#=GF AC RF00107
#=GF ID FinP
#=GF DE FinP
#=GF AU Griffiths-Jones SR
#=GF SE Griffiths-Jones SR
#=GF SS Published; PMID:9917389
#=GF GA 45.00
#=GF TC 50.80
@stefanahman
stefanahman / multiple_runs.sh
Last active December 27, 2015 22:49
This bash script runs a time measuring program N times and takes the average (takes the speed up of a reference program). The program will run with different number of threads (1-8). Requires that the program prints a time at the end. Usage: ./multiple_runs.sh [N] [prog] [ref-prog]
#! /bin/bash
export OMP_NUM_THREADS=1
nparam=$#
runs=$1
app=$2
ref=$3
# Init
tsup=0
@stefanahman
stefanahman / Preferences.sublime-settings
Created November 5, 2013 21:21
This is my Sublime Text 3 User settings file, Plugins used: BracketHighlighter, ColorPicker, DocBlockr, GitGutter, HTML5, LaTeXTools, Package Control, SublimeCodeIntel, Theme - Soda
{
"binary_file_patterns":
[
"*.jpg", "*.jpeg", "*.png", "*.gif", "*.ttf", "*.ico", "*.pdf",
"*.jar", "*.zip",
"*/min/*.js",
"*/min/*.css",
"*/min/*.map"
],
"bold_folder_labels": true,