Skip to content

Instantly share code, notes, and snippets.

View cupracer's full-sized avatar

Thomas Schulte cupracer

  • NRW, Germany
  • 17:34 (UTC +02:00)
View GitHub Profile
@wittekind
wittekind / extract-port-overrides.json
Created July 22, 2020 19:30
node-red function, that gets the port_overrides array of a specific Unifi device from the output of the node-red-contrib-unifi node's AccessDevices command.
[
{
"id": "76e8dd64.3526ac",
"type": "function",
"z": "3eed02d1.e6900e",
"name": "extract port_overrides",
"func": "const deviceId = \"your device id\";\n\nconst port_overrides = msg.payload.flatMap(site => site) \n .filter(device => device._id == deviceId)\n .flatMap(device => device.port_overrides);\nmsg.payload = port_overrides;\nmsg.device_id = deviceId;\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
@superseb
superseb / rke2-commands.md
Last active July 3, 2024 02:07
RKE2 commands

RKE2 commands

  • Updated on May 29 to accommodate etcd container not having /bin/sh available anymore.

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
@brandonb927
brandonb927 / puppeteer-vscode-scraper.js
Last active February 22, 2022 00:51
A tiny self-contained node script to scrape the VS Code Marketplace website to get all the information about the packages you have installed in VS Code.
#!/usr/bin/env node
// $ npm install -d fs-extra ora open puppeteer
const { spawn } = require('child_process')
const readline = require('readline')
const path = require('path')
const fse = require('fs-extra')
const open = require('open')
@troyfontaine
troyfontaine / README.md
Last active October 15, 2023 09:58
Ubiquiti USG config.gateway.json Syntax

Ubiquiti USG Advanced Configuration

Overview

Integrated DNS Overview

When using a USG with Ubiquiti's Unifi Controller software (version 5.6 and earlier), the functionality of integrating the hostnames of clients (when they request a DHCP lease) into local DNS does not appear to work as you would find with Consumer grade routers. To work around this limitation, we can add static host mappings to a configuration file that will be provisioned to the USG when either a configuration change is made or we force provisioning to the USG itself.

Non-GUI Supported Dynamic DNS Providers

I've added in the necessary syntax for adding Cloudflare DDNS to the USG for VPN/Services setup courtesy of this post by britannic on the Ubiquiti Forums.

Configuration File

@luckydonald
luckydonald / answer.md
Last active January 9, 2023 19:14
How to get the hostnames and informations of other hosts in the same docker scale grouping. http://stackoverflow.com/a/39895650/3423324

The way I could do it was by using the docker api. I used the docker-py package to access it.

The api exposes a labels dictionary for each container, and the keys com.docker.compose.container-number, com.docker.compose.project and com.docker.compose.service did what was needed to build the hostname.

The code below is a simplified for code I am now using. You can find my advanced code with caching and fancy stuff that at Github at luckydonald/pbft/dockerus.ServiceInfos (backup at gist.github.com).

@rkuzsma
rkuzsma / gist:b9a0e342c56479f5e58d654b1341f01e
Last active May 18, 2024 15:40
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@hpherzog
hpherzog / jessie-mongodb-3-0-x.sh
Created September 13, 2015 11:34
Install mongodb version 3.0.x on debian jessie
#!/bin/sh
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/debian wheezy/mongodb-org/3.0 main" | tee /etc/apt/sources.list.d/mongodb-org-3.0.list
apt-get update
apt-get install -y mongodb-org
@chadrien
chadrien / README.md
Last active September 1, 2023 12:43
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@u0d7i
u0d7i / disable_vim_auto_visual_on_mouse.txt
Last active February 27, 2024 14:08
Disable vim automatic visual mode on mouse select
Disable vim automatic visual mode on mouse select
issue: :set mouse-=a
add to ~/.vimrc: set mouse-=a
my ~/.vimrc for preserving global defaults and only changing one option:
source $VIMRUNTIME/defaults.vim
set mouse-=a
@soarez
soarez / ca.md
Last active June 19, 2024 19:32
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.