Skip to content

Instantly share code, notes, and snippets.

View nafisk's full-sized avatar
💣
blowing up code

Nafis Khan nafisk

💣
blowing up code
View GitHub Profile
@nafisk
nafisk / latency.markdown
Created August 15, 2024 22:32 — forked from hellerbarde/latency.markdown
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@nafisk
nafisk / shell_aliases
Created August 15, 2024 20:12 — forked from hellerbarde/shell_aliases
Shell Aliases
# Be nice to your computer
alias please='sudo'
alias plz='sudo'
# file managing stuff
alias r="PYTHONOPTIMIZE=1 /usr/bin/ranger"
alias l='ls'
alias perm='stat -c %a'
# Dogit
@nafisk
nafisk / PEP8_style_guide.md
Last active August 12, 2024 21:18
PEP8 Style Guide Summary

PEP 8 – Style Guide for Python Code

📐 Code Layout

  • Indentation: Use 4 spaces per indentation level. Continuation lines should align with the opening delimiter or use a hanging indent. Hanging indents should not have arguments on the first line and should further indent to distinguish from the rest.
    # Correct:
    def long_function_name(var_one, var_two,
                           var_three, var_four):
    

print(var_one)

@nafisk
nafisk / vim_cheatsheet.md
Last active August 12, 2024 21:18
Vim Cheatsheet

Vim Commands List

1. Vim Motions

  • Vim motions consist of modes and commands that help developers navigate and edit code more efficiently.
  • Vim comes with three modes:
    • Normal Mode: Where you type all the Vim commands.
    • Insert Mode: Where you actually write code.
    • Visual Mode: Helps us visually select and manipulate text.
  • Normal Visual Mode: Works like selecting text with a mouse.

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@nafisk
nafisk / LinuxCommands.md
Last active January 19, 2024 18:29
Linux Command Cheatsheet

Linux Commands Cheat Sheet

This Linux Commands Cheat Sheet provides a comprehensive list of commonly used Linux commands categorized for easy reference. Whether you're a seasoned Linux user or just getting started, this guide covers a wide range of tasks from system information and hardware details to file and directory management, process monitoring, security, and more.

Use this cheat sheet to quickly access essential commands for various tasks, making your Linux experience more efficient and productive.

Table of Contents: