Skip to content

Instantly share code, notes, and snippets.

View pedrocarrico's full-sized avatar

Pedro Carriço pedrocarrico

View GitHub Profile
@stonehippo
stonehippo / RPi-Dashing-howto.md
Last active October 6, 2021 13:52
Setting up a Raspberry Pi as a dashboard server with Dashing

Setting up a Raspberry Pi as a dashboard server with Dashing

Why the heck did I do this?

I wanted to set up one of my Raspberry Pi's as a data dashboard, pushing sensor data to a web interface that's easy to digest. I decided to use Shopify's Dashing framework. Dashing is based on Sinatra, and is pretty lightweight.

Dashing does require Ruby 1.9.3 to run. In addition, it makes use of the execjs gem, which needs to have a working Javascript interpreter available. Originally, I tried to get therubyracer working, but decided to switch over to Node.js when I ran into roadblocks compiling V8.

One warning: The RPi is a very slow system compared with modern multi-core x86-style systems. It's pretty robust, but compiling all this complex software taxes the system quite a bit. Expect that it's going to take at least half a day to get everything going.

@willurd
willurd / web-servers.md
Last active May 7, 2024 14:57
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@sturadnidge
sturadnidge / minipi.sh
Last active June 13, 2016 13:21
Minimal Raspbian image builder.
#!/bin/bash
# required build environment packages: binfmt-support qemu qemu-user-static debootstrap kpartx lvm2 dosfstools
# made possible by:
# Klaus M Pfeiffer (http://blog.kmp.or.at/2012/05/build-your-own-raspberry-pi-image/)
# Alex Bradbury (http://asbradbury.org/projects/spindle/)
deb_mirror="http://archive.raspbian.org/raspbian/"
deb_local_mirror=$deb_mirror
deb_release="wheezy"

ruby-1.9.3-p392 cumulative performance patch for rbenv

(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)

This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

@dweeber
dweeber / gist:3748975
Created September 19, 2012 10:49
Bash script uses vcgencmd on Raspberry Pi with bc to calculate F value of Temp
#!/bin/bash
######################################################################
# Raspberry Pi
#
# Gross Script by Dweeber (Kevin Reed) <dweeber.dweebs@gmail.com>
# V1.0 2012-09-19
#
# Use the vcgencmd to obtain the Temp of the SOC
# then calculates the F value using bc.
#
@adammw
adammw / README.md
Created August 3, 2012 06:30
Node.js for Raspberry Pi

Node.js for Raspberry Pi

Pre-built binaries

Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

If you have found these packages useful, give me a shout out on twitter: @adammw

@bensomers
bensomers / rails_routing_invalid_chars_fix.rb
Created May 29, 2012 19:08
3.0.x monkeypatch for fixing Invalid Char 500s
# Fix for a Rails - Ruby 1.9 bug
# Rails Router, now that it's UTF-8 default, blows up when routing requests
# with invalid chars in the URL; it should properly return a 400 error
# Have to monkey-patch the fix in, since it's not scheduled for release until
# Rails 4.0.
# Adapted Andrew White (pixeltrix)'s fix at
# https://github.com/rails/rails/commit/3fc561a1f71edf1c2bae695cafa03909d24a5ca3,
# but edited to work in 3.0.x.
# 3.1.x, 3.2.x compatibility unknown
require 'action_dispatch/routing/route_set'
@sj26
sj26 / 0-readme.md
Created May 5, 2012 05:39 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p194 with patches for boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@jaytaylor
jaytaylor / mysql-fast-loader.sh
Created October 20, 2011 19:38
Copies MySQL database to ramdisk then runs supplied shell script or command. The ramdisk version of the database is then copied back to the filesystem. Speeds up IO-intensive operations (e.g. loading heavily indexed tables.)
#!/usr/bin/env bash
##
# @author Jay Taylor <outtatime@gmail.com>
#
# @date 2011-10-20
#
# @description Copies MySQL database to ramdisk then runs supplied shell script
# or command. The ramdisk version of the database is then copied back to the
# filesystem. Speeds up IO-intensive operations (e.g. loading heavily indexed