Skip to content

Instantly share code, notes, and snippets.

@treehouse-su
Created August 1, 2015 08:49
Show Gist options
  • Save treehouse-su/95b0785c697d79720e6a to your computer and use it in GitHub Desktop.
Save treehouse-su/95b0785c697d79720e6a to your computer and use it in GitHub Desktop.
raspi-cam time lapse
if usbkey mounted then watch raspistill
#!/bin/bash
set_config_var() {
lua - "$1" "$2" "$3" <<EOF > "$3.bak"
local key=assert(arg[1])
local value=assert(arg[2])
local fn=assert(arg[3])
local file=assert(io.open(fn))
local made_change=false
for line in file:lines() do
if line:match("^#?%s*"..key.."=.*$") then
line=key.."="..value
made_change=true
end
print(line)
end
#enable raspi-cam
set_config_var start_x 1 /boot/config.txt
CUR_GPU_MEM=$(get_config_var gpu_mem /boot/config.txt)
if [ -z "$CUR_GPU_MEM" ] || [ "$CUR_GPU_MEM" -lt 128 ]; then
set_config_var gpu_mem 128 /boot/config.txt
fi
sed /boot/config.txt -i -e "s/^startx/#startx/"
sed /boot/config.txt -i -e "s/^fixup_file/#fixup_file/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment