Skip to content

Instantly share code, notes, and snippets.

View prashant-shahi's full-sized avatar
:shipit:
Working remotely

Prashant Shahi prashant-shahi

:shipit:
Working remotely
View GitHub Profile
@prashant-shahi
prashant-shahi / main.go
Created April 24, 2024 14:04
Example clickhouse DNS strings and how it is parsed
package main
import (
"fmt"
"net/url"
"strings"
)
func main() {
dsnStrings := []string{
@prashant-shahi
prashant-shahi / main.go
Created March 11, 2024 06:25
Array sum using Loop, Goroutines and Recursion in Go
package main
import "fmt"
const (
BATCH_COUNT = 5
)
func loopSum(s []int) int {
sum := 0
@prashant-shahi
prashant-shahi / index.md
Created March 11, 2024 05:29
Time zones available in Go (Linux)

Time zones available in Golang

  • Retrieving time zones from : /usr/share/zoneinfo/
  • OS : linux
  • Total timezone ids : 608
GMT+00:00 Africa/Abidjan
GMT+00:00 Africa/Accra
GMT+03:00 Africa/Addis_Ababa
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<script>
L_NO_TOUCH = false;
L_DISABLE_3D = false;
</script>

SigNoz Dashboards for Monitoring Kubernetes

Dashboard URL
PVC Metrics [kubernetes-pvc-metrics.json][1]
Pods Metrics (Overall) [kubernetes-pod-metrics-overall.json][2]
Pods Metrics (Detailed) [kubernetes-pod-metrics-detailed.json][3]
Node Metrics (Overall) [kubernetes-node-metrics-overall.json][4]
Node Metrics (Detailed) [kubernetes-node-metrics-detailed.json][5]
@prashant-shahi
prashant-shahi / main.go
Created January 17, 2024 08:58
kebab casing string for valid URL paths in Golang
package main
import (
"fmt"
"regexp"
"strings"
)
func toKebabCase(s string) string {
// Regular expression to match non-alphanumeric characters
@prashant-shahi
prashant-shahi / gist:2efb55e97cd4c6226c1789ca7b56765b
Created January 11, 2024 12:10 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@prashant-shahi
prashant-shahi / instruction.md
Last active October 7, 2023 07:14
Recover from ufw not allowing to ssh on port 22 in GCP instance

SSH Firewall

Tried to setup UFW or any other Firewall, but it disallows any traffic to port 22, which doesn't let you ssh to your Google Cloud Platform (GCP) instance? 😖

This article might be your savior. 😎

Follow the instructions below :

  1. Go to your VM’s configuration page. Select the project. Then, Go to Compute -> Compute Engine -> VM Instances. Click the VM you want to recover
  2. Click Edit. Then, scroll down to Custom Metadata
@prashant-shahi
prashant-shahi / nanoid.sql
Created August 4, 2021 20:40
Nano ID implementation in PostgreSQL - PL/pgSQL
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACE FUNCTION public.nanoid(size integer DEFAULT 21)
RETURNS text
LANGUAGE plpgsql
STABLE
AS $function$
DECLARE
id text := '';
i int := 0;
#!/usr/bin/env bash
# require: git version > 2.3
# require: `db/letsencrypt` existed in git repo
if [[ -z "$CERTBOT_DOMAIN" ]] || [[ -z "$CERTBOT_VALIDATION" ]]; then
echo '$CERTBOT_DOMAIN and $CERTBOT_VALIDATION environment variables required.'
fi
source /etc/letsencrypt/dns-auth.conf