Skip to content

Instantly share code, notes, and snippets.

@hex0x0000
hex0x0000 / snake.py
Created October 27, 2025 22:12
snake.py
#!/usr/bin/env python
import curses
from random import randint
VOID, APPLE, UP, DOWN, LEFT, RIGHT, HEAD = range(0, 7)
# height
H = 0
# width
@hex0x0000
hex0x0000 / vid2ascii.sh
Created August 23, 2024 21:09
Converts a video to ascii
#!/usr/bin/env bash
# requires jp2a and ffmpeg
FILENAME="vid.mp4"
OUTDIR="./vid"
CONVERT=0
printhelp() {
echo "USAGE: $(basename $0) [-c FILENAME] [-o OUTDIR] [-h]"
echo "Converts a video to ascii, and plays the output"
@hex0x0000
hex0x0000 / mkchroot.sh
Created February 29, 2024 11:42
Gentoo useful script for mounting devices necessary for the chroot environment
#!/bin/bash
if [[ -z "$1" ]] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
echo Usage: mkchroot ROOT_DEVICE [BOOT_DEVICE] [HOME_DEVICE]
exit
fi
if [[ ! -z "$(findmnt -nr -o target -S $1)" ]]; then
echo Partition has already been mounted
exit 1
@hex0x0000
hex0x0000 / miniban.sh
Last active February 11, 2024 18:10
Simple script that bans unwanted bots from clogging up your servers
#!/bin/sh
# /usr/bin/miniban
# MIT License
#
# Copyright (c) 2024 hex0x0000 <hex0x0000@protonmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@hex0x0000
hex0x0000 / governor.sh
Created December 29, 2023 19:37
Simple CPU governor controller script, works with just bash and linux /sys/ files
#!/bin/bash
AVAILABLE_GOVERNORS=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
if [[ $1 == "-h" ]]; then
echo "USAGE:"
echo -e "\tgovernor [GOVERNOR] - Sets governor if valid, otherwise returns errors"
echo -e "\tgovernor [FLAGS]"
echo -e "\tgovernor [No args] - Shows current governor"
echo "FLAGS:"
@hex0x0000
hex0x0000 / brightness.sh
Created December 29, 2023 19:36
Simple brightness controller script, works with just bash and linux /sys/ files
#!/bin/bash
DEVICE="amdgpu_bl0"
BL_PATH="/sys/class/backlight/$DEVICE"
MAX_VAL=$(cat $BL_PATH/max_brightness)
CURRENT_VAL=$(cat $BL_PATH/brightness)
NEW_VAL=$CURRENT_VAL
show_help() {
echo USAGE: $(basename $0) [-d DEVICE] [-a PERCENTUAL] [-b PERCENTUAL] [-h]
@hex0x0000
hex0x0000 / snake.cpp
Created December 25, 2023 20:28
Little SDL Snake game (WIP)
#include <SDL2/SDL.h>
#include <thread>
#include <chrono>
#include <string>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <ctype>
#include <cmath>
@hex0x0000
hex0x0000 / tris.cpp
Created December 25, 2023 20:26
Little tris (tic-tac-toe) game in C++
#include <iostream>
#include <vector>
#include <limits>
using namespace std;
void void_tris(vector< vector<char> > &tris, int size) {
for (int i = 0; i < size; i++)
for (int j = 0; j < size; j++)
tris[i][j] = ' ';
}
@hex0x0000
hex0x0000 / ls-net.sh
Last active February 3, 2021 21:13
ls-net, lists every IP in the network
#!/bin/sh
prefix=192.168
BLUE="\e[34m"
END="\e[0m"
found=$(mktemp)
if [ ! -z "$1" ]; then
prefix=$1
fi