Skip to content

Instantly share code, notes, and snippets.

View kmalloc's full-sized avatar
🍊
I may be slow to respond.

Mingdong Liao kmalloc

🍊
I may be slow to respond.
View GitHub Profile
@kmalloc
kmalloc / memory_layout.md
Created July 26, 2018 01:55 — 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
@kmalloc
kmalloc / procstat.c
Created April 18, 2018 09:41 — forked from arbinish/procstat.c
/proc/<PID>/stat information
/*
* Displays linux /proc/pid/stat in human-readable format
*
* Build: gcc -o procstat procstat.c
* Usage: procstat pid
* cat /proc/pid/stat | procstat
*
* Homepage: http://www.brokestream.com/procstat.html
* Version : 2009-03-05
*
@kmalloc
kmalloc / ipow.c
Last active August 29, 2015 14:06 — forked from orlp/ipow.c
int64_t ipow(int32_t base, uint8_t exp) {
static const uint8_t highest_bit_set[] = {
0, 1, 2, 2, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 255, // anything past 63 is a guaranteed overflow with base > 1