Wednesday 5 November 2014

IPTV / UPNPD for raspberry pi

Check out my github!

https://github.com/txt3rob/xupnpd-raspberry-armhf



 README.md


xupnpd-raspberry-armhf

This is just a DEB file built on a Raspberry PI!

I AM NOT THE AUTHOR OF XUPNPD SO I OFFER NO SUPPORT JUST AN INSTALL FILE!

For all info on xupnpd - http://xupnpd.org/

xupnpd - eXtensible UPnP agent

This program is a light DLNA Media Server which provides ContentDirectory:1 service for sharing IPTV unicast streams over local area network (with udpxy for multicast to HTTP unicast conversion).
The program shares UTF8-encoded M3U playlists with links over local area network as content of the directory.
You can watch HDTV broadcasts (multicast or unicast) and listen Internet Radio in IP network without transcoding and PC.
Multicast IPTV without transcoding (xupnpd+udpxy) was tested with:
Ubuntu 10.04 (Linux, IA-32) as Media Server
D-Link DIR-320 (DD-WRT v24 preSP2 13064, mipsel), ASUS WL-500gP, Asus N-16, TP-LINK WR841ND as Media Server
Sony PlayStation 3 as UPnP player
IconBit HDS4L, WDTV Live as UPnP player
HTC Desire, HTC Sensation as UPnP player (Android 2.2 + UPnPlay/BubbleUPnP + VPlayer/MX Video Player)
Samsung UE46D6510, Samsung UE40D5000PW, Samsung LE40c550, Samsung LE40B650, Samsung UE40C6000, Samsung US46ES6100, Samsung UE32EH6037, LG PZ750, Sony 26EX231, Philips 47pfl7606h as player
Microsoft Windows Media Player 11 as UPnP player
Ubuntu 10.04 with VideoLAN as UPnP player

Features

Builtin DLNA/UPnP media server for sharing local media files and external IPTV/Radio streams
Builtin multicast proxy for MPEG-TS streams
YouTube, Vimeo and GameTrailers plugins (HD)
No transcoding
HDTV ready
Parent control (Access Control List)
Web-based user interface
LUA scripting
For all support see http://xupnpd.org/

Airplay Easy Install Script for your raspberry Pi

I wanted to be able to play some songs from my iphone / ipad / macbook to my pi.


Made a  nice easy script to do this


copy and paste the below

wget https://gist.githubusercontent.com/txt3rob/4cc88f810969f75dcdce/raw/758f5e04b21042b3c698bc5affb9101e7fd861e3/gistfile1.txt -O shairport.sh
chmod 777 shairport.sh
sudo shairport.sh

Thursday 23 October 2014

Installing python packages for raspberry pi

INSTALLING PYTHON PACKAGES

APT

Some Python packages can be found in the Raspbian archives and can be installed using APT, for example:
sudo apt-get update
sudo apt-get install python3-picamera
This is a preferable method of installing software, as it means that the modules you install can be kept up to date easily with the usual sudo apt-get update and sudo apt-get upgrade commands.
Python packages in Raspbian which are compatible with Python 2.x will always have a python- prefix. So, the picamera package for Python 2.x is named python-picamera (as shown in the example above). Python 3 packages always have a python3- prefix. So, to install rpi.gpio for Python 3 you would use:
sudo apt-get install python3-rpi.gpio
Uninstalling packages installed via APT can be accomplished as follows:
sudo apt-get remove python3-rpi.gpio
or completely remove with --purge:
sudo apt-get remove python3-rpi.gpio --purge

PIP

Not all Python packages are available in the Raspbian archives, and those that are can sometimes be out of date. If you can't find a suitable version in the Raspbian archives you can install packages from the Python Package Index (also known as PyPI). To do so, use the pip tool.
First install pip with apt.
sudo apt-get install python3-pip
or the Python 2 version:
sudo apt-get install python-pip
pip-3.3 installs modules for Python 3 and pip installs modules for Python 2.
For example, the folowing command installs the Pibrella library for Python 3:
pip-3.3 install pibrella
and the folowing command installs the Pibrella library for Python 2:
pip install pibrella
Uninstall Python modules with pip-3.3 uninstall or pip uninstall.
Upload your own Python modules to pip with the guide at PyPI.

