Skip to content

Instantly share code, notes, and snippets.

@U1F30C
U1F30C / raw-http.md
Last active May 25, 2025 01:44
Raw HTTP client and server over TCP with netcat

Using HTTP over raw TCP with netcat

Netcat HTTP

HTTP Client

Create a minimal raw HTTP request file request.txt. End of line must be CLRF.

GET / HTTP/1.1
@U1F30C
U1F30C / keys_management.md
Created April 27, 2025 08:55
SSL, JWK, JWT examples

Keys management

Generate keys

Instructions for generating and managing cryptographic keys using OpenSSL. These keys are typically used for secure communication, signing, or encryption in various applications.

openssl genrsa -out test_private_key.pem 2048

openssl req -new -x509 -key test_private_key.pem -out test_public_key.pem -subj '/CN=test_key_name'
@U1F30C
U1F30C / bookmarks-html-to-json.ts
Created March 24, 2025 00:29
bookmarks.html to bookmarks.json
import { readFile, writeFile } from "fs-safe";
import { DomNode, LinkNode, parse } from "netscape-bookmark-tree";
const bookmarksDir = "data/bookmarks.html";
const outputDir = "data/bookmarks.json";
interface Link<Metadata = any> {
name: string;
url: string;
folder?: string;
@U1F30C
U1F30C / id3.ts
Last active September 29, 2024 19:19
ID3 classification algorithm implemented in js
// Sources:
// https://en.wikipedia.org/wiki/ID3_algorithm
// https://towardsdatascience.com/decision-trees-for-classification-id3-algorithm-explained-89df76e72df1
// https://brilliant.org/wiki/entropy-information-theory/
// TODO: explicitly specify attribute classes and implement generalization
import { countBy, groupBy, minBy, maxBy } from "lodash";
type Data = string[][];
@U1F30C
U1F30C / disjoint-set.ts
Created August 16, 2024 15:05
Graph search algorithms
export interface Dictionary<T> {
[key: string]: T;
}
interface DisjointSetElement {
key: string;
parent?: DisjointSetElement;
children: DisjointSetElement[];
}
@U1F30C
U1F30C / solution.ts
Last active May 19, 2024 04:01
Evaluate Boolean Binary Tree problem from github
/**
* Definition for a binary tree node.
* class TreeNode {
* val: number
* left: TreeNode | null
* right: TreeNode | null
* constructor(val?: number, left?: TreeNode | null, right?: TreeNode | null) {
* this.val = (val===undefined ? 0 : val)
* this.left = (left===undefined ? null : left)
* this.right = (right===undefined ? null : right)
@U1F30C
U1F30C / Dockerfile
Created March 25, 2024 00:11
build brcypt binary in docker to solve depencencies error loop
# to know the right version use
# cat /etc/os-release
# node --version
FROM node:14-buster as build
WORKDIR /app
COPY . ./
RUN npm i
@U1F30C
U1F30C / pi.js
Created February 6, 2024 03:05
PI calculation
function piStep(n) {
return (
(
Math.pow(-1, n)
/ (2 * n + 1)
)
* (
4 / Math.pow(5, 2 * n + 1)
- 1 / Math.pow(239, 2 * n + 1)
)
@U1F30C
U1F30C / shapefileConversion.md
Created December 3, 2023 03:37 — forked from YKCzoli/shapefileConversion.md
Step through of converting shapefile to geojson with qgis.

Converting shapefiles to geojson

####Assumptions

Get the data

We will use the Electoral District and Polling Division shapefiles found on the Elections Ontario site:

@U1F30C
U1F30C / README.md
Created December 3, 2023 03:08 — forked from gilangvperdana/README.md
Make your Ubuntu Server be Router!

Goals

  • Can use Ubuntu Server 20.04 LTS to be Router Gateway include DHCP Server
  • Client who connected to Ubuntu Server can be access Internet

Environement

  • Ubuntu 20.04 LTS
  • 2 Interface
    • 1 Interface from WAN / ISP (enp2s0)
    • 1 Interface for distribution clients (enx00e04c534458)