Skip to content

Instantly share code, notes, and snippets.

View oddmario's full-sized avatar

Mario oddmario

View GitHub Profile
@dronezzzko
dronezzzko / mysql-mariadb-tuning-and-optimization-for-best-performance.md
Last active September 22, 2024 01:48
MySQL/MariaDB Tuning And Optimization For Best Performance

MySQL/MariaDB Tuning And Optimization For Best Performance

OS Level Optimization

Swappiness

sysctl -w vm.swappiness=1
echo "vm.swappiness = 1" | sudo tee -a /etc/sysctl.conf

noatime

@andrewloable
andrewloable / Program.cs
Created June 23, 2019 05:48
Use a library compiled in Go in c# (.net)
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace GoSharedDLL
{
class Program
{
[DllImport("shared.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)]
private static extern IntPtr ReturnReversedString(byte[] input);
@sevkin
sevkin / getfreeport.go
Last active August 11, 2025 22:49
get free port in golang
// GetFreePort asks the kernel for a free open port that is ready to use.
func GetFreePort() (port int, err error) {
var a *net.TCPAddr
if a, err = net.ResolveTCPAddr("tcp", "localhost:0"); err == nil {
var l *net.TCPListener
if l, err = net.ListenTCP("tcp", a); err == nil {
defer l.Close()
return l.Addr().(*net.TCPAddr).Port, nil
}
}
@2minchul
2minchul / main.go
Created April 16, 2019 05:55
golang http client using specific network adapter
package main
import (
"context"
"fmt"
"io/ioutil"
"net"
"net/http"
)
@mohanpedala
mohanpedala / nginx_performance_tuning.md
Last active February 28, 2025 02:16
NGINX Performance tuning

NGINX Performance Tuning

Content Compressions and Decompression

  • Documentation
    • NGINX http_gzip module
    • NGINX http_gunzip module
  • Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
  • But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
    $ vim /etc/nginx/nginx.conf
@bmaupin
bmaupin / free-database-hosting.md
Last active August 10, 2025 01:30
Free database hosting
'use strict';
const puppeteer = require('puppeteer');
(async () => {
/* PRECONDITION:
0. download ublock, I used https://github.com/gorhill/uBlock/releases/download/1.14.19b5/uBlock0.chromium.zip
1. run $PATH_TO_CHROME --user-data-dir=/some/empty/directory --load-extension=/location/of/ublock
2. enable block lists you want to use
*/
@monsterbrain
monsterbrain / iframe_to_image_conversion_javascript_js_html5.html
Created February 7, 2019 05:05
iframe is not supported by html2canvas. to convert iframe to image / base64, using iframe2image and html2canvas to save that image data.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Canvas to Image Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="main.css" />
<script src="html2canvas.js"></script>
@slayer
slayer / cloudflare-delete-all-records.sh
Last active January 30, 2025 11:44
Delete all DNS records for specified zone
#!/bin/bash
TOKEN="xxxxxxxxxxxxxxxxxxx"
ZONE_ID=2222222222222222222222222
# [email protected]
# KEY=11111111111111111111111111
# Replace with
# -H "X-Auth-Email: ${EMAIL}" \
# -H "X-Auth-Key: ${KEY}" \
@chrisswanda
chrisswanda / WireGuard_Setup.txt
Last active August 12, 2025 06:59
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be