Skip to content

Instantly share code, notes, and snippets.

View indradhanush's full-sized avatar

Indradhanush Gupta indradhanush

View GitHub Profile
@indradhanush
indradhanush / repo-clone-modes.md
Created February 27, 2023 08:33
Sourcegraph: Where do we ensure that uncloned repositories are cloned? And how often? And why?

Where do we ensure that uncloned repositories are cloned? And how often? And why?

Modes of cloning a repo

In gitserver we may clone a repo if it receives a request to one of the following endpoints:

  1. /exec or /archive: If any of the allowed exec commands (gitCmdAllowList) are "executed" on a repo through we may clone the repo in maybeStartClone
  2. /repo-update: If a request to update a repo is received and it is not cloned, then we will clone a repo
  3. /repo-clone: If a request to clone the repo is received
  4. /search: If a search is made in a repo and the repo is not cloned
@indradhanush
indradhanush / README.md
Last active December 30, 2022 03:55
A Python scipt to fetch all public and user affliiated repos with visibility: all

README

Requirements

  • python3.6
  • python-requests
  • GitHub Public Access Token

What this does

@indradhanush
indradhanush / change-ns.sh
Created October 21, 2022 10:41
A bash function to switch namespaces in the current Kubernetes cluster
change-ns () {
namespace=$1
if [ -z "${namespace}" ]
then
namespace="default"
fi
context=$(kubectl config current-context)
kubectl config set-context "${context}" --namespace "${namespace}" > /dev/null
yellow="\033[1;93m"
green="\033[1;92m"
https://www.mikekasberg.com/blog/2020/04/08/dual-boot-ubuntu-and-windows-with-encryption.html
#!/usr/bin/bash
echo "hello"
sleep 5
echo "bye"
pa-list() { pacmd list-sinks | awk '/index/ || /name:/' ;}
pa-set() {
# list all apps in playback tab (ex: cmus, mplayer, vlc)
inputs=($(pacmd list-sink-inputs | awk '/index/ {print $2}'))
# set the default output device
pacmd set-default-sink $1 &> /dev/null
# apply the changes to all running apps to use the new output device
for i in ${inputs[*]}; do pacmd move-sink-input $i $1 &> /dev/null; done
}
pa-playbacklist() {
@indradhanush
indradhanush / speedtest.md
Created April 1, 2019 19:01 — forked from sdstrowes/foo.md
Reverse Engineering the Speedtest.net Protocol, Gökberk Yaltıraklı

Source: https://web.archive.org/web/20141216073338/https://gkbrk.com/blog/read?name=reverse_engineering_the_speedtest_net_protocol Author: Gökberk Yaltıraklı

Reverse Engineering the Speedtest.net Protocol

After finishing my command line speed tester written in Rust, I didn't have a proper blog to document this process. A few days ago I wrapped up a simple blogging script in Python so hopefully it works good enough to explain how everything works.

By now I have already figured out the whole protocol for performing a speed test but I will write all the steps that I took so you can learn how to reverse engineer a simple protocol.

The code that I wrote can be found at https://github.com/gkbrk/speedtest-rust.

@indradhanush
indradhanush / debug-log.md
Created March 26, 2019 10:34
Error using counsel-rg

Error

Error in post-command-hook (ivy--queue-exhibit): (wrong-type-argument number-or-marker-p nil)

Debugger output

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
@indradhanush
indradhanush / minikube.txt
Last active January 10, 2019 08:45 — forked from F21/gist:08bfc2e3592bed1e931ec40b8d2ab6f5
Minikube RBAC Quick Start
minikube start --kubernetes-version=v1.11.0 --extra-config=apiserver.authorization-mode=RBAC -v 10
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
minikube dashboard
@indradhanush
indradhanush / dark.md
Created August 31, 2018 10:08 — forked from a7madgamal/dark.md
Dark mode for Slack on MacOS
  1. Close slack
  2. Open this file /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js
  3. Append this to it
document.addEventListener('DOMContentLoaded', function() {
 $.ajax({
   url: 'https://cdn.rawgit.com/laCour/slack-night-mode/master/css/raw/black.css',
   success: function(css) {
 $("").appendTo('head').html(css);