Skip to content

Instantly share code, notes, and snippets.

View a6b8's full-sized avatar

αηdr3α5 ɮαηɦօlʐ3ʀ a6b8

View GitHub Profile
@a6b8
a6b8 / findJsonOjects.js
Last active February 26, 2024 14:14
Find JSON Objects and Array Objects inside of a single string.
function findJsonObjects( { str } ) {
if( typeof str === undefined ) {
console.log( `str is undefined.` )
process.exit( 1 )
} else if( typeof str !== 'string' ) {
console.log( `str is not type of string: "${str}"` )
process.exit( 1 )
}
@a6b8
a6b8 / getRootFromModule.js
Last active December 28, 2023 05:34
Get root from module
#getRootAbsolutePath() {
const __filename = fileURLToPath( import.meta.url )
const __dirname = path.dirname( __filename )
const root = new Array( 10 )
.fill()
.reduce( ( acc, a ) => {
try {
acc['_acc'] = path.resolve( acc['_acc'], '..' )
const files = fs.readdirSync( acc['_acc'] )
@a6b8
a6b8 / hello-project.json
Last active December 26, 2023 14:01
EasyMina - Importer Struct
{
"projectName": "",
"name": "Hello Project",
"description": "",
"contracts": [
{
"name": "hello-world",
"description": "",
"source": "",
"destination": ""
@a6b8
a6b8 / valueModifier.mjs
Created November 24, 2023 16:13
Value Modifier
class ValueModifier {
#config
constructor( config ) {
this.#config = config
return true
}
@a6b8
a6b8 / minaMemo.mjs
Last active November 19, 2023 03:44
Encode/Decode Mina Memo
import base58check from 'bs58check'
class MinaMemo {
#config
constructor() {
this.#config = {
'maxLength': 32,
@a6b8
a6b8 / DocumentSplitter.mjs
Last active November 13, 2023 13:51
Document splitter
import fs from 'fs'
import path from 'path'
class DocumentSplitter {
#config
#silent
constructor( silent=false ) {
@a6b8
a6b8 / metaverseGroundDistribution.html
Last active November 12, 2023 22:11
Metaverse Ground Distribution
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Spiralförmige Pixelanimation mit Raster und Delay</title>
<style>
canvas {
border: 1px solid black;
}
@a6b8
a6b8 / getAsciiTable.js
Created November 12, 2023 03:32
Get Ascii Table
function getTableInAscii( { headlines, items, nr="Nr", splitter=true } ) {
function getRow( { rowItems, maxLengths } ) {
const row = rowItems
.reduce( ( acc, a, index, all ) => {
index === 0 ? acc += '| ' : ''
const l = maxLengths[ index ] - a.length
acc += a
acc += new Array( l ).fill( ' ' ).join( '' )
if( all.lenght -1 === index ) {
@a6b8
a6b8 / bitcoinWIF.js
Last active August 6, 2023 18:05
Bitcoin - String > Private Key > WIF > Public Key
const bitcoin = require( 'bitcoinjs-lib' )
const { ECPairFactory } = require( 'ecpair' )
const ecc = require( 'tiny-secp256k1' )
const crypto = require( 'crypto' )
const ECPair = ECPairFactory( ecc )
const result = {
'private': {
'str': '1',
'hex': null,
@a6b8
a6b8 / findClosestString.js
Last active August 6, 2023 00:58
Find Closest String
function findClosestString( { input, keys } ) {
function distance( a, b ) {
let dp = Array( a.length + 1 )
.fill( null )
.map( () => Array( b.length + 1 )
.fill( 0 )
)
.map( ( z, index, all ) => {
index === 0 ? z = z.map( ( y, rindex ) => rindex ) : ''
z[ 0 ] = index