Skip to content

Instantly share code, notes, and snippets.

View rbrito's full-sized avatar
☹️
Having (YET another) kidney stone surgery in a few days...

Rogério Brito rbrito

☹️
Having (YET another) kidney stone surgery in a few days...
View GitHub Profile
@jiphex
jiphex / scanmatic.sh
Created January 16, 2011 23:42
Scans a document from the default scanner and emails it (securely) via GMail
#! /usr/bin/env bash
# scans a single document and mails it
#
# Requirements: sane, ImageMagick, tesseract, gocr, sendemail
# It would be trivially email to remove gocr, tesseract is better it seems
# You could replace ImageMagick with anything that convert PBM > something.
SCANFILE=`mktemp /tmp/scantmp.XXXXXXXX`
PBMFILE="${SCANFILE}.pbm"
#!/usr/bin/env ruby
$TEST_PERIOD = 60 * 61
$SAMPLE_PERIOD = 60 * 10
$CAPACITY = 1320
$RS = 20
class Array
def mean
self.inject(0) { |sum, x| sum + x } / size.to_f
#!/bin/sh
RS=20
get_capacity()
{
c=`i2cget -y 2 0x55 0x0c w`
return $(($c * 3570 / $RS / 1000))
}