Skip to content

Instantly share code, notes, and snippets.

View oddmario's full-sized avatar

Mario oddmario

View GitHub Profile
@nitred
nitred / optimal_mtu.md
Last active August 12, 2025 01:52
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@Integralist
Integralist / README.md
Last active July 7, 2025 15:07
Go: timeouts and custom http client #go #http #dns

Server Timeouts
Go Server Timeouts

Tip

Use context.WithTimeout when you need to enforce timeouts on internal operations like database queries or HTTP calls, especially when you want to propagate cancellation signals through the call stack to prevent resource leaks or manage goroutines. It's ideal for fine-grained control within a handler. In contrast, use http.TimeoutHandler when you want a simple way to enforce a timeout on the entire HTTP handler response, particularly when you don’t control the handler logic or don’t need to cancel ongoing work—it only cuts off the response after the timeout but doesn’t stop the underlying processing.

Warning

Be careful when using http.TimeoutHander. If automatically applied to all handlers (as part of a middleware pipeline) then it will not work when it comes to a streaming endpoint (see the relevant Cloudflare article linked in the NOTE below).

**Client Ti

@andrekutianski
andrekutianski / all-in-one-mail-servers-list.md
Last active July 25, 2025 01:54
All-In-One Mail Servers List

Português

Uma lista com os servidores e serviços de e-mail tudo-em-um que encontrei e parecem ser promissores para uso em ambientes reais e em produção.

Porque esta lista existe?

Esta lista vem da necessidade de compilar os serviços que podem ou poderiam ser utilizados de forma viável em um cenário real, seja para hospedar suas próprias caixas de e-mail de forma não centralizada e a baixo custo ou seja para fornecer elas como serviço, agregando em provedores de hospedagem entre outros.

Ela também vem de encontro com minha busca por boas ferramentas para gerir um servidor de e-mail além das tradicionais e monoliticas soluções como Zimbra ou cPanel por exemplo, pois estou cansado de depender de provedores tradicionais e suas limitações e também a serviços que dependam de anos de conhecimento e experiência como SysAdmin para poder gerir.

@paintmeyellow
paintmeyellow / gist:913fd91150f6259cd9cee70712bb1e15
Last active July 16, 2024 12:05
AES-128-GSM Cipher Golang+PHP
<?php
function handle(): void
{
$method = 'AES-128-GCM';
$msg = 'message';
$pass = 'password';
$tagLength = 16;
$key = hash('md5', $pass, true);
@Integralist
Integralist / 1. README.md
Last active May 30, 2025 08:35
Go: remove line from file #go

We had a bug where a line [manifest_version] was being added by accident.

Cloudflare doesn't allow disabling IPv6 via their Dashboard any more. This works:

curl -X PATCH "https://api.cloudflare.com/client/v4/zones/<zone-id>/settings/ipv6" \
  -H "X-Auth-Email: <email>" \
  -H "X-Auth-Key: <auth-key>" \
  -H "Content-Type: application/json" \

--data '{"value":"off"}'

@fschiettecatte
fschiettecatte / HighTrafficServerSettings.md
Last active October 30, 2024 09:05
High Traffic Server Settings on RHEL / AlmaLinux / Rocky / EuroLinux / CentOS 8

High Traffic Server Settings on RHEL / AlmaLinux / Rocky / EuroLinux / CentOS 8

I recently did some work to optimize the network configuration of an AlmaLinux 8 based web server that receives a lot of traffic.

Of course these settings also apply to RHEL / Rocky / EuroLinux / CentOS 8 (hereafter referred to as Linux 8.) I think these should also work on RHEL / AlmaLinux / Rocky / EuroLinux 9 as well but I have not yet tested them.

There is a lot of information on the web for this and it distills down to a minimum recommended configuration, and a recommended configuration.

The minimum recommended configuration should be sufficient for servers with less than 10Gb, and the recommended configuration should be sufficient for servers with 10Gb or more.

@evansims
evansims / decrypt.php
Last active October 3, 2024 11:19
AES-256-GCM w/ PHP 7.1+ OpenSSL
<?php
public function decrypt($secret, $data)
{
$secret = hex2bin($secret);
$iv = base64_decode(substr($data, 0, 16), true);
$data = base64_decode(substr($data, 16), true);
$tag = substr($data, strlen($data) - 16);
$data = substr($data, 0, strlen($data) - 16);
try {
<?php
# credentials
$url = VPC_URL; // https://migs.mastercard.co.in/vpcpay or https://migs.mastercard.com/vpcpay
$merchantId = MERCHANT_ID; //value get from your bank
$accessCode = ACCESS_CODE; //value get from your bank
$SECURE_SECRET = SECURE_SECRET; //value get from your bank
$baseURL = "localhost/migs";
# amount
@MelchiSalins
MelchiSalins / http-rate-limit.go
Last active February 17, 2025 19:24
GoLang HTTP Client with Rate Limiting
package main
import (
"context"
"fmt"
"net/http"
"time"
"golang.org/x/time/rate"
)