Skip to content

Instantly share code, notes, and snippets.

View duducp's full-sized avatar

Carlos Eduardo duducp

View GitHub Profile
@duducp
duducp / 0-index.md
Last active December 3, 2025 18:47
GoLang

Guia Rápido de Go

Bem-vindo ao guia prático de Go!
Aqui você encontra resumos e exemplos essenciais para aprender a linguagem Go do zero, com explicações em português e comparações com Python.

Este material é organizado em tópicos curtos e objetivos, ideais para consulta rápida ou estudo inicial.


Conteúdo

@duducp
duducp / setting-up-new-device.md
Last active December 17, 2025 20:46
Ubuntu #ubuntu

Below is a step-by-step guide on how to configure a new device with Ubuntu operating system for development mode.

Initial configuration

  1. Update packages: sudo apt update
  2. Install extra packages:
sudo apt install -y --no-install-recommends \
    build-essential \
    procps \
    curl \
@duducp
duducp / changelist-filter-collapse.md
Last active July 31, 2025 13:58
Django 5 #django

The script below shows how to add the collapse button to the django admin filters.

In the static directory, which is configured in the django settings STATICFILES_DIRS, create the file changelist_filter_collapse.js inside /admin/js. For example, if your STATICFILES_DIRS is mapped to the statics directory, the file would look like this /statics/admin.js/changelist_filter_collapse.js.

// changelist_filter_collapse.js
// The original code for the snippet is here: https://gist.github.com/duducp/0c5b32f7936b924b39c10e5983de1199#file-changelist-filter-collapse-md

// Wait for the DOM to be fully loaded before running the script
document.addEventListener('DOMContentLoaded', function() {
@duducp
duducp / 0-index.md
Last active June 30, 2025 23:19
English

Índice (Index)

  1. Tempos Verbais (Verb Tenses)

Expressions

in order to ("a fim de" ou "para")

É usada para indicar o propósito ou a intenção de uma ação. Geralmente, é seguida por um verbo no infinitivo.

@duducp
duducp / transaction.py
Created October 18, 2024 01:33
Transaction Atomic Django (Sync and Async)
from types import TracebackType
from asgiref.sync import sync_to_async
from django.db.transaction import Atomic as _Atomic
__all__ = ["AtomicAsync", "Atomic"]
class AtomicAsync(_Atomic):
"""
@duducp
duducp / semaphore_python.py
Last active October 13, 2022 17:01
Semáforo em Python
from threading import Semaphore, Thread
from time import sleep
# Número máximo de threads a serem execultadas simultaneamente
control_threads = Semaphore(5)
def view_log(number: int):
with control_threads:
print(f'O número atual é: {number}')