Skip to content

Instantly share code, notes, and snippets.

View Juan-Severiano's full-sized avatar

Francisco Juan Juan-Severiano

View GitHub Profile
@Juan-Severiano
Juan-Severiano / rn-specific.sh
Created January 27, 2026 12:03
Creating a new project with React Native with a specific version, ex: 0.82
# npx @react-native-community/cli@latest init <NOME_DO_PROJETO> --version <VERSAO>
npx @react-native-community/cli@latest init LottieFilesTest --version 0.82.0
#!/bin/bash
# Author: Francisco Juan
# Converte dump MySQL para PostgreSQL e importa
# Remove migrações do Prisma e CREATE TABLE, mantém apenas INSERTs
DUMP_FILE="${1:-dump.sql}"
OUTPUT_FILE="dump_postgres_fixed.sql"
DB_URL="${DATABASE_URL:-postgresql://user:pass@host:port?sslmode=require}"
if [ ! -f "$DUMP_FILE" ]; then
import { env } from "@/config/env";
const DEFAULT_HEADERS: Record<string, string> = {
Accept: "application/json",
};
export type HttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
export type QueryParams = Record<
string,
api.interceptors.response.use(
(res) => res,
async (error) => {
if (error.response?.status === 401) {
// Aqui pode-se implementar algo para fazer quando der um erro 401 (ou qualquer outro)
// Ex. pode chamar uma rota de revalidação de token, ou simplesmente deslogar o user
}
return Promise.reject(error)
},
)
import axios from "axios"
const logRequest = (config: any) => {
const isDev = true
if (isDev) {
console.group(`🚀 ${config.method?.toUpperCase()} ${config.url}`)
console.log("URL:", `${config.baseURL}${config.url}`)
console.log("Headers:", config.headers)
if (config.data) console.log("Data:", config.data)
#!/bin/bash
SIZE_OF_SWAP="$1" # 1G 2G
echo "=== Alocando $SIZE_OF_SWAP no swapfile ==="
sudo fallocate -l "$SIZE_OF_SWAP" /swapfile
# Listar se foi realmente alocado
ls -lh /swapfile
#!/bin/bash
set -e
echo "=== Atualizando pacotes ==="
sudo apt update && sudo apt upgrade -y
echo "=== Instalando dependências ==="
sudo apt install -y curl software-properties-common
echo "=== Instalando unzip ==="
import socketio
import unicodedata
from pathlib import Path
PRINTER_PATH = "/dev/usb/lp0"
sio = socketio.Server(cors_allowed_origins='*')
app = socketio.WSGIApp(sio)
def remove_accents(text):
name: Discord Notifications
on:
issues:
types: [opened, closed, labeled, reopened]
pull_request:
types: [opened, closed, merged, reopened]
push:
jobs:
notify-discord:
import serial
import time
# Configura a porta serial
ser = serial.Serial(
port='/dev/ttyS4', # <-- muda se necessário
baudrate=9600, # padrão da Elgin I9
bytesize=8,
parity='N',
stopbits=1,