Skip to content

Instantly share code, notes, and snippets.

View AnimeshRy's full-sized avatar
🏠
Working from home

Animesh AnimeshRy

🏠
Working from home
View GitHub Profile
## install uv on OS
curl -LsSf https://astral.sh/uv/install.sh | sh
## create new project
uv init myproj
## install packages
uv add django requests "pandas>=2.3"
## remove package
@AnimeshRy
AnimeshRy / latency.txt
Created March 30, 2024 10:53 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@AnimeshRy
AnimeshRy / forwarder.py
Created April 22, 2023 10:41 — forked from LiveOverflow/forwarder.py
TCP Forwarder
import socket
import select
from logzero import logger
# python forwarder.py localhost:1337 ipinfo.io:80
# curl -v http://localhost.com:1337 -H "Host: ipinfo.io"
# video: https://www.youtube.com/watch?v=32KKwgF67Ho
class Forwarder:
@AnimeshRy
AnimeshRy / gist:54dfc9f0b20c84ea203513097ed81556
Created February 6, 2022 17:17
WSL2 Ubuntu NPM Install Slow Fix
I tried every solutions here, but nothing works for me.
But I found solutions.
in wsl, type below.
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf

Keybase proof

I hereby claim:

  • I am AnimeshRy on github.
  • I am era5tone (https://keybase.io/era5tone) on keybase.
  • I have a public key whose fingerprint is E825 374C 380C 3EFA 82B3 FF22 A6F1 6351 CCAA 205B

To claim this, I am signing this object:

@AnimeshRy
AnimeshRy / commitbot.py
Created May 17, 2021 21:54
Git Commit Bot
from time import sleep
import os
count=1
def update():
if 'a.txt' in os.listdir():
os.system('rename a.txt b.txt') #Renames file
elif 'b.txt' in os.listdir():
os.system('rename b.txt a.txt') #Renames file
@AnimeshRy
AnimeshRy / bashy.sh
Created May 25, 2020 19:26
cheatsheetbash
#! /bin/bash
# ECHO COMMAND
# echo Hello World!
# VARIABLES
# Uppercase by convention
# Letters, numbers, underscores
NAME="Bob"
# echo "My name is $NAME"
@AnimeshRy
AnimeshRy / plurality.c
Created January 6, 2020 22:36
Plurality Pset 2 CS50
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
// Max number of candidates
#define MAX 9
@AnimeshRy
AnimeshRy / runoff.c
Last active June 26, 2024 19:39
CS50 Runoff Pset3
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
// Max voters and candidates
#define MAX_VOTERS 100
#define MAX_CANDIDATES 9
@AnimeshRy
AnimeshRy / readability.c
Last active January 2, 2020 07:50
Readability Using Coleman-Liau index
#include <stdio.h>
#include <cs50.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
int letter;
int word;
int sentence;