Skip to content

Instantly share code, notes, and snippets.

View lucascompython's full-sized avatar

Lucas lucascompython

  • 01:55 (UTC +01:00)
View GitHub Profile
@lucascompython
lucascompython / calc_optimal.py
Last active April 2, 2025 10:40
lzbench results ran on the 01/04/25 | lzbench 2.0.2 (64-bit Linux) AMD A9-9420 RADEON R5, 5 COMPUTE CORES 2C+3G
import polars as pl
import argparse
import sys
from typing import List, Dict, Tuple
def calculate_optimal_algorithm(
csv_file: str,
file_size_mb: float,
upload_speed_mbps: float,
download_speed_mbps: float = None,
@lucascompython
lucascompython / zed_cheatsheet.txt
Last active April 22, 2025 07:21
Zed cheatsheet
# Match Selection
g-a -> select all match
g-l -> select next match
g-shit l -> select previous match
g-l and then c -> select next match, remove the text and enter insert mode
# Pane Spliting
ctrl-w a -> split window
ctrl-k down -> split window down
@lucascompython
lucascompython / atop.md
Last active March 19, 2023 19:07
Make a terminal show both information of your CPU and GPU!

ATOP (all top)

REALLY simple (4 lines) script that uses Tmux to split the terminal vertically and open nvtop to the left and btop to the right.

Preview

Preview image

Code

As I said really simple!

#!/bin/sh
@lucascompython
lucascompython / pacsize.sh
Created June 5, 2022 21:03
Shell script (basically just awk) to view a list of the packages that use more space in your disk, PACMAN ONLY.
#!/bin/sh
pacman -Qi | awk $@ '
BEGIN {
units["B"] = 0
units["KiB"] = 1
units["MiB"] = 2
units["GiB"] = 3
if (unit == "") unit = "MiB"
if (min == "") min = 50
if (pad == "") pad = 10
@lucascompython
lucascompython / opencv resizer_watermark.py
Created March 21, 2022 20:53
This is a faster resizer that also applies an watermark image using opencv
import cv2, os
watermark = cv2.imread(os.path.join("watermark.jpg"))
h_wtmk, w_wtmk = watermark.shape[:2]
def resize(inpath: str, outpath: str, size: tuple = (768, 512), inter: int = cv2.INTER_AREA) -> None:
@lucascompython
lucascompython / typeracer-chear.js
Last active March 18, 2022 08:57
This is a very simple typeracer-cheat
/* ==== Typeracer Cheat ==== */
//Paste this script into the developer console right before the race start
//Now you can press any key and it will enter the correct one
var arrSpan = document.querySelectorAll('[unselectable="on"]');
var fullSentence = '';
arrSpan.forEach(function (item) {
fullSentence += item.innerHTML;
@lucascompython
lucascompython / base64toblob.js
Created February 25, 2022 21:58
This is a javascript function to convert a given base64 string to a blob.
const b64toBlob = (b64Data, contentType='', sliceSize=512) => {
const byteCharacters = atob(b64Data);
const byteArrays = [];
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
const slice = byteCharacters.slice(offset, offset + sliceSize);
const byteNumbers = new Array(slice.length);
for (let i = 0; i < slice.length; i++) {
byteNumbers[i] = slice.charCodeAt(i);
@lucascompython
lucascompython / resizer.py
Last active February 24, 2022 21:27
This is a very simple image resizer that keeps the aspect ratio.
import os, sys
from PIL import Image
def rezise(dir, size: tuple = (768, 512)) -> None:
for infile in os.listdir(dir):
outfile = os.path.splitext(infile)[0] + "_resized.thumbnail"
if infile != outfile:
try: