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 / openssl.sh
Created July 4, 2024 15:06 — forked from NULLx76/openssl.sh
OpenSSL generate ed25519 and RSA
# Generate ed25519 privkey
openssl genpkey -algorithm ed25519 -out privkey.pem
# export its pubkey
openssl pkey -in privkey.pem -pubout -out pubkey.pem
# Generate RSA privkey
openssl genrsa -des3 -out private.pem 2048
# export its pubkey
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
@paranlee
paranlee / traceroute.py
Created June 26, 2024 09:09 — forked from aalmiramolla/traceroute.py
Python implementation of traceroute
# references:
# Learning by doing: Writing your own traceroute in 8 easy steps (Ksplice Blog)
# https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your
# Edited by: Alejandro Almira <laboral at alejandroalmira.com>
import datetime
import socket
import sys
@paranlee
paranlee / encrypt_openssl.md
Created June 20, 2024 10:15 — forked from dreikanter/encrypt_openssl.md
File encryption using OpenSSL

Symmetic encryption

For symmetic encryption, you can use the following:

To encrypt:

openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt

To decrypt:

@paranlee
paranlee / cc.sh
Created May 16, 2024 14:46
The provided bash script is designed to check write permission for regular files only. It filters out directories and symbolic links by using the `-type f` option with find. This option ensures that only files with the regular file type are processed.
#!/bin/bash
# Target path to check (passed as argument)
target_path="$1"
# Check if target path is empty
if [ -z "$target_path" ]; then
echo "Usage: $0 <target path>"
exit 1
fi
@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() */