Skip to content

Instantly share code, notes, and snippets.

@bshambaugh
bshambaugh / gist:e2f01a77648cae5723c921f315b07afa
Created December 11, 2022 18:14
char sequence compare and hexStringToBytes .... char_string_util
#include <string.h>
#include <stdbool.h>
// this was added for printing out for testing purposes...
#include <stdio.h>
unsigned char nibble(char c)
{
if (c >= '0' && c <= '9')
return c - '0';
@bshambaugh
bshambaugh / gist:68c89a51834f74b28cc2dabca7bc61f8
Created December 11, 2022 16:54
simple program that parses a string into substrings .... ~/Downloads/testCLibrary/substringProto3.c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char* substring(const char *string, int position, int length)
{
int c;
char *p = (char *)malloc(sizeof(char)*(length+1));
if(p == NULL)
https://www.programmingsimplified.com/c/source-code/c-substring , gives a useful function
char* substring(const char *string, int position, int length)
{
int c;
char *p = (char *)malloc(sizeof(char)*(length+1));
if(p == NULL)
{
printf("Unable to allocate memory.\n");
exit(1);
@bshambaugh
bshambaugh / gist:507ea768fb7a1458862f84c6ecbac1ca
Created December 10, 2022 03:22
DIF Interop WG - Nov 30th ...Human Colossus Foundation
WEBVTT
Lamari Lavarrette (DIF):
Hi Paul, how are you? This is Lamari. I'm the community manager here at DIF.
Paul Knowles:
Hi Lamari, nice to meet you.
Lamari Lavarrette (DIF):
Nice to meet you as well. Uhm...So, Kaliya should be getting on, uhm, in a minute here. .so.and we're just waiting here for other people to get on.
@bshambaugh
bshambaugh / gist:d98bea1fa134d7dbb034445f68058c9c
Created December 4, 2022 16:12
fix the unitialized value jump
==32719== 1 errors in context 1 of 4:
==32719== Conditional jump or move depends on uninitialised value(s)
==32719== at 0x4C34996: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==32719== by 0x1174C2: mergeCharArray(int, unsigned char*, char*) (in /home/ubuntu/Downloads/blinky_utils/.pio/build/native/program)
==32719== by 0x117817: mergeCharArray_merge_a_char_array_Test::TestBody() (in /home/ubuntu/Downloads/blinky_utils/.pio/build/native/program)
==32719== by 0x14C231: void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/ubuntu/Downloads/blinky_utils/.pio/build/native/program)
==32719== by 0x146246: void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) (in /home/ubuntu/Downloads/blinky_utils/.pio/build/native/program)
==32719== by 0x128ADD: testing::Test::Run() (in /home/ubuntu/Downloads/blinky_ut
@bshambaugh
bshambaugh / gist:7e5ff0918470d285d900b8276fe43b31
Created December 3, 2022 19:20
sample makefile for google test that does not work....
# https://chromium.googlesource.com/external/googletest/+/9855a87157778d39b95eccfb201a9dc90f6d61c6/make/Makefile?autodive=0
# A sample Makefile for building Google Test and using it in user
# tests. Please tweak it to suit your environment and project. You
# may want to move it to your project's root directory.
#
# SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
@bshambaugh
bshambaugh / gist:41683d50c5de91344e724afc585b10fa
Created November 30, 2022 00:29
main.cpp with some string embellishments
#include <Arduino.h>
#include <SparkFun_ATECCX08a_Arduino_Library.h> /// the latest version of this library might work with the ESP32. so you do not need to use Blinky's *-aug26.h
#include <WiFi.h>
#include <WebSocketClient.h>
#include <Wire.h>
#include <concatenateArray.h>
#include <protected.h>
#include <websocketserver_config.h> // defines: path, host, and espport
#include <string>
@bshambaugh
bshambaugh / gist:667a18d001048ce57b0f810d70ac70b3
Created November 25, 2022 22:13
I can create a valid JWT with a remote signer
~/Downloads/key-did-provider-p256Test-remote/lib$ node remote-matchDIDKeyWRemoteT2-getJWT-nl1.1.js
creates a valid JWT
checked with
~/Downloads/testNPMJose/lib$ node createJWT3.js
https://www.youtube.com/watch?v=KPesyRp8qqo
ESP8266 Unit Testing - Part 1/2: Unity Test Framework - Day 32 of #100DaysOfCode​ in IoT
ESP8266 Unit Testing - Part 2/2: GoogleTest and GoogleMock - Day 33 of #100DaysOfCode​ in IoT
https://www.youtube.com/watch?v=_xRv-3FWyLE
channel: https://www.youtube.com/@tomasztarnowski4434
mentions https://embetronicx.com/tutorials/unit_testing/unit-testing-in-c-mock-using-cmock-in-embedded/
import { Signer } from 'did-jwt'
import { createJWS } from 'did-jwt'
import stringify from 'fast-json-stable-stringify'
import type {
AuthParams,
CreateJWSParams,
DIDMethodName,
DIDProviderMethods,
DIDProvider,
GeneralJWS,