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 / example.js
Created November 25, 2018 23:09
simple node.js tcp server
const tcpServer=require("./tcp-server.js");
var server=new tcpServer(80);
server.setupServeListener(function(){
console.log("START SERVER on port "+this.port);
});
server.setupConnectListener(function(conn){
console.log("client connected!!! "+conn.remoteAddress);
});
server.setupDataProcessor(function(data, conn){
console.log(data);

Dictionary class

based on Python concept of dictionary type, provides access to assocc array

usage

dictionary slownik;
dictionary *wikipedia=new dictionary;

methods

@Sarverott
Sarverott / core-sheme.js
Last active July 16, 2019 07:18
simple sheme for core of software in js
/*
Sett Sarverott
core-sheme.js
summer 2019
*/
class Core{
constructor(opts={}){
this.opts=this.defaults(opts);
this.init();
@Sarverott
Sarverott / char-string.h
Last active January 31, 2020 23:41
group of functions to make easier work with char* based strings
#ifndef CHAR_STRING
#define CHAR_STRING
/* Sarverott 2020 */
class charString{
public:
static char* leftTrim(char* input, char trimmer=' '){
int index=0;
int cutFlag=0;
bool cutting=false;
char* output=new char();
@Sarverott
Sarverott / mytime.h
Last active January 31, 2020 23:40
simple time class
#ifndef TIME_H
#define TIME_H
/* Sarverott 2020 */
//#include <iostream>
//using namespace std;
class time{
private:
int hour=0;
@Sarverott
Sarverott / mydate.h
Last active January 31, 2020 23:41
simple date class
#ifndef DATE_H
#define DATE_H
/* Sarverott 2020 */
//#include <iostream>
//using namespace std;
class date{
public:
int year=0;
@Sarverott
Sarverott / ipac-maco.js
Last active June 15, 2020 00:53
solution to easy compression of MAC and IPv4 adresses
/*
ipac-maco.js
Sett Sarverott
2020
*/
function ipacCoding(ipAddress){
//console.log(ipAddress);
var cryptoip=[];
ipAddress.split(".").forEach(function(data){
const express=require('express');
const johnnyFive=require("johnny-five");
const app=express();
const port=3000;
const board=new johnnyFive.Board({port:"COM8"});
class AnubisLightsControll{
constructor(name,pin){
this.pin=pin;
this.name=name;
/* Sett Sarverott @ 2021 */
function camelCaser(name, spliter="-"){//camelCaser("namespace-helpers")=="namespaceHelpers"
name=name.split(spliter);
for(var i in name){
if(i!=0){
name[i]=name[i].charAt(0).toUpperCase()+name[i].slice(1).toLowerCase();
}
}
return name.join("");
}
@Sarverott
Sarverott / #youtube-extracting-song-s-titles-from-mixtape-videos.js
Last active November 14, 2021 22:47
paste code into browser devtools js console (F12 in most of internet browsers, search for "CONSOLE") and press enter to get chapters list, list of tracks shuld be printed below.
/* Sett Sarverott @ 2021 */
var d="YT-mixtape.";
var z=window.location.href.split("?")[1].split("&");
for(var i in z)
if(
z[i].split("=")[0]=="v"
)
d+=z[i].split("=")[1]+".";
d+="txt\n\n~~~~~~\n";
var y=document.getElementsByTagName("yt-formatted-string");