Skip to content

Instantly share code, notes, and snippets.

View terremoth's full-sized avatar
🌄
Open to work. #HireMe #OpenToWork

Lucas M. Dutra terremoth

🌄
Open to work. #HireMe #OpenToWork
View GitHub Profile
@terremoth
terremoth / post.md
Created September 9, 2025 23:32 — forked from vinicius73/post.md
["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

#["LÓGICA DE PROGRAMAÇÃO" É BOBAGEM, e explicarei porquê.]

Se preparem que o texto é longo.

Várias vezes chegam novatos aqui perguntando como começar, e a galera diz "estuda lógica primeiro, depois vai pra linguagem X". Vivo dizendo que é bobagem. Ontem, em particular, falei isso, e vieram várias pessoas por inbox me perguntar porquê (e uma pra me xingar, achando que falei por arrogância).

Pra facilitar, eu vou escrever uma boa explicação de porquê "lógica de programação" é furada, doa a quem doer, e postar na APDA e no fórum da EnergyLabs (para futuras referências, porque esse assunto vai voltar, ctz).

@terremoth
terremoth / hello.s
Created August 7, 2025 05:50
Hello World in assembly x64 using AT&T syntax
.section .data
msg:
.asciz "Hello, World!\n"
.section .text
.global main
main:
mov $1, %rax
mov $1, %rdi
@terremoth
terremoth / child.html
Last active May 11, 2025 16:35
Father - child html page communication with JavaScript postMessage
<!DOCTYPE html>
<html>
<head>
<title>Child Window</title>
<meta charset="utf-8">
</head>
<body>
<h2>Child</h2>
<input type="text" id="valueToSend" placeholder="Enter something..." />
<button onclick="sendMessage()">Send to Parent</button>
@terremoth
terremoth / versiculo.py
Last active May 6, 2025 09:13
Pega um versículo aleatório da Bíblia (em PT-BR) e printa no terminal
from requests import get
MAIN_URL = "https://onbibles.com/api/verses/random?bibleSlug=acf"
HEADERS = ({
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.2403.157 '
'Safari/537.36', 'Accept-Language': 'pt-BR, en;q=0.5'})
page = get(MAIN_URL, headers=HEADERS)
@terremoth
terremoth / gui-example.c
Last active April 15, 2025 12:32
Simple input and button with pure C + Win32 API
#include <windows.h>
#define ID_EDITBOX 1001
#define ID_BUTTON_OK 1002
void DrawCustomButton(LPDRAWITEMSTRUCT lpDrawItem) {
COLORREF bgColor = RGB(255, 165, 0); // orange
COLORREF textColor = RGB(128, 128, 128); // grey
@terremoth
terremoth / fibonacci.xsl
Last active January 11, 2025 17:48
XSLT + XML are turing complete
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Fibonacci Sequence</title>
</head>
<body>
<h1>Fibonacci Sequence</h1>
@terremoth
terremoth / CollectionPaginate.php
Created January 3, 2025 11:59
Laravel Collection Pagination
<?php
namespace App\Resources;
use Illuminate\Container\Container;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Collection;
class CollectionHelper
@terremoth
terremoth / helpers.php
Created January 3, 2025 11:56
Some useful PHP helper functions
<?php
// Don't just COPY everything to your codebase without looking the need of these functions.
// Helpers functions can be a cancer if you don't have any idea where to put and why.
const DS = DIRECTORY_SEPARATOR;
function echoln($str) {
echo $str . PHP_EOL;
}
@terremoth
terremoth / reconfigure-php-ini.sh
Created January 3, 2025 11:38
Script to reconfigure and increase PHP.ini settings (FPM)
#!/usr/bin/env sh
# The FPM ini file, and not the CLI one
ini_file=$(php -i | grep "Loaded Configuration File" | awk -F ' => ' '{print $2}' | sed 's/cli/fpm/g')
echo $ini_file
sudo sed -i 's/memory_limit\s*=.*/memory_limit = 256M/g' $ini_file
cat $ini_file | grep memory_limit
sudo sed -i 's/upload_max_filesize\s*=.*/upload_max_filesize = 3G/g' $ini_file
@terremoth
terremoth / versions.sh
Created January 3, 2025 11:36
web development tools versions for diagnosis
#!/bin/sh
uname -a;
lsb_release -a;
php --version;
mysql --version;
composer --version;
echo nodejs $(node --version);
echo npm $(npm --version);
openssl version;
ssh -V;