Raw code. Tested with PiZero in G1FabLab

This commit is contained in:
fred 2023-01-22 19:39:44 +01:00
parent ddd2879c76
commit c39c4b8936
601 changed files with 41859 additions and 0 deletions

50
0TX.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
mkdir -p "./IPFS/"
mkdir -p "./SCAN/"
tail -fn 1 /tmp/qrcode.scan | while read -r line
do
QRCODE=$(echo $line | cut -d ' ' -f 1)
MEMBER=$(echo $line | cut -d ' ' -f 2)
if [[ "${QRCODE: 0:2}" == "Qm" ]]; then
echo "IPFS! ${QRCODE}"
mkdir -p "./IPFS/${QRCODE}"
# GET PIN FROM NUMBOARD
P1=$(python matrixKeypad_RPi_GPIO.py)
P2=$(python matrixKeypad_RPi_GPIO.py)
P3=$(python matrixKeypad_RPi_GPIO.py)
P4=$(python matrixKeypad_RPi_GPIO.py)
PIN=$P1$P2$P3$P4
# GET CARD ON IPFS
ipfs cat ${QRCODE}/key.gpg > "./IPFS/${QRCODE}/key.pgp"
echo $PIN | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/key.pgp"
ipfs cat ${QRCODE}/authfile.gpg > "./IPFS/${QRCODE}/authfile.pgp"
cat "./IPFS/${QRCODE}/key" | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/authfile.pgp"
else
mkdir -p "./SCAN/${QRCODE}"
curl https://g1pod.madeinzion.org/user/profile/${QRCODE} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "./SCAN/${QRCODE}/avatar.png"
convert "./SCAN/${QRCODE}/avatar.png" -rotate 90 "./tmp/rotate.png"
composite -compose Over -gravity East "./tmp/rotate.png" "./G1.png" "./tmp/avatar.png"
convert -font 'Times-Bold' \
-pointsize 20 -fill black -draw 'text 10,20 "'"$MEMBER"'"' \
"./tmp/avatar.png" "./tmp/uid.png"
convert "./tmp/uid.png" -strip +dither -colors 3 -treedepth 3 +remap "./result.png"
python inky_display.py
fi
done

26
1_members_WOF.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
################################################################################
# Author: Fred (support@qo-op.com)
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
curl https://g1.duniter.org/wot/members > "./members.json"
total=$(cat "./members.json" | jq '.results' | jq length)
# Forever Loop
while :
do
member=$((RANDOM % $total))
uid=$(cat "./members.json" | jq ".results[$member].uid" | sed s/\"//g)
pubkey=$(cat "./members.json" | jq ".results[$member].pubkey" | sed s/\"//g)
test=$(curl https://g1pod.madeinzion.org/user/profile/${pubkey} | jq '._source.avatar._content')
if [[ $test != null ]]; then
echo "$pubkey $uid" >> /tmp/qrcode.scan
sleep 45
fi
sleep 5
done

BIN
G1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

43
QRcodeRegognition.py Executable file
View File

@ -0,0 +1,43 @@
#!/usr/bin/python3
################################################################################
# Authors: Fred (support@qo-op.com) + Mark
# Version: 0.1
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
################################################################################
import cv2
import os
import time
import subprocess
import numpy as np
from pyzbar import pyzbar
print("\n [INFO] STARTING VIDEO CAPTURE \n")
faceCascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml')
cap = cv2.VideoCapture(0)
while 1:
ret, img = cap.read()
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
time.sleep(1)
# find the barcodes in the image and decode each of the barcodes
barcodes = pyzbar.decode(img)
# loop over the detected barcodes
for barcode in barcodes:
(x, y, w, h) = barcode.rect
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 2)
barcodeData = barcode.data.decode("utf-8")
barcodeType = barcode.type
text = "{} ({})".format(barcodeData, barcodeType)
print("QRcode: %s"%(text))
# Filename to append
filename = "/tmp/qrcode.scan"
myfile = open(filename, 'a')
myfile.write("%s\n"%(text))
myfile.close()
# do a bit of cleanup
print("\n [INFO] Exiting Program and cleanup stuff \n")
cap.release()
cv2.destroyAllWindows()

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1 @@
樣e

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1 @@
樣e

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show More