Skip to content

Instantly share code, notes, and snippets.

@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 6, 2024 08:48
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@karpathy
karpathy / min-char-rnn.py
Last active May 6, 2024 08:47
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@s3rvac
s3rvac / double-dispatch.cpp
Last active May 6, 2024 08:46
An example of using double dispatch in C++ to implement expression evaluation without type casts.
// $ g++ -std=c++14 -pedantic -Wall -Wextra double-dispatch.cpp -o double-dispatch
// $ ./double-dispatch
//
// Also works under C++11.
#include <iostream>
#include <memory>
#if __cplusplus == 201103L
namespace std {
@deveworld
deveworld / encode.py
Last active May 6, 2024 08:45
Diff-SVC Audio Data Preprocess Python Script
import os
import glob
import parmap
import multiprocessing
import subprocess as sp
FFMPEG_BIN = "ffmpeg"
def encode(input, output_path):
@jbd
jbd / 01-form-single.html
Created November 22, 2023 10:25 — forked from ve3/01-form-single.html
Slice large file into chunks and upload using JavaScript.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>XHR upload large file with slice</title>
<style>
#debug {
border: 3px dashed #ccc;
margin: 10px 0;
padding: 10px;
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 6, 2024 08:45
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@webarchitect609
webarchitect609 / php8_docker.sh
Last active May 6, 2024 08:41
Quick docker PHP 8 setup for composer and unit testing
# Terminal Tab #1 (with privileges inside container)
# =============
cd "/the/dir/you/want/to/work/with/php8"
docker run --name php8 \
-it \
-v $PWD:/var/php:rw \
php:8.0-cli-alpine3.12 \
ash
cd /tmp
@urwx
urwx / sys-btrfs.txt
Last active May 6, 2024 08:38
Arch Linux Encrypted LVM Luks Btrfs Guide (EFI)
Arch Linux Encrypted LVM Luks Btrfs Guide (EFI)
# Wipe disk with random data (optional)
badblocks -c 10240 -s -w -t random -v /dev/sda
# Partition
parted -a minimal /dev/sda
- mklabel gpt
- unit Mib
- mkpart ESP fat32 0% 512
- set 1 boot on
- mkpart primary ext4 512 100%

Transparent Restaurant Backend

In this task, you're going to implement a REST API for a interacting with a menu of a restaurant. The menu is given to you as a JSON file which you will parse and perform operations on. The required features will be listed below.

Description

In this restaurant, honesty is extremely promoted. So extreme, that the restaurant declares that differing quality of ingredients are used in their meals. Like that's not enough, it also allows the customers to choose the ingredients of each meal in different qualities. Each ingredient has the following quality levels:

  • low: the cheapest
  • medium: moderate