Skip to content

Instantly share code, notes, and snippets.

View pandasoli's full-sized avatar
🪴

Eli Soli pandasoli

🪴
View GitHub Profile
@pandasoli
pandasoli / config.lua
Last active September 14, 2023 20:31
My LunarVim config file
-- General --
lvim.colorscheme = 'nord'
lvim.transparent_window = true
lvim.builtin.nvimtree.setup.view.side = 'right'
-- Restore cursor when close vim
vim.api.nvim_create_autocmd('VimLeave', {
@pandasoli
pandasoli / wherexy.py
Last active May 30, 2023 01:54
A function to get the current row and column of the cursor in the console
import re, sys, termios, tty
def getpos():
buff = ''
stdin = sys.stdin.fileno()
tattr = termios.tcgetattr(stdin)
try:
tty.setcbreak(stdin, termios.TCSANOW)
sys.stdout.write('\033[6n')
@pandasoli
pandasoli / getch.c
Last active May 31, 2023 17:10
Get char function
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define BUFFER_SIZE 10
/*
* If you desire track the mouse, active and desactive the mouse tracking.
*
* write(STDOUT_FILENO, "\e[?9h", 5); // active
@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
@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 / 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 / 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 / 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 / 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 / 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