Skip to content

Instantly share code, notes, and snippets.

View padurean's full-sized avatar

Valentin Padurean (Ogg) padurean

View GitHub Profile
@padurean
padurean / Notes-syntax-in-GitHub-markdown.md
Last active October 30, 2024 23:29
Notes syntax in GitHub markdown

Note

Highlights information that users should take into account, even when skimming.

Tip

Optional information to help a user be more successful.

Important

Crucial information necessary for users to succeed.

[!WARNING]

@padurean
padurean / print-memory.go
Created September 5, 2024 09:50 — forked from rdyv/print-memory.go
Go print current memory
package main
import (
"runtime"
"fmt"
"time"
)
func main() {
// Print our starting memory usage (should be around 0mb)
@padurean
padurean / README.md
Created March 8, 2023 11:42 — forked from nitaku/README.md
Markdown sidenotes

Test sidenote1 blah.

Footnotes

  1. Bah.

@padurean
padurean / stringToReaderCloser.go
Created September 27, 2022 11:34 — forked from crgimenes/stringToReaderCloser.go
string to io.ReadCloser
package main
import (
"bytes"
"fmt"
"io"
"os"
"strings"
)
@padurean
padurean / status.go
Created January 15, 2022 13:54
Golang enum pattern with TextMashalJSON
package task
import (
"fmt"
"strings"
)
// Status ...
type Status int
@padurean
padurean / wait_timeout.go
Created January 5, 2022 16:17 — forked from r4um/wait_timeout.go
Golang - WaitGroup Timeout
package main
import (
"fmt"
"sync"
"time"
)
func main() {
wg := sync.WaitGroup{}
@padurean
padurean / enum.go
Created December 16, 2021 21:55 — forked from lummie/enum.go
Golang Enum pattern that can be serialized to json
package enum_example
import (
"bytes"
"encoding/json"
)
// TaskState represents the state of task, moving through Created, Running then Finished or Errorred
type TaskState int
@padurean
padurean / main.go
Created January 29, 2021 12:06 — forked from dopey/main.go
How to generate secure random strings in golang with crypto/rand.
package main
import (
"crypto/rand"
"encoding/base64"
"fmt"
"io"
)
// Adapted from https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/
package websocket
import (
"fmt"
"io"
"strings"
"time"
logger "github.com/rs/zerolog/log"
"golang.org/x/net/websocket"
# Git log oneline since a certain date with author names:
git log --after="2020-09-22T00:00:00-00:00" --pretty=format:"%h%x09%ad%x09%an%x09%s" --date=short