Skip to content

Instantly share code, notes, and snippets.

View michaljemala's full-sized avatar
🤘
Enjoying Golang

Michal Jemala michaljemala

🤘
Enjoying Golang
  • Bratislava, Slovakia
View GitHub Profile
@michaljemala
michaljemala / tls-client.go
Last active April 10, 2024 01:57
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@michaljemala
michaljemala / slow_client.go
Created September 12, 2019 08:03
A slow HTTP client
package main
import (
"bytes"
"fmt"
"io"
"log"
"net/http"
"time"
)
@michaljemala
michaljemala / docker-aliases.sh
Created September 5, 2019 08:00 — forked from jgrodziski/docker-aliases.sh
Useful Docker Aliases
############################################################################
# #
# ------- Useful Docker Aliases -------- #
# #
# # Installation : #
# copy/paste these lines into your .bashrc or .zshrc file or just #
# type the following in your current shell to try it out: #
# wget -O - https://gist.githubusercontent.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb/raw/d84ef1741c59e7ab07fb055a70df1830584c6c18/docker-aliases.sh | bash
# #
# # Usage: #
@michaljemala
michaljemala / todo-tester.go
Created September 7, 2020 12:43
Zero-downtime deployment tester
package main
import (
"fmt"
"log"
"os"
"os/exec"
"time"
"golang.org/x/sync/errgroup"
@michaljemala
michaljemala / pgpool.yaml
Created August 14, 2020 13:47
Postgres cluster with streaming replication and pgpool
version: '3.8'
services:
pgmaster:
image: bitnami/postgresql:latest
ports:
- 5432
volumes:
- pgmaster_data:/bitnami/postgresql
@michaljemala
michaljemala / kubernetes_commands.md
Created September 14, 2019 22:29 — forked from edsiper/kubernetes_commands.md
Kubernetes Useful Commands
package main
import (
"fmt"
"hova.dzia.poliev.ka/slice"
)
func main() {
x := slice.Unordered{1, 2, 3}
@michaljemala
michaljemala / graphql_desc.go
Created April 5, 2019 10:09
Descriptions not properly set
package main
import (
"log"
"net/http"
"github.com/graph-gophers/graphql-go"
"github.com/graph-gophers/graphql-go/relay"
)
@michaljemala
michaljemala / expression.go
Created October 9, 2018 09:27
Mongo-like expressions
package graphql
import (
"fmt"
"strings"
"github.com/aintu/api-go-poc/orm"
)
const (
@michaljemala
michaljemala / to_uuid.sql
Created April 12, 2018 12:21
OID to UUID
CREATE OR REPLACE FUNCTION uuid_from(oid bigint) RETURNS uuid AS $$
BEGIN
RETURN (
lpad(to_hex(oid::bit(64)::bit(32)::integer), 8, '0') ||
'-0000-4000-8000-0000' ||
lpad(to_hex((oid::bit(64)<<32)::bit(32)::integer), 8, '0')
)::uuid;
END;
$$ LANGUAGE plpgsql;