Skip to content

Instantly share code, notes, and snippets.

View paranlee's full-sized avatar
🐧
Run RISC-V run!

Paran Lee paranlee

🐧
Run RISC-V run!
View GitHub Profile
@paranlee
paranlee / Linux 内核及内核模块开发环境搭建
Created December 29, 2023 12:07 — forked from Civitasv/Linux 内核及内核模块开发环境搭建
Build and run minimal Linux / Busybox systems in Qemu
## Common
````
export OPT=/opt
export BUILDS=/some/where/mini_linux
mkdir -p $BUILDS
````
## Linux kernel
@paranlee
paranlee / elf_format_cheatsheet.md
Created December 16, 2023 04:34 — forked from x0nu11byt3/elf_format_cheatsheet.md
ELF Format Cheatsheet

ELF Format Cheatsheet

Introduction

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

ELF

Compilation

@paranlee
paranlee / erlang-uftrace.md
Created October 2, 2023 01:22
erlang with uftrace
export CXXFLAGS="-g3 -O0 -pg"
make clean -j4
./configure
make -j -C erts/emulator debug
make -j4
make -j -C erts/emulator debug
make -j4 -C debug

export ERL_TOP=`pwd`
@paranlee
paranlee / ftrace_task_cpu_migrate.sh
Last active June 16, 2023 02:40
[독자 질문] 리눅스 커널: 프로세스 CPU 마이그레이션에 대한 질문 : ftrace.log 수집까지 bash shell script `sudo bash ftrace_task_cpu_migrate.sh`
#!/bin/bash
# sudo bash ftrace_task_cpu_migrate.sh
echo 0 > /sys/kernel/debug/tracing/tracing_on
sleep 1
echo "tracing_off"
echo 0 > /sys/kernel/debug/tracing/events/enable
sleep 1
@paranlee
paranlee / socket.c
Created May 15, 2023 12:58 — forked from nolim1t/socket.c
HTTP Request in C using low level write to socket functionality
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@paranlee
paranlee / http-server.c
Last active May 15, 2023 14:01 — forked from keiya/http-server.c
`gcc http.c -lcurl -o http.o` `sudo apt install libcurl4-openssl-dev -y` [ a simple http server ]feature: directory listing, high-throughput mmap io
#include <stdio.h> /* fprintf() */
#include <stdlib.h> /* exit() */
#include <sys/types.h> /* socket(), wait4() */
#include <sys/socket.h> /* socket() */
#include <netinet/in.h> /* struct sockaddr_in */
#include <sys/resource.h> /* wait4() */
#include <sys/wait.h> /* wait4() */
#include <pthread.h> /* pthread_create */
#include <netdb.h> /* getnameinfo() */
#include <string.h> /* strlen() */
@paranlee
paranlee / shell.c
Created April 23, 2023 17:03 — forked from parse/shell.c
Simple shell in C
/* Compile with: g++ -Wall –Werror -o shell shell.c */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
@paranlee
paranlee / scrape-images.py
Created April 21, 2023 14:09 — forked from firxworx/scrape-images.py
Web scraping with python: download all files linked to from a given web page with BeautifulSoup, urllib, and shutil
import urllib
import shutil
import re
from pathlib import Path
from bs4 import BeautifulSoup
# target page containing links to the image files
target_page = 'http://example.ca/image_links.php'
# local path
@paranlee
paranlee / lkdtm-as-ko.md
Last active February 12, 2023 13:30
LKDTM as lkdtm.ko Module build. https://elixir.bootlin.com/linux/v5.15/source/drivers/misc/lkdtm edit Makefile

Edit Makefile.

# SPDX-License-Identifier: GPL-2.0
KERNEL_PATH ?= /lib/modules/$(shell uname -r)/build

obj-m		+= lkdtm.o

lkdtm-objs		+= core.o
lkdtm-objs		+= bugs.o