Skip to content

Instantly share code, notes, and snippets.

ELF Format Cheatsheet

Introduction

Executable and Linkable Format (ELF), is the default binary format on Linux-based systems.

ELF

Compilation

@juniorprincewang
juniorprincewang / tcp_client.go
Created April 26, 2023 06:10 — forked from abhishekkr/tcp_client.go
simple golang's net example
package main
import (
"fmt"
"io/ioutil"
"net"
"os"
)
const (
@juniorprincewang
juniorprincewang / launch.json
Created November 29, 2022 07:19 — forked from xanathar/launch.json
launch.json to debug Rust with VsCode
{
// The following are sample configurations for common case scenarios of debugging
// Rust in Visual Studio Code
//
// For syntax, visit: https://go.microsoft.com/fwlink/?linkid=830387
//
"version": "0.2.0",
"configurations": [
{
"name": "Launch an application",
@juniorprincewang
juniorprincewang / Asset.sh
Created October 12, 2022 02:58 — forked from JoeyBurzynski/Asset.sh
Bash Scripting: Check if a Bash Variable Has Been Set (Or Is Empty String)
# How to determine if a bash variable is empty?
# A variable in bash (and any POSIX-compatible shell) can be in one of three states:
#
# unset
# set to the empty string
# set to a non-empty string
# Most of the time you only need to know if a variable is set to a non-empty string, but occasionally it's important to distinguish between unset and set # to the empty string.
#
#include <cmath>
#include <thread>
#include <Windows.h>
#include <MMSystem.h>
#pragma comment(lib, "winmm")
struct MultiMediaTimer {
static const wchar_t* name;
static LARGE_INTEGER elapsed[10000];
static int idx;
@juniorprincewang
juniorprincewang / Makefile
Last active June 15, 2022 08:22 — forked from kishmakov/Makefile
Shared libraries and Address Sanitizer (ASAN)
SAN_CMP := -fno-omit-frame-pointer -fsanitize=address
SAN_STAT := -static-libstdc++ -static-libasan
BIN_CMP := -std=c++11 -c -I. main.cpp -O -g3 -o main.o
LIB_CMP := -std=c++11 my.cpp -o libmy.so -shared -fPIC -g3
RUN := LD_LIBRARY_PATH=. ASAN_OPTIONS=symbolize=1 ASAN_SYMBOLIZER_PATH=$(shell which llvm-symbolizer)
PRELOAD := LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libasan.so.5
lib-gcc:
@juniorprincewang
juniorprincewang / Android.mk
Created August 3, 2021 06:15 — forked from akshar100/Android.mk
To add your own modules to the kernel of the Android-x86 project. Replace the Android.mk file in the kernel folder with this file.
#
# Copyright (C) 2009-2011 The Android-x86 Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@juniorprincewang
juniorprincewang / mesa-howto.md
Created June 22, 2021 07:12 — forked from Venemo/mesa-howto.md
How to build and use mesa from source

Building and using mesa for development and testing

This explains how to build mesa from source, and how to use the custom built mesa to run some apps and games, without needing to replace the mesa libraries that your operating system runs on.

Let's assume that you are using an x86_64 system.

Install dependencies

This is how to install them on Fedora. You can substitute with other distros' package managers, the packages are named similarly but maybe have a different naming convention (eg. -dev vs. -devel, etc.).

@juniorprincewang
juniorprincewang / Makefile
Created May 11, 2021 02:10 — forked from EXL/1-ReadMe.md
OpenGLES for Linux example
all:
$(CC) *.c -lm `sdl2-config --cflags` `sdl2-config --libs` -lEGL -lGLESv1_CM -o gles_linux
clean:
-rm -f gles_linux
-rm -f *.o
@juniorprincewang
juniorprincewang / gem_ioctl_new.log
Created July 24, 2020 16:31
1. user mmu/mem/vmm are used
nouveau 0000:01:00.0: DRM: func nouveau_gem_ioctl_new size 0x24
nouveau 0000:01:00.0: DRM: func nouveau_bo_new size 0000000000000024 flags 4
nouveau 0000:01:00.0: DRM: page shift 12, pi 1
nouveau: DRM-master:00000000:00000000: ioctl: size 82
nouveau: DRM-master:00000000:00000000: ioctl: vers 0 type 02 object ffff9eb9ff0800f8 owner ff
nouveau: DRM-master:00000000:80009009: ioctl: new size 58
nouveau: DRM-master:00000000:80009009: ioctl: new vers 0 handle 00000000 class 8000900b route 00 token ffff9eba44a8e090 object ffff9eba44a8e090
nouveau: DRM-master:00000000:80009009: func nvkm_ummu_sclass
nouveau: DRM-master:00000000:80009009: func nvkm_umem_new type 5 page 12 size 0x1000
nouveau 0000:01:00.0: mmu: func nvkm_mem_new_type type NVKM_MEM_VRAM