Skip to content

Instantly share code, notes, and snippets.

@praveen-krishn
praveen-krishn / System Design.md
Created October 9, 2023 04:38 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@praveen-krishn
praveen-krishn / mainpython.md
Created May 3, 2020 20:14 — forked from rochacbruno/mainpython.md
Use of __main__.py

The use of __main__.py to create executables

myprojectfolder/
    |_ __main__.py
    |_ __init__.py

Being __main__.py:

print("Hello")

@praveen-krishn
praveen-krishn / latency.txt
Created July 29, 2019 06:34 — 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
@praveen-krishn
praveen-krishn / autopgsqlbackup
Created July 10, 2017 04:34 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9
@praveen-krishn
praveen-krishn / ora_impdp_expdp
Last active August 9, 2016 05:48 — forked from bulain/ora_impdp_expdp.bat
using expdp and impdp in oracle 10g 11g
# For remote usage: https://oracle-base.com/articles/10g/oracle-data-pump-10g
# create directory
create directory dmpdir as 'c:/temp';
select directory_name,directory_path from dba_directories;
# expdp owner
create user scott identified by tiger;
grant connect, resource to scott;
...
grant read, write on directory dmpdir to scott;
@praveen-krishn
praveen-krishn / show-remote-branch-info.sh
Created July 1, 2016 05:16 — forked from jdigger/show-remote-branch-info.sh
Too many crusty old git branches? Run this to find likely candidates for deletion. It lists all the remote branches and sorts them by age.
#!/bin/sh
#
# Too many crusty old git branches? Run this to find likely candidates for deletion
# It lists all the remote branches and sorts them by age.
#
#for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%ci %cr %cn " $k|head -n 1`\\t$k;done|sort -r
for k in `git branch -r|awk '{print $1}'`;do echo `git show --pretty=format:"%Cgreen%ci %Cblue%cr %Cred%cn %Creset" $k|head -n 1`\\t$k;done|sort -r
@praveen-krishn
praveen-krishn / genclient
Created February 15, 2016 12:21 — forked from wsargent/genclient
Create a working(!) client certificate for use with nginx, using only keytool
#!/bin/bash
export PW=`pwgen -Bs 10 1`
echo "$PW" > password
# Create a self signed certificate & private key to create a root certificate authority.
keytool -genkeypair -v \
-alias clientCA \
-keystore client.jks \