Skip to content

Instantly share code, notes, and snippets.

View DrPsychick's full-sized avatar
🤔

DrPsychick DrPsychick

🤔
View GitHub Profile
@DrPsychick
DrPsychick / docker-compose-keycloak.yml
Created August 20, 2020 18:36
Demo keycloak docker-compose
# source: https://github.com/keycloak/keycloak-containers/tree/master/docker-compose-examples
version: '3'
volumes:
postgres_data:
driver: local
services:
postgres:
image: postgres
@DrPsychick
DrPsychick / docker-compose.yml
Last active August 17, 2020 21:03
Example to run telegraf, influxdb, grafana locally in docker
# using version 2 because of https://docs.docker.com/compose/compose-file/#resources
version: "2.4"
services:
telegraf:
image: drpsychick/telegraf
restart: always
environment:
HOST_PROC: /rootfs/proc
HOST_SYS: /rootfs/sys
HOST_ETC: /rootfs/etc
@DrPsychick
DrPsychick / ascii-art.py
Last active May 2, 2020 21:02
Medium code
import sys
import os
import fortune
from pyfiglet import Figlet
def main():
f = Figlet()
# take text from command line or env
text = " ".join(sys.argv[1:])
if (text == ""):
@DrPsychick
DrPsychick / cups-cert.sh
Created May 2, 2020 10:08
Signed SSL certificate with Root CA
# generate a root CA (which will be your master certificate)
openssl req -x509 -nodes -new -sha256 -days 1024 -newkey rsa:2048 \
-keyout RootCA.key -out RootCA.pem \
-subj "/C=DE/CN=Root CA for .mydomain"
openssl x509 -outform pem -in RootCA.pem -out RootCA.crt
# import the cert as trusted on macOS
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain RootCA.crt
@DrPsychick
DrPsychick / cups.env
Last active April 20, 2020 22:09
airprint-bridge environment
CUPS_ADMIN_USER=admin
CUPS_ADMIN_PASSWORD=admin
CUPS_REMOTE_ADMIN=yes
CUPS_WEBINTERFACE=yes
CUPS_SHARE_PRINTERS=yes
CUPS_ACCESS_LOGLEVEL=access
CUPS_LOGLEVEL=info
CUPS_LPADMIN_PRINTER1=lpadmin -p Epson-RX520 -D 'Epson RX520' -m 'gutenprint.5.3://escp2-rx620/expert' -o PageSize=A4 -v smb://user:pass@host/Epson-RX520
CUPS_LPADMIN_PRINTER1_ENABLE=cupsenable Epson-RX520
@DrPsychick
DrPsychick / medium-demo.sh
Last active April 27, 2020 21:34
airprint-bridge playground
# start a container to play with it
docker run -d --rm -e CUPS_WEBINTERFACE="yes" -e CUPS_REMOTE_ADMIN="yes" \
--hostname mycups --name cups-setup drpsychick/airprint-bridge
# you can search for local printers via the web interface
IP=$(docker inspect --format '{{ .NetworkSettings.Networks.bridge.IPAddress }}' cups-setup)
echo "http://$IP:631"
# you can open a shell to explore printers via `lpinfo`, `lpadmin`, `lpoptions`
docker exec -it cups-setup lpinfo --make-and-model "Epson Stylus Photo RX" -m
@DrPsychick
DrPsychick / Dockerfile
Created March 18, 2020 23:03
extend pdflatex docker image
FROM drpsychick/texlive-pdflatex:latest
RUN tlmgr update --self && \
tlmgr install collection-latexextra \
utopia
@DrPsychick
DrPsychick / git-auto-checksheet.md
Last active August 4, 2022 07:46
git commands for automation

create or update a version branch from master

# make sure to have your origin set correctly
# git remote set-url origin "[email protected]:DrPsychick/docker-telegraf.git"

branch="testbranch"
# checkout master from origin, skip if you already have a fresh checkout!
@DrPsychick
DrPsychick / compile-travis.yml.md
Last active February 2, 2019 23:43
compile .travis.yml into script to test locally
@DrPsychick
DrPsychick / macOS-remote-environment.md
Last active May 9, 2024 18:36
macOS / OSX ansible path test

INFO

  • remote SSH shell on macOS does not use /etc/paths
  • this is not an issue of ansible, it is the way macOS processes config files on remote shells:
  • see ssh localhost echo \$PATH

ANSIBLE executes remote shell /bin/sh

  • ...if not specified otherwise and macOS does not read any startup files
  • example: [...]localhost '/bin/sh -c '"'"'sudo -H -S -n -u test /bin/sh -c '"'"'"'"'"[...]
  • even /bin/bash does not read any startup files by default