Skip to content

Instantly share code, notes, and snippets.

@sanjeev2838
sanjeev2838 / 01.bash_shortcuts_v2.md
Created April 16, 2025 07:53 — forked from tuxfight3r/01.bash_shortcuts_v2.md
Bash keyboard shortcuts

Bash Shortcuts

visual cheetsheet

Moving

command description
ctrl + a Goto BEGINNING of command line
@sanjeev2838
sanjeev2838 / latency.txt
Created January 24, 2025 02:48 — 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
@sanjeev2838
sanjeev2838 / JetBrains trial reset.md
Created September 11, 2024 09:37
Reset all JetBrains products trial in Linux

In some cases, only these lines will work

for product in IntelliJIdea WebStorm DataGrip PhpStorm CLion PyCharm GoLand RubyMine; do
    rm -rf ~/.config/$product*/eval 2> /dev/null
    rm -rf ~/.config/JetBrains/$product*/eval 2> /dev/null
done

But if not, try these

@sanjeev2838
sanjeev2838 / iterm2.md
Created May 4, 2024 13:06 — forked from squarism/iterm2.md
An iTerm2 Cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@sanjeev2838
sanjeev2838 / find_dups.rb
Created July 31, 2022 13:28 — forked from rob-murray/find_dups.rb
Rails find duplicate records
columns_that_make_record_distinct = [:some_id, :another_name]
distinct_ids = Model.select("MIN(id) as id").group(columns_that_make_record_distinct).map(&:id)
duplicate_records = Model.where.not(id: distinct_ids)
@sanjeev2838
sanjeev2838 / toys.rb
Created August 3, 2021 18:32 — forked from lucapette/toys.rb
methods to create toys arrays and hashes
class Array
def self.toy(n=10, &block)
block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1}
end
end
class Hash
def self.toy(n=10)
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]
end
rubocop -a `git diff --name-only --cached | grep '\.rb'`

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@sanjeev2838
sanjeev2838 / rubymine-reset-eval.sh
Created May 1, 2020 11:46 — forked from gcasa/rubymine-reset-eval.sh
Reset RubyMine (and other JetBrains products) evaluation period.
#!/usr/bin/env bash
# $ crontab -e
# 0 0 25 * * * ~/bin/rubymine-reset-eval.sh
# Directories
LIB=${HOME}/Library
PREFS=${LIB}/Preferences
CACHE=${LIB}/Caches
ASUPP=${LIB}/Application\ Support