Skip to content

Instantly share code, notes, and snippets.

View cubedtear's full-sized avatar

Aritz Lopez cubedtear

  • Donostia, Basque Country
View GitHub Profile
grammar FleetLang;
program
: tlds+=topLevelDecl* EOF
;
topLevelDecl
: function
| typeDecl
| declaration stmtEnd
@cubedtear
cubedtear / lumberjack.py
Last active September 4, 2020 19:04
Bot that plays Telegram Lumberjack (https://tbot.xyz/lumber)
from time import sleep # Bot for https://tbot.xyz/lumber
from mss import mss
from pyautogui import press
actions = ['left']
sleep(2)
with mss() as sct:
while True:
color = sct.grab({'top': 440, 'width': 4, 'left': 517, 'height': 150}).rgb
actions.append('left' if any(map(lambda x: color[x] > max(color[x+1:x+2]), range(0, len(color), 3))) else 'right')
action = actions.pop(0)
@cubedtear
cubedtear / script.sh
Last active July 7, 2023 04:37
Self-updating bash script
#!/usr/bin/env bash
VERSION="0.0.2"
SCRIPT_URL='https://gist.github.com/cubedtear/54434fc66439fc4e04e28bd658189701/raw'
SCRIPT_DESCRIPTION=""
SCRIPT_LOCATION="${BASH_SOURCE[@]}"
rm -f updater.sh
function update()
{
function contieneUnMes_(str) {
const meses = ["enero", "febrero", "marzo", "abril",
"mayo", "junio", "julio", "agosto",
"septiembre", "octubre", "noviembre", "diciembre"];
return meses.indexOf(str.split(" ")[0]) > -1;
}
function createMonthArray_() {
var result = [];
for (var a = 0; a<31; a++) result.push(0);
@cubedtear
cubedtear / profile.ps1
Last active January 31, 2025 11:35
Powershell snippets to add git aliases and autocompletion using https://github.com/dahlbyk/posh-git - Add it to your profile at "code $profile"
Remove-Alias gcm -Force -ErrorAction SilentlyContinue
Remove-Alias gp -Force -ErrorAction SilentlyContinue
function Git-gs { git status -sb $args }
Set-Alias gs Git-gs
function Git-g { git status -sb $args }
Set-Alias g Git-g
function Git-ga { git add $args }
Set-Alias ga Git-ga
function Git-gaa { git add . $args }
@cubedtear
cubedtear / iomonit.py
Created January 31, 2025 11:54
Self-contained python script to monitor HDD usage (read/write speed, queue length, and usage percentage)
import time
# Assuming sector size is 512 bytes
SECTOR_SIZE = 512
def get_disk_stats():
with open('/sys/block/sda/stat', 'r', encoding='ascii') as f:
stats = f.readline().split()