Friday, October 14, 2022

Steps to follow to create and use a local npm module:

 Steps to follow to create and use a local npm module:


Create a directory
:

mkdir npm-test

Create a package.json file in the directory
:

cd npm-test
npm init

follow the steps at the prompt, keep the defalts, maybe add a description and author

If index.js is the entry point listed in package.json (by default, e.g "main":"index.js", create the index.js file:

touch index.js

Edit index.js with your favorite text editor. I am using vim. :

vim index.js

Add the following content within vim as a test :

exports.printMsg = function() {
     console.log("This is a message from the demo package.");

}

Create a package with the npm file
:

npm pack

unzip the tarball:

tar xzvf test-npm-1.0.0.tgz

In the unzipped package, link to the global package namespace:

cd package
npm link

Create a file folder to call the new npm package:

mkdir test-folder
cd test-folder

Make the npm package available:

npm link test-npm


Use the npm package in a test file:

touch testfile.ts
vim testfile.ts
add to vim: " import * as testy  from 'test-npm'
console.log(testy.printMsg) "
convert to js: tsc testfile.ts
run with node: node testfile.js

How to reverse the link:

Remove package in the test-folder:
      npm unlink --no-save npm-test

Remove global link to the npm package:
      cd npm-test/package/ 
      npm unlink

 
Sources:

https://docs.npmjs.com/cli/v6/commands/npm-pack

https://medium.com/@debshish.pal/publish-a-npm-package-locally-for-testing-9a00015eb9fd

https://www.cyberciti.biz/faq/unpack-tgz-linux-command-line/

https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af








Wednesday, September 21, 2022

Audio Level Indicator . Log DB LM3915 fed by LF353 for S-meter?

I've also discovered an audio level indicator recently: https://www.aliexpress.us/item/2251832501435636.html
&
https://www.mouser.com/datasheet/2/405/lm3915-443929.pdf
& https://www.ti.com/lit/ds/symlink/lf353-n.pdf
https://www.youtube.com/watch?v=jllsqRWhjGM (EEVblog #490 - Peak Detector Circuit --- feed to lm3915 for led bar display  (s-meter))
use caps with low dielectric adsorption: http://danssmallpartsandkits.net/ (polystyrene caps)
https://www.youtube.com/watch?v=Fn5kHhNRsz0 (#77: Op Amp Peak Detector Tutorial, with peak detector basics)Why?
http://www.ozqrp.com/docs/MST3_manual_V1.pdf (mostly analog radio)
-->    http://www.ozqrp.com/docs/LED_S_meter_manual_V1_0.pdf (S-Meter)

My mind also wandered to the digital to signal processing realm:
https://www.analog.com/media/en/technical-documentation/data-sheets/ad9226.pdf (Analog to Digital)
https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/Nano-9K.html (Digital Signal Processing)
https://www.analog.com/media/en/technical-documentation/data-sheets/2604fd.pdf (Digital to Analog) --- to 50MhZ
https://www.youtube.com/watch?v=ZZJekllYUVc (R2R resistor ladder to 25MHz)ADC w/ FPGA (https://www.youtube.com/watch?v=cvdzEQhLpYw)
VLSI Project || DAC( Digital to Analog Converter) interfacing with FPGA using SPI || SPARTAN 3E (https://www.youtube.com/watch?v=CPGX-Kdvx9s)

-----------------------------------------------------------------------------------------------------------------------------
Addendum:
https://www.elprocus.com/analog-to-digital-converter/

Oddly I found myself thinking about FPGAs, here are my findings... (tldr....you can try obtaining ZKP BLS12_381 curves)

This was some bantering also published here: (https://lists.w3.org/Archives/Public/public-credentials/2022Sep/0180.html).

As I was studying for my HAM radio general exam, my brain wondered. I thought about digital filtering, which led me to https://www.youtube.com/watch?v=HJ-C4Incgpw (How to design and implement a digital low-pass filter on an Arduino).
Realizing the limitations of this I soon found myself on https://www.youtube.com/watch?v=vVjWFFclU6I (Implementing Digital Signal Processing on the FPGA of a FlexRIO).

Naturally the next morning this led to exploration of https://identity.foundation/bbs-signature/draft-looker-cfrg-bbs-signatures.html#name-bls12-381-ciphersuites and discovery of
https://www.youtube.com/watch?v=vCG5_nxm2G4 (MeganWachs - Keynote RISC-V and FPGAs: Open Source Hardware Hacking) which led to https://github.com/riscv/riscv-crypto and
https://riscv.org/wp-content/uploads/2017/12/Wed-1354-RISCV-CryptoExtensions-RichardNewell.pdf and https://www.youtube.com/watch?v=-HVRjbxWF-I (A Guide to the RISC V Cryptography Extension).

I also found bls12_381 on an FPGA: https://dspace.mit.edu/bitstream/handle/1721.1/138122/Paper_PrePrint_Version.pdf (done on an in-house FPGA)

This bls12_381 on FPGAs also led to discovery of work by the ZCash Foundation: https://github.com/ZcashFoundation/zcash-fpga/tree/master/zcash_fpga/src/rtl/bls12_381 . Apparently this was done on AWS FPGAs.

I discovered the Tang Nano 9K FPGA Development Board GOWIN GW1NR-9 RISC-V HDMI kit . Realizing they were inexpensive, I grabbed two imagining IIW. I also recalled my time at the
Virtual Silicon Salon (https://www.siliconsalon.info/) and remembered that hardware was slow, and
IIRC BLS signatures used for selective disclosure are not yet available in hardware.
I've never worked with FPGAs before. I discovered what I found is like the Ice40 (unfortunately hard to find at the moment), but it did lead me to some good resources.

ice40 playlist:
https://www.youtube.com/watch?v=DwxBkYhor80
https://www.youtube.com/watch?v=UlgJ7TRU1KI
https://www.youtube.com/watch?v=6UgVUExXlvg
https://www.youtube.com/watch?v=dTL0qrzme4
(I found that this was still available, later in exploration: https://tinyvision.ai/) --- ditto for tinyFPGA (https://tinyfpga.com/)


Tang Nano from Gowin Semi:
https://github.com/gowinsemi  (Github)
https://www.youtube.com/channel/UC0VdsHXVKAaMkFVyBzVLVIQ (YouTube)
https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/Nano-9K.html (Wiki)
https://www.youtube.com/watch?v=WKB04zxLrHA (Tang Nano 9k)
https://www.youtube.com/watch?v=kyQLtBh6h0U (FPT2020: A Complete Open Source Design Flow for Gowin FPGAs)
https://www.youtube.com/watch?v=Gh9VfCvTWck (2nd Open Source video, possibly building on the former)
https://www.bananatronics.org/first-steps-with-the-tang-nano-fpga-development-board/
https://www.cnx-software.com/2022/01/17/tang-nano-9k-fpga-board-can-emulate-picorv32-risc-v-soft-core-with-all-peripherals/

General FPGA links:
https://www-electronicayciencia-com.translate.goog/2021/07/tang_nano_fpga.html?_x_tr_sl=auto&_x_tr_tl=en&_x_tr_hl=en&_x_tr_pto=wapp
https://www.youtube.com/watch?v=gUsHwi4M4xE (EEVblog#496 What is an FPGA?)
https://fpgatutorial.com/getting-started-with-fpga-development-process/
https://www.fpga4student.com/p/verilog-project.html
https://github.com/BrunoLevy/learn-fpga

------------------------------------
Addendum:
https://medium.com/asecuritysite-when-bob-met-alice/explaining-bls12-381-the-zero-knowledge-proof-curve-aa5eabec8261

https://www.youtube.com/watch?app=desktop&v=sOKJWAnrbHM (ARM with FPGA)

Sunday, August 14, 2022

WiFi Manager for connecting the ESP32 to a WiFi Network when you don't know the password

 https://www.youtube.com/watch?v=_uXKIEmJh3g

WiFiManager with ESP32 - Stop Hard-coding WiFi Credentials!

 I suppose you also could use Bluetooth or even LoRa if you had the transceiver.

LoRa Location Tracking

 https://www.rs-online.com/designspark/lora-location-tracker-introduction

https://tinygs.com/

Tuesday, July 26, 2022

journal july 26th

 

I realize you've got you're own lives, so you don't need to read this. I'm in front of the computer a lot, and just typing things out comes most naturally. It's a journal, to get my thoughts out of my head and hopefully get back to what I need to do to move forward. I'm happy that there is a distributed systems paper group. It was a fun way to connect, and maybe something a little more neutral than asking for help with a project. I don't feel like I fit in where I live. There are a lot of React and C# development jobs, but I typically don't gravitate that direction. I thought I had it made when my HAM buddies challenged me to find a gig, and I found one on GitCoin for a known web3 project, but it got closed up when I pointed out a broken link in the documentation. Oh well. I spend a lot of time at home these days. It's frustrating that my interests don't seem to fit in with the local market. I've been into distributed/decentralized systems for about 10 years but it doesn't seem to be a thing here. I always have to remind myself to keep my chin up and focus on where I want to go, even if that means finding and investing in another community to succeed. I found a JavaScript discord that I wasn't aware of, so it is another place to look if I get totally stuck.
I think I will get back to working with group theory. I've been trying to figure out how this fits in with cryptography, and well category theory too. (It's a subset afaik). Tonight is the HAM thing. I guess if I cannot pull myself away from my project and learn something like React or C#, I could work at the drive-in for extra cash. Or just not bother, and read books and build projects for as long as I can. I think I've been pretty good about managing my money, with a few exceptions. I'll be going to the Internet Identity Workshop this fall. I hope to present on an abstract data model for dids and v.c. (if possible) and talk about my adventures with IoT. A friend of mine just sent me a cryptographic protocol that they developed. I'd like to check it out. If it can get me away from using an auxiliary cryptographic co-processor it could save on the complexity and unit cost.