Skip to content

Instantly share code, notes, and snippets.

View cyantarek's full-sized avatar
🏠
Working from home

Cyan Tarek cyantarek

🏠
Working from home
View GitHub Profile
@cyantarek
cyantarek / main.go
Created January 16, 2021 07:54 — forked from salihzain/main.go
Go code to get the name of the function that invoked the current function
package main
import (
"fmt"
"runtime"
)
// whoCalledMe is a function that returns the name, fileName, and lineNumber of the caller that called function X
// the code doesn't check for edge cases
func whoCalledMe() (callerName, callerFileName string, callerLineNumber int) {
@cyantarek
cyantarek / README.md
Created October 1, 2020 18:07 — forked from crgimenes/README.md
Example of pagination using PostgreSQL, Golang and SQLx

Configure environment variable

export DATABASE_URL=postgres://postgres@localhost/dbname?sslmode=disable 

Run in CLI

go run main.go -page 1
@cyantarek
cyantarek / README.md
Created June 24, 2020 20:02 — forked from denji/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker-compose exec sentry sentry upgrade to setup database and create admin user
  5. (Optional) Run docker-compose exec sentry pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker-compose restart sentry
  7. Sentry is now running on public port 9000
@cyantarek
cyantarek / go-stdlib-interface-selected.md
Created October 11, 2018 12:22 — forked from asukakenji/go-stdlib-interface-selected.md
Go (Golang) Standard Library Interfaces (Selected)

Go (Golang) Standard Library Interfaces (Selected)

This is not an exhaustive list of all interfaces in Go's standard library. I only list those I think are important. Interfaces defined in frequently used packages (like io, fmt) are included. Interfaces that have significant importance are also included.

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

@cyantarek
cyantarek / client.go
Created October 5, 2018 16:42
Golang AES-CFB encrypted TCP stream
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"fmt"
"io"
"net"
)