Skip to content

Instantly share code, notes, and snippets.

@anshprat
anshprat / latency.txt
Created October 31, 2023 09:57 — 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
@anshprat
anshprat / lima-on-m1-mac-installation-guide.md
Created August 6, 2022 06:17 — forked from toricls/lima-on-m1-mac-installation-guide.md
Using Lima to run containers with containerd and nerdctl (without Docker Desktop) on M1 Macs

Sourced from https://gist.github.com/toricls/d3dd0bec7d4c6ddbcf2d25f211e8cd7b

Lima (Linux virtual machines, on macOS) installation guide for M1 Mac.

Sep. 27th 2021 UPDATED

Now we can install patched version of QEMU via Homebrew (thank you everyone for the info!). Here is the updated instruction with it:

Used M1 Mac mini 2020 with macOS Big Sur Version 11.6.

@anshprat
anshprat / gist:27512a7dc59eba27fed2954feeb8d20a
Last active July 22, 2021 16:10
Hotstar/SonyLiv Akamai DNS broken in India
➜ ~ dig www.hotstar.com +trace
; <<>> DiG 9.10.6 <<>> www.hotstar.com +trace
;; global options: +cmd
. 87007 IN NS m.root-servers.net.
. 87007 IN NS b.root-servers.net.
. 87007 IN NS c.root-servers.net.
. 87007 IN NS d.root-servers.net.
. 87007 IN NS e.root-servers.net.
. 87007 IN NS f.root-servers.net.

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@anshprat
anshprat / gist:516ba353c1933afaeef6874a7efef02e
Last active June 4, 2019 06:30
run_chromium_fullscreen.sh
#!/bin/bash
ps aux|grep chromium-browser|grep -v grep
is_chromium_not_running=$?
if [ ${is_chromium_not_running} -eq 1 ]
then
chromium-browser --start-fullscreen "https://grabpay.atlassian.net/plugins/servlet/Wallboard/?dashboardId=10113" &>/dev/null &
fi
With /etc/hosts pointing to 18.205.93.0 , 18.205.93.1 and 18.205.93.2 in that order
mouthwash :~/tmp\>echo | openssl s_client -showcerts -servername gnupg.org -connect bitbucket.org:443 2>/dev/null | openssl x509 -inform pem -noout -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
0a:7e:ec:9b:39:52:f1:7e:2f:67:16:55:7a:6f:52:7d
Signature Algorithm: sha256WithRSAEncryption
Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert SHA2 Extended Validation Server CA
git pull -vvv
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:wezjvpBxKKg7bKiQ3YStGkNRWONvYAxPHv5zAvNqnLs.
Please contact your system administrator.
@anshprat
anshprat / gist:517d1420198c67001738ffa02f86ec01
Created June 6, 2018 00:49
unbale to connect to 1.1.1.1 w/ either libressl or openssl
mouthwash :~/tmp\>curl -vvv https://1.1.1.1
* Rebuilt URL to: https://1.1.1.1/
* Trying 1.1.1.1...
* TCP_NODELAY set
* Connected to 1.1.1.1 (1.1.1.1) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /usr/local/etc/openssl/cert.pem
CApath: /usr/local/etc/openssl/certs

Keybase proof

I hereby claim:

  • I am anshprat on github.
  • I am anshu (https://keybase.io/anshu) on keybase.
  • I have a public key ASBMZklZ_Ng8tXwENWNUfAuUSWOsVonZP4EwFjguSKMzZQo

To claim this, I am signing this object:

\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n