Wednesday 17 September 2014

Google Sheets - How to grab the sheet as a CSV

                                                    Google Spreadsheets




Very quick tip to get the url for a google spreadsheet in csv format is easy.


when you are in sheets click file and then publish to the web.

copy and paste the URL given and then add /export?format=csv


Example:

https://docs.google.com/spreadsheets/d/1_svvemcpnvbsWolXs3KR0A3in8zf9U3xI6Ms9Pq_vHs/

becomes

https://docs.google.com/spreadsheets/d/1_svvemcpnvbsWolXs3KR0A3in8zf9U3xI6Ms9Pq_vHs/export?format=csv


now it's ready to be downloaded and imported in to a mysql database :)





Tuesday 19 August 2014

Share remote keyboard and mouse on to your raspberry pi

This is a little heads-up for those of you (includes me) that don’t want to dedicate a mouse and keyboard to their Pi and would rather use their laptop’s mouse and keyboard. This is a bit different from running remote desktop software, since what I actually want to do is to take use of my newly installed mini LCD monitor for my Pi. Another reason for this is to keep the USB ports free. Surely there are micro wireless keyboards as well such as this one offered by Adafruit but I was not in a spending mood :)
So my research ended up with installing Synergy on my Windoes 7 laptop and my Raspberry Pi. Synergy software is pretty amazing, here is what it is about:
Synergy lets you easily share your mouse and keyboard between multiple computers on your desk, and it’s Free and Open Source. Just move your mouse off the edge of one computer’s screen on to another. You can even share all of your clipboards. All you need is a network connection. Synergy is cross-platform (works on Windows, Mac OS X and Linux).
The good thing is that it is cross platform, plus it is open source. Installing it on my Windows laptop was easy. To get it on your Raspberry Pi simply use
sudo apt-get install synergy
You need to make sure it runs on startup, the Wiki on the Synergy site has some tips.
Running it is simple:
/usr/bin/synergyc --daemon YOUR_SERVER_IP
So now it acts as extended desktop, by moving the mouse all the way to the right, I can see it appear on my Raspberry Pi’s display. Even the clipboard gets transferred, so quite neat indeed.

taken from http://raspberry-pi-how.blogspot.co.uk/

Friday 18 July 2014

Enable Crontab Logging On Raspberry Pi

Enable crontab logging in Debian Linux

debian-dots
By default the logging for the cron demon is not active in Debian Linux. To activate it, please open the file /etc/rsyslog.conf via
vi /etc/rsyslog.conf
and uncomment the line
# cron.*                          /var/log/cron.log
After that you need to restart rsyslog via
/etc/init.d/rsyslog restart
and you will find the cron logs in /var/log/cron.log

Friday 11 July 2014

Let Website Guests Notify you via SMS








Call Back Request

Name:
Number:
Simply go to https://github.com/txt3rob/SMS-PI/tree/master/PHP/Callback

Alter the following lines to suit your needs.


callback.php

Edit this and fill in the below
// Number you wish to text when you want this to send a SMS
$number = "077777777";
// Your SMSPI.co.uk HASH
$hash = "YOURSMSPIHASH";
//Website URL
$webpage = "example.com"
Everything should work fine but any issues please contact me on twitter @smspiuk or info@smspi.co.uk
Donations via PayPal are welcome to txt3rob@gmail.com
and job is a gooden!

Log Uptime

The command "uptime" you can see how long your raspberry pi is up. Shut it down, or pull the power will you trow back to zero :)

The program "uptimed" will log all the uptimes and can show the longest uptme and other time stats.
How to install?
sudo apt-get update
[enter]
sudo apt-get install uptimed
[enter]
See your uptime start with command:"uprecords"

My current stats:

Taken From:

Friday 13 June 2014

