Skip to content

Instantly share code, notes, and snippets.

View Skarlso's full-sized avatar
🚫
At KubeCon Utah

Gergely Brautigam Skarlso

🚫
At KubeCon Utah
View GitHub Profile
@rkibria
rkibria / gospinningcube.go
Last active May 3, 2023 09:40
Generate a .gif showing a spinning 3d wireframe cube with hidden lines in Golang
package main
import (
"fmt"
"image"
"image/color"
"image/gif"
"math"
"os"
)
@Skarlso
Skarlso / main.go
Created February 16, 2019 21:31
Golang SSH connection with hostkey verification
package main
import (
"bytes"
"fmt"
"io/ioutil"
"log"
"golang.org/x/crypto/ssh"
kh "golang.org/x/crypto/ssh/knownhosts"
// Single-Click Version:
// 1. Create a bookmark with:
javascript:document.body.addEventListener("click",function(t){for(var e=window.getSelection(),n=e.getRangeAt(0),o=e.anchorNode;0!=n.toString().indexOf(" ");)n.setStart(o,n.startOffset-1);n.setStart(o,n.startOffset+1);do{n.setEnd(o,n.endOffset+1)}while(-1==n.toString().indexOf(" ")&&""!=n.toString().trim()&&n.endOffset<o.length);n.toString().trim();e.focusNode.nodeValue=e.focusNode.nodeValue.replace(n.toString().trim(),"***")});
// 2. Place your bookmark on your bookmarks bar
// 3. Push the button when you want to censor your name / anything else
// 4. Click on the word you want to hide
// Double-Click Version:
javascript:document.body.addEventListener("dblclick",function(t){for(var e=window.getSelection(),n=e.getRangeAt(0),o=e.anchorNode;0!=n.toString().indexOf(" ");)n.setStart(o,n.startOffset-1);n.setStart(o,n.startOffset+1);do{n.setEnd(o,n.endOffset+1)}while(-1==n.toString().indexOf(" ")&&""!=n.toString().trim()&&n.endOffset<o.length);n.toString().trim
@bgadrian
bgadrian / set.go
Last active October 18, 2024 06:13
How to implement a simple set data structure in golang
type Set struct {
list map[int]struct{} //empty structs occupy 0 memory
}
func (s *Set) Has(v int) bool {
_, ok := s.list[v]
return ok
}
@enricofoltran
enricofoltran / main.go
Last active October 3, 2024 14:08
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@leonardofed
leonardofed / README.md
Last active November 14, 2024 13:37
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


@bmhatfield
bmhatfield / .profile
Last active November 14, 2024 12:11
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@thisismitch
thisismitch / haproxy.cfg
Last active October 18, 2024 15:19
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
Tmux is a "terminal multiplexer", it enables a number of terminals to be accessed and controlled from a single terminal.
If you use Debian/Ubuntu, you can just run apt-get install tmux, and voila.
Since the title was about centos 7, then do the following step to install tmux.
(1). tmux has a library dependency on libevent which, of course, isn’t installed by default.
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzvf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure && make
@yitsushi
yitsushi / Makefile
Last active April 15, 2016 11:44
Epic Makefile for Go. (make help for more info)
all: cover build
coverFile := $(shell mktemp -u -t cover.out.XXXXXX)
projectName := $(shell basename `pwd`)
hasGocov := #$(shell which gocov)
packages := $(shell go list ./...)
ifndef OUTPUT
OUTPUT = "text"
endif