Skip to content

Instantly share code, notes, and snippets.

View mozarik's full-sized avatar
💭
Im still learning new thing , and always be

Zein Fahrozi mozarik

💭
Im still learning new thing , and always be
View GitHub Profile
@mozarik
mozarik / cookie.go
Last active January 13, 2021 00:48
#!/usr/bin/python3
import os
from PIL import Image
OUTPUT_FILE_PATH = "./opt/icons/"
ORIGINAL_FILE_PATH = "./images/"
FILL_COLOR = (120, 8, 220)
@mozarik
mozarik / error_message
Created March 2, 2021 13:15
Coursera Week 7 Grade Assesment
#!/usr/bin/python3
import re
import operator
import pprint
import operator
import collections
import csv
# 1.The rankking of errors generated by the system
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mozarik
mozarik / models.go
Last active June 20, 2021 16:22
Example of Models in GORM
package model
import "gorm.io/gorm"
type User struct {
gorm.Model
Username string
Password string
Role string
}
@mozarik
mozarik / rowscan.go
Created October 6, 2021 12:13
Rows Scan Gorm
func (repo QuoteRepo) FindUserFavorites(userID int) ([]domain.Quote, error) {
query := `SELECT q.id, q.body, q.author, q.quote_source FROM quotes q
JOIN userfavoritesquotes on (q.id = userfavoritesquotes.quote_id)
JOIN users ON (users.id = userfavoritesquotes.user_id)
WHERE users.id = @userID`
rows, err := repo.DB.Debug().Raw(query, sql.Named("userID", userID)).Rows()
if err != nil {
return nil, err
}
@mozarik
mozarik / read.txt
Created March 31, 2022 10:34
Read This File
Hello! congratulations you can read me :D