Skip to content

Instantly share code, notes, and snippets.

View JanisErdmanis's full-sized avatar

Jānis Erdmanis JanisErdmanis

View GitHub Profile
@JanisErdmanis
JanisErdmanis / logo.jl
Last active February 28, 2024 16:25
PeaceFounder logo update
using Luxor
function make_path()
A = Point(-50, 0)
B = Point(50, 0)
C = Point(50, -100)
D = Point(150, -100)
move(A)
@JanisErdmanis
JanisErdmanis / auth.jl
Created February 4, 2024 23:36
Integration API exploration for HMAC authorization
using Base64
using Nettle
using Dates
sha256(data) = Nettle.digest("sha256", data)
sha256(data, key) = Nettle.digest("sha256", key, data)
function get_header(headers, key)
for (keyi, value) in headers
@JanisErdmanis
JanisErdmanis / auth.jl
Last active February 2, 2024 22:45
Test vector extraction for Azure HMAC implementation
using JSON3
using Base64
using Nettle
using Dates
sha256(data) = Nettle.digest("sha256", data)
sha256(data, key) = Nettle.digest("sha256", key, data)
function verifyRequest(request, secretBase64::String)
method = request["method"]
@JanisErdmanis
JanisErdmanis / make-dmg.sh
Created November 29, 2023 22:58
Bundling script for AppBundler produced app bundle
#!/bin/bash
set -e
info() {
local GREEN="\033[0;32m"
local NO_COLOR="\033[0m" # No color (reset to default)
echo -e "${GREEN}INFO: $*${NO_COLOR}"
}
APPDIR="$1"
@JanisErdmanis
JanisErdmanis / build.ps1
Created November 29, 2023 22:55
Remote bundling scripts for Windows using AppBundler produced archive
param (
[string]$Archive,
[string]$MSIX,
[string]$Password
)
New-Alias -Name makeappx -Value "C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64\makeappx.exe"
New-Alias -Name signtool -Value "C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x64\signtool.exe"
New-Alias -Name editbin -Value "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\editbin.exe"
@JanisErdmanis
JanisErdmanis / publish.el
Created August 9, 2023 20:40
Compiling `.org` files into a personal website with `org-publish`
(require 'ox)
(require 'cl-lib)
(require 'cl)
(setq make-backup-files nil) ;; No need for backup files
(defvar my-base-directory (concat (file-name-directory load-file-name) "org")
"Org sources are taken from folder org relative to this file")
(defvar my-publishing-directory (concat (file-name-directory load-file-name) "html")
"Everything is published in folder html relative to this file")
@JanisErdmanis
JanisErdmanis / JWT_test.jl
Last active July 2, 2023 09:59
JWT public key test with CryptoGroups
#https://www.rfc-editor.org/rfc/rfc7515#appendix-A.3
using CryptoGroups
using CryptoSignatures
using Base64
base64url_decode(x) = replace(x, "_" => "/", "-" => "+") |> base64decode
base64url_encode(x) = replace(base64encode(x), "/" => "_", "+" => "-")
# Reading in from JSON Web Key string
@JanisErdmanis
JanisErdmanis / openssl_test.jl
Created July 1, 2023 21:31
Testing secp256r1 curve on CryptoGroups
# Let's test that the curve is on the
# https://www.herongyang.com/EC-Cryptography/Curve-secp256r1-for-256-Bit-ECC-Keys.html
using CryptoGroups
using Base64
curve = CryptoGroups.curve("secp256r1")
P_256 = specialize(ECPoint, curve)
g = convert(P_256, generator(curve))
@JanisErdmanis
JanisErdmanis / Bank.qml
Created March 19, 2023 22:02
Property grouping (none works)
import QtQuick
import QtQuick.Window
import QtQuick.Controls
Window {
id: app
width: 550
height: 700
@JanisErdmanis
JanisErdmanis / Survey.qml
Created March 16, 2023 16:24
Example of dynamic survey and bridging that with julia while preserving ability to test UI with dummy data
import QtQuick
import QtQuick.Window
import QtQuick.Controls
import org.julialang
Window {
id : window