Skip to content

Instantly share code, notes, and snippets.

LeoDJ

Block or report user

Report or block LeoDJ

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LeoDJ
LeoDJ / voltmeter.cpp
Created Jul 18, 2019
Arduino (ATMega328P) Internal VCC Voltmeter
View voltmeter.cpp
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
Created Apr 20, 2019
TreeStyleTabs userChrome.css (hide tab bar and "Tree Style Tab" headline)
View userChrome.css
/* put file in <AppData>/Mozilla/Firefox/Profiles/<yourProfile>/chrome */
#main-window[tabsintitlebar="true"]:not([extradragspace="true"]) #TabsToolbar {
opacity: 0;
pointer-events: none;
}
#main-window:not([tabsintitlebar="true"]) #TabsToolbar {
visibility: collapse !important;
}
#sidebar-box[sidebarcommand="treestyletab_piro_sakura_ne_jp-sidebar-action"] #sidebar-header {
@LeoDJ
LeoDJ / index.js
Last active Feb 22, 2019
Artnet2MQTT
View index.js
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 Feb 1, 2019
AHK middle mouse scroll everywhere
View middleScroll.ahk
; 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
ISDT firmware download script
View downloader.js
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
Created May 8, 2018
ISDT Firmware Changelog (manually updated)
View T6
T6 V1.0.0.4
1. FD-100 DSC Voltage Seting Support.
2. Optimize BattGo handling at work.
View TTN Feinstaub Decoder.js
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 Jul 11, 2017
Greenshot Imgur Upload Script via External Command
View a_greenshot_imgur_script.md

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 Jun 25, 2017
Banggood Compact Shopping Cart Bookmarklet
View banggood_compactCart_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>')})()
@LeoDJ
LeoDJ / doorStatus.php
Last active Mar 16, 2017
A simple PHP persistance key/val store // Simply set the $secret to your password of choice and host the .php file on a server, then call the .php file with ?help for more information
View doorStatus.php
<?php
header('Access-Control-Allow-Origin: https://yourDomain.tld');
$secret = "yourSecret"; //set you secret for write access here
error_reporting(E_ALL);
ini_set('display_errors', true);
global $filePath, $secret;
$filePath = "doorStatusData.json";
function readDataFile() { //read data from persistance file
global $filePath;
You can’t perform that action at this time.