Skip to content

Instantly share code, notes, and snippets.

View lorenzbaum's full-sized avatar
🎯
Focusing

Lorenz Baum lorenzbaum

🎯
Focusing
View GitHub Profile
@leonjza
leonjza / README.md
Last active May 7, 2025 08:33
Tailscale Webhook to Telegram

Tailscale Webhook to Telegram

These files are an example setup to have Tailscale webhooks deliver to a Telegram channel with https://github.com/adnanh/webhook fronted with Traefik, protected with an HTTP basic authentication setup.

Setup

Get a set of credentials to populate in the in the traefik.http.middlewares.basic-auth.basicauth.users label with htpasswd -Bn user. Remember to double escape the $ sign.

Then, in the Tailscale administrator console, add a new webhook endpoint that would point to something like https://user:pass@webhook.domain.com/hooks/tailscale after configuring your docker-compose.yml file appropriately.

unsigned long last1 = 0;
unsigned long last2 = 0;
unsigned long lasts = 0;
unsigned int dur1 = 0;
unsigned int dur2 = 0;
byte tgt1 = 128;
byte tgt2 = 128;
void setup() {
Serial.begin(115200);
@lorenzbaum
lorenzbaum / 1_primitive_comparison.js
Created July 1, 2017 11:52 — forked from nicbell/1_primitive_comparison.js
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true
@lorenzbaum
lorenzbaum / StreamcloudEnhancer.user.js
Last active May 2, 2016 21:42
Prepares video for playback and enables download.
// ==UserScript==
// @name StreamCloud Enhancer
// @namespace lorenzbaum
// @description Prepares video for playback and enables download.
// @include *streamcloud.eu/*
// @copyright 2016, lorenzbaum
// @license MIT
// @version 0.2
// @grant none
// @downloadURL https://gist.github.com/lorenzbaum/973a1d75b340bcff4d7e8789c96fc454#file-streamcloudenhancer-user-js
"use strict";
var cluster = require("cluster");
if (process.env.NODE_ENV == 'production' && cluster.isMaster) {
// this is the master control process
console.log("Control process running: PID=" + process.pid);
// fork as many times as we have CPUs
var numCPUs = process.env.NPROCS || require("os").cpus().length;
@derekconjar
derekconjar / wordpress-firebase.php
Last active April 25, 2024 15:21
An example of using Firebase and WordPress together. The idea is to use WP's custom post types and metaboxes to make content management easy, and sync with Firebase so that your websites have access to a real-time JSON feed of your custom data.
<?php
/**
* All custom functions should be defined in this class
* and tied to WP hooks/filters w/in the constructor method
*/
class Custom_Functions {
// Custom metaboxes and fields configuration
@dweymouth
dweymouth / AES.java
Created April 19, 2014 16:18
A Java class to perform password-based AES encryption and decryption
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <dweymouth@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. D. Weymouth 4/2014
* ----------------------------------------------------------------------------
*/
import java.io.*;
@nicbell
nicbell / 1_primitive_comparison.js
Last active September 17, 2025 21:07
JavaScript object deep comparison. Comparing x === y, where x and y are values, return true or false. Comparing x === y, where x and y are objects, returns true if x and y refer to the same object. Otherwise, returns false even if the objects appear identical. Here is a solution to check if two objects are the same.
//Primitive Type Comparison
var a = 1;
var b = 1;
var c = a;
console.log(a == b); //true
console.log(a === b); //true
console.log(a == c); //true
console.log(a === c); //true