Skip to content

Instantly share code, notes, and snippets.

@warlock
warlock / aws_mailer.go
Created January 29, 2024 17:47
AWS Mailer Go Example
package mailer
import (
"bytes"
"fmt"
"log"
"os"
"text/template"
"github.com/aws/aws-sdk-go/aws"
@warlock
warlock / golang-exit-signals.go
Last active December 20, 2022 13:25
golang-exit-signals.go
func handleExit(
sigs <-chan os.Signal,
cancelFunc context.CancelFunc,
logger log.Logger,
shutDownManager synched_shutdown.WorkManager,
) {
sig := <-sigs
logger.WithFields(log.Fields{"type": serviceName, "subtype": "shutdown"}).
Infof("received signal %s", sig.String())
cancelFunc()
@warlock
warlock / solana-network.text
Created November 27, 2021 00:16
solana-network.text
~$ solana config get
Config File: /Users/josep/.config/solana/cli/config.yml
RPC URL: https://api.mainnet-beta.solana.com
WebSocket URL: wss://api.mainnet-beta.solana.com/ (computed)
Keypair Path: /Users/josep/.config/solana/id.json
Commitment: confirmed
~$ solana config set --url https://api.devnet.solana.com
Config File: /Users/josep/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
@warlock
warlock / gestio-errors.go
Last active December 20, 2022 13:23
Gestió d'errors Go
var codeErr pq.Error
if errors.As(err, &codeErr) {
if codeErr.Code == "unique_violation" {
handleError(w, http.StatusInternalServerError, errors.New("order exists"))
return
}
}
@warlock
warlock / docker-compose.yaml
Last active December 20, 2022 13:27
Traefik 2.3 Reverse Proxy in docker-compose
version: "3.3"
services:
traefik:
image: "traefik:v2.3"
container_name: "traefik"
command:
#- "--log.level=DEBUG"
- "--api.insecure=true"
@warlock
warlock / delete_git_submodule.md
Created July 13, 2021 06:15 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@warlock
warlock / systemctl.md
Last active December 20, 2022 13:29
Apunts de systemctl loginctl journalctl
loginctl list-users
loginctl user-status nom_del_usuari
loginctl show-user nom_del_usuari
loginctl terminate-user nom_del_usuari
loginctl kill-user nom_del_usuari
systemctl is-enabled mariadb.service
@warlock
warlock / iwl11n.conf
Last active January 11, 2021 07:32
Realtek Wifi Driver Solver (VANT DOMO4)
# /etc/modprobe.d/iwl11n.conf
options iwlwifi 11n_disable=8
@warlock
warlock / haproxy-config-2-0.cfg
Created December 2, 2020 10:16 — forked from haproxytechblog/haproxy-config-2-0.cfg
HAProxy 2.0 configuration
#
# This is the ultimate HAProxy 2.0 "Getting Started" config
# It demonstrates many of the features available which are now available
# While you may not need all of these things, this can serve
# as a reference for your own configurations.
#
# Have questions? Check out our community Slack:
# https://slack.haproxy.org/
#
@warlock
warlock / prometheus-operator-kubernetes.yaml
Created December 1, 2020 14:18 — forked from christophlehmann/prometheus-operator-kubernetes.yaml
Example: Monitoring external server with Prometheus Operator
# First install prometheus-operator:
#
# helm install coreos/prometheus-operator --name prometheus-operator
#
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: node-exporter
# Namespace of prometheus operator