Skip to content

Instantly share code, notes, and snippets.

View maxwellamaral's full-sized avatar
😀

Maxwell Anderson maxwellamaral

😀
View GitHub Profile
@maxwellamaral
maxwellamaral / anunciar-porta-aberta.yaml
Created December 29, 2023 09:58
Blueprint do Home Assistant para anunciar a porta aberta
# Anuncia a porta aberta
# Referência https://community.home-assistant.io/t/door-open-tts-announcer/266252
blueprint:
name: Door open TTS announcer
domain: automation
input:
door_entity:
name: Door Sensor
description: Entity that causes announcement
selector:
@maxwellamaral
maxwellamaral / obsidian-callouts.css
Created October 29, 2023 14:09
Obsidian CSS callouts imported from Zotero (plugin ZotLit)
/* Settings for all callouts / admonitions: */
/* Attention --> Nota (amarelo) */
.callout[data-callout="attention"] {
/* same name as in callout to be changed */
--callout-color: 0, 0, 0;
/* rgb only */
--callout-icon: "lucide-sticky-note";
/* Use lucide- plus icon name from https://lucide.dev */
background-color: #fdff85;
@maxwellamaral
maxwellamaral / getJD.py
Created October 6, 2023 17:00
Código parta listar pastas e subpastas de um sistema construiído em Johnny Decimal
import os
import sys
from datetime import datetime
import shutil
PASTA_PADRAO = "./00-09 Meta/00 Indice/00.02 Estrutura"
def listar_pastas(diretorio, profundidade=0, nivel_max=3):
# Função para listar pastas e subpastas até um nível máximo
@maxwellamaral
maxwellamaral / raindrop_obsidian_plugin_header.js
Created October 1, 2023 12:18
Template para o plugin Raindrop do Obsidian
{% if link %}link: {{link}}{% endif %}
{% if tags|lenght %}tags: {%for tag in tags %}
- {{tag}}{% endfor %}{% endif %}
{% if cover %}banner: {{cover}}{% endif %}
@maxwellamaral
maxwellamaral / profile.ps1
Last active September 19, 2023 17:47
Alterar diretório no sistema Johnny Decimal no Powershell | Change directory on Johnny Decimal system on Powershell
function cdj {
param (
[string]$folderName
)
# Atualize com a pasta raiz dos seus documentos
$rootPath = "D:\Cloud\OneDrive"
# Lista de diretórios correspondentes ao padrão
$matchingDirs = Get-ChildItem -Path $rootPath -Directory -Recurse | Where-Object { $_.Name -like "*$folderName*" }
@maxwellamaral
maxwellamaral / fortune.vim
Created December 15, 2022 21:59
Fortune (ou "biscoito da sorte") em português do Brasil
scriptencoding utf-8
" Function: s:get_random_offset {{{1
function! s:get_random_offset(max) abort
return str2nr(matchstr(reltimestr(reltime()), '\.\zs\d\+')[1:]) % a:max
endfunction
" Function: s:draw_box {{{1
function! s:draw_box(lines) abort
let longest_line = max(map(copy(a:lines), 'strwidth(v:val)'))
@maxwellamaral
maxwellamaral / multi.py
Created November 16, 2022 12:32
Exemplo de multiprocessamento
import multiprocessing
import time
from multiprocessing import Pool, freeze_support
MAX_ITER = 9999999
def f1(a):
c = 0
for i in range(0, MAX_ITER):
c += 1
@maxwellamaral
maxwellamaral / README.md
Last active October 6, 2022 12:46 — forked from crissilvaeng/README.md
Padrão e mensagens de commit.

Styleguides

Mensagens de commit styleguide

  • Usar modo imperativo ("Adiciona feature" não "Adicionando feature" ou "Adicionada feature")
  • Primeira linha deve ter no máximo 72 caracteres
  • Considere descrever com detalhes no corpo do commit
  • Considere usar um emoji no início da mensagem de commit

Emoji | Code | Commit Type

@maxwellamaral
maxwellamaral / test_initial.py
Last active October 4, 2022 17:50
Lidando com o time.sleep() vodu em testes
def wait_for_site_page_title(self, page_title: str, MAX_WAIT=10):
"""
Função que lida com o time.sleep() em testes. Sabe-se que a sleep() não funciona para esperas explícitas utilizando Selenium
"""
if not page_title:
raise Exception('No title')
start_time = time.time()
while True:
try:
title = self.browser.title
@maxwellamaral
maxwellamaral / admin.py
Created September 6, 2022 12:41 — forked from maxwellcc/admin.py
Para retirar o botão 'Novo' do Django Admin
@admin.register(NotificationType)
class NotificationTypeAdmin(admin.ModelAdmin):
model = NotificationType
(...)
def has_add_permission(self, request, obj=None):
return False