Skip to content

Instantly share code, notes, and snippets.

@SomajitDey
SomajitDey / compression_cryptography_using_URL_shortener.md
Last active September 19, 2024 07:31
Any data can be compressed using URL shorteners. Two such compression can form a public-private key pair. Only one can lead to the other not the other way round.

Compression

  • take your minified JSON and turn it into a URL safe base64 string. The length of this string can be as big as this.
  • make a dummy url like http://dummy.tld/<the base64 string> and shorten it using any URL shortener.
  • save the unique path of the shortened url as your compressed data (henceforth called token). No need to store the domain of the shortened URL as the URL shortener would be hardcoded in your app.

Decompression

  1. Reconstruct the shortened URL from the token. Try to fetch (GET) the shortened URL.
  2. Parse the response for the redirect url and extract the base64 string.
  3. Decode the base64.
@SomajitDey
SomajitDey / static_site_howto.md
Last active September 20, 2024 14:47
Create and deploy static site for personal website or blog. Contains contact form, feeds and comment section.
@SomajitDey
SomajitDey / ANN_DL_deep_dive.md
Last active September 12, 2024 13:16
Transformers and Artificial Neural Networks/Deep Learning in AI/ML
@SomajitDey
SomajitDey / WSLg.md
Last active March 25, 2024 16:25 — forked from 4wk-/README.md
Clean uninstall then reinstall of WSL on Windows 10, with systemD support

Uninstall then reinstall WSL on Windows 10 (clean way)

A - Uninstall wsl and related stuff

  1. In powershell (as admin)
# list all installed distros
wsl -l -v

# destroy distros
wsl --unregister Ubuntu
@SomajitDey
SomajitDey / WSL2-Windows_port-forward.md
Last active July 24, 2024 11:44
How to forward WSL2 port to Windows port and vice versa
@SomajitDey
SomajitDey / anydesk-enable-remote-access.md
Created April 2, 2023 13:56 — forked from imami/anydesk-enable-remote-access.md
AnyDesk - How Enable Remote Access from ubuntu/debian terminal

###AnyDesk - How Enable Remote Access from ubuntu/debian terminal.

Note:

Here are the commands might be usefull in this purpose:

  • anydesk --get-status : To get current status of anydesk, which might be offlien,online or nothing.
  • anydesk --get-id : To get the ID that your system can be accessed by.
  • anydesk --service : To start anydesk service if not already running (for Linux).
  • anydesk --restart-service : To restart anydesk service
  • anydesk --stop-service : To stop anydesk service
@SomajitDey
SomajitDey / getopt.bash
Last active December 26, 2022 07:40
Parse GNU style long options (--opt optarg | --opt=optarg) as well as short Unix options (-ooptarg | -o optarg). Source: https://stackoverflow.com/a/28466267.
die() { echo "$*" >&2; exit 2; } # complain to STDERR and exit with error
needs_arg() { if [ -z "$OPTARG" ]; then die "No arg for --$OPT option"; fi; }
while getopts ab:c:-: OPT; do
# support long options: https://stackoverflow.com/a/28466267/519360
if [ "$OPT" = "-" ]; then # long option: reformulate OPT and OPTARG
OPT="${OPTARG%%=*}" # extract long option name
OPTARG="${OPTARG#$OPT}" # extract long option argument (may be empty)
OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=`
fi
@SomajitDey
SomajitDey / Makefile
Last active June 22, 2024 16:58
Sample Makefile for a Modern Fortran project
# Disable all of make's built-in rules (similar to Fortran's implicit none)
MAKEFLAGS += --no-builtin-rules --no-builtin-variables
# Fortran Compiler
FC := gfortran
# The following must have non-empty value if OpenMP is required
OMP :=
# The following must have non-empty value if Debugging compiler options are required