Skip to content

Instantly share code, notes, and snippets.

@tarun-ssharma
tarun-ssharma / work-with-multiple-github-accounts.md
Created January 11, 2024 04:42 — forked from rahularity/work-with-multiple-github-accounts.md
How To Work With Multiple Github Accounts on your PC

How To Work With Multiple Github Accounts on a single Machine

Let suppose I have two github accounts, https://github.com/rahul-office and https://github.com/rahul-personal. Now i want to setup my mac to easily talk to both the github accounts.

NOTE: This logic can be extended to more than two accounts also. :)

The setup can be done in 5 easy steps:

Steps:

  • Step 1 : Create SSH keys for all accounts
  • Step 2 : Add SSH keys to SSH Agent
@tarun-ssharma
tarun-ssharma / gist:d3727d0d8d11d0be448eec2f7780c5b4
Created September 25, 2023 01:46 — forked from jwebcat/gist:5122366
Properly download from github using wget and curl
wget --no-check-certificate --content-disposition https://github.com/joyent/node/tarball/v0.7.1
# --no-check-cerftificate was necessary for me to have wget not puke about https
curl -LJO https://github.com/joyent/node/tarball/v0.7.1
@tarun-ssharma
tarun-ssharma / delete_git_submodule.md
Created September 14, 2023 19:48 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@tarun-ssharma
tarun-ssharma / tensorflow-macos-bigsur.md
Created August 1, 2023 04:51
Installing tensorflow on macOS Big Sur

TL;DR: Couldn't get Tensorflow to work with MacOS BigSur

First, I tried these commands, with python 3.10:

  1. Install Miniconda from their website
  2. conda install -c apple tensorflow-deps Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. failed
  3. conda config --add channels conda-forge
  4. conda config --set channel_priority strict

Using an Access Token for the first time

Follow the instructions on Github to Create an Access Token in Github

Configure Git to use the osxkeychain

By default, git credentials are not cached so you need to tell Git if you want to avoid having to provide them each time Github requires you to authenticate. On Mac, Git comes with an “osxkeychain” mode, which caches credentials in the secure keychain that’s attached to your system account.

You can tell Git you want to store credentials in the osxkeychain by running the following:-

  1. You are craving mango shake. You have raw mango, raw milk and sugar.
  2. You slice up the mango in smaller pieces so that it's easier for the mixer to do it's job.
  3. You put that in the mixer container and pour in the milk and the sugar as required.
  4. You close the lid and attach the container to the mixer main body. You turn on the switch.
  5. The electrical energy carried by the AC current from "mains" is converted into mechnaical energy of the mixer blades by the mixer motor. The blades soon attain a stable speed depending on the speed configuration that you can set with something like a knob.
  6. The blades are pivoted, and as they rotate they cause the ingredients directly in contact with them to rotate due to friction. That rotation motion is passed on to all the ingredients which are in contact due to gravity and molecular forces.
  7. All the ingredients start rotating, and experience a centrifugal force which forces them to move to the extremes of the container since there's no opposing force. This c
  1. Install imgaug pip install imgaug
  2. Import neccessary libs:
import numpy as np
import imgaug as ia
import imgaug.augmenters as iaa
import glob
from PIL import Image
  1. Download the official benchmarking tool ( as a pre-built native command line library):
wget https://storage.googleapis.com/tensorflow-nightly-public/prod/tensorflow/release/lite/tools/nightly/latest/android_arm_benchmark_model
  1. Run the benchmark from command line:
./android_arm_benchmark_model \
  --graph=model.tflite \
  --num_threads=4
import tensorflow as tf
output_directory = './saved_model'
converter = tf.lite.TFLiteConverter.from_saved_model(output_directory) # path to the SavedModel directory
tflite_model = converter.convert()
# Save the model.
with open('model.tflite', 'wb') as f:
f.write(tflite_model)