Skip to content

Instantly share code, notes, and snippets.

View LeoDJ's full-sized avatar

LeoDJ

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / downloader.js
Created May 8, 2018 08:38
ISDT firmware download script
const cheerio = require('cheerio')
const request = require('request')
const fs = require('fs');
let subfolder = 'firmwares'
if(!fs.existsSync(subfolder))
fs.mkdirSync(subfolder);
consoleLog = console.log
console.log = (text) => {
@LeoDJ
LeoDJ / T6
Last active June 5, 2022 17:19
ISDT Firmware Changelog (manually updated)
T6 V1.0.0.4
1. FD-100 DSC Voltage Seting Support.
2. Optimize BattGo handling at work.
T6 V1.0.0.16
1. Support for adjust the smart power voltage.
T6 V1.0.0.17
1.Increase agreement for SmartPower.
function Decoder(bytes, port) {
// Decode an uplink message from a buffer
// (array) of bytes to an object of fields.
var decoded = {};
//port 1 = data struct LSB first
//port 2 = data struct MSB first
if (port === 1) {
decoded.pm10 = (bytes[1] << 8) + bytes[0];
@LeoDJ
LeoDJ / a_greenshot_imgur_script.md
Last active July 11, 2017 14:49
Greenshot Imgur Upload Script via External Command

Problem

I don't have admin rights on a PC, but do have Greenshot installed. Having said that, greenshot was installed without any online publishing plugins, but with the Office and External Command plugins.
So I set out and created a hacky solution with a more or less simple vbs script that uploads images to imgur using the external command plugin.

Installation Instructions

  • download the .vbs and the .bat file and place them in some folder (has to be in the same folder)
  • open Greenshot Settings
    • go to the "Plugins" tab
    • select "External command Plugin"
  • click "Configure"
@LeoDJ
LeoDJ / banggood_compactCart_bookmarklet
Last active June 25, 2017 01:54
Banggood Compact Shopping Cart Bookmarklet
javascript:(function(){$(document.head).append('<style>.cart_main_list dt {display: none;}.cart_main_list dd ul {height: 75px;min-height: 0;}.cart_main_list dd ul .td_product a.img {margin-top: -20px;}.cart_main_list dd .ul_total {display: none;}.cart_main {margin-bottom: 0px;border: 0;padding: 0;}.cart_main_list dd ul .td_filter {display: none;}.cart_main_list dd ul .td_product_btn {display: none;}</style>')})()