Skip to content

Instantly share code, notes, and snippets.

View melissacoleman's full-sized avatar

Melissa Coleman melissacoleman

View GitHub Profile
/* From https://github.com/raspberrypi-ui/rc_gui/blob/master/src/rc_gui.c#L23-L70 */
#define GET_CAN_EXPAND "sudo raspi-config nonint get_can_expand"
#define EXPAND_FS "sudo raspi-config nonint do_expand_rootfs"
#define GET_HOSTNAME "sudo raspi-config nonint get_hostname"
#define SET_HOSTNAME "sudo raspi-config nonint do_hostname %s"
#define GET_BOOT_CLI "sudo raspi-config nonint get_boot_cli"
#define GET_AUTOLOGIN "sudo raspi-config nonint get_autologin"
#define SET_BOOT_CLI "sudo raspi-config nonint do_boot_behaviour B1"
#define SET_BOOT_CLIA "sudo raspi-config nonint do_boot_behaviour B2"
#define SET_BOOT_GUI "sudo raspi-config nonint do_boot_behaviour B3"
@melissacoleman
melissacoleman / framebuffer-pythonscript.py
Created January 22, 2018 18:13
framebuffer pythonscript
from FBpyGIF import fb
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument("-img", action="store", required=True, dest="image_name", help="name of splash image")
args = parser.parse_args()
BIT_DEPTH = 8
FRAME_BUFFER = 1
#!/bin/bash
source .env
set -eo pipefail
cd "$(dirname "$0")"
if [[ ! $UID -eq 0 ]]; then
echo "you must run this as root:"
@melissacoleman
melissacoleman / gist:9a9860574c859ce606bfa0b3ed4e63bc
Last active February 5, 2024 17:30
Remove all console messages on Raspberry Pi
#!/bin/bash
if [[ ! $UID -eq 0 ]]; then
echo "you must run this as root:"
echo "sudo $0"
exit 1
fi
touch /home/pi/.hushlogin
#!/bin/bash
set -eo pipefail
cd "$(dirname "$0")"
watchman watch-del-all
watchman watch .
watchman -- trigger . sync '**/*' -- ./sync.sh
#!/bin/bash
source .env
cd "$(dirname "$0")"
exec rsync -rlpt \
--exclude '*.pyc' \
--exclude '__pycache__/' \
--exclude 'venv/' \
@melissacoleman
melissacoleman / gist:a1442b9d23f4515c6e9e4d337c34c265
Last active January 22, 2018 12:55
startup bash script for python module
#!/bin/bash
echo "start wifi-leaf"
exec python3 -m wifi-leaf
@melissacoleman
melissacoleman / gist:ff05d8fea5e2113ddb8628352c9e9ade
Last active October 23, 2020 14:20
Service for safe-to-power-off image
[Unit]
Description=safe-to-power-off image
DefaultDependencies=no
After=umount.target
Before=final.target
[Service]
ExecStart=/usr/bin/python3 /path/to/framebuffer-pythonscript.py -img /path/to/unplugimage.jpg
Type=oneshot
@melissacoleman
melissacoleman / gist:19f1bbf112e15e6e4201fda55d9c85db
Last active September 16, 2019 08:50
Service for showing image on starting shutdown
[Unit]
Description=show image on starting shutdown
DefaultDependencies=no
Before=halt.target
[Service]
ExecStart=/usr/bin/python3 /path/to/framebuffer-pythonscript.py -img /path/to/powerdownimage.jpg
Type=oneshot
[Install]
@melissacoleman
melissacoleman / gist:6b5c9ecddda137d725ad1f4546190a74
Last active September 16, 2019 08:50
boot splash screen service
[Unit]
Description=boot splash screen
[Service]
ExecStart=/usr/bin/python3 /path/to/framebuffer-pythonscript.py -img /path/to/bootimage.jpg
[Install]
WantedBy=basic.target