Posts for: #Notes

Regex Cheatsheet

We can use regular expression for regular find operations as well as replace.

SymbolDescriptionSample TextRegexOutput
Letters\wMatches any latin letter or digitSample\wS a m p l e
\WMatches any non-alphanumeric character
Digits\dMatches any decimal digitNumbers: 1, 2, 3, 100, 200\dNumbers: 1, 2, 3, 1 0 0, 2 0 0
\DMatches any non decimal digit character.
Repetition+Matches one or more repetition of symbol (select whole word or digit)Sample Text.\w+Sample Text.
Repetition*Matches Zero or more occurrences of the symbol1 , 2, 3, 10, 20, 100, 200\d\d*1, 2, 3, 10, 20, 100, 200
Set[]Matches set of charactersAll symbols inside the braces.[abc] will match a,b or cAll symbols inside the braces.
[a-c]Works similarly to [abc]
[^abc]Match any character except a,b or c[^abc]All symbols inside the braces.
Special Symbols\. \[ \+Match symbols that bear special meaning for regex. need to escape with \2+2+2+2
Alterationa|bWill match a or bnumbers: 1, 2, 3, 100[a-f]|\dnumbers: 1, 2, 3, 1 0 0
Single Character.Matches any character other than newlineThis is test..*This is test.
Optional?Makes the symbol optionalhe and shes?hehe and she
Start Of string^Matches the start of a string without consuming charactersstart of string^\w+start of string
End Of string$Matches the end of string without consuming charactersend of string\w+$end of string
Word Boundary\bMatches boundaries of word. \b\w and \w\b will match first and last letter in word.Immortal Gods\b\wImmortal Gods
Immortal Gods\w\bImmortal Gods
Space Symbol\sMatch any space symbolsThis is test.\sThis is test.
\SMatches a single character which is not white space.
Number of Repetitions{min_num, max_num}Number of repetitions for an expression.I remember, Nick.\w{3,5}I remem-ber, Nick
{n}Exactly n receptionsI remember, Nick.\w{3}I rem-member, Nick.
{n,}N or moreI remember, Nick.\w{3,}I remember, Nick.
Grouping()Group of the match by putting them in braces.John Smith(\w+)\s(\w+)John Smith
Replacing$1 $2We can use groups for replacing, referencing by numbers: $1 $2 (selecting group 1 and group 2 using $1 $2)John Smith(\w+)\s(\w+) replace with $2 $1Smith John
Backreferenace (Contents In Capture Group)\1It will return a string with the content from the first capture group. 1 can be any number as long as it corresponds to a valid capture group.6362888232275296622(\d)\163628882322752966 22
Lookeaheads(?=)abc(?=d) will match abc only if it is followed by d.abcdabc(?=d)abcd
Read more

Go


Go is a programming language that focuses on simplicity and speed. It’s simpler than other languages, so it’s quicker to learn. And it lets you harness the power of today’s multicore computer processor, so your programs run faster.

History of Go

Back in 2007, the search engine Google had a problem. They had to maintain programs with millions of line of code. Before they could test new changes, they had to compile the code into runnable form, a process which at the time took the better part of an hour. Needless to say, this was bad for developer productivity.

Read more

System Design


Zero To Millions of Users

In this section, we will explores the process of scaling a system from supporting a single user to eventually serving millions of users.

Single Server Setup

In any system development journey, it’s best to begin with a simple step, and that applies even to complex systems. We initiate this process by running everything on a single server. This single server setup includes web services, applications, databases, caching, and more.

Read more