Skip to content

Instantly share code, notes, and snippets.

View achetronic's full-sized avatar
💭
From bad practises always to the best ones

Alby Hernández achetronic

💭
From bad practises always to the best ones
View GitHub Profile
@smartameer
smartameer / prepare-commit-msg
Created July 6, 2021 19:35
Git coauthor hook for pre-commit message
#!/bin/bash
function prompt_for_multiselect {
# little helpers for terminal print control and key input
GREEN='\033[00;32m'
YELLOW='\033[00;33m'
RESTORE='\033[0m'
ESC=$( printf "\033")
cursor_blink_on() { printf "$ESC[?25h"; }
@stormcat24
stormcat24 / irsa.go
Last active June 8, 2023 15:06
How to build a configuration to enable IAM roles for service accounts (IRSA)
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
)
func buildConfig() {
@lenalebt
lenalebt / DefaultKeyBinding.dict
Created December 18, 2019 06:59
How to use a typical Linux / Windows Keybindung on MacOS (tested with 10.15.2 Catalina)
/*
PUT THIS FILE IN ~/Library/KeyBindings/DefaultKeyBinding.dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more closely
match default behavior on Windows systems. This particular mapping assumes
that you have also switched the Control and Command keys already.
This key mapping is more appropriate after switching Ctrl for Command in this menu:
Apple->System Preferences->Keyboard & Mouse->Keyboard->Modifier Keys...->
Change Control Key to Command
Change Command key to Control
@bzz
bzz / docker-rm-images.md
Created March 1, 2019 17:15 — forked from alferov/docker-rm-images.md
Remove all (untagged) images and containers from Docker
# Delete all containers
docker rm $(docker ps -aq)
# Delete all images
docker rmi $(docker images -q)
# Delete all untagged images
docker rmi $(docker images -q --filter "dangling=true")

References:

@katallaxie
katallaxie / main.go
Last active May 7, 2023 04:56
Server in Go with multiple listeners and signals.
package server
import (
"context"
"os"
"os/signal"
"syscall"
"time"
"golang.org/x/sync/errgroup"
@mohamedadaly
mohamedadaly / bw_export_kp.py
Last active April 14, 2024 03:57
Export Bitwarden to KeePass 2 XML format
#!/usr/bin/python
from __future__ import print_function
import base64
import commands
import json
import sys
import uuid
import xmltodict
@lamarmarshall
lamarmarshall / callback.go
Created October 25, 2017 04:56
go callback, function as argument
package main
import "fmt"
func addName(name string, callback func(string)) {
callback(name)
}
func main() {
addName("lamar", func(nm string) {
@asukakenji
asukakenji / 0-go-os-arch.md
Last active July 18, 2024 06:42
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@jbardin
jbardin / proxy_copy.go
Last active June 28, 2023 22:12
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@daniel-garcia
daniel-garcia / simple_ssh_server.go
Created September 14, 2012 04:28
simple ssh server
package main
import (
"fmt"
"io/ioutil"
"code.google.com/p/go.crypto/ssh"
"code.google.com/p/go.crypto/ssh/terminal"
)