Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korchasa
korchasa / techradar.json
Created August 2, 2024 09:49
korchasa Tech Radar
[
{
"name": "Composer",
"ring": "adopt",
"quadrant": "tools",
"isNew": "TRUE",
"description": "Although the idea of dependency management ..."
},
{
"name": "Canary builds",
@korchasa
korchasa / aidir.sh
Last active January 14, 2025 03:58
A script that places all project files in the aichat REPL
#!/bin/bash
# Function: aidir
# Description:
# This function analyzes the project code in a given directory by recursively
# finding all files and processing them. It skips directories specified in the
# environment variable AIDIR_SKIP. If AIDIR_SKIP is not set, no directories are skipped.
# The function concatenates the content of text/source files into a single string
# and saves it to ~/.aidir. Then, it starts a REPL session with aichat, using the
# concatenated content as input.
@korchasa
korchasa / aidbg.sh
Created February 3, 2024 03:27
Shell command debug using aichat
#!/usr/bin/env bash
local command_text="$*"
command_output=$(eval "$command_text" 2>&1)
command_status=$?
echo "$command_output"
# Check if the command failed
if [ $command_status -ne 0 ]; then
print "==================================="
print "Explaining the error with aichat..."
@korchasa
korchasa / fix_alpine_packages_versions.sh
Created December 29, 2023 16:58
How to find current versions of alpine packages, to fix their version numbers in apk add
#!/usr/bin/env bash
# Check if at least two arguments are provided (Alpine version and one package)
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <alpine_version> <package1> [package2 ...]"
exit 1
fi
alpine_version=$1
shift
@korchasa
korchasa / HttpProxy.go
Created April 26, 2022 15:11 — forked from yowu/HttpProxy.go
A simple HTTP proxy by Golang
package main
import (
"flag"
"io"
"log"
"net"
"net/http"
"strings"
)
@korchasa
korchasa / provis.hcl
Created September 25, 2021 18:14
provis
server "nomad-client" {
config {
packages "yum" {
additional_sources = [
"epel-releases",
"https://download.docker.com/linux/centos/docker-ce.repo"
]
}
services "systemctl" {}
@korchasa
korchasa / cloudflare-copy.go
Last active April 12, 2021 07:16
Copy domain between Cloudflare accounts
package main
import (
"context"
"fmt"
"github.com/cloudflare/cloudflare-go"
"log"
"os"
)
@korchasa
korchasa / main.go
Created September 30, 2020 09:04
golang-prometheus-register-wide-labels
package main
import (
"github.com/prometheus/client_golang/prometheus"
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
)