Skip to content

Instantly share code, notes, and snippets.

@fabriciorsf
fabriciorsf / async_read_txt_file.py
Last active March 22, 2025 15:14
The goal of the code is to read a text file asynchronously, allowing lines to be processed while other lines are loaded in the background, with support for buffering, encoding, and detailed logging settings.
import logging
import sys
import asyncio
import time
from contextlib import asynccontextmanager
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout,
format='[%(asctime)s]%(levelname)s(%(name)s): %(message)s')
LOGGER = logging.getLogger(__name__)
#!/bin/bash
# https://www.intel.com/content/www/us/en/docs/oneapi/installation-guide-linux/2024-2/configure-wsl-2-for-gpu.html
sudo apt install -y clinfo
clinfo | head -n 5
sudo apt install -y gpg-agent wget
wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/graphics/ubuntu $(lsb_release -cs) arc" | sudo tee /etc/apt/sources.list.d/intel.gpu.$(lsb_release -cs).list
#!/bin/bash
# https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html
#### CONFIG REPO INTEL ONEAPI ####
# download the key to system keyring
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
#!/bin/bash
sudo apt install dos2unix
git -c core.quotepath=off ls-files --eol \ # query git
| awk '/\/crlf/' \ # filter only lines starting with i/crlf
| cut -f2 / # filter files only (see why it is TAB-delimited https://git-scm.com/docs/git-ls-files#_output)
| xargs -I{} dos2unix {} # convert CR/LF to LF
#!/bin/bash
mkdir -p ~/Downloads
sudo mkdir -p /opt/programs
sudo chmod -R a+rwx /opt/programs/.
mkdir -p /opt/programs/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/Downloads/miniconda.sh
bash ~/Downloads/miniconda.sh -b -u -p /opt/programs/miniconda3
echo 'export MINICONDA="/opt/programs/miniconda3"' | sudo tee /etc/profile.d/miniconda.sh
echo 'export CONDA="${MINICONDA}/bin"' | sudo tee --append /etc/profile.d/miniconda.sh
## Uninstall the OpenSSH Client
Remove-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
## Uninstall the OpenSSH Server
Remove-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
cd ~/Downloads
New-Item -ItemType Directory -Force -Path ssh
cd ssh
@fabriciorsf
fabriciorsf / ssh-agent.service
Last active May 3, 2020 19:33 — forked from magnetikonline/README.md
Add user ssh-agent as daemon to Ubuntu 18.04LTS server.
[Unit]
Description=SSH authentication agent
[Service]
ExecStart=/usr/bin/ssh-agent -a %t/ssh-agent.socket -D
Type=simple
[Install]
WantedBy=default.target
#!/bin/bash
# em cada PC remoto, logo após a instalação limpa do ubuntu desktop LTS
#ip a ## anotar o IP
#sudo apt install openssh-client openssh-server -y
# no PC administrador
if ! grep -q "^deb .*ansible" /etc/apt/sources.list /etc/apt/sources.list.d/*; then
sudo add-apt-repository ppa:ansible/ansible
Set WshShell = CreateObject("WScript.Shell")
MsgBox ConvertToKey(WshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"))
Function ConvertToKey(Key)
Const KeyOffset = 52
i = 28
Chars = "BCDFGHJKMPQRTVWXY2346789"
Do
Cur = 0
x = 14
Do
sudo apt update && sudo apt upgrade && sudo apt dist-upgrade && sudo apt autoremove && sudo apt autoclean && sudo apt clean
sudo apt install htop tilda hardinfo inxi gdebi synaptic cmake traceroute gparted openssh-server tree screen libimage-exiftool-perl
sudo apt install cpufrequtils
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils
sudo systemctl disable ondemand
cd ~/Downloads && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb && sudo gdebi google-chrome-stable_current_amd64.deb && rm google-chrome-stable_current_amd64.deb && cd ~
sudo add-apt-repository ppa:webupd8team/java
###ATTETION: accept
sudo add-apt-repository ppa:linuxuprising/java
###ATTETION: accept