Skip to content

Instantly share code, notes, and snippets.

View midibyte's full-sized avatar
🎯
Focusing

midibyte midibyte

🎯
Focusing
  • Florida
View GitHub Profile
//transforms a range of [iMin, iMax] to [outMin, outMax]
//returns the transformed value
int range_transform(int input, int iMax, int iMin, int outMax, int outMin)
{
//transform range for histogram operation
int output = (((input - iMin) * (outMax - outMin)) / (iMax - iMin)) + outMin;
return output;
}
@midibyte
midibyte / gibbons.sh
Created July 5, 2020 11:21
Get some simple CPU and GPU info for a Raspberry Pi
#!/bin/bash
# @midibyte
# (^ V ^)
# tested on Rpi zero W
min_freq=$(sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq)
max_freq=$(sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
current_freq=$(sudo cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
cpu=$(</sys/class/thermal/thermal_zone0/temp)
@midibyte
midibyte / list_all_cronjobs.sh
Created July 10, 2020 10:26
list all cron jobs
#!/bin/bash
# System-wide crontab file and cron job directory. Change these for your system.
CRONTAB='/etc/crontab'
CRONDIR='/etc/cron.d'
# Single tab character. Annoyingly necessary.
tab=$(echo -en "\t")
# Given a stream of crontab lines, exclude non-cron job lines, replace
@midibyte
midibyte / ripPSX.sh
Created August 27, 2020 07:40
Create ISO image of PSX disk
#!/bin/bash
#tested on Manjaro 5.7
#adapted from https://pastebin.com/TLJMAU9V
# this directory must already exist
export PSXDIR=$HOME/psxISO
if [ $1 -z -o $2 -n ];
then
echo "\nERROR: Invalid usage.\n"
echo "\n Usage: psxrip [filename]\n"
echo "\n where filename is the desired name, minus extensions.\n"