Skip to content

Instantly share code, notes, and snippets.

View Dentrax's full-sized avatar
🎶
GNW's Not Wololooo!

Furkan Türkal Dentrax

🎶
GNW's Not Wololooo!
View GitHub Profile
[dentrax@arch etc]$ polybar --log=info top
* Loading config: /home/dentrax/.config/polybar/config
* Loaded monitor eDP-1 (1920x1080+0+0)
* Bar geometry: 1920x34+0+0
error: Disabling module "mpd" (reason: No built-in support for 'internal/mpd')
error: Disabling module "volume" (reason: Could not connect pulseaudio context.)
error: Disabling module "wired-network" (reason: Invalid network interface "net0")
* Starting application
* Starting module/powermenu
* Starting module/cpu
// Integer Playground
// Furkan
#include <iostream>
#include <string>
#include <climits>
#include <typeinfo>
using namespace std;
@Dentrax
Dentrax / AST.go
Created April 27, 2020 09:29
Go | Simple Linter
package main
import (
"bytes"
"fmt"
"go/ast"
"go/format"
"go/parser"
"go/token"
"os"
-----BEGIN ENCRYPTED PRIVATE KEY-----
eyJrZGYiOnsibmFtZSI6InNjcnlwdCIsInBhcmFtcyI6eyJOIjozMjc2OCwiciI6
OCwicCI6MX0sInNhbHQiOiJENlQ0VTRXb1IyWEhuZW5qanNkMHY5MXhOQ2ZDMGZx
Z0JCM0dXdUdTRVRNPSJ9LCJjaXBoZXIiOnsibmFtZSI6Im5hY2wvc2VjcmV0Ym94
Iiwibm9uY2UiOiJHRGtGcmF3Y2FhUm05S2FrcG9DdUoxWU15MFJrVUJOTCJ9LCJj
aXBoZXJ0ZXh0IjoiczFnbUJsUU9IMURXOXJaM2xGTnFuTXpJSkU5Y3Z1UTVpdDZZ
ZTI4dmVqclJ1dEh1UzdDMmZrYUk0NEJsWDRFajRhdWNJUEhLTmF4WjFwam4wVElp
SjhzdGc5blQ2OUxxQjNhUXQ1UmlyNER0eDAxbHlQcGp3YnVXRnZOWEx6RTJ4bHRZ
MSt5KzQxT2lZUCsxcEd1cGgzOHVyTVNCNEN6SHhCb0tEbFI1UlNiQXRJdlRhU3F5
UEsyMU1QVDhaTGdUTUM4N2ZLTHkxNHc1N3l5WHZJV3hRamtaRDROdHY3VnhIaWlk
@Dentrax
Dentrax / copy-helm-images.sh
Last active December 13, 2021 14:56
Get all images in helm chart and copy to internal registry
#!/bin/bash
set -e
function usage(){
echo "$(basename $0) --registry registry.gitlab.com/images --platform linux/amd64 --chart fluent/fluent-bit --version 0.19.10" >&2
}
function teardown {
rm -rf "./tmp"
@Dentrax
Dentrax / main.go
Last active August 14, 2022 20:41
demo: delve-entrypoint-mutating
package main
import (
"archive/tar"
"bytes"
"fmt"
"github.com/google/go-containerregistry/pkg/crane"
"github.com/google/go-containerregistry/pkg/name"
v1 "github.com/google/go-containerregistry/pkg/v1"
"github.com/google/go-containerregistry/pkg/v1/mutate"
@Dentrax
Dentrax / oidc-flow-study-notes.md
Last active November 29, 2022 11:50
Kubernetes OIDC - IDToken
@Dentrax
Dentrax / etcd-defragmentation.md
Last active December 13, 2022 07:55
How etcd defragmentation works?

Abstract

Bolt operations are copy-on-write. When a page is updated, it is copied to a completely new page. The old page is added to a "freelist", which Bolt refers to when it needs a new page. This means that deleting large amounts of data will not actually free up space on disk, as the pages are instead kept on Bolt's freelist for future use. In order to free up this space to disk, you will need to perform a defrag.

The process of defragmentation releases this storage space back to the file system. Defragmentation is issued on a per-member so that cluster-wide latency spikes may be avoided.

Algorithm

  1. lock batchTx to ensure nobody is using previous tx, and then close previous ongoing tx.
  2. lock database after lock tx to avoid deadlock.
@Dentrax
Dentrax / config
Created May 30, 2023 06:32
~/.ssh/config for GitHub (macOS)
Host github.com
User git
Hostname github.com
AddKeysToAgent yes
IgnoreUnknown UseKeychain
UseKeychain yes
PreferredAuthentications publickey
IdentityFile /Users/USERNAME/.ssh/id_rsa
@Dentrax
Dentrax / etcd-check.md
Last active June 2, 2023 12:06
ETCD - Interact in Kubernetes VM
  1. Export all the required environment variables:
export $(grep -v '^#' /etc/etcd.env | xargs -d '\n')
  1. Start interacting with etcdctl
etcdctl endpoint health status --cluster -w table && etcdctl endpoint status --cluster -w table