Skip to content

Instantly share code, notes, and snippets.

View niepiekm's full-sized avatar

Marek Niepiekło niepiekm

View GitHub Profile
@syuu1228
syuu1228 / arm-mmap.s
Last active December 8, 2021 21:20
Linux/arm EABI system call sample program
@ This is Linux/arm EABI system call sample program.
@
@ Build with following command:
@ as -o arm-mmap.o arm-mmap.s
@ ld -o arm-mmap arm-mmap.o
@
@ You can see the program issues system calls by following command:
@ strace ./arm-mmap
@
@cpq
cpq / Stack.md
Last active March 29, 2025 06:49
Why stack grows down

Why stack grows down

Any running process has several memory regions: code, read-only data, read-write data, et cetera. Some regions, such as code and read-only data, are static and do not change over time. Other regions are dynamic: they can expand and shrink. Usually there are two such regions: dynamic read-write data region, called heap, and a region called stack. Heap holds dynamic memory allocations, and stack is mostly used for keeping function frames.

Both stack and heap can grow. An OS doesn't know in advance whether stack or heap will be used predominantly. Therefore, an OS must layout these two memory regions in a way to guarantee maximum space for both. And here is the solution:

  1. Layout static memory regions at the edges of process's virtual memory
  2. Put heap and stack on edges too, and let them grow towards each other: one grows up, one grows down
@iamnewton
iamnewton / bash-colors.md
Last active July 13, 2025 15:19
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
Start every day coding, end every day thinking.
1. Warmup exercise (30 mins)
Make sure to have these ready the night before, pick stuff
that you can work on right away without having to study
in advance.
They can either be book exercises or stuff
from other sources, but they should be self-verifiable
@giuseppebarba
giuseppebarba / gist:10149352
Last active March 22, 2018 14:25
Android Debugging
Some system properties:
--------------------------------------------------------------------------------
setprop debug.db.uid 32767
That will cause the crash catcher (debuggerd) to freeze the process,
allowing you to use gdb/gdbserver to debug it.
In the source tree, after you "source build/envsetup.sh" and use
"lunch" or "choosecombo", you will have a shell command called
"gdbclient". By default, it expects to debug "app_process" on port
@StrikeW
StrikeW / format_st_mtime.c
Created April 20, 2014 15:25
format st_mtime which get from stat()
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <time.h>
int main(int argc, char *argv[])
{
struct stat st;
char *f = "README";
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active July 24, 2025 13:35
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@staltz
staltz / introrx.md
Last active August 2, 2025 18:25
The introduction to Reactive Programming you've been missing
@adamhotep
adamhotep / gnome-keyring-query.c
Last active March 5, 2019 03:58
Simple command-line interface to GNOME keyring
/*
* gnome-keyring-query, for simple command-line interactions with gnome-keyring.
*
* To compile and install:
*
* sudo apt-get install libgnome-keyring-dev libglib2.0-dev
* gcc `pkg-config --cflags --libs gnome-keyring-1 glib-2.0` -o gnome-keyring-query gnome-keyring-query.c
* chmod +x gnome-keyring-query
* sudo cp -p gnome-keyring-query /usr/local/bin/
*
@johnpolacek
johnpolacek / .gitconfig
Last active June 13, 2025 03:17
My current .gitconfig aliases
[alias]
recent = "!git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:short) %(refname:short)' | head -n 10"
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status