Skip to content

Instantly share code, notes, and snippets.

@electronicayciencia
electronicayciencia / gist:cd4adf62f1ea386495498dd8e12612c4
Created October 13, 2020 09:32
Create SERVER and CLIENT certificates from intermediate CA.
Create CA structure:
https://jamielinux.com/docs/openssl-certificate-authority/sign-server-and-client-certificates.html
cd ~/ca
#For SERVER Cert
#===============
NAME=workstation002.example.com
#BANKX
int filter[] = {0, 0, 0, 1, 0, 0, 0};
#BANKY
int samples[] = {1, 2, 3, 4, 5, 6, 7};
CORCONbits.IFMODE = CORCON_IFMODE_INTEGER;
#ASM
mov filter,w8 // W8 and W9 can address X memory
mov samples,w10 // W10 and W11 can address Y memory
#BANKX
int buffer[BUFFER_LEN];
// Modulo addressing inicialization
XMODSRT = buffer;
XMODEND = buffer + BUFFER_LEN - 1;
MODCONbits.XWM = MODCON_WREG1;
MODCONbits.XMODEN = MODCON_ENABLED;
#ASM
if (v == 1) && (v ~= last_v) % raising edge
fcounter = fcounter + 1;
if (fcounter == f)
f = floor(fcounter_max + rand);
fcounter = 0;
else
icounter = icounter + 1;
end
if (v == 1) && (v ~= last_v) % raising edge
if (rand >= 1/fcounter_max)
icounter = icounter + 1;
end
end
@electronicayciencia
electronicayciencia / fractdiv_snippet.m
Last active March 26, 2017 21:29
Fractional divider snippet
Fc = 10; % clock frequency
Tfreq = 4; % Target frequency
% working options
n = 100000; % number of points
SR = 10*Fc; % sampling rate
T = n/SR; % sampling time (s)
% working vectors
t = 0:1/SR:T-1/SR; % time vector