Skip to content

Instantly share code, notes, and snippets.

View abairo's full-sized avatar

Anderson Bairo abairo

  • Curitiba, Paraná - Brasil
View GitHub Profile
@abairo
abairo / instructions.md
Last active May 29, 2025 00:45
Fix Linux suspend mode

Fixing the wake up immediately after suspend problem

Ref.: Reddit

Tested with Gygabyte B550M AORUS ELITE BIOS Version: F20d

Instructions

First of all, create a file called disable-wakeup.service at /etc/systemd/system/ with the content below:

@abairo
abairo / flutter-setup.sh
Created April 18, 2024 00:56
Flutter Development Environment
install_flutter () {
echo "installing flutter..."
sudo snap install flutter --classic
}
display_flutter_sdk_path () {
echo "displaying flutter sdk path..."
flutter sdk-path
}

openapi-generator

Generate clients, servers, and documentation from OpenAPI 2.0/3.x documents

For Python example, run the command below in a terminal:

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i https://petstore.swagger.io/v2/swagger.yaml -g python -o /local/out/python

The generated code will be in the out folder from the current path ${PWD}. So, if you need to change the folder permissions for the current user, run:

# For installation windows managers, set this variables
_JAVA_AWT_WM_NONREPARENTING=1
export _JAVA_AWT_WM_NONREPARENTING
# Add permissions to usb port
sudo chmod a+rw /dev/ttyUSB0

Edit the file /etc/modprobe.d/default.conf:

options snd_hda_intel index=1
1 - install nvidia packages and xorg-server:
sudo pacman -S nvidia nvidia-utils nvidia-settings xorg-server-devel opencl-nvidia
2 - insert noveau on blacklist:
/usr/lib/modprobe.d/nvidia.conf
blacklist nouveau
3 - run nvidia command to create xorg.conf:
nvidia-xconfig --prime
4 - Edit the grub config: /etc/default/grub and update grub
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet nvidia-drm.modeset=1
5 - add new conf to .xinitrc:
google search:
intext:"buscar por" intitle:"index.of" (pdf|mobi|epub) -inurl:(php|html|aspx|shtml)
@abairo
abairo / iterador_simples.py
Created October 4, 2019 16:04
Iterador simples
import csv
# inicializa o contador de linhas
numero_da_linha = 1
# abre o arquivo
with open('vazao.csv') as arquivo_csv:
# Lê o arquivo csv
arquivo_lido = csv.reader(arquivo_csv, delimiter=',')
# itera o arquivo de forma simples
for linha_arquivo in arquivo_lido:
@abairo
abairo / iterador_avancado.py
Last active October 4, 2019 16:03
iteradores de csv
import csv
def iterador_avancado():
# abre o arquivo
with open('vazao.csv', "r") as arquivo_csv:
# Lê o arquivo csv
for linha_arquivo in csv.reader(arquivo_csv):
# retorna linha iterada
yield linha_arquivo
exec --no-startup-id /usr/lib/kdeconnectd
exec --no-startup-id kdeconnect-indicator