Skip to content

Instantly share code, notes, and snippets.

View abnvanand's full-sized avatar
🎯
Focusing

Abhinav Anand abnvanand

🎯
Focusing
View GitHub Profile
@abnvanand
abnvanand / grokking_to_leetcode.md
Created July 24, 2022 04:42 — forked from tykurtz/grokking_to_leetcode.md
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window

@abnvanand
abnvanand / typecheck.go
Created May 4, 2022 03:46
Go Compile-time check for ensuring a type implements a particular interface.
import "fmt"
// Compile-time checks for ensuring a type implements a particular
// interface.
var (
// Works but allocates a dummy Foo instance on the heap.
_ fmt.Stringer = &Foo{}
// Preferred way that does not allocate anything on the heap.
_ fmt.Stringer = (*Foo)(nil)
@abnvanand
abnvanand / config.toml
Created May 20, 2021 16:21
gitlab runner in docker with docker bind mount
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "my-runner"
url = ""
token = ""
@abnvanand
abnvanand / ansible.md
Created March 16, 2021 04:34
ansible
# Sample Inventory File

# Web Servers
web1 ansible_host=server1.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web2 ansible_host=server2.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!
web3 ansible_host=server3.company.com ansible_connection=ssh ansible_user=root ansible_ssh_pass=Password123!

# Database Servers
db1 ansible_host=server4.company.com ansible_connection=winrm ansible_user=administrator ansible_password=Password123!
@abnvanand
abnvanand / testing.md
Last active November 29, 2020 04:50
go testing

man pages

  • go help test
  • go help testflag

Naming Conventions

  • Add _test to filenames.
  • Prefix test functions with Test
  • Accept one param *testing.T
  • Same package name for whitebox testing
  • Add _test suffix to package name for blackbox testing
@abnvanand
abnvanand / robbyrussell.zsh-theme
Created September 13, 2020 08:06
robbyrussell theme with hostname when in ssh session
local hostname="%{$fg_bold[black]%}%m"
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)"
if [[ -n $SSH_CONNECTION ]]; then
PROMPT='${hostname} ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
else
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
fi
@abnvanand
abnvanand / docker.md
Last active December 11, 2019 18:04
docker

Docker

List images: docker images

Get image: docker pull ubuntu

Image to container: docker run -ti image-name proc-to-run -ti => terminal interactive

>> docker run -ti ubuntu:latest bash
root@91a4f28e6693:/# 
@abnvanand
abnvanand / readme.md
Created November 17, 2019 09:15
Raspberry pi find IP

Raspberry Pi find ip

TLDR; Continue if all you have are the following

  • raspberrypi
  • raspbian image
  • linux(ubuntu)
  • ethernet cable (LAN cable)
  • Internet (for installing required packages)
@abnvanand
abnvanand / mpi.md
Last active November 12, 2019 17:59
MPI Snippets

A sequence of collective communications on distinct procs will be matched in the order in which they are executed.

for eg here proc one receives value of x in y and y in x.

#include <bits/stdc++.h>
#include <mpi.h>

using namespace std;
@abnvanand
abnvanand / commands.md
Created June 6, 2019 10:33
Uninstall bloatware android