Skip to content

Instantly share code, notes, and snippets.

View m0zgen's full-sized avatar

/:) m0zgen

View GitHub Profile
@m0zgen
m0zgen / macps_stop_mds_stores.txt
Created December 6, 2024 16:07
fix mds_stores high CPU
If the Spotlight is indexing data on your Mac, the mds and mds_stores will cost a relatively high CPU at that duration
1. Turning off indexing on all drives: `sudo mdutil -a -i off`
2. Stop `mds` service: `sudo launchctl stop /System/Library/LaunchDaemons/com.apple.metadata.mds.plist`
## Additional steps:
- Use [Raycast](https://www.raycast.com/)
- Disable Spotlight hotkey: System Preferences > Keyboard > Keyboard Shortcuts… > Spotlight > Uncheck “Show Spotlight search”
# Get the latest version of pushgateway from prometheus.io, then download and extract:
$ wget https://github.com/prometheus/pushgateway/releases/download/v0.8.0/pushgateway-0.8.0.linux-amd64.tar.gz
$ tar -xvf pushgateway-0.8.0.linux-amd64.tar.gz
# Create the pushgateway user:
$ useradd --no-create-home --shell /bin/false pushgateway
# Move the binary in place and update the permissions to the user that we created:
$ cp pushgateway-0.8.0.linux-amd64/pushgateway /usr/local/bin/pushgateway
$ chown pushgateway:pushgateway /usr/local/bin/pushgateway
# Reference: https://superuser.com/questions/513159/how-to-remove-systemd-services
systemctl stop [servicename]
systemctl disable [servicename]
rm /etc/systemd/system/[servicename]
rm /etc/systemd/system/[servicename] # and symlinks that might be related
rm /usr/lib/systemd/system/[servicename]
rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related
systemctl daemon-reload
systemctl reset-failed
@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