Skip to content

Instantly share code, notes, and snippets.

View alexandear's full-sized avatar

Oleksandr Redko alexandear

View GitHub Profile
@alexandear
alexandear / lowercase-dirs.sh
Created July 10, 2024 14:33
Recursively rename directories to lowercase starting from the current directory.
# Recursively rename directories to lowercase starting from the current directory.
find . -type d | while read dir; do
# Extract the directory name and path
dirname=$(basename "$dir")
dirpath=$(dirname "$dir")
# Convert directory name to lowercase
lower_dirname=$(echo "$dirname" | tr '[:upper:]' '[:lower:]')
# Skip if already lowercase
@alexandear
alexandear / gist:b72e5932f411dd1fef9e1c4d2e36f2ef
Created February 27, 2025 12:40
Convert github.com/pkg/errors to errors
# Update `errors.Wrapf`:
find . -name "*.go" -exec sed -i '' -E 's/errors\.Wrapf\(([^,]+), "([^"]+)", ([^)]+)\)/fmt.Errorf\("\2: %w", \3, \1\)/g' {} +
# Update `errors.Wrap`:
find . -name "*.go" -exec sed -i '' -E 's/errors\.Wrap\(([^,]+), "([^"]+)"\)/fmt.Errorf\("\2: %w", \1\)/g' {} +
@alexandear
alexandear / transfer_forks.sh
Created April 2, 2025 09:52
Transfer forks from username to org via GitHub CLI
$from=alexandear
$to=alexandear-org
gh repo list --fork --limit 1000 --json name --jq ".[] | [.name] | @tsv" "$from" | while read -r repo; do; gh api "repos/$from/$repo/transfer" -f new_owner="$to" --silent; done
@alexandear
alexandear / test_task.md
Created February 19, 2026 09:58
MediDrive test task for Go Engineer

From https://djinni.co/jobs/805762-power-golang-developer/

Test Task: Product Catalog Service (Middle Golang Engineer)

Overview

You are tasked with implementing a simplified Product Catalog Service using the same architecture, patterns, and technology stack used in our production systems. This service will manage products and their pricing with proper domain-driven design and clean architecture principles.

Time Estimate: 8-12 hours Submission: GitHub repository with README, working code, and tests

@alexandear
alexandear / stdpackages.go
Created March 9, 2026 10:11
Generates standardPackages map for GCI
// Generates https://github.com/daixiang0/gci/blob/ba4e6aab099e64c6ff43942cc7112a1604580b7e/v2/pkg/section/standard_list.go#L3
package main
import (
"fmt"
"log"
"strings"
"golang.org/x/tools/go/packages"
@alexandear
alexandear / token.go
Created May 16, 2026 12:39
Fetch and log the last month of transactions for a UAH Black account in Monobank
// The program fetches and logs the last month of transactions for a UAH Black account in Monobank.
package main
import (
"context"
"log"
"os"
"time"