Skip to content

Instantly share code, notes, and snippets.

View awnumar's full-sized avatar
🐘
I may be slow to respond.

Awn awnumar

🐘
I may be slow to respond.
View GitHub Profile
@awnumar
awnumar / sorter.go
Last active November 30, 2021 00:57
sort files into folders according to date (must be on same drive)
package main
import (
"encoding/base64"
"flag"
"fmt"
"io/fs"
"os"
"path/filepath"
"strings"
@awnumar
awnumar / ptr2bytes.go
Created April 29, 2017 21:54
Go function to convert a pointer to a slice.
package ptr2bytes
func GetBytesFromPtr(ptr uintptr, len int, cap int) []byte {
var sl = struct {
addr uintptr
len int
cap int
}{ptr, len, cap}
return *(*[]byte)(unsafe.Pointer(&sl))
}