Skip to content

Instantly share code, notes, and snippets.

View felipekm's full-sized avatar
🦈

Felipe Kautzmann felipekm

🦈
View GitHub Profile
@felipekm
felipekm / felipekm-dracula.zsh-theme
Created March 5, 2025 14:00
felipekm-dracula.zsh-theme
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='%{$fg_bold[cyan]%}▲ %{$fg_bold[yellow]%}%t - %{$fg_bold[blue]%}%c $(git_prompt_info)% %{$reset_color%}'
ZSH_THEME_GIT_PROMPT_CLEAN=") %{$fg_bold[green]%}✔ "
ZSH_THEME_GIT_PROMPT_DIRTY=") %{$fg_bold[red]%}✘ "
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}("
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}
"
@felipekm
felipekm / first-step.sh
Last active February 28, 2025 14:48
NGINX - Complete Script: Automated Log Analysis & Auto-Blocking
#!/bin/bash
# 1️⃣ Adding Execution Permissions & Running as Root
touch setup-fail2ban.sh
chmod +x setup-fail2ban.sh
sudo vim ./setup-fail2ban.sh
@felipekm
felipekm / block_specific_ips.conf
Created February 28, 2025 14:02
NGINX - Enhance security by blocking malicious requests and logging threats.
server {
location /api/ {
deny 192.168.1.100; # Block specific IPs
error_page 403 /403.html;
access_log /var/log/nginx/api.log; # Log all requests
}
}
@felipekm
felipekm / block_bad_bots.conf
Created February 28, 2025 13:57
NGINX - Block bad bots and unwanted scrapers by filtering User-Agents
server {
location /api/ {
if ($http_user_agent ~* (curl|wget|bot|crawler)) {
return 403; # Block known scrapers and bots
}
}
}
@felipekm
felipekm / gist:ae95d0d059ca33402b9abe1a258a3116
Created February 28, 2025 13:53
Caching for Performance - Reduce API load and speed up responses by caching frequent requests
server {
location /api/ {
proxy_cache cache_zone; # Enable caching for responses
proxy_cache_valid 200 10m; # Cache 200 OK responses for 10 min
}
}
@felipekm
felipekm / rate_limiting_connecions.conf
Created February 28, 2025 13:48
NGINX Config for Rate Limiting & Connection Limits nginx Copy Edit
server {
location /api/ {
limit_req zone=req_limit burst=20 nodelay; # Limit to 10 req/sec per IP
limit_conn conn_limit 5; # Max 5 concurrent connections per IP
}
}
@felipekm
felipekm / block_unwanted_ips.conf
Created February 26, 2025 19:00
NGINX Allow/Deny Lists - Restrict API access to specific IPs or countries
server {
location /api/ {
deny 192.168.1.100;
allow 10.0.0.0/8;
deny all;
}
}
@felipekm
felipekm / rate_limiter.conf
Created February 26, 2025 18:47
NGINX rate limiter - Prevent excessive API requests from a single IP or user
http {
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=10r/s;
server {
location /api/ {
limit_req zone=api_limit burst=20 nodelay;
}
}
}
@felipekm
felipekm / launch.json
Created February 1, 2025 18:23
VSCode Nodemon debug launcher
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Nodemon launch",
"runtimeExecutable": "nodemon",
"program": "${workspaceFolder}/src/server.js",
"restart": true,
@felipekm
felipekm / btc-wallet.js
Created June 12, 2024 13:06
BTC wallet creation
const bitcoin = require('bitcoinjs-lib');
const bip39 = require('bip39');
const bip32 = require('bip32');
// Generate a random mnemonic (12 words)
const mnemonic = bip39.generateMnemonic();
console.log('Mnemonic:', mnemonic);
// Generate seed from mnemonic
const seed = bip39.mnemonicToSeedSync(mnemonic);