Skip to content

Instantly share code, notes, and snippets.

View dweeber's full-sized avatar

Kevin Reed dweeber

  • TNET Services Inc
  • Mesa AZ
View GitHub Profile
@dweeber
dweeber / xbmc.log
Created September 1, 2012 21:59
Errorlog from XBMC when trying to play an ISO
14:54:14 T:1101049856 DEBUG: OnKey: 11 (0b) pressed, action is Select
14:54:14 T:1101049856 DEBUG: OnPlayMedia /media/iso/AVATAR.iso
14:54:14 T:1101049856 DEBUG: CPlayerCoreFactory::GetPlayers(/media/iso/AVATAR.iso)
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: system rules
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: matches rule: system rules
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtv
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: hdhomerun/myth/rtmp/mms/udp
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: lastfm/shout
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: rtsp
14:54:15 T:1101049856 DEBUG: CPlayerSelectionRule::GetPlayers: considering rule: streams
@dweeber
dweeber / rpiGpioSensor.bash
Created September 3, 2012 15:36
Intial script for sensing GPIO pin dropping to reset RPi
#! /bin/bash
# Originally posted to http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=14255
# This script is used to check a pin at half second intervals and
# will shutdown the system if the pin is at a low level.
# Portions of this script adapted from "GPIO Driving Example (Shell script)"
# found on elinux.org .
@dweeber
dweeber / Function for expanding fs
Created September 9, 2012 18:27
raspi-config do_expand_rootfs function that uses all of the SDcard
do_expand_rootfs() {
# Get the starting offset of the root partition
PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^2" | cut -f 2 -d:)
[ "$PART_START" ] || return 1
# Return value will likely be error for fdisk as it fails to reload the
# partition table because the root fs is mounted
fdisk /dev/mmcblk0 <<EOF
p
d
2
@dweeber
dweeber / sample code
Created September 9, 2012 18:34
Sample code of determining the size of the partition.
DISK_SIZE="4" # set this to the card size in nominal GB
# or: DISK_SIZE="$(($(sudo blockdev --getsz /dev/mmcblk0)/2048/925))"
PART_START="$(sudo parted /dev/mmcblk0 -ms unit s p |grep "^2" |cut -f2 -d:)"
[ "$PART_START" ] || exit 1
PART_END="$((DISK_SIZE*925*2048-1))"
[ "$PART_END" -ge 3788799 ] || exit 1
printf "d\n2\nn\np\n2\n$PART_START\n$PART_END\np\nw\n" |sudo fdisk /dev/mmcblk0
@dweeber
dweeber / menu
Created September 18, 2012 20:13
Simple menu of common things located in /usr/local/bin/menu
echo
echo Menu of Common Things
echo ===============================================================================
cat <<EOF
Omxplayer .................. omxplayer -o hdmi filename.mp4
Locations of Stuff ......... locations
Turn On VNC server ......... vncserver :1 -geometry 1280x800 -depth 24
Switch to Videos ........... vidoes
Switch to /etc/network ..... networks
Status of Stuff ............ status
@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.
#
@dweeber
dweeber / gist:3807857
Created September 30, 2012 17:42
Init.d script for tightvnc
#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start vnc server
# Description:
### END INIT INFO
@dweeber
dweeber / gpio.c
Created October 21, 2012 21:06
Original gpio.c module
/*
* gpio.c:
* Swiss-Army-Knife, Set-UID command-line interface to the Raspberry
* Pi's GPIO.
* Copyright (c) 2012 Gordon Henderson
***********************************************************************
* This file is part of wiringPi:
* https://projects.drogon.net/raspberry-pi/wiringpi/
*
* wiringPi is free software: you can redistribute it and/or modify
@dweeber
dweeber / gist:3950942
Created October 25, 2012 06:53
Script to check for button press
#!/bin/bash
#################################################
# Switch Test #1
#
# Sets up the GPIO 4 port to check for a button
# press. Loops until the button is pressed
#
# Ref:
# http://rpi.tnet.com/project/hardware/project001
#
@dweeber
dweeber / phonehome.php
Created October 26, 2012 22:54
Phone Home Script
<?php
######################################################################
# Phonehome script to obtain IP of home router
#
# Call with wget from your internal machine
# with the command:
# wget -t 10 http://yourwebsite/phonehome.php?c=1234&cmd=1 -O /dev/null
#
######################################################################
$SY = array();