Skip to content

Instantly share code, notes, and snippets.

@freix1
freix1 / venv.md
Last active January 20, 2022 11:01
[Python Virtual Environment] #Python

Creating a Virtual Environment

python3 -m venv /path/to/new/virtual/environment

Activating a Virtual Environment

Unix

source venv/bin/activate
@freix1
freix1 / html_syntax.html
Last active February 9, 2022 22:20
[Flask] #Python
<!-- Inline variable -->
{{ variable_name }}
<!-- Loop -->
{% with messages = get_flashed_messages(with_categories=True) %}
{%- if messages %}
{% for category, message in messages %}
<p>{{ message }}</p>
{% endfor %}
{% endif -%}
@freix1
freix1 / install.md
Last active January 30, 2022 08:41
[Python Packages] #Python

Install Packages from requirements.txt file

pip install -r requirements.txt

Note: This command most likely requires Administrator privileges.

Uninstall Packages

pip uninstall <packagename>
@freix1
freix1 / terminal.md
Last active July 26, 2022 08:20
[Linux] #Unix

Get system information

Get general information about Linux distribution

lsb_release -a

Check disk space

df -h
@freix1
freix1 / configuration.md
Last active November 1, 2022 20:39
[Raspberry Pi] #Unix #RaspberryPi

Device configuration menu

sudo raspi-config

Check the device temperature

vcgencmd measure_temp
@freix1
freix1 / setup.md
Last active January 21, 2022 17:14
[Minecraft Server] #Unix #RaspberryPi

Start the server

cd ~/papermc-server
java -Xmx2048M -Xms2048M -jar server.jar nogui

-Xms<n>
Specifies the initial size, in bytes, of the memory allocation pool.

-Xmx<n>
Specifies the maximum size, in bytes, of the memory allocation pool.

@freix1
freix1 / commands.md
Last active January 20, 2022 19:40
[Pi-hole] #Python #RaspberryPi #Unix

Update

pihole -up

Reset password

pihole -a -p
@freix1
freix1 / commands.md
Last active January 30, 2022 09:06
[Screen] #Unix

Installation

The screen package is pre-installed on most Linux distros nowadays. You can check if it is installed on your system by typing:

screen --version

If it is not installed it can be installed via:

sudo apt install screen
@freix1
freix1 / cmd.md
Last active May 18, 2023 17:52
[Windows] #Windows #Microsoft #Edge

Shutdown

Command Description
shutdown /s Shut down the computer
shutdown /r Restart the computer
shutdown /l Log off from computer

Clear local DNS cache

ipconfig /flushdns
@freix1
freix1 / threads.md
Last active February 1, 2022 14:54
[Threads]

Daemon Threads

When Daemon Threads are useful

In a big project, some threads are there to do some background task such as sending data, performing periodic garbage collection etc. It can be done by non-daemon thread. But if non-daemon thread is used, the main thread has to keep track of them manually. However, using daemon thread the main thread can completely forget about this task and this task will either complete or be killed when main thread exits.