Skip to content

Instantly share code, notes, and snippets.

View rochacbruno's full-sized avatar
🛠️
QQ

Bruno Cesar Rocha rochacbruno

🛠️
QQ
View GitHub Profile
@rochacbruno
rochacbruno / record.py
Last active October 20, 2025 14:43
gpu-screen-recorder with systray icon
#!/usr/bin/env python3
import subprocess
import gi
import signal
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, AppIndicator3
APP_ID = "gpu.screen.recorder"
RECORD_CMD = ["bash", "-c", "gpu-screen-recorder", "-o", "/tmp/output.mp4"]
@rochacbruno
rochacbruno / config
Created October 17, 2025 14:14
swappy config
[Default]
save_dir=$HOME/Pictures/Screenshots
save_filename_format=swappy-%Y%m%d-%H%M%S.png
show_panel=true
paint_mode=arrow
early_exit=true
#! /usr/bin/env bash
##############################################################################################
# _ _ _ _ _ #
# (_) (_) | | | | | | #
# _ __ _ _ __ _ ___ ___ _ __ __ _ | |_ ___ | |__ _ __ __ _ __| | #
#| '_ \ | || '__|| | ______ / __| / __|| '__| / _` || __| / __|| '_ \ | '_ \ / _` | / _` | #
#| | | || || | | ||______|\__ \| (__ | | | (_| || |_ | (__ | | | || |_) || (_| || (_| | #
#|_| |_||_||_| |_| |___/ \___||_| \__,_| \__| \___||_| |_|| .__/ \__,_| \__,_| #
# | | #
@rochacbruno
rochacbruno / README.md
Last active September 24, 2025 16:43
Static Blog Generator in less than 100 lines of Python

Basic

mkdir blog
echo "site_name = 'My Blog'" > blog/config.toml
echo "# Hello World" > blog/2025-01-31-hello-world.md
uv run static.py blog public

Custom template

[
{
"input_combination": [
{
"type": 1,
"code": 58,
"origin_hash": "99614f2eb2dff6628bd5eff9210e538f"
}
],
"target_uinput": "keyboard",
@rochacbruno
rochacbruno / pycon.md
Created September 7, 2025 21:23
Format python console REPL blocks on github markdown code fences
>>> from pprint import pprint as pp
>>> from rich import inspect
>>> import datetime
>>> a = 1
```pycon
>>> from pprint import pprint as pp
@rochacbruno
rochacbruno / .vimrc
Last active September 10, 2025 09:23
Minimal Possible VIM COnfig for Python with AutoComplete, Help, Syntax Check
let mapleader=' '|set nu rnu hid bs=2 ts=4 sw=4 et ai si nocp wmnu tw=79 cc=80 stal=2 cot=menuone,longest,preview ph=10 ruler statusline=%f%m%r%h%w%=%y\ %l,%c\ %p%%
let g:p=executable('uv')?'uv run python3':'python3'|let g:d=g:p.' -m pydoc'|let g:c=g:p.' -m py_compile'
filetype plugin indent on|sy on|nn <leader>b :ls<cr>:b<space>|nn <leader><Tab> <C-^>
au FileType python setl ofu=python3complete#Complete cot=menuone,longest,preview inc=^\s*\(from\|import\) def=^\s*\(def\|class\)|exe 'setl kp='.escape(g:d,' ')|nn <buffer> <leader>k :exe 'vert term ++close '.g:d.' '.expand('<cword>')<CR>|nn <buffer> <leader>r :w<CR>:exe '!'.g:p.' %'<CR>
au BufWritePost *.py silent! exe '!'.g:c.' %'
au CompleteDone * pc
@rochacbruno
rochacbruno / amazing_vimtips.md
Last active September 4, 2025 19:56
Useful vim tips
@rochacbruno
rochacbruno / fuzzyfind.vim
Created September 4, 2025 11:34
Simple Fuzzy Finder for Vim9
vim9script
# simple fuzzy find finder
# place into ~/.vim/plugin/fuzzyfind.vim
set wildmode=noselect:lastused,full
set wildmenu wildoptions=pum,fuzzy pumheight=12
cnoremap <Up> <C-U><Up>
cnoremap <Down> <C-U><Down>
@rochacbruno
rochacbruno / generate_log.py
Created September 2, 2025 17:52
Generate Random Huge 2GB Sample Log for Nginx
#!/usr/bin/env python3
import asyncio
import random
import datetime
import time
import os
from concurrent.futures import ThreadPoolExecutor
# Configuration
BATCH_SIZE = 10000