Skip to content

Instantly share code, notes, and snippets.

View abdivasiyev's full-sized avatar
🥷
golang ninja

Asliddinbek Azizovich abdivasiyev

🥷
golang ninja
View GitHub Profile
@abdivasiyev
abdivasiyev / Git_Commit_Freeze_Solution.md
Created January 15, 2025 09:30 — forked from bahadiraraz/Git_Commit_Freeze_Solution.md
Git Commit Freeze Due to GPG Lock Issues (Solution)

Git Commit Freeze Due to GPG Lock Issues

If you encounter a problem where you cannot commit changes in Git – neither through the terminal nor via the GitHub Desktop application – the issue might be a freeze during the Git commit process. This is often caused by GPG lock issues. Below is a concise and step-by-step guide to resolve this problem.

Solution Steps

1. Check for GPG Lock Messages

Open your terminal and try to perform a GPG operation (like signing a test message). If you see repeated messages like gpg: waiting for lock (held by [process_id]) ..., it indicates a lock issue.

@abdivasiyev
abdivasiyev / subdomains.sh
Created November 6, 2024 05:00
Find subdomains using crt.sh
#!/bin/bash
# check curl exists
if ! command -v curl >/dev/null 2>&1
then
sudo apt install -y curl
fi
# check pup exists
if ! command -v pup >/dev/null 2>&1
@abdivasiyev
abdivasiyev / decoder.go
Created August 3, 2024 12:29
Decode everything using only one package
package decoder
import (
"encoding/json"
"io"
"net/http"
"github.com/gorilla/schema"
)
@abdivasiyev
abdivasiyev / workerpool.go
Last active May 22, 2024 21:16
Goroutine management by using workerpool pattern
package workerpool
type Work[T any] func(workerID int, result chan<- T) error
type Pool[T any] interface {
Add(w Work[T])
Shutdown()
Result() <-chan T
}
@abdivasiyev
abdivasiyev / generic_setter.go
Created May 1, 2024 18:32
Set value by calling functions in generics
package main
import "fmt"
type Setter[V any] interface {
Set(value V)
}
type Getter[V any] interface {
Get() V
@abdivasiyev
abdivasiyev / optional.go
Created May 1, 2024 17:39
Optional arguments implementation
// Usage:
//
// SomeFn(1, "test", WithArg1("optional 1"), WithArg2(true))
//
package some_pkg
type Option func(*option)
type option struct {
arg1 string
@abdivasiyev
abdivasiyev / repository.go
Last active April 21, 2024 16:15
Repository for dynamic insertion
package repository
import (
"fmt"
"strings"
)
type Row interface {
SetPos(pos int)
Values() []any
package http
import (
"context"
"encoding/json"
"mime/multipart"
"net/http"
"github.com/go-chi/chi/v5"
"github.com/google/uuid"
@abdivasiyev
abdivasiyev / default.nix
Created February 3, 2024 18:37
default nix configuration
with import <nixpkgs> {}; rec {
helloNixEnv = stdenv.mkDerivation {
name = "hello-nix-env";
buildInputs = [ go ];
};
}
@abdivasiyev
abdivasiyev / ternary.go
Created June 28, 2023 14:40
Simple ternary operator implementation in Go with generics
package ternary
type operatorIf[T comparable] struct {
condition bool
value T
elseIf *operatorIf[T]
elseValue T
}
func If[T comparable](condition bool) *operatorIf[T] {