Skip to content

Instantly share code, notes, and snippets.

View lukasMega's full-sized avatar
🦡

Lukáš Melega lukasMega

🦡
  • Slovakia
View GitHub Profile
@marcus-j-davies
marcus-j-davies / build.js
Last active August 13, 2024 21:29
Node Red V4 - SFE (Single File Executable)
const esbuild = require('esbuild');
const { cp, readFile, writeFile } = require('fs/promises');
const { exists } = require('fs-extra');
const OutputDIR = './build';
const InputFile = `./main-source.js`;
const OutputFile = `${OutputDIR}/node-red.js`;
const FinalPKG = `${OutputDIR}/package.json`;
const GotSourceFile = './node_modules/got/dist/source/index.js';
const GotPackageFile = './node_modules/got/package.json';
@OrionReed
OrionReed / dom3d.js
Last active September 19, 2024 20:10
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@guest271314
guest271314 / javascript_engines_and_runtimes.md
Last active September 20, 2024 05:19
A list of JavaScript engines, runtimes, interpreters

V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++. It is used in Chrome and in Node.js, among others. It implements ECMAScript and WebAssembly, and runs on Windows 7 or later, macOS 10.12+, and Linux systems that use x64, IA-32, ARM, or MIPS processors. V8 can run standalone, or can be embedded into any C++ application.

SpiderMonkey is Mozilla’s JavaScript and WebAssembly Engine, used in Firefox, Servo and various other projects. It is written in C++, Rust and JavaScript. You can embed it into C++ and Rust projects, and it can be run as a stand-alone shell. It can also be [compiled](https://bytecodealliance.org/articles/making-javascript-run-fast-on

@dgalli1
dgalli1 / .sh
Created November 15, 2023 16:56
Simple update script for docker compose
#!/bin/bash
echo "Now Updating all Docker Containers"
export TZ=UTC # force all timestamps to be in UTC (+00:00 / Z)
printf -v start_date_epoch '%(%s)T'
printf -v start_date_iso8601 '%(%Y-%m-%dT%H:%M:%S+00:00)T' "$start_date_epoch"
# List of all folders that contain a docker compose
declare -a StringArray=("auth-stack" "bitwarden" "languagetool" "media-stack" "monitoring" "" "mosquitto" "portainer" "dnsmasq" "socks5" "nginx-proxy-manager" "filebrowser")
# Iterate the string array using for loop
@Dzhuneyt
Dzhuneyt / shelly_auto_reboot_script.js
Created November 12, 2023 10:46
Shelly Auto Reboot if no Internet Connection
let CONFIG = {
endpoints: [
"https://global.gcping.com/ping",
"https://us-central1-5tkroniexa-uc.a.run.app/ping",
],
//number of failures that trigger the reset
numberOfFails: 5,
//time in seconds after which the http request is considered failed
httpTimeout: 10,
//time in seconds for the relay to be off
substitutions:
name: victron-mppt
external_components_source: github://KinDR007/VictronMPPT-ESPHOME@main
esphome:
name: ${name}
platform: ESP8266
board: d1_mini
external_components:
@mbrammer
mbrammer / crop-rtsp-live-stream-and-provide-result-as-new-rtsp-live-stream.md
Last active August 21, 2024 09:07
Crop section from RTSP live stream and provide result as new RTSP live stream

Create croped RTSP live stream from existing RTSP live stream

I needed a croped section of a RTSP live stream from a UniFi Protect camera, since I am filming my yard from a shed and wanted to see a cutout of the front door from my 4K camera.
This article will show you how to enable the RTSP live stream on the UniFi Protect camera, how to setup a streaming server and how to actually execute the processing of the live stream.

Enable UniFi Protect RTSP live stream

The following screenshots are made from UniFi Protect application on version 2.7.18

  1. Go to "UniFi devices"
  2. Click on the desired camera in the camera list
@Gromina
Gromina / remove_bloatware_10pro
Last active April 4, 2024 09:43
OnePlus 10 pro bloatware removal script. run it adb shell
# Source: https://www.droidwin.com/remove-bloatware-debloat-oneplus-10-pro-no-root/
#
pm uninstall -k --user 0 com.android.apps.tag # Stock android fluff
pm uninstall -k --user 0 com.android.bips # Stock android fluff
pm uninstall -k --user 0 com.android.bluetoothmidiservice # Stock android fluff
pm uninstall -k --user 0 com.android.bookmarkprovider # Stock android fluff
pm uninstall -k --user 0 com.android.calllogbackup # Stock android fluff
pm uninstall -k --user 0 com.android.cellbroadcastreceiver.overlay.common # Stock android fluff
pm uninstall -k --user 0 com.android.cts.priv.ctsshim # Stock android fluff
pm uninstall -k --user 0 com.android.dreams.basic # Stock android AOD provider. This is needed for AOD to work fully
@swrogers
swrogers / gitlab-docker-caddy-portainer.md
Last active September 16, 2024 09:44
Run Gitlab Docker behind Caddy reverse proxy via Portainer stack (with an XWiki bonus!)

Gitlab Docker / Caddy / Portainer (plus bonus XWiki)

This is how I was able to get Gitlab CE Docker to run behind a Caddy reverse proxy, created from Portainer stack.

This has taken quite a lot of searching, so I figured that I'd write it up in a location that I could easily refer to it in the future.

There are a handful of items that are initially needed here:

  • Caddy and its network
  • Portainer
@dgcoffman
dgcoffman / require-named-effect.js
Created May 23, 2022 16:16
libs/eslint-rules/require-named-effect.js
const isUseEffect = (node) => node.callee.name === 'useEffect';
const argumentIsArrowFunction = (node) => node.arguments[0].type === 'ArrowFunctionExpression';
const effectBodyIsSingleFunction = (node) => {
const { body } = node.arguments[0];
// It's a single unwrapped function call:
// `useEffect(() => theNameOfAFunction(), []);`
if (body.type === 'CallExpression') {