Skip to content

Instantly share code, notes, and snippets.

View Venkat2811's full-sized avatar
:octocat:

Venkat Raman Venkat2811

:octocat:
View GitHub Profile
@Venkat2811
Venkat2811 / latency.txt
Created October 5, 2023 08:40 — 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
@Venkat2811
Venkat2811 / GoConcurrency.md
Created December 30, 2020 17:38 — forked from rushilgupta/GoConcurrency.md
Concurrency in golang and a mini Load-balancer

INTRO

Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".

Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).

Let's dig in:

Goroutines

@Venkat2811
Venkat2811 / curl.md
Created September 4, 2019 15:38 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@Venkat2811
Venkat2811 / kill_all_processes_by_name.sh
Created December 28, 2016 06:56
Shell script to grep and kill all process by name. Usage `sudo ./kill_all_processes_by_name.sh process_name`
#!/bin/bash
i="1"
echo "Running Script to kill all $1 processes"
while [[ $i -lt 100 ]]; do
PID=`ps -ef | grep $1 | grep -v 'grep' | awk '{print $2}'`
if [[ "" != "$PID" ]]; then
echo "killing $PID"
kill -9 $PID
@Venkat2811
Venkat2811 / rxweb.py
Created August 24, 2016 13:32 — forked from yarosla/rxweb.py
RxPy + Twisted example - simplistic web server.
# coding=utf-8
from StringIO import StringIO
from datetime import timedelta
from rx import Observer
from rx.concurrency import TwistedScheduler
from rx.disposables import Disposable
from rx.subjects import Subject
from twisted.internet.protocol import Factory, Protocol, connectionDone
from twisted.internet.endpoints import TCP4ServerEndpoint