DLINK NAS - Free SMS notifications UKONLY

  • Register at http://www.smspi.co.uk and get your hash.
  • Log into the NAS Web UI (i.e. enter the DNS-345 IP address in a browser)
  • Navigate to Management > System Management > Notifications
  • Expand SMS Settings
  • Check the Enable SMS Notifications checkbox
  • Click Add next to SMS service provider
  • Welcome: Click Next
  • Step 1: Enter a name of your choice in Provider Name and copy the following URL into the SMS URLtextarea: http://www.smspi.co.uk/api/?to=Phone_number&message=Message_content&hash=what ever your hash is
  • Click Next
  • Step 2: Next to each URL variable, select the following options from the appropriate dropdown menus:
    • user=Username = Username
    • password=Password = Password
    • api_id=Other = Other
    • to=Phone_number = Phone number
    • text=Message_content = Message content
  • Click on Finish
  • Enter your mobile phone number into the field next to Phone number1((to)).
  • Click Test SMS and the NAS will display an affirmation message if the settings are correct and you will receive an SMS
  • Click Save Settings

Monday 2 June 2014

Mysql Backup to Dropbox

Go to the following link to download the scripts:https://github.com/txt3rob/Dropbox-Mysql-Upload

Mysql Backup To Dropbox

This script you will need to run once manually to link to your dropbox folder.
To Run
chmod 777 backupsql.sh
./backupsql.sh
Once it's confirmed working then add it to the crontab.
Dropbox uploader script originally from - https://github.com/andreafabrizi/Dropbox-Uploader/
You will need to alter the following in backupsql.sh

MYSQLUSERNAME="USERNAME"
MYSQLPASSWORD="PASSWORD"
BACKUPPATH="/LOCALPATH/$TIMESTAMP"
DATABASE="DATABASE NAME"
DROPBOXPATH="/PATH ON DROPBOX/"

It's set to delete files older than 5 days.
You can alter this by changing the following line:
dropbox_uploader.sh delete $DROPBOXPATH/mysql_db_backup-`date +%d-%m-%y-%H --date 'now -5 days'`.bz2
For adding to the crontab you can easily use the following site to generate how often you wish for it to run
http://www.easycron.com/generator/crontab
All should be easy to work out.
Any issues please email me txt3rob@gmail.com

Tuesday 15 April 2014

Install NO IP Update Service on Raspberry Pi

Install the No-IP client The next step is downloading and installing the No-IP client that will update your DNS with your dynamic IP. Note, if you have several machines all behind the same external IP then you really only need to install the No-IP client on one of your servers. So we'll run a few commands to download the client, unpack it, build it, and install it. wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz tar xzf noip-duc-linux.tar.gz cd noip-* sudo make sudo make install Upon running the final command you should be presented with some configuration questions. The first two will ask you for your No-IP username and password. After you've entered your credentials the installer will tell you how many hosts (domains/subdomains) you have available and if you'd like to update them all. If you select No it will go through each host and allow you to pick which ones you'd like to update. After you've made your selections it will ask for an interval (in minutes). This controls how often the service will check to see if your IP has changed. 30 is a good default value, if you know that your IP changes more frequently then you may want to lower this value. The final question will ask you if you'd like to run a program upon completing a DNS update. Most people can go ahead and say No here. Now we just need to create an init script that will automatically start the service when Debian boots. As root, copy the following bash script and save it to /etc/init.d/noip2. ####################################################### #! /bin/sh case "$1" in start) echo "Starting noip2." /usr/local/bin/noip2 ;; stop) echo -n "Shutting down noip2." killall -q -TERM /usr/local/bin/noip2 ;; *) echo "Usage: $0 {start|stop}" exit 1 esac exit 0 ####################################################### Next we need to modify the permissions on the script so that it's executable and add the service. sudo chmod 755 /etc/init.d/noip2 sudo update-rc.d noip2 defaults Go ahead and restart your installation and the No-IP service should now be running. Port Forwarding One more important thing to note is that if your servers aren't directly mapped to an external IP, meaning they have a local address (e.g. 192.168.x.x) and pass traffic through a router, then you'll need to setup port forwarding on your router so that the proper traffic makes its way to your appropriate servers. Note, you only need to setup port forwarding if you want your server(s) to be available via the internet. Here are some common ports you may need to forward for certain functions. TCP port 53 (DNS) - If you run an authoritative nameserver you'll need this TCP port 25 (SMTP) - Required for a mail server, the server receives mail on this port TCP port 80 (HTTP) - Required for a web server, allows you to serve web pages TCP port 143 (IMAP) - Required if you want to download your mail from your server over the internet using a desktop client like Thunderbird or Outlook TCP port 443 (HTTPS) - Required if you want to serve secure web pages using SSL

