Skip to content

Instantly share code, notes, and snippets.

View aerobless's full-sized avatar

Theo Winter aerobless

View GitHub Profile
- theme: Backend-selected
icon: mdi:city-variant
path: zurich
badges: []
cards:
- type: vertical-stack
cards:
- camera_view: auto
type: picture-glance
title: Uetliberg Zürichsee
@aerobless
aerobless / Samsung TV to Apple TV Remote Emulation Flow
Created March 24, 2022 09:55
A Node-RED flow to emulate an Apple TV remote for a samsung TV via Logitech Harmony IR commands
[
{
"id": "398bef58.0823b",
"type": "server-events",
"z": "7d4c9938.2a0338",
"name": "Apple TV Remote",
"server": "78fe396.483dac8",
"event_type": "homekit_tv_remote_key_pressed",
"exposeToHomeAssistant": false,
"haConfig": [
[{"id":"a5733396e98a6fbf","type":"function","z":"e550f91e.577438","name":"insert metrics","func":"msg.payload = {\n\"data\" : {\n\"metrics\" : [\n{\n\"units\" : \"count\",\n\"data\" : [\n{\n\"qty\" : 5472,\n\"date\" : \"2021-12-11 00:00:00 -0500\"\n},\n{\n\"qty\" : 8169,\n\"date\" : \"2021-12-12 00:00:00 -0500\"\n},\n{\n\"date\" : \"2021-12-13 00:00:00 -0500\",\n\"qty\" : 3446\n},\n{\n\"date\" : \"2021-12-14 00:00:00 -0500\",\n\"qty\" : 4784\n},\n{\n\"date\" : \"2021-12-15 00:00:00 -0500\",\n\"qty\" : 4837.7652613770606\n},\n{\n\"qty\" : 4852,\n\"date\" : \"2021-12-16 00:00:00 -0500\"\n}\n],\n\"name\" : \"step_count\"\n}\n],\n\"workouts\" : [\n\n]\n}\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":220,"y":3440,"wires":[["aaeb804e202a0508"]]},{"id":"9513551692b17c69","type":"inject","z":"e550f91e.577438","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":
@aerobless
aerobless / raspberry_autostart.md
Created April 7, 2019 11:54
Add service to raspberry pi to start automatically

1. Create unit file

sudo vim /lib/systemd/system/servicename.service

2. Insert config

 [Unit]
 Description=My Service
 After=multi-user.target

 [Service]
@aerobless
aerobless / server.py
Last active April 7, 2019 10:02
Simple HTTPS Basic Auth server in python
# generate certificates for 10years with the following command:
# openssl req -new -x509 -keyout key.pem -out server.pem -days 3000 -nodes
# Startup with the following command:
# python3 server.py
import http.server
import ssl
import subprocess
import base64
@aerobless
aerobless / versioning.gradle
Created October 29, 2018 09:55
A way to easily increment major, minor or hotfix via gradle
def props = new Properties()
file("gradle.properties").withInputStream { props.load(it) }
int major
int minor
int hotfix
task readVersion() {
doFirst {
String version = props.getProperty("version")
@aerobless
aerobless / scp.md
Created July 25, 2018 08:30
Using SCP to transfer files between servers

Upload to server:

scp filename.txt username@ipOrDomain.ch:/var/lib/location/on/server

Download from server:

scp username@ipOrDomain.ch:/var/lib/location/on/server/filename.txt ./

@aerobless
aerobless / raspberry_headless_201807.md
Last active April 6, 2019 18:20
Raspberry PI headless 2018-07

1. Put wpa_supplicant.conf on boot drive:

country=CH
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
 
network={
	ssid="yourSSID"
	psk="yourWifiPassword"
@aerobless
aerobless / gfc-local-testing-snippet.sh
Last active June 29, 2018 08:52
Commands for local testing of gfc
# 1. Install gfc emulator
npm install -g @google-cloud/functions-emulator
# 2. Set correct project
functions config set projectId YOUR_PROJECT_ID
# 3. Get correct version of Node.js (works for *nix systems)
npm install -g n
n 6.11.5
@aerobless
aerobless / gcf-config-snippet.js
Created June 28, 2018 12:28
Example of how to have a config for Google Cloud Functions.
const config = {
sample: {
database: {
connection: 'projectId:location:dbInstance',
name: 'dbName',
user: 'dbUser',
password: 'dbPassword'
}
}
};