Skip to content

Instantly share code, notes, and snippets.

@cgsdev0
Created July 29, 2026 05:43
Show Gist options
  • Select an option

  • Save cgsdev0/3361b8401b1b01d1b4e11e598052438c to your computer and use it in GitHub Desktop.

Select an option

Save cgsdev0/3361b8401b1b01d1b4e11e598052438c to your computer and use it in GitHub Desktop.
hacking an ereader
i=0
j=0
while [ "$i" -lt 600 ]; do
n=$(((i-60)/2))
if [ "$n" -lt 0 ]; then
n=255
fi
if [ "$n" -gt 255 ]; then
n=255
fi
printf "\\$(printf '%03o' "$n")"
i=$((i+1))
done > gradient
i=0
while [ "$i" -lt 60 ]; do
cat gradient
i=$((i+1))
done
yes $'\xFF' | tr -d '\n' | head -c $((600*40))
i=0
while IFS= read -rn1 c; do
if [ "$c" = '' ]; then
# pad the rest of the row
while [ "$i" -lt 600 ]; do
printf '\xFF'
i=$((i+1))
done
i=0
continue
fi
if [ "$c" = '#' ]; then
printf '\x00\x00\x00\x00'
else
printf '\xFF\xFF\xFF\xFF'
fi
i=$((i+4))
done < text
yes $'\xFF' | tr -d '\n'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment