Skip to content

Instantly share code, notes, and snippets.

⚠️ There is now an official way to connect Glow to Home Assistant via MQTT, I would suggest using that instead of the method described below. Here are the sensor templates for that (replace GLOW_DEVICE_ID with the relevant information for your device):

mqtt:
  sensor:
    - name: "Home Power"
      state_topic: "glow/GLOW_DEVICE_ID/SENSOR/electricitymeter"
      unit_of_measurement: 'W'
      value_template: "{{ (value_json['electricitymeter']['power']['value'] * 1000) | int }}"
      icon: 'mdi:flash'
@zdxerr
zdxerr / server.py
Created June 1, 2020 17:11
Python ThreadingHTTPServer Example
from http.server import ThreadingHTTPServer, SimpleHTTPRequestHandler
def run(server_class=ThreadingHTTPServer, handler_class=SimpleHTTPRequestHandler):
server_address = ('', 80)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
if __name__ == "__main__":
@nileshtrivedi
nileshtrivedi / home-server.md
Last active June 1, 2024 00:11
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

@manuelbl
manuelbl / README.md
Created August 3, 2019 09:12
ESP32 as Bluetooth Keyboard

ESP32 as Bluetooth Keyboard

With its built-in Bluetooth capabilities, the ESP32 can act as a Bluetooth keyboard. The below code is a minimal example of how to achieve it. It will generate the key strokes for a message whenever a button attached to the ESP32 is pressed.

For the example setup, a momentary button should be connected to pin 2 and to ground. Pin 2 will be configured as an input with pull-up.

In order to receive the message, add the ESP32 as a Bluetooth keyboard of your computer or mobile phone:

  1. Go to your computers/phones settings
  2. Ensure Bluetooth is turned on
@neftaly
neftaly / cyberpunk2077-ssh.md
Created June 10, 2019 03:36
Cyberpunk 2077 internal-cdprojektred.com SSH session
neftaly@nef-w10:~$ ssh samurai@internal-cdprojektred.com -p 2020
samurai@internal-cdprojektred.com's password:
WhenItsReady

 ___________  ____________ _____   ___ _____ _   _______  ______ ___________
/  __ \  _  \ | ___ \ ___ \  _  | |_  |  ___| | / /_   _| | ___ \  ___|  _  \
| /  \/ | | | | |_/ / |_/ / | | |   | | |__ | |/ /  | |   | |_/ / |__ | | | |
| |   | | | | |  __/|    /| | | |   | |  __||    \  | |   |    /|  __|| | | |
| \__/\ |/ /  | |   | |\ \\ \_/ /\__/ / |___| |\  \ | |   | |\ \| |___| |/ /
@topshed
topshed / Tonal Buzzer.md
Last active March 8, 2023 15:17
Old macDonald using Tonal Buzzer in gpio zero
from gpiozero import TonalBuzzer
from gpiozero.tones import Tone
from time import sleep
t = TonalBuzzer(21) # change to whatever pin the buzzer is connected

v1 = ["G4", "G4", "G4", "D4", "E4", "E4", "D4"]
v2 = ["B4", "B4", "A4", "A4", "G4"]
v3 = ["D4", "G4", "G4", "G4", "D4", "E4", "E4", "D4"]
@mvanantw
mvanantw / Add-MvaNetFirewallRemoteAdressFilter.ps1
Last active July 30, 2020 20:23
PowerShell function to add one or more IP addresses to the scope of a Windows Firewall Rule
function Add-MvaNetFirewallRemoteAdressFilter {
<#
.SYNOPSIS
This function adds one or more ipaddresses to the firewall remote address filter
.DESCRIPTION
With the default Set-NetFirewallAddressFilter you can set an address filter for a firewall rule. You can not use it to
add a ip address to an existing address filter. The existing address filter will be replaced by the new one.
The Add-MvaNetFirewallRemoteAdressFilter function will add the ip address. Which is very usefull when there are already
many ip addresses in de address filter.
@gpduck
gpduck / readme.md
Last active December 15, 2023 17:22
Ansible on Windows over SSH

Windows

  • Install OpenSSH
  • For domain user on 7.7+ (all lower case): AllowUsers domain\user
  • For local user (all lower case): AllowUsers user
  • run-as user to create profile (or log-in)
  • create .ssh and authorized_keys in the user's profile
  • run the fix user key script (program files\openssh)

Ansible

@vikassaini01
vikassaini01 / kms
Last active July 12, 2024 08:39 — forked from CHEF-KOCH/KMS_office.cmd
KMS server Windows
Online kms host address:
--------
kms.digiboy.ir
54.223.212.31
kms.cnlic.com
kms.chinancce.com
kms.ddns.net
franklv.ddns.net
k.zpale.com
m.zpale.com
@mdonkers
mdonkers / server.py
Last active July 19, 2024 21:03
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer