Skip to content

Instantly share code, notes, and snippets.

View sarfarazahmad89's full-sized avatar
📺
Glued to my terminal ?

Sarfaraz Ahmad sarfarazahmad89

📺
Glued to my terminal ?
View GitHub Profile
@sarfarazahmad89
sarfarazahmad89 / proxy.go
Created March 5, 2024 20:38 — forked from ericflo/proxy.go
Golang TCP Proxy
package proxy
import (
"io"
"net"
"sync"
log "github.com/Sirupsen/logrus"
)
[root@ip-172-31-0-99 ~]# chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
#* PHC0 0 0 377 0 +1ns[ +1ns] +/- 5031ns
^- 169.254.169.123 1 4 77 10 -7957ns[-8245ns] +/- 98us
^- ec2-15-152-156-115.ap-no> 4 6 17 43 -45us[ -47us] +/- 3998us
^- ec2-15-152-48-157.ap-nor> 4 6 17 43 +350us[ +348us] +/- 4805us
^- ec2-15-152-226-86.ap-nor> 4 6 17 42 +602us[ +599us] +/- 4490us
^- ec2-15-168-66-245.ap-nor> 4 6 17 42 -28us[ -31us] +/- 4042us
[root@ip-172-31-0-99 ~]# chronyc tracking
@sarfarazahmad89
sarfarazahmad89 / 0001-patch-from-gmires.patch
Created December 23, 2023 17:46
Slim 7 16APH8 Audio on Linux-6.6.0
From 6ee3013cdb3fd750fdbe175f275214fbfc3b3992 Mon Sep 17 00:00:00 2001
From: nobody <nobody@nobody.com>
Date: Sat, 23 Dec 2023 17:29:23 +0100
Subject: [PATCH 1/3] patch from gmires
---
sound/pci/hda/cs35l41_hda_property.c | 7 +++++++
sound/pci/hda/patch_realtek.c | 30 +++-------------------------
2 files changed, 10 insertions(+), 27 deletions(-)
package main
import (
"fmt"
"os"
"gopkg.in/yaml.v3"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/rulefmt"
//"github.com/prometheus/prometheus/rules"
)
set -g status-bg black
set -g status-fg white
bind -n M-Left prev
bind -n M-Right next
bind -n M-Down select-pane -R
bind -n M-Up select-pane -L
#bind -n M-d detach
set -sg escape-time 0
bind -n M-n new-window
bind -n M-c kill-window
@sarfarazahmad89
sarfarazahmad89 / gaming_on_linux.md
Last active April 4, 2020 18:37
Gaming on Linux (ROG GL503GE: CoffeeLake i7-8750H + Geforce 1050Ti ) + Manjaro Kyria 19.0.2
@sarfarazahmad89
sarfarazahmad89 / distronotes
Last active October 29, 2019 16:48
Ahmad's recipe for the best Linux distro experience yet.
This gist documents some of tweaks I have done to my install of Manjaro KDE on my ROG Strix and which in turned to be by far the best desktop experience I have had on Linux.
Just joting them down for my future reference.
* Distro: Manjaro
Reason: Superstable, has the latest software mostly, is minimal by design (love for ArchLinux!) and packaging is both insanely fast and simple.
Plus AUR makes maintaining my personal custom packages super easy !
* DE: KDE plasma
Reason: Amazingly pleasant to the eyes, highly customizable and incredibly fast.
Kwin-lowlatency is the closest you can get to an amazing supersmooth, lightweight, eye-candyful desktop experience that you can have on Linux today.
@sarfarazahmad89
sarfarazahmad89 / gist:d07b4794b59017209871ad6e3c597ad7
Last active October 22, 2019 07:25
SSHFP and SSH client logs : how the public key is encoded/hashed
SSHFP records have the following :
[root@host ~]# awk '{print $2}' /etc/ssh/ssh_host_rsa_key.pub | base64 -d | sha1sum -b | sed 's/ .*$//'
30b2296b3907a1a08d9159aa6a5110c49b4b15d0
SSH logs have the following :
[root@host ~]# awk '{print $2}' /etc/ssh/ssh_host_rsa_key.pub | base64 -d | sha1sum -b | sed 's/ .*$//'|xxd -r -p |base64
MLIpazkHoaCNkVmqalEQxJtLFdA=
How do you test you can connect to a utility without telnet lying around ?
>> for i in 5601 5602; do (</dev/tcp/my-machine.domain.com/$i) 2>/dev/null && echo "Can connect to port $i";done
@sarfarazahmad89
sarfarazahmad89 / Filters And Lambda
Last active March 15, 2019 08:22
My Python Gists
** Filter, Lambda **
There are probably 10 other better ways to do this, but this is for my personal reference.
mylst = ['dummy-2019.01', 'dummy-testindex', 'dummy-2019.02']
def match_indices(index, regex):
return re.match(regex, index)
def match_indices_by_month_or_week(index):
return match_indices(index, '.*?\d{4}.\d{2}')