Skip to content

Instantly share code, notes, and snippets.

View TruncatedDinoSour's full-sized avatar
🏳️‍⚧️

Ari Archer (migrated to https://git.ari.lt/ari) TruncatedDinoSour

🏳️‍⚧️
View GitHub Profile
@TruncatedDinoSour
TruncatedDinoSour / blake2s.c
Last active October 27, 2024 20:59
BLAKE2s hashing algorithm from scratch in the C programming language.
/*
* This file is/was a part of the Vessel project. (https://git.ari.lt/ari/vessel)
*
* Copyright (C) 2024 Ari Archer <[email protected]>
*
* Vessel is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
@TruncatedDinoSour
TruncatedDinoSour / siphash.c
Created September 25, 2024 19:44
Simple SipHash16, SipHash32, and SipHash64 implementation in C (public domain)
/*
* UNLICENSE
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@TruncatedDinoSour
TruncatedDinoSour / pgpkeydns.sh
Last active August 21, 2024 08:45
OPENPGPKEY DNS record generator implementing RFC 7929 (https://www.rfc-editor.org/rfc/rfc7929.txt)
#!/usr/bin/env sh
# OPENPGPKEY DNS record generator implementing RFC 7929 (https://www.rfc-editor.org/rfc/rfc7929.txt)
#
# NOT IMPLEMENTED:
#
# 2. The local-part is first canonicalized using the following rules.
# If the local-part is unquoted, any comments and/or folding
# whitespace (CFWS) around dots (".") is removed. Any enclosing
# double quotes are removed. Any literal quoting is removed.
@TruncatedDinoSour
TruncatedDinoSour / fw.sh
Last active November 10, 2024 20:45
Use IPTables and IP6Tables as a firewall in Linux easily for SSH, HTTP(S), Email, Matrix, and XMPP traffic.
#!/bin/sh
set -eu
main() {
for ip in iptables ip6tables; do
echo '----------------------------------------------------------------'
echo "[$ip] Setting up iptables rules..."
@TruncatedDinoSour
TruncatedDinoSour / matrix.c
Last active October 19, 2024 12:02
Matrix arithmetic in C
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include "include/mem.h"
#include "include/matrix.h"
#ifndef INFINITY
#define INFINITY HUGE_VAL
@TruncatedDinoSour
TruncatedDinoSour / ML.java
Created May 22, 2024 03:48
A machine learning model example in Java: prediction of f(x) = x/pi
/*
* Me and #root:ari.lt people on Matrix are messing aroung with
* Java and I went from Hello World to Fibonacci, to Machine Learning.
* Enjoy
*
* License: Unlicense
*/
import java.util.Random;
@TruncatedDinoSour
TruncatedDinoSour / client.py
Created May 17, 2024 16:05
Example of encrypted an socket connection in Python 3 (For TruncatedDinoSour/armour Standard Network Application Programming Interface (SNAPI) version 0): ECDH (Elliptic Curve Diffie-Hellman) with the SECP521R1 curve, ChaCha20-Poly1305, SHA3, and BLAKE2
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Sample SNAPI client"""
import hashlib
import os
import socket
from warnings import filterwarnings as filter_warnings
from cryptography.hazmat.primitives import hashes, serialization
@TruncatedDinoSour
TruncatedDinoSour / machine_learnind.md
Created May 7, 2024 21:04
Python vs C: Machine learning

I feel like Python is a very stupid choice for machine learning, C is a much better alternative because there's many libraries already available for it, and if not you can make them yourself. Machine learning is mainly mathematics, which C is efficient at, and if you're working with large numbers you could use a bigint implementation such as GMP. I don't get why people choose Python for such intensive tasks, yet choose something like Rust for backend web development, it just makes no sense. Backend doesn't need the best performance, and high level features in that sector are great, while performance and low level control in case of C for machine learning models can be great for optimization, performance, and efficiency for the model. It's so stupid, it's 1000% not worth the syntax sugar, high level abstraction, mathematics integration, and all that when stuff becomes like 6000000 times slower, and not as if mathematics from Python can't be ported to C, they can, and very easily, so like wtf, lol.

Python has

@TruncatedDinoSour
TruncatedDinoSour / groups.c
Last active April 7, 2024 11:57
(How to) check if a user is in a supplimentary group in Linux in ANSI C89. (/etc/group parser in C for Linux)
/*
* UNLICENSE
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*