Monday 24 February 2014

Write .IMG to SD Card Using Mac OSX

How To Write an .IMG file to SD Card Using MAC OSX.


 Well recently my work bought me a lovely mac book pro for working with.

Now i have 4 Raspberry PI's and an Odroid U3 and have stopped using my pc and my laptop i would normally use.

I've been googling for a about 3 hours today trying to find a nice GUI to write the damm .img file to my SD CARD.


Bingo!

Apple Pi Baker - Is a utility that will restore and back up images for you and also allow you to create a SD card for N00bs!




it can be found from the link below


Enjoy!

Friday 14 February 2014

Time Lapse

Creating time lapse videos using the Raspberry Pi and camera is incredibly easy, and you can create some really cool looking videos at the end of it. To make a time lapse video, you will need a Pi and a camera module.
  1.  Set up your Raspberry Pi in the desired place.
  2. Test the positioning of the camera by taking a still photo (find out how to do this here)
  3. When you are happy, enter this code in the command line (LXTerminal): raspistill -o ****_%04d.jpg -tl 60000 -t 7200000
  4. This command will take a photo every 60 seconds (60000 milliseconds) for 2 hours (7200000 milliseconds) You can change this to whatever you like. The stars can be replaced by the image name of your choice.
  5. The bit of code that looks like this: %04d.jpg is telling the pi to name each photo with an increasing 4 digit number. Again, the .jpg means that the photos will be saved in .jpg format. 
  6. Press enter, and leave the pi to do its business for the amount of time you specified. 
  7. When the Pi has finished, you will find loads of pictures in your home directory. 
 Note: Make sure that you don't move the Pi at all during the stills being captured, this will result in a poor quality end product. 
 To create your video on your Pi:
  1. Type the following into the command line: sudo apt-get -y install libav-tools
  2. Press enter
  3. Then, type this and press enter. avconv -r 10 -1 *****_%04d.jpg -r 10 -vcodec libx264 -crf 20 -g 15 ------.mp4
  4. Replace the stars with the name that your images were called, and the dashes with the name you wish your video to be called.
  5. When this has finished, you can view your video in omxplayer, as demonstrated here.
taken from http://www.raspberrypitutorials.yolasite.com/time-lapse-videos.php

How to Print Via the raspberry Pi

