Skip to content

Instantly share code, notes, and snippets.

View m0zgen's full-sized avatar

/:) m0zgen

View GitHub Profile
@m0zgen
m0zgen / .bashrc
Created February 21, 2024 17:07 — forked from vsouza/.bashrc
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@m0zgen
m0zgen / manual-uninstall-parallels.sh
Created November 2, 2023 18:16 — forked from guycalledseven/manual-uninstall-parallels.sh
Manually remove Parallels Desktop v15 leftovers MacOS
# used different forum posts/guides to figure this out like:
# The uninstall script is located at /Library/Parallels/Parallels Service.app/Contents/Resources
# https://github.com/danijeljw/remparallels/blob/master/remprls.sh
# https://kb.parallels.com/122461
# sudo find / -iname "*parallels*"
# sudo find / -iname "*prl*"
#before uninstalling deactivate your licencse - this won't be possible after uninstall
prlsrvctl deactivate-license
@m0zgen
m0zgen / gist:a2b5a430060427fe4fe2eedae54ce26e
Created March 26, 2023 07:31 — forked from anikitenko/gist:b41206a49727b83a530142c76b1cb82d
[Golang] Convert size in bytes to Bytes, Kilobytes, Megabytes, GB and TB
package main
import (
"fmt"
"math"
"strconv"
)
var (
sizeInMB float64 = 999 // This is in megabytes
@m0zgen
m0zgen / main.go
Created March 22, 2023 06:02 — forked from anujsinghwd/main.go
Upload File - golang
package main
import (
"crypto/md5"
"fmt"
"io"
"net/http"
"os"
"strconv"
"text/template"
@m0zgen
m0zgen / upload.go
Created March 22, 2023 06:01 — forked from ebraminio/upload.go
golang upload client and server
// curl -X POST -H "Content-Type: application/octet-stream" --data-binary '@filename' http://127.0.0.1:5050/upload
package main
import (
"fmt"
"io"
"net/http"
"os"
"time"
@m0zgen
m0zgen / walk.go
Created March 14, 2023 15:08 — forked from tdegrunt/walk.go
Replace some text in a bunch of files with golang
package main
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
)
@m0zgen
m0zgen / dnsdist-config.md
Created September 17, 2022 07:12 — forked from zoonderkins/dnsdist-config.md
dnsdist config
-- listen for console connection with the given secret key
-- controlSocket("0.0.0.0")
-- setKey(please generate a fresh private key with makeKey())

-- start the web server on port 8083, using password 'set a random password here'
-- webserver("0.0.0.0:8083", "set a random password here")

-- accept DNS queries on UDP/5200 and TCP/5200
@m0zgen
m0zgen / centos8-9.sh
Created August 30, 2022 07:21 — forked from yodermk/centos8-9.sh
Commands to live-upgrade CentOS Streams 8 -> 9
# The general procedure here is adapted from the 7->8 guide here. https://www.tecmint.com/upgrade-centos-7-to-centos-8/
#
# It is a curated list of my bash history. I entered other commands so hopefully I got the right ones here.
yum upgrade
reboot
dnf install epel-release
dnf install rpmconf
dnf install yum-utils
rpmconf -a # answer "n" to both things
@m0zgen
m0zgen / nginx.conf
Created July 25, 2022 07:47 — forked from phamquocbuu/nginx.conf
NGINX Proxy with Geo module
# https://serverfault.com/questions/545441/nginx-geo-location-module-configuration-using-geo-database
# http://nginx.org/en/docs/http/ngx_http_geo_module.html#directives
# https://www.howtoforge.com/nginx-how-to-block-visitors-by-country-with-the-geoip-module-debian-ubuntu
# https://dev.maxmind.com/geoip/legacy/geolite/
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $backend {
default US;
US US;
CN DE;
@m0zgen
m0zgen / kresd-config.lua
Created June 20, 2022 11:34 — forked from catap/kresd-config.lua
An example configuration to random selection between Quad9, Cloudflare and Google DNS-over-TLS for knot-resolver (kresd)
require 'math'
math.randomseed(os.time())
dns_providers = {
{ -- Quad9
{'9.9.9.9', hostname='dns.quad9.net', ca_file='/usr/local/etc/kresd/DigiCertECCSecureServerCA.pem'},
{'149.112.112.112', hostname='dns.quad9.net', ca_file='/usr/local/etc/kresd/DigiCertECCSecureServerCA.pem'}
},
{ -- Cloudflare
{'1.1.1.1', hostname='cloudflare-dns.com', ca_file='/usr/local/etc/kresd/DigiCertECCSecureServerCA.pem'},