Skip to content

Instantly share code, notes, and snippets.

View Goodnessuc's full-sized avatar
🎯
Focusing

Ukeje Chukwuemeriwo Goodness Goodnessuc

🎯
Focusing
View GitHub Profile
@Goodnessuc
Goodnessuc / mux.go
Created February 16, 2023 05:53
CRUD RESTful API in Go with the Gorilla Mux Package - Article for RedGate's Simple Talk Blog
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"gorm.io/driver/sqlite"
@Goodnessuc
Goodnessuc / gsod.md
Last active February 25, 2023 08:36
GSoD Application HTML

Ukeje Goodness C | LinkedIn Github Portfolio Resume Main Tech Blog Linktree Twitter | About Me Hey there, I am Ukeje Goodness, an opensource enthusiast, backend developer, and technical writer focused on Python, Golang, and Rust while writing documentation for APIs, CLI apps, and other projects. I have over 3 years of experience with technical writing. My goal is to bring clarity to your technical projects.

@Goodnessuc
Goodnessuc / main.go
Created March 3, 2023 09:01
Converting PNG files to JPG
package main
import (
"image/jpeg"
"image/png"
"os"
"strings"
)
func main() {
@Goodnessuc
Goodnessuc / PushaG.sh
Last active June 8, 2023 13:39
Helper file for pushing code to github with a commit message input
git add .
echo -n "🔊 What's the commit message 👉 "
read response
git commit -m "$response"
git push origin main
@Goodnessuc
Goodnessuc / fake_database.go
Last active September 3, 2023 14:26
A program that generates X no of rows of fake data for database insertion/operation (just modify the struct)
package main
import (
"github.com/brianvoe/gofakeit/v6"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"log"
"time"
)
@Goodnessuc
Goodnessuc / optimize.go
Last active September 3, 2023 15:50
Full code for the Earthly Technologies Article on Optimizing SQL Queries
package main
import (
"fmt"
"gorm.io/driver/postgres"
"gorm.io/gorm"
"gorm.io/gorm/schema"
"log"
"time"
)
@Goodnessuc
Goodnessuc / Dockerfile
Created September 22, 2023 02:47
My Typical Dockerfile
# Build stage
FROM golang:1.20-alpine AS build
# Set the working directory inside the container
WORKDIR /app
# Copy the Go application source code into the container
COPY . .
# Build the Go application
@Goodnessuc
Goodnessuc / randomgenerator.go
Last active November 10, 2023 13:02
Generate Cryptographically secure random values of any type in Go
// In this script, we'll create a function to generate secure random strings.
// First, define the function that generates the random string.
func generateRandomString(chars string, length int) string {
// Create an array of bytes with the specified length.
bytes := make([]byte, length)
// Use crypto/rand to fill the byte array with secure random bytes.
_, err := rand.Read(bytes)
if err != nil {
@Goodnessuc
Goodnessuc / gitlab.go
Created December 30, 2023 09:33
GitLab Oauth Example
package main
import (
"context"
"encoding/json"
"fmt"
"golang.org/x/oauth2"
"io"
"net/http"
)
@Goodnessuc
Goodnessuc / gin.go
Last active January 18, 2024 09:24
CRUD API in Go using the Gin FrameWork - Article for Earthly Technologies
package main
import (
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"log"
"net/http"
)