Skip to content

Instantly share code, notes, and snippets.

View achetronic's full-sized avatar
🧙‍♂️
Crafting arcane magic

Alby Hernández achetronic

🧙‍♂️
Crafting arcane magic
View GitHub Profile
@vmihailenco
vmihailenco / proxy.go
Created November 20, 2011 15:22
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"
@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"
)
@jbardin
jbardin / proxy_copy.go
Last active April 27, 2025 20:47
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
@soroushjp
soroushjp / deepcopy.go
Last active June 14, 2025 11:49
Golang: deepcopy map[string]interface{}. Could be used for any other Go type with minor modifications.
// Package deepcopy provides a function for deep copying map[string]interface{}
// values. Inspired by the StackOverflow answer at:
// http://stackoverflow.com/a/28579297/1366283
//
// Uses the golang.org/pkg/encoding/gob package to do this and therefore has the
// same caveats.
// See: https://blog.golang.org/gobs-of-data
// See: https://golang.org/pkg/encoding/gob/
package deepcopy
@asukakenji
asukakenji / 0-go-os-arch.md
Last active June 27, 2025 12:52
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
@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) {
@mohamedadaly
mohamedadaly / bw_export_kp.py
Last active June 17, 2025 09:24
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
@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"
@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:

@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