Skip to content

Latest commit

 

History

History
148 lines (118 loc) · 7.41 KB

README.md

File metadata and controls

148 lines (118 loc) · 7.41 KB

WARNING This library is still under development and intended for experimental purposes only.

Various string-decoding tools

Core dependencies under the hood:

Examples (live)

[
   {
      "str_to_fix":"Gocławski",
      "encoding_from":"cp1252",
      "fixed_str":"Gocławski",
      "encoding_to":"utf_8",
      "recursivity_depth":1
   },
   
]
[
   ⋮,
   {
      "str_to_fix":"échéancier",
      "encoding_from":"cp1252",
      "fixed_str":"échéancier",
      "encoding_to":"utf_8",
      "recursivity_depth":2
   },
   {
      "str_to_fix":"échéancier",
      "encoding_from":"cp1252",
      "fixed_str":"échéancier",
      "encoding_to":"utf_8",
      "recursivity_depth":1
   },
   
]
{
  "str_to_decode":"••• −•− •− −−•• •− −• −• −−− •  •• ••• −−−• • −−•• •− • − •−•−•−  −• •− •−−• •• ••• •− −• −• −−− •  −−− ••• − •− • − ••• •−•−",
  "cyrillic":"СКАЗАННОЕ ИСЧЕЗАЕТ, НАПИСАННОЕ ОСТАЕТСЯ",
  "latin":"SKAZANNOE ISÖEZAET, NAPISANNOE OSTAETSÄ"
}
{
  "str_to_encode": "СКАЗАННОЕ ИСЧЕЗАЕТ, НАПИСАННОЕ ОСТАЕТСЯ",
  "morse": "... -.- .- --.. .- -. -. --- .  .. ... ---. . --.. .- . - .-.-.-  -. .- .--. .. ... .- -. -. --- .  --- ... - .- . - ... .-.-"
}

Installation & usage on a latest Ubuntu Linux server

1. Download and get into the directory

git clone https://github.com/kirisakow/api-py.git

cd api-py

2. Install and run as...

  1. a. ...either as a Docker container:
docker build -f ./python3.10.dockerfile -t api-py-img .

docker run -d --name api-py -p ${PORT_NUM_AS_ENV_VAR}:80 api-py-img
  1. b. ...or as a transient systemd service in a virtual environment:
sudo apt install python3.10-venv

python3 -m venv venv

source venv/bin/activate

python3 -m pip install -r ./requirements.txt

# simplest possible launch option, not recommended as it confers weak reliability:
python3 ./main.py --port ${PORT_NUM_AS_ENV_VAR} &

# a much better launch option, as a transient systemd service:
sudo systemd-run --uid=myuser --gid=myuser --same-dir --unit=api-py_$(date +%Y%m%d_%H%M%S)_myuser /usr/bin/python /home/myuser/api-py/main.py --port $PORT_NUM_AS_ENV_VAR
  1. Configure Nginx as reverse proxy, for example:
server {
   server_name ${DOMAIN_NAME_AS_ENV_VAR};

   location ~ ^/(endpoint|another_endpoint|yet_another) {
       proxy_pass http:https://localhost:${PORT_NUM_AS_ENV_VAR};
   }

   #
   # ...TLS / SSL / HTTPS / LetsEncrypt / certbot stuff...
   #

}
server {
   #
   # ...TLS / SSL / HTTPS / LetsEncrypt / certbot stuff...
   #
}
  1. Test Nginx configuration and, if valid, restart Nginx service:
sudo nginx -t && sudo systemctl restart nginx.service