Skip to content

Instantly share code, notes, and snippets.

View Sarverott's full-sized avatar
💭
I may be slow to respond.

Sett Sarverott Sarverott

💭
I may be slow to respond.
View GitHub Profile
@Sarverott
Sarverott / dimmu-brightir.ino
Last active September 5, 2023 09:36
Simple dimmer controlled with push buttons, using Digispark ATtiny85 and IRFZ44VPbF Power MOSFET for 12v LEDs
/*
Simple dimmer controlled with buttons
Sarverott @ 2023
https://gist.github.com/Sarverott/3b352c6c3fe1c3d13f3faf642cc3b23c
this project ingredients:
- digispark board {
ATtiny85 :: [ Flash memory = 8kb ; frequency = 16MHz ]
Board operational voltage = 5V
var result=[];
document.querySelectorAll(".table-container table tr").forEach(function(x){
var currentRow=[];
x.childNodes.forEach(function(y){
if(y.nodeType==1){
currentRow.push(y.innerText)
}
})
result.push(currentRow);
});
@Sarverott
Sarverott / randomNoiseTones.ino
Created July 17, 2023 02:26
project for digispark with Atmel ATTiny85, makes random noise, every pin (0-5) have to be conected with speaker or piezo
int randomSound, delayPeriod;
void setup() {
}
void loop() {
delayPeriod=random(1,10);
for(int pin=0;pin<6;pin++){
randomSound=random(20,1000);
noTone(pin);
@Sarverott
Sarverott / image-renamer.bat
Last active April 10, 2023 17:38
simple script to rename long-named images from camera or download directory [[[ **WARNING:** errors or infinite loop possibility ]]]
rem Sett Sarverott @ 2017
rem image-renamer.bat [from-directory-path] [to-directory-path] [extension-without-dot]
rem ###
rem example of use: START /w /b .\image-renamer.bat E:\path\from\camera-files-with-long-names E:\path\to\camera-files-with-long-names jpg
dir /b "%1" >".\_picture-list.txt"
set picturecounter=1
pause
:g
@Sarverott
Sarverott / python-detection-louncher.sh
Created March 8, 2023 17:23
idea of unification of python version detection while lounching
if [ $(cat "$1" |grep "print " -c) == 0 ];
then
python2 "$1";
else
python3 "$1";
fi
/*
usefull in new study groups if your uniwersity email is based on "firstname.lastname@university.domain.net" pattern, go to:
https://classroom.google.com/r/{ id of your classroom }/sort-last-name
inspect in devtools in browser one name of student, should be <span class="y4ihN YVvGBb">....
paste code it into console
*/
const CSS_SELECTOR_TARGET=prompt("insert css selector of all name fields", "span.y4ihN.YVvGBb");
const COLEDGE_MAIL_POSTFIX=prompt("insert students emails postfix", "@edu.your-colledge.pl");
console.log(
Array.from(
@Sarverott
Sarverott / variable-sizes.cpp
Last active June 14, 2022 14:20
prints variable types sizes in var, tab and point variant
#include <iostream>
using namespace std;
template<typename V> void varPrint(char *name, V x, int len){
V xT[len], *xX=xT;
cout
<<name
// EXECUTE: help | pipetest "dest.txt" | find "HELP"
#include <iostream>
using namespace std;
int main(int argc, char *argv[]){
char tmpBuff=0;
while(argc-->0){
cout<<"\t"<<(argv++)<<endl;
}
while(cin.good()){
if(cin.get(tmpBuff))cout.put(tmpBuff);
@Sarverott
Sarverott / #get-dom-elements-events.js
Last active April 25, 2022 03:27
to search events and listeners in dom by js
function eventSearch(searchQuery="*", searchEvent=false){
var out=Array.from(
document.querySelectorAll(searchQuery)
);
out=out.map(function(element){
const events=getEventListeners(element);
if(Object.keys(events).length!==0&&(!searchEvent||Object.keys(events).includes(searchEvent))){
var itemQuery=element.nodeName;
if(
typeof element.id=="string"
@Sarverott
Sarverott / asm-worm.a80.asm
Last active March 16, 2023 19:53
code in assembler for Intel 8080, that is self-replicatory virus example. Written for fun for 80's old school microprocessor unit. Tested on http://asm80.com/ and https://github.com/eliben/js-8080-sim emulators
;asmWorm - self-replication code in assembler for Intel 8080
;Sett Sarverott @ 2022
lxi h, 0000h ;start read
lxi d, 002fh ;stop read/start write
mvi c, 2fh ;length
mvi a, 00h ;index
replicator:
;copy this code to space after this code
mov b, m ;b=*read_pointer
xchg