TheShed

Image viewing on a Raspberry Pi

Category: Raspberry Pi
#tools #sysadmin

I wanted a quick and simple slideshow on a Raspberry Pi

apt-get install fbi
fbi -a -t 5 -noverbose img/*.jpg

Creates a slideshow with auto image scaling, a five second delay, without the status bar using all .jpg images in the img subfolder.

Encoding with FFMEG

Category: tools
#video #encoding #tools

Wow. iOS is fussy about MPEG4 encoding. Stuff that worked fine as HTML5 video sources in Chrome and Safari on a Mac failed to load in various i-devices. In the end I re-encoded using FFMPEG and:

ffmpeg.exe"  -i input.mov -codec:v libx264 -profile:v main -preset slow -b:v 2000k -maxrate 400k -bufsize 800k -vf scale=-1:1080 -threads 0 -codec:a libvo_aacenc -b:a 192k output.mp4

Serving content during development

Category: Tools
#pelican #HTTP #tools #python #web

Python's SimpleHTTPServer is my goto friend for serving HTTP requests locally while developing stuff. Sometimes however you get caught with the browser caching things that you really don't want it to. CTRL+F5 usually works (it's a hardcoded pattern for me by now) but today I stumbled on a gotcha: cached JSON content that a page was pulling in.

The solution for me, was to modify SimpleHTTPServer to set HTTP headers to tell the browser not to cache. Here's the code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#!/usr/bin/env python
import SimpleHTTPServer

class MyHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_my_headers()
        SimpleHTTPServer.SimpleHTTPRequestHandler.end_headers(self)
    def send_my_headers(self):
        self.send_header("Cache-Control", "no-cache, no-store, must-revalidate")
        self.send_header("Pragma", "no-cache")
        self.send_header("Expires", "0")
if __name__ == '__main__':
SimpleHTTPServer.test(HandlerClass=MyHTTPRequestHandler)

Usage: python serveit.py 8080 to serve the local directory on port 8080.

Source: The ever helpful stackoverflow

Another tooling post

Category: tools
#tools

Another post Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Downloading with wget

Category: Tools
#network #http #tools

Tools for downloading from the command line

wget

Details on resuming downloads with wget