Skip to content

Instantly share code, notes, and snippets.

View fredcamps's full-sized avatar

Fred Campos fredcamps

  • myself
  • Ubatuba SP, Brazil
View GitHub Profile
@fredcamps
fredcamps / file_ast.py
Last active March 29, 2023 19:08
AST renaming modules
import ast
# Replace the old package name with the new package name
def replace_imports(node, old_name, new_name):
if isinstance(node, ast.ImportFrom):
if node.module == old_name:
node.module = new_name
for alias in node.names:
if alias.name == old_name:
alias.name = new_name
@fredcamps
fredcamps / webserver_shop_cart_ptbr.py
Created September 29, 2022 19:54
webserver_shop_cart_ptbr.py - part I - OOO, DB
#!/usr/bin/env python
from http.server import BaseHTTPRequestHandler, HTTPServer
class Entidade:
@property
def id(self):
return id(self)
@fredcamps
fredcamps / conkyd.desktop
Last active May 22, 2020 22:53
Conkyd desktop autostart ~/.config/autostart
[Desktop Entry]
Type=Application
Exec=/usr/bin/conky -d -c ~/.conkyrc
X-GNOME-Autostart-enabled=true
NoDisplay=false
Hidden=false
Name[en_US]=conky
Comment[en_US]=Conky System Monitor Autostart
X-GNOME-Autostart-Phase=Application
X-GNOME-Autostart-Delay=0
@fredcamps
fredcamps / .flake8
Last active August 29, 2022 21:17
dev quality tools
[flake8]
## VERBOSITY ##
verbose = 1
quiet = 0
## PARALLEL ##
jobs = auto
## FORMAT ##
show-source = True
@fredcamps
fredcamps / base.sh
Last active April 19, 2024 04:26
My development environment installation
#!/bin/bash
sudo apt-get update
# kernel
sudo apt-get install -y linux-lowlatency linux-tools-lowlatency grub-customizer
# extra packages management
sudo rm -rf /etc/apt/preferences.d/nosnap.pref
sudo apt-get install -y snapd snapcraft
@fredcamps
fredcamps / poetry.fish
Created May 1, 2020 02:35
~/.config/fish/completions
function __fish_poetry_b6c543db761696cb_complete_no_subcommand
for i in (commandline -opc)
if contains -- $i about add build cache check config debug env export help init install lock new publish remove run search self shell show update version
return 1
end
end
return 0
end
# global options
@fredcamps
fredcamps / audio.sh
Last active May 2, 2020 03:35
# Office/Multimedia Production environment
#!/bin/bash
# gave permissions to user
sudo usermod -a -G audio "${USER}"
# add audio repositories
wget https://launchpad.net/~kxstudio-debian/+archive/kxstudio/+files/kxstudio-repos_10.0.3_all.deb
# low latency kernel
sudo apt-get install -y linux-lowlatency
@fredcamps
fredcamps / teamviewer
Last active October 9, 2019 15:11
Teamviewer docker container
xhost +local:docker && docker run --rm -it -e DISPLAY=$DISPLAY -e XAUTHORITY=$XAUTHORITY -v /etc/machine-id:/etc/machine-id:ro -v $HOME/.Xauthority:/root/.Xauthority:ro -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v $HOME/teamviewer/config/:/opt/teamviewer/config/ -v $HOME/teamviewer/profile/:/opt/teamviewer/profile/ albertalvarezbruned/teamviewer:12
@fredcamps
fredcamps / virtualenv.fish
Last active September 23, 2020 20:20
~/.config/fish/functions/
if set -q VIRTUAL_ENV
echo -n -s (set_color -b blue white) "(" (basename "$VIRTUAL_ENV") ")" (set_color normal) " "
end
@fredcamps
fredcamps / aliases.fish
Last active March 8, 2021 22:36
~/.config/fish/conf.d/
# aliases
alias omfrc="$EDITOR $HOME/.local/share/omf/init.fish"
alias terminalrc="$EDITOR $HOME/.config/xfce4/terminal/terminalrc"
alias esudo="sudo -e $EDITOR"