Skip to content

Instantly share code, notes, and snippets.

View LeoDJ's full-sized avatar

LeoDJ

View GitHub Profile
@LeoDJ
LeoDJ / middleScroll.ahk
Last active February 1, 2019 15:24
AHK middle mouse scroll everywhere
; Description: Scroll Explorer on middle mouse button drag
; Permalink: https://autohotkey.com/boards/viewtopic.php?t=43715
; Author: aph
; Version: 0.4.1
; Modified by: LeoDJ
; changelog:
; 0.4.1: - fixed Firefox getting stuck
; 0.4.0: - implemented much better exponential scrolling behaviour
; - tried to handle sticky scrolling better, but sometimes AHK does not see the KeyUp event, even when polled
; 0.3.0: - implement other scrolling behaviour, but still not perfect
@LeoDJ
LeoDJ / index.js
Last active February 22, 2019 02:24
Artnet2MQTT
const artnet = require('./modules/artnet.module');
const mqtt = require('mqtt');
const port = 0x1936;
const listenUniverse = 42;
//MQTT stuff
var client = mqtt.connect('mqtt://localhost');
@LeoDJ
LeoDJ / userChrome.css
Last active October 21, 2022 07:19
TreeStyleTabs userChrome.css (hide tab bar and "Tree Style Tab" headline)
/* put file in <AppData>/Mozilla/Firefox/Profiles/<yourProfile>/chrome */
/* to correctly display tab title as window title, set browser.tabs.drawInTitlebar to false in about:config */
/* note: since FF 69 you also need to set toolkit.legacyUserProfileCustomizations.stylesheets to true for it to work*/
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
@LeoDJ
LeoDJ / voltmeter.cpp
Created July 18, 2019 14:01
Arduino (ATMega328P) Internal VCC Voltmeter
long readVcc() {
// Read 1.1V reference against AVcc
// set the reference to Vcc and the measurement to the internal 1.1V reference
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
ADMUX = _BV(REFS0) | _BV(MUX4) | _BV(MUX3) | _BV(MUX2) | _BV(MUX1);
#elif defined (__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
ADMUX = _BV(MUX5) | _BV(MUX0);
#elif defined (__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
ADMUX = _BV(MUX3) | _BV(MUX2);
#else
@LeoDJ
LeoDJ / outPortTester.js
Last active January 24, 2020 10:53
Quick and dirty test to see which ports are whitelisted in a firewall
var request = require('request');
let blocked = [], open = []
lastPort = 6000
function pingPort(port) {
request('http://portquiz.net:' + port, function (err, res, body) {
//console.log(err, res, body)
if ((!err && res.statusCode == 200) || (err && err.code == 'HPE_INVALID_CONSTANT')) {
@LeoDJ
LeoDJ / led_strip.yaml
Last active October 31, 2020 14:52
MagicHome ESPHome RGB Strip Effects
esphome:
name: led_strip
platform: ESP8266
board: esp01_1m
wifi:
ssid: ""
password: ""
# Enable fallback hotspot (captive portal) in case wifi connection fails
@LeoDJ
LeoDJ / spacenav_raw.py
Created January 6, 2021 13:55
Read raw values for 3DConnexion SpacePilot / SpaceMouse / SpaceNavigator
import spacenavigator
import time
def callback(s):
print("X: %5.2f Y: %5.2f Z: %5.2f Roll: %5.2f Pitch: %5.2f Yaw: %5.2f Buttons:" % (s.x, s.y, s.z, s.roll, s.pitch, s.yaw), s.buttons)
success = spacenavigator.open(callback)
if success:
while 1:
time.sleep(0.1)
@LeoDJ
LeoDJ / _cm1106_co2_sensor_esphome.yaml
Last active November 24, 2022 01:01
ESPHome Custom Sensor CM1106 CO2
esphome:
name: cm1106_sensor
platform: ESP32
board: wemos_d1_mini32
includes:
- "cm1106.h"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_pass
@LeoDJ
LeoDJ / xpv2bin.py
Created April 27, 2021 23:57
Convert XPV/XDV files to binary (CSR Blueflash Bluecore firmware files)
#!/usr/bin/env python3
# Convert XPV/XDV files to binary (CSR Blueflash / Bluecore firmware files)
# Quickly hacked together by LeoDJ
import sys
import os
def xpv2bin(input_file, output_file):
with open(input_file) as f_in, open(output_file, "wb") as f_out:
@LeoDJ
LeoDJ / ttn_mapper_uplink_payload_formatter.js
Created March 10, 2022 23:18
Uplink Payload Formatter for TTN Mapper LoRa node (including generic function for converting raw C struct integer values to JavaScript number)