This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aproducer.py | |
# | |
# Async Producer-consumer problem. | |
# Challenge: How to implement the same functionality, but no threads. | |
import time | |
from collections import deque | |
import heapq | |
class Scheduler: |
While I'm learning how to use Nginx, I was instructed to update the server_names_hash_bucket_size
(/etc/nginx/nginx.conf
) value from 32 to 64, but I don't understand why should I increase the value to 64.
References that have been read so far:
- See the Server names, Optimization section.
- See setting up hashes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseModel(Model): | |
def __getitem__(self, key): | |
return self.__dict__[key] | |
class UserModel(BaseModel): | |
... | |
class AdminModel(BaseModel): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
x = np.arange(-2, 2, 0.00001) | |
upper = np.sqrt(1 - (abs(x) - 1) ** 2) | |
lower = np.arccos(1 - abs(x)) - np.pi | |
plt.plot(x, upper, color="darkred") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------Install vim---------------- | |
sudo apt update | |
sudo apt install --assume-yes vim | |
----------------Install wget---------------- | |
sudo apt update | |
sudo apt install --assume-yes wget | |
----------------Install snap---------------- | |
sudo apt update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"editor.formatOnSave": true, | |
"editor.tabCompletion": "on", | |
"editor.tabSize": 2, | |
"eslint.options": { "configFile": "./config/.eslintrc.yml", "ignorePath": "./config/.eslintignore" }, | |
"files.insertFinalNewline": true, | |
"prettier.configPath": "./config/.prettierrc.yml", | |
"prettier.ignorePath": "./config/.prettierignore" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt update | |
apt upgrade --assume-yes | |
apt autoremove | |
apt install --assume-yes build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev | |
wget install https://nginx.org/download/nginx-1.21.1.tar.gz | |
tar -xvzf nginx-1.21.1.tar.gz |