Skip to content

Instantly share code, notes, and snippets.

View waldson's full-sized avatar

Waldson Patrício waldson

  • Natal, RN
View GitHub Profile
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'
@iwishiwasaneagle
iwishiwasaneagle / latex_useful_one-liners.sh
Last active November 28, 2021 20:42
🧰 Useful CLI one-liners for LaTex
# Show all errors, warnings, and undefined messages in log file after compilation with location in log file for further analysis
grep -iHEn "error|warning|undefined" *.log
# Find all the duplicated labels in a directory
grep -ERh "\\\\label\{\w*:\w*\}" --include="*.tex" | tr -d " " | sort | uniq -c | awk '$1>1 {print $0}'
# Validate references.bib using https://github.com/Pezmc/BibLatex-Check
curl https://raw.githubusercontent.com/Pezmc/BibLatex-Check/master/biblatex_check.py 2>/dev/null | python - -b $(find ./ -maxdepth 1 -name "*.bib" | head -n1) -a $(find ./ -maxdepth 1 -name "*.aux" | head -n1)
# Find all the unused labels

Some useful custom text objects for vim

Collection of my custom text objects I use quite often.

97975602 6e90ee00 1dda 11eb 9286 6894300457e3

Numbers

Put it into your .vimrc:

# GIT heart FZF
# -------------
is_in_git_repo() {
git rev-parse HEAD > /dev/null 2>&1
}
fzf-down() {
fzf --height 50% --min-height 20 --border --bind ctrl-/:toggle-preview "$@"
}
@zarzen
zarzen / spacemacs-cpp.md
Last active January 23, 2024 13:06
C++ development environment setup in Spacemacs
@bishboria
bishboria / springer-free-maths-books.md
Last active June 8, 2024 06:39
Springer made a bunch of books available for free, these were the direct links

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies) (counter-example: MGA)
  5. All currencies are subdivided. (counter-examples: KRW, COP, JPY... Or subdivisions can be deprecated.)
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency. (EUR is the best example, but also Franc CFA, etc.)
@jboner
jboner / latency.txt
Last active June 21, 2024 04:31
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