Skip to content

Instantly share code, notes, and snippets.

View sohailnajar's full-sized avatar
👋

Sohail Najar sohailnajar

👋
View GitHub Profile
@sohailnajar
sohailnajar / gonumbers.go
Last active December 16, 2023 20:50
golang split number
package gonumbers
func SplitNumber(n int) []int {
slc := []int{}
for n > 0 {
slc = append(slc, n%10)
n = n / 10
}
// reverse the slice
for i, j := 0, len(slc)-1; i < j; i, j = i+1, j-1 {
@sohailnajar
sohailnajar / jq-profilejsonschema.md
Created July 12, 2023 14:28 — forked from mikehwang/jq-profilejsonschema.md
Use jq to profile the schema of a given JSON object or an array of JSONs objects

Profile JSON schema

Using jq is great for examining JSON objects. You can extend its functionality with custom methods. The following is useful to understand at a high level the structure of arbitrary JSONs which is useful when trying to understand new data sources.

Requires jq verison 1.5.

Profile an object

Add the following method to your ~/.jq:

@sohailnajar
sohailnajar / System Design.md
Created May 12, 2021 02:30 — 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?
@sohailnajar
sohailnajar / memory_layout.md
Created April 30, 2020 13:54 — forked from CMCDragonkai/memory_layout.md
Linux: Understanding the Memory Layout of Linux Executables

Understanding the Memory Layout of Linux Executables

Required tools for playing around with memory:

  • hexdump
  • objdump
  • readelf
  • xxd
  • gcore