you might be wondering how to print to a printer connected to the same network that your Raspberry Pi is connected to.This is how you can:
  1. In LXTerminal, type sudo apt-get install cups.
  2. When prompted, type then press enter.
  3. Then, still in LXTerminal, type sudo usermod -a -G lpadmin pi.
  4. Open Midori, then type the following into the URL Bar at the top of the screen.  http://127.0.0.1:631
  5. Save this website to your favourites for future reference. 
  6. From the main screen, choose the 'Administration' tab.
  7. Select 'Add Printer'
  8. Enter your normal Pi username and password.
  9. Select your printer from the list. Click 'continue'.
  10. Edit the settings if you wish (if you only have one printer, you can leave these be.)
  11. Click on 'continue'.
  12. Choose the model that is the closest mach to your printer from the list (it doesn't matter whether it is a bit different.)
  13. Click on 'add printer'.
  14. Choose the different options to suit your printer.
  15. Click on 'set default options'
  16. Choose the 'Printers' tab. You can request a print test if you wish.

The printer will now appear in any applications that provide printing facilities.

A couple of tips:

  • Be patient - Sometimes printing can take a long time.
  • Avoid running other applications on your Raspberry Pi while printing is in progress.
taken from http://www.raspberrypitutorials.yolasite.com/printing.php



Monday 20 January 2014

Stream to Justin TV from your pi!



Live Streaming Video using AVConv and the Raspberry Pi


The Raspberry Pi is a credit-card sized $35 computer that can be used to accomplish many tasks similar to what a desktop PC can do. This includes spreadsheets, word-processing, games, and even…live video broadcasting! By connecting a powered USB Hub and webcam to your Raspberry Pi, you can broadcast live video to an unlimited audience for free. I’ll show you how this is possible.
Please be patient and read through the entire tutorial before attempting.
What You NeedCredit: Wikipedia.org
Getting started requires a few peripherals. To start up your Raspberry Pi and do initial configuration, you will need an HDMI cable, USB keyboard, and USB mouse. In addition:
  • A Raspberry Pi Model B running Debian or “Rasbian”
  • A powered USB hub
  • A Debian-supported webcam (Logitech HD C series) – I use the Logitech HD V-U0016 HD C510




Recommendations
  • Use the raspberry pi “headless”. Do not run the desktop version of Rasbian on your Pi (xwindows). It uses an excess amount of RAM and precious CPU power that you need to reserve for your live video compression and streaming. Instead, use the command line interface or access via Secure Shell from another computer. (optional)
  • Assign a static local IP to the Raspberry Pi. (Configuration can be found in: /etc/network/interfaces). This is useful when accessing the Pi remotely. (optional)
  • Don’t use a Raspberry Pi enclosure that limits heat transfer and airflow.
Preparation
Update your software repository to the latest version by running the following commands:
sudo apt-get update
sudo apt-get upgrade
Plug in your devices.  Webcam –> Powered USB Hub –> Raspberry Pi
Install Screen (optional):
apt-get install screen
Restart your Pi device:
reboot


Installation
To transcode and broadcast the video, you will need to use a Linux application called AVConv (similar to FFmpeg). It is a command line program for transcoding multimedia files using the Libav Multimedia Framework. FFmpeg will give you the same result, but I personally prefer AVConv for ease-of-use.
To Install AVConv, run the following command:
sudo apt-get install avconv
Find a Broadcasting Platform:
To broadcast live streaming video to the Internet, you will need to create an account with Ustream, Justin.tv, or similar. After creating an account, it’s important you find the “Stream Key” or “Stream URL”.
Find the Stream URL and Key in Ustream:
  • Login to Ustream.tv
  • Open your “Dashboard”
  • Click “Remote”
  • Copy the “RTMP URL”. You will need this once you begin broadcasting, in the next step of this tutorial.
Here is an example of the final URL:
rtmp://2.773.fme.ustream.tv/ustreamVideo/77775432
Find the Stream URL and Key in Justin.TV:
  • Login to Justin.tv
  • Go to the “Other” Broadcasting page:http://www.justin.tv/broadcast/adv_other
  • Press “Show” beside “Stream Key”
  • Save this Key! You will need it in the next step.
  • Paste your “Stream Key” in immediately after this URL:  rtmp://live.justin.tv/app/
    • Note: The Default RTMP server is hosted in San Francisco. On the Justin.TV forum, you can find the RTMP address URLs for a server that is closer to you. (optional)
Here is an example of the final URL using the default URL:
rtmp://live.justin.tv/app/live_3987439857_QQsAmPlEVeStREamkeYgN6a93
Save these URLs for the next step!
Broadcast Configuration
Once you have everything set up, command-line access to the Raspberry Pi, and your Justin.tv/Ustream Stream Key URL, you’re ready to initiate the broadcast! This is the fun part!
From this point forward, you only have to input TWO commands.
  • Open a new screen session:
    screen
  • Enter the AVConv command with ALL of the parameters attached.
Basic command:
Enter this single command inside the screen session to start broadcasting! Yes, it’s that easy!
avconv -f video4linux2 -s 640×360 -r 10 -b 350k -i /dev/video0 -f flv rtmp://live.justin.tv/app/live_ReplaceThisWithYourURL
In the above example,
  • -s defines the broadcasting resolution. (Widescreen = 640×360)
  • -r defines the maximum frame-rate
  • -b defines the maximum bitrate (k= Kbps)
  • -i defines the location of your USB webcam. In most cases, if you only have one USB video device plugged in, use the /dev/video0 phrase.
  • -f defines the type of video stream and location. In this example it’s FLV transcoding (Flash video) to an RTMP server at Justin.tv
  • Don’t forget to replace the rtmp:// URL with your own Stream Key URL from the “Find a Broadcasting Platform” step.

An advanced example: (Warning: for experienced users only)
avconv -f video4linux2 -s 640×360 -r 10 -b 350k -i /dev/video0 -vf drawtext=”fontfile=/usr/share/fonts/truetype/freefont/FreeSansBold.ttf:text=’some text here ‘:fontsize=16:fontcolor=blue:x=2:y=360″ -acodec copy -metadata title=”24×7 Pi Cam” -f flv rtmp://live.justin.tv/app/live_81777DontStealMyKey6777
The above example is what I use on my “Eric’s Pets” live stream. You may notice a big difference from the original AVConv command. The -vf drawtextcommand allows you to define a font (download to your /freefont/ folder). Once a font is defined, you can add formatted text such as a “watermark” in the bottom left. The “-metadata title” allows me to tell Justin.TV what the broadcast page title should be. It can even get more advanced than this!
Please be very patient with AVConv and Raspbian. It takes time to perfect the stream quality. (My settings may not work for your camera or setup).
AVConv is very similar to FFmpeg in this sense. You can add many different features to your live video broadcast by simply putting new parameters in your initial command. You can learn more about these by reading AVConv/FFmpeg documentation.
AVConv will provide information while streaming, similar to the following string. If you see this, the stream should be broadcasting correctly.
Eric's Live Bunny Cam via Raspberry Pi
Eric’s Live Bunny Cam via Raspberry Pi
   Stream #0:0 -> #0:0 (rawvideo -> flv)
frame=215  fps=8   q=15.5   size=1001kB   time=29.20  bitrate=281.0kbits/s  dup=0   drop=3   
At any time, you can stop the stream by typing Ctrl-C, and exit the screen session by typing “exit”. To close the screen session but leave AVConv running, type Ctrl-A-D. To enter a screen session that’s already running, type “screen -r”.
Still hungry? Learn more at http://libav.org/avconv.html

Tuesday 14 January 2014

Aircrack-NG On Raspberry Pi

Installer for Aircrack-NG / Airoscript For Raspberry Pi

copy and paste the below
sudo wget https://raw.github.com/txt3rob/Aircrack-NG_RaspberryPI/master/install.sh
sudo chmod 777 install.sh
sudo ./install.sh
follow the on screen instructions and your raspberry pi be able to do packet injection.
If you wish to donate to me my email address is txt3rob@gmail.com

Raspberry Pi IRC Server

Raspberry Pi IRC server!
For more info about IRC (Internet Relay Chat) click here.

First update your raspberry pi image:

Sudo apt-get update
[enter]
Sudo apt-get upgrade
Ready? Let's go! :)

sudo aptitude install ircd-hybrid[enter]
Now me must make a Admin password: /usr/bin/mkpasswd “password”
This commando will give you a MD5 hashed password.
sudo nano /etc/ircd-hybrid/ircd.conf
[enter]
Find section listen { part and
Change host = “127.0.0.1″; to host = “0.0.0.0″;

Then go to the operator { section and change the password. This should be the MD5 string we created earlier also change user to user = “*@*”;
Control + X. And save the file.

sudo /etc/init.d/ircd-hybrid restart
[ENTER]
Now you have your OWN IRC server!

First connect to ( IP ADRES OF THE PI) Port: 6667.
If you like, change more settings in the ircd.conf and make it totally your own IRC server!

Amazon

Donate

Donate Towards More Raspberry PI's for Projects