Skip to content

Instantly share code, notes, and snippets.

View rochacbruno's full-sized avatar

Bruno Rocha rochacbruno

View GitHub Profile
@rochacbruno
rochacbruno / README.md
Last active July 24, 2026 01:21
Vim Configs and CheatSheet

VIM CheatSheet

Based on configuration provided in .config/nvim/init.vim

Glossary

  • L = Leader Key, mapped to a single space " "
  • C = Control
  • S = Shift
@rochacbruno
rochacbruno / admonition.md
Last active May 19, 2026 03:42
Github markdown admonition

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

[!WARNING]

#! /usr/bin/env bash
##############################################################################################
# _ _ _ _ _ #
# (_) (_) | | | | | | #
# _ __ _ _ __ _ ___ ___ _ __ __ _ | |_ ___ | |__ _ __ __ _ __| | #
#| '_ \ | || '__|| | ______ / __| / __|| '__| / _` || __| / __|| '_ \ | '_ \ / _` | / _` | #
#| | | || || | | ||______|\__ \| (__ | | | (_| || |_ | (__ | | | || |_) || (_| || (_| | #
#|_| |_||_||_| |_| |___/ \___||_| \__,_| \__| \___||_| |_|| .__/ \__,_| \__,_| #
# | | #
@rochacbruno
rochacbruno / mainpython.md
Last active December 20, 2025 22:09
Use of __main__.py

The use of __main__.py to create executables

myprojectfolder/
    |_ __main__.py
    |_ __init__.py

Being __main__.py:

print("Hello")

@rochacbruno
rochacbruno / curses_detect.py
Created April 18, 2022 20:49
curses detect key pressed python - detect each types key
import curses
import os
def main(win):
win.nodelay(True)
key = ""
win.clear()
win.addstr("Detected key:")
@rochacbruno
rochacbruno / fastapi_session.py
Last active December 11, 2025 15:00
Session based cookie auth fastapi
from fastapi import Request, Depends, HTTPException, Response
from fastapi.responses import RedirectResponse
# This must be randomly generated
RANDON_SESSION_ID = "iskksioskassyidd"
# This must be a lookup on user database
USER_CORRECT = ("admin", "admin")
# This must be Redis, Memcached, SQLite, KV, etc...
@rochacbruno
rochacbruno / pdoc_django_init.sh
Created December 10, 2025 17:46
pdoc django setup
#!/usr/bin/env python
import os
import sys
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'platform_service_example.settings')
import django
django.setup()
from pdoc.__main__ import cli
sys.exit(cli())
@rochacbruno
rochacbruno / amazing_vimtips.md
Last active November 9, 2025 17:52
Useful vim tips
{
'AsyncGenerator': ['asend', 'athrow'],
'AsyncIterable': ['__aiter__'],
'AsyncIterator': ['__anext__'],
'Awaitable': ['__await__'],
'ByteString': ['__getitem__', '__len__'],
'Callable': ['__call__'],
'Collection': ['__contains__', '__iter__', '__len__'],
'Container': ['__contains__'],
'Coroutine': ['__await__', 'send', 'throw'],