Skip to content

Instantly share code, notes, and snippets.

@sujeet-agrahari
sujeet-agrahari / grokking_to_leetcode.md
Created January 7, 2025 07:38 — 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

@sujeet-agrahari
sujeet-agrahari / admin.sql
Created July 6, 2023 18:21 — forked from namrata4/admin.sql
Handy PostgreSQL Monitoring Scripts
-- turn off paging (less/more)
psql> \pset pager off
/*
Pager usage is off.
*/
-- find an object name by id
SELECT OID, relname
WITH table_scans as (
SELECT relid,
tables.idx_scan + tables.seq_scan as all_scans,
( tables.n_tup_ins + tables.n_tup_upd + tables.n_tup_del ) as writes,
pg_relation_size(relid) as table_size
FROM pg_stat_user_tables as tables
),
all_writes as (
SELECT sum(writes) as total_writes
FROM table_scans
@sujeet-agrahari
sujeet-agrahari / psql_useful_stat_queries.sql
Created June 28, 2023 17:54 — forked from anvk/psql_useful_stat_queries.sql
List of some useful Stat Queries for PSQL
--- PSQL queries which also duplicated from https://github.com/anvk/AwesomePSQLList/blob/master/README.md
--- some of them taken from https://www.slideshare.net/alexeylesovsky/deep-dive-into-postgresql-statistics-54594192
-- I'm not an expert in PSQL. Just a developer who is trying to accumulate useful stat queries which could potentially explain problems in your Postgres DB.
------------
-- Basics --
------------
-- Get indexes of tables
echo-server-epoll
echo-server-poll
talk
talk.dSYM
reosurces: https://www.jsv9000.app/
http://latentflip.com/loupe/
Work as a browser engineer who is expert in creating web browsers. Who is also expert in javascript. Validate and correct below statement and also answer the question:
There are three main components on browser side javascript runtime i.e. v8, web apis, and a event loop that watches on the callback queues and executes it.
question1 : How many type of callback queues are there in this case? What are their priority and what type of tasks they hold?
question2: If there is an express ` a = a +1` does it go to event loop or executed on v8 right away?
ChatGPT
The statement you provided is mostly accurate. However, it's important to clarify a few points.
@sujeet-agrahari
sujeet-agrahari / query.mongodb
Last active December 3, 2022 18:01
mongodb-aggregation
// MongoDB Playground
// Use Ctrl+Space inside a snippet or a string literal to trigger completions.
const database = 'ecommerce';
// The current database to use.
use(database);
// Create a new collection.
// db.createCollection(collection);
@sujeet-agrahari
sujeet-agrahari / elastic search query
Last active November 13, 2022 07:52
Elastic Search Queries
GET players/_search
{
"track_total_hits": true
}
GET players/_search
{
"query": {
"range": {
"@timestamp": {
@sujeet-agrahari
sujeet-agrahari / .zshrc
Last active October 12, 2022 07:19
p10k.zsh
# Fig pre block. Keep at the top of this file.
[[ -f "$HOME/.fig/shell/zshrc.pre.zsh" ]] && builtin source "$HOME/.fig/shell/zshrc.pre.zsh"
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.