Skip to content

Instantly share code, notes, and snippets.

View hitalos's full-sized avatar

Hítalo Silva hitalos

  • Maceió, Alagoas, Brasil
View GitHub Profile
@hitalos
hitalos / ANSI-escape-sequences.md
Created September 3, 2025 19:16 — forked from ConnerWill/ANSI-escape-sequences.md
ANSI Escape Sequences cheatsheet

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@hitalos
hitalos / main.go
Last active September 3, 2025 19:01
Golang progress bar
package main
import (
"fmt"
"os"
"strings"
"time"
"golang.org/x/term"
)
@hitalos
hitalos / go.mod
Last active November 6, 2024 17:53
Get system info from linux files
module sysfetch
go 1.23.2
@hitalos
hitalos / golangUpdate.sh
Last active December 15, 2023 05:58
Update Golang to latest version
#!/bin/bash
source <(go env)
INFO=$(curl -sf 'https://go.dev/dl/?mode=json')
[[ "$?" -ne "0" ]] && echo "Error getting latest info" && exit 1
FILEHASH=$(jq -r ".[0].files[] | select(.arch==\"$GOARCH\" and .os==\"$GOOS\") | \"\(.sha256) \(.filename)\"" <<< "$INFO")
FILENAME=${FILEHASH#* }
@hitalos
hitalos / main.go
Last active January 5, 2023 01:28
ASCII table
package main
import (
"fmt"
)
const (
numCols = 4
height = 32
width = 20
@hitalos
hitalos / cities.sql
Created April 22, 2021 19:23
Create migrations for Brazilian states and cities
CREATE TABLE IF NOT EXISTS cities (
id INTEGER PRIMARY KEY,
name VARCHAR,
uf_id INTEGER REFERENCES ufs (id) ON UPDATE RESTRICT ON DELETE RESTRICT,
CONSTRAINT cities_name_uf_id_key UNIQUE (name, uf_id)
);
---- create above / drop below ----
DROP TABLE IF EXISTS cities;
@hitalos
hitalos / Config para vscode
Created September 30, 2019 04:18
Debugando aplicações desenvolvidas em go, sendo executadas no docker com o vscode
{
"name": "attach",
"type": "go",
"request": "attach",
"mode": "remote",
"remotePath": "/app",
"port": 2345,
"host": "localhost"
}
@hitalos
hitalos / 1_create_tables.down.sql
Last active January 31, 2019 16:07
Exemplo de uso da função `StructScan` do pacote sqlx
DROP TABLE IF EXISTS items;
DROP TABLE IF EXISTS categories;
DROP TABLE IF EXISTS menus;
@hitalos
hitalos / expressOptimized.js
Created November 27, 2017 04:31
Exemplo de aplicação web usando templates carregados na memória e arquivos estáticos
const express = require('express')
const pug = require('pug')
const app = express()
const index = pug.compileFile('views/index.pug')
app.get('/', (req, res) => {
res.send(index({ title: 'Express' }))
})
@hitalos
hitalos / express.js
Created November 27, 2017 04:29
Exemplo de aplicação web usando templates e arquivos estáticos
const express = require('express')
const app = express()
app.set('view engine', 'pug')
app.get('/', (req, res) => {
res.render('index', { title: 'Express' })
})