Skip to content

Instantly share code, notes, and snippets.

View mStirner's full-sized avatar

Marc Stirner mStirner

View GitHub Profile
@mStirner
mStirner / RPi3-Auto-WiFi.md
Created February 19, 2024 14:55 — forked from carry0987/RPi3-Auto-WiFi.md
Raspberry Pi 3B+ Auto reconnect to wifi when lost connect

Auto reconnect to wifi when lost connect

Create script file

Use touch /home/pi/wifi-reconnect.sh to create shell script file, with following content:

#!/bin/bash 
 
SSID=$(/sbin/iwgetid --raw) 
@mStirner
mStirner / cron.js
Created May 5, 2023 15:20 — forked from shimondoodkin/cron.js
javascript cron can be used in node.js
/*
Added complex matches by Shimon Doodkin 2012
Developed by Elijah Rutschman 2009 - http://elijahr.blogspot.com/2009/03/javascript-cron.html
*/
/*
a typical cron entry has either wildcards (*) or an integer:
.---------------- minute (0 - 59)
| .-------------- hour (0 - 23)
| | .------------ day of month (1 - 31)
@mStirner
mStirner / tunejack.sh
Created March 7, 2023 09:40 — forked from xndc/tunejack.sh
Instant radio streaming script using the TuneIn API
#!/bin/bash
# tunejack.sh uses the TuneIn public API (at opml.radiotime.com) to search for
# a radio station, print out its details and try to play it somehow.
if [ "$#" -eq 0 ]; then
echo "$0: search for a radio station using the TuneIn API"
echo "Usage: $0 PATTERN"
exit 1
fi
@mStirner
mStirner / adapter.js
Created April 26, 2022 19:47
WebSocket l4 adapter minimal reproducible example
const { Transform } = require("stream");
module.exports = () => {
let encode = new Transform({
transform(chunk, encoding, cb) {
console.log("[encode]", chunk);
cb(null, chunk);
@mStirner
mStirner / README.md
Last active March 20, 2022 21:21
Lightweight, stream based, expandable, node.js logger with zero dependencies

This is a example of a very lightweight, stream based, node.js logger. It creates a "record" object for each log call, and pipe it throught the spicified streams. In the streams its possible to modifie the record, format the message, and many more.

Bunyan, there is no one responding on issues, Winstons is way to big and have unecesseray dependencies.

I wanted a lightweight, easy to use, expandable, stream based, logging utily with zero dependencies. You can all merge this down into a single file. You bascily need class.logger.js & levels.js which can simple merged into a single file.

The other files (demo.js, formatter.js) are for demonstration & formatting and not needed for the functionality.

@mStirner
mStirner / fingerprint.js
Created March 29, 2020 22:29
canvas fingerprint
var makeCRCTable = function(){
var c;
var crcTable = [];
for(var n =0; n < 256; n++){
c = n;
for(var k =0; k < 8; k++){
c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1));
}
crcTable[n] = c;
}
@mStirner
mStirner / README.md
Created March 22, 2020 00:51
*tgz verification (for signed plugins)
  • Quick & dirty tar.gz/.tgz verification
  • add extra header filed
  • sub header contains:
    • Author information (email & name)
    • Signature from server (public + private key)

lib coming soon...

const events = require("events").EventEmitter;
/*
Added complex matches by Shimon Doodkin 2012
Developed by Elijah Rutschman 2009 - http://elijahr.blogspot.com/2009/03/javascript-cron.html
*/
/*
a typical cron entry has either wildcards (*) or an integer:
@mStirner
mStirner / README.md
Last active August 4, 2019 17:15
Pioneer & Onkyo eISCP wrapper

node command.js --cmd=PWR01 Power On
node command.js --cmd=PWR00 Power Off
node command.js --cmd=MVL010 Master volume = 10
node command.js --cmd=MVL000 Master volume = 0\

@mStirner
mStirner / upload.js
Created October 24, 2018 17:49
Express/Multer http upload
const os = require("os");
const fs = require("fs");
const path = require("path");
const express = require('express');
const multer = require('multer');
const bodyParser = require('body-parser');
// build/normalize paths
const src = path.resolve(os.tmpdir(), "uploads");