Skip to content

Instantly share code, notes, and snippets.

View pandasoli's full-sized avatar
🪴

Eli Soli pandasoli

🪴
View GitHub Profile
@pandasoli
pandasoli / child.py
Last active December 11, 2023 02:09
A script that run a file and reads its stdout and stderr buffers
#!/usr/bin/env python3
from sys import stdout, stderr
stderr.write(f'Error: Something went wrong!{"a" * 2048}\n')
stdout.write('Success: Something went normal!\n')
print('Just the same from print()')
@pandasoli
pandasoli / server.c
Last active October 27, 2023 19:31
Simple HTTP server in C
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <pthread.h>
#include <regex.h>
#include <string.h>
#include <unistd.h>
@pandasoli
pandasoli / vol
Last active June 7, 2024 05:47
Simple script to help changing volume with pulseaudio
#!/bin/bash
program=$(basename "$0")
help="\
\rUsage: $program [OPTION|VOLUME]\n\
\rChange volume\n\
\rVOLUME can be \e[90m/$num_regex\e[90m/\e[m\n\
\r\n\
\r$(printf "%-30s %s" "$program <sink id?> <volume>" "Set volume level")\n\
@pandasoli
pandasoli / brightness
Last active April 10, 2025 03:25
Script to change monitor brightness
#!/usr/bin/sh -e
# Usage: brightness level
device="/sys/class/backlight/acpi_video0"
file="$device/brightness"
max=$(cat "$device/max_brightness")
case $1 in *[!0-9]*|"")
echo "Provide a positive number smaller or equal to $max." >&2
@pandasoli
pandasoli / main.go
Created October 7, 2023 23:09
Watch terminal size in Golang
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"github.com/pandasoli/goterm"
)
@pandasoli
pandasoli / resverse-edited.py
Created September 4, 2023 00:18
A script to make a message with a reserve "(edited)" tag
import requests
# Discover your Discord token:
# `https://mediaboss.fr/pt/encontrar-token-discordancia`
class Exploit:
MAGIC_CHAR = '\u202b'
def __init__(self, token, channel_id, message):
self.token = token
@pandasoli
pandasoli / config.fish
Created August 17, 2023 06:42
This is my FishShell config file
if status is-interactive
# Commands to run in interactive sessions can go here
export PATH="$PATH:$HOME/.local/bin"
export PATH="$PATH:$HOME/.cargo/bin"
export PATH="$PATH:$HOME/.deno/bin"
export PATH="$PATH:/usr/local/go/bin"
# Perl
begin
export PATH="$PATH:$HOME/perl5/bin"
@pandasoli
pandasoli / colortext.cmd
Last active July 15, 2023 15:22
A BatchScript lib to print colored text
setlocal & rem [color, text]
<nul set /p ".=%COLORTEXT_DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1
(
endlocal
exit /b 0
)
@pandasoli
pandasoli / oop.c
Created May 30, 2023 01:54
How to reproduce OOP in CLang
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
struct Person {
char name[10];
uint8_t age;
uint8_t height;
@pandasoli
pandasoli / wherexy.c
Created May 30, 2023 01:50
A function to get the current row and column of the cursor in the console
#include <stdio.h>
int wherexy(int *x, int *y) {
printf("\033[6n");
if (getch() != '\x1B') return 1;
if (getch() != '\x5B') return 1;
int