Skip to content

Instantly share code, notes, and snippets.

View karitham's full-sized avatar
🖥️
nerd

PL Pery karitham

🖥️
nerd
View GitHub Profile
@karitham
karitham / quickCss.css
Last active March 27, 2025 08:44
hide discord bullshit
/* Hide top bar */
.visual-refresh {
--custom-app-top-bar-height: 0px !important;
}
.visual-refresh .chat_f75fb0[data-has-border="true"],
.visual-refresh .container__133bf,
.visual-refresh .container_a592e1 {
border-top: 0 !important;
}
@karitham
karitham / requestIDHandler.go
Created April 2, 2024 07:59
slog handler that pulls request id from context and adds it to traces
package http
import (
"context"
"log/slog"
)
// RequestAttrGrabber adds an attribute to each row produced by the logger when it can
type RequestAttrGrabber struct {
Sub slog.Handler
@karitham
karitham / .envrc
Last active February 27, 2024 09:32
alias for direnv
alias() {
mkdir -p .direnv/bin
echo "#!/usr/bin/env sh
$(which $2) \$@" >.direnv/bin/$1
chmod +x .direnv/bin/$1
}
alias k8 kubectl
alias k9 k9s
@karitham
karitham / screen.sh
Created February 20, 2024 07:54
script to set display settings based on the existence of a screen
#/usr/bin/env bash
set -x +o pipefail
# Get the current output of hyprland monitors command
output=$(hyprctl monitors -j)
# Check if the HDMI-A-1 display exists in the output
# use grep because it fails if it doesn't find anything, unlike jq.
if echo "$output" | grep "HDMI-A-1"; then
@karitham
karitham / README.md
Created January 11, 2024 11:07
nixos rustdesk from github deb pkg

To build the derivation just run nix-build -A rustdesk ./rustdesk.nix

@karitham
karitham / dragonfly.yml
Created August 9, 2023 14:10
dragonflydb template for a kraud app
version: '3.9'
name: dragonfly
x-kraud-ui:
label: "DragonflyDB"
description: |
Dragonfly is an in memory data store built for modern application workloads.
Fully compatible with Redis and Memcached APIs,
Dragonfly requires no code changes to adopt.
@karitham
karitham / update-char-img.sh
Last active March 8, 2022 08:11
Updating a character image in the WaifuBot DB with `usql`, `jq` and `curl`
#! /bin/bash
query=$(curl 'https://graphql.anilist.co/' \
-s \
-H 'content-type: application/json' \
-d "{\"query\":\"query(\$id: Int) {Character(id:\$id){image{large}}}\",\"variables\":{\"id\":$1}}")
URL=$(echo $query | jq -r '.data.Character.image.large')
if [ $URL != "null" ]; then
@karitham
karitham / README.md
Created July 2, 2021 10:04
SQL to Go struct

SQL to Go struct

Simple program to transform SQL queries to go structs.

The fields need to have a as clause for now.

Example

SELECT inbounds.count as inbounds_count,
@karitham
karitham / toCamel.go
Created May 16, 2021 17:11
Export all struct fields of a go file
package main
import (
"bytes"
"fmt"
"os"
"regexp"
"strings"
"github.com/iancoleman/strcase"
@karitham
karitham / webhook.go
Created November 13, 2020 12:26
small go code for using webhooks
package webhook
import (
"bytes"
"encoding/json"
"net/http"
)
// Webhook is the toplevel webhook object
type Webhook struct {