Skip to content

Instantly share code, notes, and snippets.

View wyaadarsh's full-sized avatar

Aadarsh Indurkhya wyaadarsh

  • Microsoft India
  • Bangalore
View GitHub Profile
@wyaadarsh
wyaadarsh / git-cheatsheet.md
Created November 28, 2023 07:39 — forked from jeremypage/git-cheatsheet.md
Git cheatsheet

Git cheatsheet

Find all instances of text in all commits

git grep "text to look for" $(git rev-list --all)

List commit messages since given commit

@wyaadarsh
wyaadarsh / cert.txt
Created April 11, 2022 14:13
Accessing Local System - CurrentUser Certs - Windows
cd Cert:\CurrentUser\My
dir
@wyaadarsh
wyaadarsh / sort.py
Created February 21, 2022 23:03
Custom Sorting in Python
# How this works is: if we want n1 to go first in the sorted order, we return -1 and we want n2 to go first, we return a +1
def compare(n1, n2):
if n1+n2 > n2+n1:
return -1
else:
return 1
nums = sorted(nums, key=cmp_to_key(compare))
# cmp_to_key is important
@wyaadarsh
wyaadarsh / MyHeap.py
Created January 24, 2022 15:36
Custom Heap Wrapper
import heapq
class MyHeap(object):
def __init__(self, initial=None, key=lambda x: x):
# Max Heap: key: lambda x: -x
# Min Head: default key would work
self.key = key
self.index = 0
if initial:
@wyaadarsh
wyaadarsh / Bitmasking.md
Last active March 1, 2022 15:21
Bitmasking.md

Topocoder Article

Set the ith bit: b(1<<i).

Let i=0, so, (1<<i) = 00001 01010 | 00001 = 01011

Unset the ith bit: b & !(1<<i).

Let i=1, so,

@wyaadarsh
wyaadarsh / git.md
Created June 29, 2021 15:57
Git Common Used Commands

Remove File from git but keep in local

git rm --cached mylogfile.log # Single file git rm --cached -r mydirectory # From Directory

@wyaadarsh
wyaadarsh / setup.py
Created February 10, 2021 17:04
PyPi Project Setup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Note: To use the 'upload' functionality of this file, you must:
# $ pipenv install twine --dev
import io
import os
import sys
from shutil import rmtree
The most beautiful explanation of Raft Concesus Algo: http://thesecretlivesofdata.com/raft/
@wyaadarsh
wyaadarsh / cheatsheet-elasticsearch.md
Created December 22, 2020 04:34 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
  • Tell me about yourself.
  • Tell me about current company(team) and your role in it
  • What are you looking for in next company
  • Why do you want to leave your currrent company

Amazon Leadership Principles

  • Tell me an area where you think you can improve.
  • Tell me a time when you created an innovative product
  • Give me an example of when you took a risk and it failed.