Skip to content

Instantly share code, notes, and snippets.

@jadkik
jadkik / validate-nginx-config.sh
Created August 24, 2017 07:06
Used to validate nginx templated config files before actually using them. For use with Ansible.
#!/usr/bin/env bash
# Example usage from an Ansible playbook:
# - name: Copy the nginx validate script
# copy: src=validate-nginx-config.sh dest=/opt/validate-nginx-config.sh mode=0744
#
# - name: Update main nginx config file
# template:
# src: nginx.conf.j2
# dest: /etc/nginx/nginx.conf
@FrankSpierings
FrankSpierings / README.md
Last active November 4, 2025 21:29
Linux Container Escapes and Hardening
@squito
squito / _summary.md
Last active February 5, 2020 14:15
spark sql timestamp semantics, and how they changed from 2.0.0 to 2.0.1 (see query_output_2_0_0.txt vs query_output_2_0_1.txt) changed by SPARK-16216

Spark "Timestamp" Behavior

Reading data in different timezones

Note that the ansi sql standard defines "timestamp" as equivalent to "timestamp without time zone". However Spark's behavior depends on both the version of spark and the file format

format \ spark version <= 2.0.0 >= 2.0.1
@leanderjanssen
leanderjanssen / registry-minio.md
Last active February 11, 2025 14:12
Docker Registry with Minio storage example

Running a docker registry with Minio S3 backend

Run minio in a container

docker run -d -p 9000:9000 --name minio minio/minio server /export

Use docker logs to retrieve access key and secret key from minio container

docker logs minio

Create config.yml for Docker Registry

This file will have to be mounted to /etc/docker/registry/config.yml

@ageis
ageis / systemd_service_hardening.md
Last active December 19, 2025 07:46
Options for hardening systemd service units

security and hardening options for systemd service units

A common and reliable pattern in service unit files is thus:

NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
DevicePolicy=closed
ProtectSystem=strict
@komljen
komljen / shell_tips.sh
Last active September 13, 2024 08:16
Linux shell tips and tricks
# Suspend process:
Ctrl + z
# Move process to foreground:
fg
# Generate random hex number where n is number of characters:
openssl rand -hex n
# Execute commands from a file in the current shell:
@bennofs
bennofs / doc.md
Last active March 25, 2025 18:15
Overview of the NixOS X11 session modules

How X11 is started

In the following example, sddm will be used as a display manager. The process is however similar for other display managers in nixpkgs and a summary that applies to all nixpkgs display managers is given at the end.

  1. Systemd unit "display-manager.service" starts services.x11.displayManager.job.execCmd (the display manager)

    Code reference: <nixpkgs>/nixos/modules/services/x11/xserver.nix

  2. services.x11.displayManager.job.execCmd is set to the path of the sddm binary from the sddm package in the nix store. So SDDM will start and read its configuration from /etc/sddm.conf.

@rudelm
rudelm / autofs.md
Last active December 15, 2025 03:02
Use autofs on Mac OS X to mount network shares automatically during access

Autofs on Mac OS X

With autofs you can easily mount network volumes upon first access to the folder where you want to mount the volume. Autofs is available for many OS and is preinstalled on Mac OS X so I show you how I mounted my iTunes library folder using this method.

Prepare autofs to use a separate configuration file

autofs needs to be configured so that it knows where to gets its configuration. Edit the file /etc/auto_master and add the last line:

#
# Automounter master map
#

+auto_master # Use directory service

@thde
thde / alpine-install.sh
Last active July 26, 2025 21:42
A script to install alpine linux on a dedicated server. Tested on Hetzner, Kimsufi / OVH
#!/bin/sh
set -ex
PATH=/bin:/sbin:/usr/bin:/usr/sbin
KEYMAP="us us"
HOST=alpine
USER=anon
ROOT_FS=ext4
BOOT_FS=ext4
@bydga
bydga / Vagrantfile
Last active February 3, 2016 09:43
graceful restart docker-marathon-mesos app
# -*- mode: ruby -*-
# vi: set ft=ruby :
#IP addrees this VM will have
IP = "192.168.50.4"
# script that updates the system, downloads all prerequisities, installs docker,
# zookeeper, marathon, clones actual mesos branch and compiles it.
$setup = <<SCRIPT