Skip to content

Instantly share code, notes, and snippets.

View pandasoli's full-sized avatar
🪴

Eli Soli pandasoli

🪴
View GitHub Profile
@pandasoli
pandasoli / shbuild
Last active April 15, 2025 02:59
A simple and extensible build system written in POSIX shell
#!/bin/sh -e
# Copyright © 2025 Eli Soli
SRCDIR="src"
BUILDDIR="build"
CC="${CC:-gcc}"
LD="${LD:-ld}"
BUILDFLAGS="$CFLAGS $(tr '\n' ' ' < compile_flags.txt)"
@pandasoli
pandasoli / netdrop
Last active May 5, 2025 00:33
A simple local network file share for UNIX-based systems
#!/bin/sh -e
# Usage: netdrop Start server
# netdrop host-number file Send file to server
# netdrop host-number Send piped text to server
get_local_ip() {
ip route get 10.254.254.254 2> /dev/null | awk '{print $7; exit}'
}
@pandasoli
pandasoli / background.ts
Created December 20, 2024 15:33
Chrome userScript messaging
/*
This file doesn't apply the Extension updates principles
mentioned in the Google's doc about userScripts.
Sources:
- https://developer.chrome.com/docs/extensions/reference/api/userScripts
- https://stackoverflow.com/questions/77578840/how-to-apply-dynamic-user-scripts-to-a-particular-tab-in-chrome-mv3-extension-u
*/
(async () => {
@pandasoli
pandasoli / main.c
Last active June 15, 2024 00:18
write a program that generates a 500 000 int array with values from 0 to 100and returns the sum, but do it with N threads, N>1 and chosen by argv value
#include <math.h>
#include <pthread.h>
#include <assert.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#define AMOUNT 500000
typedef struct thProps thProps;
struct thProps {
@pandasoli
pandasoli / find.sh
Last active July 10, 2024 04:02
Hack CEPED courses
#!/bin/bash
# -- Argv processing --
debug_level=0
max_threads=2
max_threads_tc=9
for (( i = 1; i < $#; i++ )); do
flag=${!i}
@pandasoli
pandasoli / .vimrc
Created March 11, 2024 04:24
My VIM configuration file
set nowrap
syntax on
set tabstop=2
set shiftwidth=2
set noexpandtab
set clipboard=unnamedplus
let g:markdown_recommended_style=0
let g:python_recommended_style=0
@pandasoli
pandasoli / main.vim
Created January 23, 2024 14:45
Simple functions to get and set the byte position of the cursor in Vim
function! GetBytePosition()
" Get EOL character size
" DOS files end with CRLF (\r\n)
let eol = &fileformat == 'dos' ? 2 : 1
let lines = getline(1, '$')
let row = line('.')
let col = col('.')
let pos = 0
@pandasoli
pandasoli / update-discordptb
Last active January 27, 2024 20:05
A simple script to update DiscordPTB for me
#!/bin/bash
function ask() {
read -p "$1 (Y/n): " response
[ -z "$response" ] || [ "$response" = 'y' ]
}
SYS="$HOME/sys"
DOWNLOADS="$HOME/Downloads"
@pandasoli
pandasoli / stack-frame.s
Last active December 26, 2023 21:53
Example of stack-frame in x32 AT&T GNU/AS
# as --32 -o main.o main.s
# ld -m elf_i386 -o main main.o
# ./main | xxd
.data
msg: .string "Hello, World!"
.text
.globl _start
@pandasoli
pandasoli / main.s
Created December 11, 2023 02:09
A simple program I made to figure out what happens when you `inc` on a 255-byte or `dec` on a 0-byte
# as --32 -o main.o main.s
# ld -m elf_i386 -o main main.o
# ./main | xxd
.data
pointer: .long list
.bss
list: .space 10