Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile

How to prune and clean up a UniFi Controller MongoDB

This script is a copy of this thread in the UI community forums code, but reformatted.

It's purpose is to clean up the UniFi Controllers MongoDB regularily and should probably best be used with a cron job.

The official docs can be found here.

Usage: Switch var dryrun = false; before running the script.

@franz-josef-kaiser
franz-josef-kaiser / README.md
Created October 8, 2021 14:06
Docker Nginx and PHP-FPM Config including Health Check, Alive Check and Status Pages

PHP-FPM and Nginx Health Check and Status pages

Access

  1. localhost/stub_status - Nginx status
  2. localhost?full&json - PHP FPM Full status (including workers) as JSON
  3. localhost?full&html - PHP FPM Full status (including workers) as HTML
  4. localhost/ping - PHP FPM alive check

TODO

  1. Configure Docker container name in nginx.conf in the fastcgi_pass in the location blocks and in the upstream directive incl. port.
@franz-josef-kaiser
franz-josef-kaiser / crash.log
Created October 22, 2020 09:12
crash log for Terraform GitLab provider; crash happend while trying to import user
2020/10/22 10:57:35 [INFO] Terraform version: 0.13.4
2020/10/22 10:57:35 [INFO] Go runtime version: go1.14.7
2020/10/22 10:57:35 [INFO] CLI args: []string{"/usr/local/Cellar/tfenv/2.0.0/versions/0.13.4/terraform", "import", "-input=true", "gitlab_user.foo-bar", "1234567"}
2020/10/22 10:57:35 [DEBUG] Attempting to open CLI config file: /path/to/.terraformrc
2020/10/22 10:57:35 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/10/22 10:57:35 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/10/22 10:57:35 [DEBUG] ignoring non-existing provider search directory /path/to/.terraform.d/plugins
2020/10/22 10:57:35 [DEBUG] ignoring non-existing provider search directory /path/to/Library/Application Support/io.terraform/plugins
2020/10/22 10:57:35 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2020/10/22 10:57:35 [INFO] CLI command args: []string{"import", "-input=true", "gitlab_user.foo-bar", "1234567"}
@franz-josef-kaiser
franz-josef-kaiser / README.md
Last active May 13, 2022 01:01
Bash installer for different OS

Bash Installer

If you are collaborating with others, chances that not everyone's on the same OS are good. If you want to avoid "running on my machine" kind of problems, just share an installer script for your favorite binaries installers/ upgrader/ uninstallers. This is one way to do it.

This is a simple installer script that selects different installation methods based on the OS you are running this on.

How to

Just replace @TODO with whatever you are installing. Make sure to adjust the different installation methods some project/ program offers.

Linux currently is running a Git clone installer that symlinks into some $PATH supporting place. This does not clone the complete repo, but just the last commit!

Uninstallation

Git

@franz-josef-kaiser
franz-josef-kaiser / docker.sh
Created May 9, 2020 22:57
Run Volumio hifi audiophile in a docker container on MacOS
#!/usr/bin/env bash
mkdir music data
set MUSIC_DIR=./music
set VOLUMIO_DATA_DIR=./data
docker run \
--rm \
-d \
--name volumio \
-e DISPLAY=unix$DISPLAY \
-e HOST=http://192.168.1.1:3000 \ # Your local network IP
@franz-josef-kaiser
franz-josef-kaiser / .bash_profile
Last active September 22, 2023 05:02
QNAP Entware opkg command not found
# .bash_profile
# /share/CACHEDEV1_DATA/.qpkg/container-station/bin location of `docker`/ `docker-compose` binaries
# /opt/bin location where `opkg` binary is installed to.
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
@franz-josef-kaiser
franz-josef-kaiser / netgear_genie_no_registration.md
Last active September 12, 2018 22:10
One line tutorial on how to avoid registering a Netgear account.

How to avoid registering a Netgear account just to log in to the admin management UI.

Open start_repeater.html: http://www.mywifiext.net/start_repeater.htm

Works for AP / repeater Netgear Genie EX3700 for e.g.

In case you are doing a factory reset (button on the hardware), make sure to clear all site data from storage: Chrome Developer Tools > Application Tab > Clear Storage > Press button on the bottom "Clear site data". Else you will have endless redirects as the JavaScript is slightly fucked up.

@franz-josef-kaiser
franz-josef-kaiser / FlowMeterDIY.ino
Created May 29, 2017 21:28
Copy of a FlowMeter logging code. A FlowMeter is used in for example Espresso Machines and is a liquid flow rate sensor.
/*
Liquid flow rate sensor -DIYhacking.com Arvind Sanjeev
Measure the liquid/water flow rate using this code.
Connect Vcc and Gnd of sensor to arduino, and the
signal line to arduino digital pin 2.
Source: @link https://diyhacking.com/projects/FlowMeterDIY.ino
*/
@franz-josef-kaiser
franz-josef-kaiser / composer.json
Created February 11, 2017 18:42
Composer bootstrapped Drupal scaffold.
{
"name" : "vendor/project",
"description" : "Much awesome. So wow.",
"type" : "project",
"license" : "MIT",
"authors" : [
{
"name" : "Firstname Lastname",
"email" : "user@example.com",
"role" : "Developer"
@franz-josef-kaiser
franz-josef-kaiser / sshfs.sh
Last active March 24, 2021 09:36
Example of SSHFS remote filesystem mounting. Useful in case one needs to access files created on a remote server on a regular basis
#!/usr/bin/env bash
sshfs \
user@example.com:/home/user/project /local/folder/to/project \
-o ServerAliveInterval=15 \
-o ServerAliveCountMax=20 \
-o reconnect \
-o defer_permissions \
-o negative_vncache \
-o volname=vendorname \