tag:blogger.com,1999:blog-33303294922259761942024-03-15T02:26:11.818+13:00jds5nzUnknownnoreply@blogger.comBlogger17125tag:blogger.com,1999:blog-3330329492225976194.post-53068859307737856272017-12-12T18:35:00.004+13:002017-12-12T18:36:15.332+13:00Raspberry Pi Music Player Feedback LightI have a pretty simple setup of a Pi that plays an internet radio stream. One of the problems was that we were constantly turning off the stereo but leaving the Pi playing the stream and we had no feedback that it was still on and consuming bandwidth.<br />
<br />
So a simple LED light when MPC was playing should fix that.<br />
<br />
After installing a base image of <a href="http://dietpi.com/" target="_blank">DietPi</a> installed all the <a href="https://www.musicpd.org/clients/mpc/" target="_blank">mpc and mpd </a>components and got the radio stream going. I installed <a href="http://wiringpi.com/" target="_blank">WiringPi </a>in order to control the GPIO pins.<br />
<br />
So, now - how to get the LED to light up with MPC was playing? There are a few approaches such as starting MPC from a script that also lights the LED, but as I sometimes start MPC from the command line, sometime from a custom webpage, I didn't want to remember to run a special script to start it up. I wanted it to be monitoring if MPC was playing and light up no matter the method of starting.<br />
<br />
Since cron only runs at 1 minute intervals, I had a problem. I didn't want to wait 1 minute to get feedback to turn the LED on or off. I wanted a smaller resolution than 1 minute intervals, but 1 second was okay. So I settled on cron starting a script every minute, and the script checking MPC each second to see if it was playing or not.<br />
<br />
If the length of the string returned was 68 characters, it meant that MPC wasn't playing as it was the general MPC info returned. If MPC was playing it would included the song details, and therefor be greater than 68 characters, so we assume it's playing and light the LED.<br />
<br />
First I need to set up the pin at boot time, so I saved this in a startup script located in /etc/init.d/startupscript.sh<br />
<br />
<div class="p1">
<span class="s1">#!/bin/bash</span></div>
<div class="p2">
<span class="s1"></span><br /></div>
<div class="p1">
<span class="s1">#register GPIO 4 for input and output</span></div>
<div class="p3">
<span class="s1">gpio </span><span class="s2">-g</span><span class="s1"> mode 4 out</span></div>
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #33bbc8; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #34bc26}
</style>
<br />
<div class="p2">
<span class="s1"></span><br /></div>
I had this code saved a script that cron called every minute:<br />
<br />
<div class="p1">
<span class="s1">#!/bin/bash</span></div>
<div class="p2">
<span class="s1"></span><br /></div>
<div class="p1">
<span class="s1">#This file is used in a cron job to test if mpc is playing or not.</span></div>
<div class="p2">
<span class="s2">for</span><span class="s1"> i </span><span class="s2">in</span><span class="s1"> </span><span class="s2">`</span><span class="s1">seq 1 60</span><span class="s2">`;</span><span class="s1"></span></div>
<div class="p4">
<span class="s1">do</span></div>
<div class="p3">
<span class="s1">sleep 1</span></div>
<div class="p3">
<span class="s1"><br /></span></div>
<div class="p3">
<span class="s1">PLAYING</span><span class="s2">=$(</span><span class="s1"> mpc status </span><span class="s2">)</span></div>
<div class="p2">
<span class="s1"></span><br /></div>
<div class="p1">
<span class="s1">#Test the length, check the staus, then</span></div>
<div class="p1">
<span class="s1">#if mpc is not playing then the string length is 68 char long</span></div>
<div class="p1">
<span class="s1">#if mpc is playing, string length is longer</span></div>
<div class="p4">
<span class="s1">if</span><span class="s3"> </span><span class="s1">[</span><span class="s3"> </span><span class="s4"><b>${#PLAYING}</b></span><span class="s3"> </span><span class="s1">-gt</span><span class="s3"> 68 </span><span class="s1">];</span><span class="s3"> </span><span class="s1">then</span></div>
<div class="p5">
<span class="s5">#echo </span><span class="s1"><b>"MPC is playing"</b></span><span class="s5">;</span></div>
<div class="p1">
<span class="s1">#turn LED on</span></div>
<div class="p3">
<span class="s1">gpio </span><span class="s2">-g</span><span class="s1"> write 4 1</span></div>
<div class="p4">
<span class="s1">else</span></div>
<div class="p1">
<span class="s1">#turn LED off</span></div>
<div class="p3">
<span class="s1">gpio </span><span class="s2">-g</span><span class="s1"> write 4 0</span></div>
<div class="p4">
<span class="s1">fi</span></div>
<div class="p2">
<span class="s1"></span><br /></div>
<div class="p4">
<span class="s1">done</span></div>
<div class="p2">
<span class="s1"></span></div>
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #33bbc8; background-color: #ffffff}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff; min-height: 13.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000; background-color: #ffffff}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #34bc26; background-color: #ffffff}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #afad24; background-color: #ffffff}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #34bc26}
span.s3 {font-variant-ligatures: no-common-ligatures; color: #000000}
span.s4 {font-variant-ligatures: no-common-ligatures; color: #c33720}
span.s5 {font-variant-ligatures: no-common-ligatures; color: #33bbc8}
</style>
<br />
<div class="p2">
<span style="font-family: "times"; font-size: small;"><span class="s1"></span>And I tested it out by wiring up the LED to the right GPIO pin, SSH to the Pi and issue the command 'mpc play' and watch the LED light up almost straight away (max 1 sec), then 'mpc stop' and the LED switched off.</span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-3004032039422284922017-03-25T16:57:00.002+13:002017-03-25T16:57:23.636+13:00TFTPWhen using Busybox TFTP client<br />
<br />
get file:<br />
tftp -g -r filename.txt tftpserverip_or_hostname<br />
<br />
put file:<br />
tftp -p -l filename.txt tftpserverip_or_hostname<br />
<br />
Getting a file not found error? It seems that the file must exist on the server first, so if you want to upload a new file, first go to the server via SSH or something and create a dummy file of the same name.<br />
<br />
Getting permission denied error? You don't have enough permissions on the dummy file you are trying to upload over. SSH to the TFTP server and chmod 777 the file. Upload it. Then change the permissions back to 644 or something.<br />
<br />
When using OSX<br />
get file, launch Terminal and type these commands:<br />
tftp<br />
binary<br />
connect tftpserverip_or_hostname<br />
get filename.txt<br />
<br />
put file, launch Terminal and type these commands:<br />
tftp<br />
binary<br />
connect tftpserverip_or_hostname<br />
put filename.txt<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-7651919475267249372016-08-11T20:56:00.002+12:002016-08-11T20:56:31.044+12:00After having a bit of trouble installing my own certificate on <a href="https://www.ubnt.com/">Ubiquiti's</a> <a href="https://www.ubnt.com/download/unifi" target="_blank">Unifi </a>software on Linux, I though I would let you know the process I went through.<br />
<br />
First up, in my case I had my CA Certificate + User Certificate + User Key in .p12 format.<br />
<br />
If you have already installed the Unifi software then please, please, please make a config backup.<br />
<br />
Install the Unifi software on your server and make sure you can get to the Management page where it will be using an untrusted certificate from ubnt.com<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLV-nO52Dm6bZY21qY4kmvXvCi9qhsUZBxcXwvCdMEz5h0pJFo1PE51HQLMgtoDqFXB4Nl-hSLHSH_0GX6uVrwi1RfqD_1L7YstGtFCC3MR7owFyx5BXnKxPxDbxzCedNENazJI1tHJkEN/s1600/screen1_SelfSignedCert.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="507" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLV-nO52Dm6bZY21qY4kmvXvCi9qhsUZBxcXwvCdMEz5h0pJFo1PE51HQLMgtoDqFXB4Nl-hSLHSH_0GX6uVrwi1RfqD_1L7YstGtFCC3MR7owFyx5BXnKxPxDbxzCedNENazJI1tHJkEN/s640/screen1_SelfSignedCert.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Download Keystore Explorer for your OS from <a href="http://www.keystore-explorer.org/" target="_blank">http://www.keystore-explorer.org/</a> which is a GUI for some java command line tools to deal with keystores.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Create a new keystore of type JKS</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy5uY9uW8qfAnKcA8coxuP7A0XvK2IRW6ND8Gxq3gV0yEw0jywj7mHfQvBJ8h5cIMruRQ78rBtCUMJ5rDDZVPN8kX7FvTFVi55dLpQ5q8klME5jUSOkzY_-AijAUVaQH2SGJej0RMf8iUr/s1600/screen2_JKS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="403" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy5uY9uW8qfAnKcA8coxuP7A0XvK2IRW6ND8Gxq3gV0yEw0jywj7mHfQvBJ8h5cIMruRQ78rBtCUMJ5rDDZVPN8kX7FvTFVi55dLpQ5q8klME5jUSOkzY_-AijAUVaQH2SGJej0RMf8iUr/s640/screen2_JKS.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Import key pair, and select your .p12 certificate.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnXv-7gwOCgiH9be1LCYXfu1wrBpfbmP1rtgBBHmQGNL-yOmcc_FvCIY3B1ekmHcW67V1buGVJ5RPVRpJtrfpVwP0gtXBdYGrV9AV5ZmuAOgJ0tP-PjatwHHmiaIh0vGBJL044_Z1y1M3X/s1600/screen3_import.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="398" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnXv-7gwOCgiH9be1LCYXfu1wrBpfbmP1rtgBBHmQGNL-yOmcc_FvCIY3B1ekmHcW67V1buGVJ5RPVRpJtrfpVwP0gtXBdYGrV9AV5ZmuAOgJ0tP-PjatwHHmiaIh0vGBJL044_Z1y1M3X/s640/screen3_import.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
give it password 'aircontrolenterprise' (This is the ubiquity set password on the existing keystore that we are going to replace)</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
When requested to give it an alias, give it an alias 'unifi'</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4NgVVzE5MCzdQZ1muYAdkUMYw53eyzg7j31M1PlQIkOHOTtGEciDcL7oq_hUoTlNa2yhQX6RWjrsqXWkTSYvmFhSpzrFC7NHGoyDbuLoXsSpMSws49-m7ix8vu-s8djy1JGoygnBT5RB6/s1600/screen4_alias.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="402" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4NgVVzE5MCzdQZ1muYAdkUMYw53eyzg7j31M1PlQIkOHOTtGEciDcL7oq_hUoTlNa2yhQX6RWjrsqXWkTSYvmFhSpzrFC7NHGoyDbuLoXsSpMSws49-m7ix8vu-s8djy1JGoygnBT5RB6/s640/screen4_alias.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Save it.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
SSH back to the server running your Unifi.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Stop the unifi service by running the command 'sudo service unifi stop'</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
move the existing keystore that we are going to replace by running 'sudo mv /var/lib/unifi/keystore /var/lib/unifi/keystore.original'</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Use FTP or another method to copy the keystore you created with Keystore Explorer into the same location /var/lib/unifi/keystore</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
restart the service by running 'sudo service unifi start'</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Back on your client machine, browse to the Unifi Management to test.</div>
<div class="separator" style="clear: both; text-align: left;">
You should now have your own trusted certificate and can start restoring your saved config or starting with your fresh Unifi install.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF8ZoIPItUgI08fswrBftE5siqBBwiqeAXRcxnISx58E6gA5zArZctByXaB1rnANgl7ZhlxcBiNS0RMndnEAAlX7TAuq8wJELeqoK6UG6qMhC2IWfgbjAFC2dsfjjZlRdqBXNh9j4Apef1/s1600/screen5_trusted.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="622" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF8ZoIPItUgI08fswrBftE5siqBBwiqeAXRcxnISx58E6gA5zArZctByXaB1rnANgl7ZhlxcBiNS0RMndnEAAlX7TAuq8wJELeqoK6UG6qMhC2IWfgbjAFC2dsfjjZlRdqBXNh9j4Apef1/s640/screen5_trusted.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-21389822825592013462016-02-24T07:19:00.000+13:002016-02-24T07:20:35.595+13:00Resize Linux PartitionI had the case of wanting to resize a linux partition for my Raspberry pi without access to the usual raspi-config tool so had to do it manually.<br />
The raspi-config tool doesn't require a reboot, so there are probably other ways to achieve it as well, but this way works for me.<br />
<br />
First I had a full disk. Which you can see by running the df command with -h for human readable output.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXO70UHPVpYuBoMTwhgMbJlGxEdbUiemV5LMdMxvb0RH9GExSsZjpT9JircvxoC7PWIeKXJ3vhB3MHZsmBZ9xmpdXuL_-6Vyp0QODvYssQe8I6p-QeidniPWZ39HSLyP8CtPtuUm8_hbSl/s1600/resize_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXO70UHPVpYuBoMTwhgMbJlGxEdbUiemV5LMdMxvb0RH9GExSsZjpT9JircvxoC7PWIeKXJ3vhB3MHZsmBZ9xmpdXuL_-6Vyp0QODvYssQe8I6p-QeidniPWZ39HSLyP8CtPtuUm8_hbSl/s1600/resize_1.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I want to expand the space for the / mount point that is at 100%</div>
<div class="separator" style="clear: both; text-align: left;">
You can see that there is a partition at /dev/mmcblk0p1 , the p1 refers to partition 1 so that is device /dev/mmcblk0 but what partition is the / mount point?</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You can check the partitions on the device with the fdisk -l command which lists them. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihu3_-xfLStwjdoHHEfcB9TLRsM668cmhpDu9bX8JsijLpKMTkZdg1vwPMWYUEcnyZkg9vPLFCoscROXUIxpayKFJIoU7N8gHCRkZ0nuhI8QTfI7nxDMT6kJ30ZG_Bj_bzHrD3ohiAK_Zv/s1600/resize_2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihu3_-xfLStwjdoHHEfcB9TLRsM668cmhpDu9bX8JsijLpKMTkZdg1vwPMWYUEcnyZkg9vPLFCoscROXUIxpayKFJIoU7N8gHCRkZ0nuhI8QTfI7nxDMT6kJ30ZG_Bj_bzHrD3ohiAK_Zv/s1600/resize_2.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
So you can see that we want to expand the partition /dev/mmblk0p2 on device /dev/mmblk0</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
You also use fdisk on the device to delete and recreate the partition, then write the results back. This is done on partition 2 even though partition 2 is the linux partition on the running system.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHO-39kpXCVoea4dDf0SRAAr97Le6ppinQ3b2q8USRenvkGi6RUZalZ3fH8lMVi0078jxuJqmpxrlY7mW31VZBxqfZk24bsUVBNjRMm0qDku7HukHQCfakmvwenRLfu7pr5OpI6LXYviY0/s1600/resize_3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHO-39kpXCVoea4dDf0SRAAr97Le6ppinQ3b2q8USRenvkGi6RUZalZ3fH8lMVi0078jxuJqmpxrlY7mW31VZBxqfZk24bsUVBNjRMm0qDku7HukHQCfakmvwenRLfu7pr5OpI6LXYviY0/s1600/resize_3.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
It says the partition was altered, but the device is busy. It also says the device is busy for the next commands so the next step was to reboot.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
After the reboot, run resize2fs on the partition that changed size.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihg1I33ImEzNibQewuQ4Vp3FvOF1Abgt49xUeoI9x2nLl6JJMHIcazHyncPfM-Ya16bI_eckezfyu4nTiac2CIbYxv8SnA-jtRAVVmo9YwWm62e-Bt9A-kJEeEp4J2tSc8J3ynW_bjBJ9y/s1600/resize_4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihg1I33ImEzNibQewuQ4Vp3FvOF1Abgt49xUeoI9x2nLl6JJMHIcazHyncPfM-Ya16bI_eckezfyu4nTiac2CIbYxv8SnA-jtRAVVmo9YwWm62e-Bt9A-kJEeEp4J2tSc8J3ynW_bjBJ9y/s1600/resize_4.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
If it ran successfully, you can df -h again to see the new space that is now available.</div>
<div class="separator" style="clear: both; text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoQbvD4AS38GkR4f4rvab3hbSQGCDe46Zojav7toqqxC4jKEKpp2xMWXCyayiB0bsp2njwYzcs9UWg8gLoFl2I5kQXEVwKLThQ1p5QBwq9buFhzQ1Mm3IOvF7OtRpPPX_H2wDx6F2FvTTx/s1600/resize_5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjoQbvD4AS38GkR4f4rvab3hbSQGCDe46Zojav7toqqxC4jKEKpp2xMWXCyayiB0bsp2njwYzcs9UWg8gLoFl2I5kQXEVwKLThQ1p5QBwq9buFhzQ1Mm3IOvF7OtRpPPX_H2wDx6F2FvTTx/s1600/resize_5.png" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The space is now available for you to use.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-34033786548877202302015-10-28T18:54:00.000+13:002015-10-28T18:54:23.982+13:00Mac OS X Automator - Convert .m4a to .mp3I had a problem that my car stereo only plays <a href="https://en.wikipedia.org/wiki/MP3" target="_blank">MP3</a> files, but I have some music in M4A format that I wanted to listen to for a road trip.<br />
<br />
So I wanted to convert it, and as I had a few files to do, I decided that Automator could help me out in order to repeat it.<br />
<br />
In the end it was pretty simple.<br />
I created a new Automator application in case I wanted to have it as an application in the future. You could do it as a workflow as well, since if you compile it as an application the paths will be set inside it and you will have to open it in Automator again to change it.<br />
<span id="goog_1167727150"></span><span id="goog_1167727151"></span><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiolbr-Wr2JB_2z5bGJE4DZ2j4VemNwP6_32KBThehudv8LvbWc7rJW47xoM4-VUrceRjTcrc0biAENSAvUlKCphOJ_s303Hc45JRcUpAkg98VTqGpeUAQcTzpdE0aFgfI8q-Ah8zUsW1YF/s1600/automator_appliocaiton.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="307" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiolbr-Wr2JB_2z5bGJE4DZ2j4VemNwP6_32KBThehudv8LvbWc7rJW47xoM4-VUrceRjTcrc0biAENSAvUlKCphOJ_s303Hc45JRcUpAkg98VTqGpeUAQcTzpdE0aFgfI8q-Ah8zUsW1YF/s320/automator_appliocaiton.png" width="320" /></a></div>
<br />
I already had <a href="https://ffmpeg.org/" target="_blank">ffmpeg</a> on my system so I tested it on the command line first.<br />
<br />
If you don't have ffmpeg installed you can install it with <a href="https://www.macports.org/" target="_blank">Macports</a> using the command:<br />
<br />
<pre class="prettytext">sudo port install ffmpeg </pre>
<br />
Once you have the ffmpeg installed, play around with for a bit to get it converting the audio file on the command line. Once that was working all you needed to do was have your Automator application get a finder object and run a shell script using the ffmpeg command line options with a few adjustments (such as needing the ffmpeg complete path in Automator)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHlI0VTx2__3NPdOtBMESFfYQc94hhkfo22e2mqmxdwmFqPAAjYWDJ8uB1r5BKFV4yYzJpJqaJGcdItSdNw4M1iby41Inkt5sUMCvQgPkx60MlOXIyx1bztj_NH-1lrr8NGcmekPtUnSuS/s1600/automator_setup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHlI0VTx2__3NPdOtBMESFfYQc94hhkfo22e2mqmxdwmFqPAAjYWDJ8uB1r5BKFV4yYzJpJqaJGcdItSdNw4M1iby41Inkt5sUMCvQgPkx60MlOXIyx1bztj_NH-1lrr8NGcmekPtUnSuS/s320/automator_setup.png" width="320" /></a></div>
<br />
<br />
Here is the code:<br />
<br />
<pre class="prettytext">for f in "$@"
do
b=$(basename -s .m4a "$f")
/opt/local/bin/ffmpeg -i "$f" -codec:a libmp3lame -ab 256k /Users/username/Desktop/"$b".mp3
done
</pre>
<br />
(If you copy the above code, don't forget to change the output directory to the one you want)<br />
<br />
That basically creates a loop that goes through all of your input files. The screenshot only had one input, but you can drag multiple files into the "get specified finder items" section. Each time the loop runs the current file it is working on gets saved into variable 'f'.<br />
<br />
b=$(basename -s .m4a "$f") -> creates a variable 'b' and saves into it, the filename of the current file we are working on (that is "$f" dont forget) without the .m4a extension. So if you pass it '/path/to/file/music.m4a' variable 'b' will contain 'music'<br />
<br />
Then run the ffmpeg command line. In my case I knew the input bitrate was 256kbps, so I forced ffmpeg to save in that bitrate too. Check the ffmpeg documentation for what you can do with it.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-79695233510946448542015-09-17T18:07:00.000+12:002015-09-17T18:07:32.293+12:00Raspberry Pi Touchscreen Display Unboxing<br />
I stumped up and bought a Raspbeery Pi 7" Touchscreen Display as I am planning on using it as a start/stop, status display for my radio streaming pi.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijbNuAklzkCevXESOXp-5J4EOTeHd4xHW-vpNpGNeSNwj4WCeSX0W6MXC-vM2Sksqbtqo4s07sm58Ql2cuiq4lvPKrYo7HFX3N2BRbGvVNTjh9kgXDpwYkiMw1uOP1koFc0_Gy4TBkfrPy/s1600/image3.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijbNuAklzkCevXESOXp-5J4EOTeHd4xHW-vpNpGNeSNwj4WCeSX0W6MXC-vM2Sksqbtqo4s07sm58Ql2cuiq4lvPKrYo7HFX3N2BRbGvVNTjh9kgXDpwYkiMw1uOP1koFc0_Gy4TBkfrPy/s320/image3.JPG" width="240" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCZ0xqYe4rSm0ZB65tZuYl-xMNlgg7ClidXxediGW0kclGPHKdH4xEE-ujfUHeS41X4gHD3Nsick2xx8F7Nfa-svwVeM5HU5rZ9GVmolRUXIs_y72doXXDT7mnLd8BbMh-5d-m3dmq-vHW/s1600/image1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCZ0xqYe4rSm0ZB65tZuYl-xMNlgg7ClidXxediGW0kclGPHKdH4xEE-ujfUHeS41X4gHD3Nsick2xx8F7Nfa-svwVeM5HU5rZ9GVmolRUXIs_y72doXXDT7mnLd8BbMh-5d-m3dmq-vHW/s320/image1.JPG" width="240" /></a></div>
<br />
All the components it came with.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjShw6ynkqiRqsClMaoRcjb2yW8pOawq9TchIt8Nx7RqzOLtHFguTJRIZihnMYgASQfZMAvWpolKY1rurpDY1WJUxlKcrqikknJOYEZ99Q0v0jmHnusDxARxfupAxjx-brZrmgOvDQAyW4Q/s1600/image2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjShw6ynkqiRqsClMaoRcjb2yW8pOawq9TchIt8Nx7RqzOLtHFguTJRIZihnMYgASQfZMAvWpolKY1rurpDY1WJUxlKcrqikknJOYEZ99Q0v0jmHnusDxARxfupAxjx-brZrmgOvDQAyW4Q/s320/image2.JPG" width="320" /></a></div>
<br />
<br />
Attach the white display cable that is going to connect to the pi, attach the large screen cable to the connector on the underside of the display board. Attach the smaller ribbon to the small connector on the top of the display board (not shown)<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAe4wMsvY8bdPOSN2e2DXy1aO54Pwkq4mvYYA0_j2yTuOKwFMbwBB3GwOX_PcAFjo7rlRzQkErWRRhf5veaf0E2frMjNfeUzLmdrvhaV1UxNAvJjfgqgDr4ZqN7_eYOPnNkzkTdrAC3Wm-/s1600/image4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAe4wMsvY8bdPOSN2e2DXy1aO54Pwkq4mvYYA0_j2yTuOKwFMbwBB3GwOX_PcAFjo7rlRzQkErWRRhf5veaf0E2frMjNfeUzLmdrvhaV1UxNAvJjfgqgDr4ZqN7_eYOPnNkzkTdrAC3Wm-/s320/image4.JPG" width="240" /></a></div>
<br />
Use the spreaders to attach the display board to the display.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaUeYtBfg3EGoZA6q27KTO0pxLLTG0PaEfOLfzJU14T_SVMxy4SjSmvT-fnqFSS20aYLtbletcOMUSiPB6m7S2kQi39guzvB8GG4DQJ-hxKDGyZO1SPMZhfxb6GAU8xL5FdjCXfqDpOq_G/s1600/image5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaUeYtBfg3EGoZA6q27KTO0pxLLTG0PaEfOLfzJU14T_SVMxy4SjSmvT-fnqFSS20aYLtbletcOMUSiPB6m7S2kQi39guzvB8GG4DQJ-hxKDGyZO1SPMZhfxb6GAU8xL5FdjCXfqDpOq_G/s320/image5.JPG" width="320" /></a></div>
Attach the pi, attach the power and boot up. (photo to come)Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-43400301658335143902014-12-02T20:39:00.000+13:002015-10-28T18:54:47.162+13:00pfsense load balancingI had the case where I wanted to access my server remotely via SSH when my server was behind my pfsense firewall.<br />
The problem was, I often swap between a wired and wireless connection. I could port forward two different ports, one to the wired network and one to the wireless, but that is one more thing to remember. So I thought I would investigate pfsense load balancing functions so I wouldn't have to remember if I left it on wired or wireless.<br />
<br />
First is to set static IPs for the servers wireless and wired connections so I could reference them later. You can do this in the Status > DHCP leases menu.<br />
<br />
Second I needed to allow SSH from the WAN to the LAN network. I created a Firewall rule to allow this. You could create two rules to allow SSH to each static IP, but I have other devices on my network, so I just opened it from the WAN port to the whole network. by using the /24 address of the destination.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbT-hhAqNhrkdRfofWDqSI-wFTkOrrVNvrULwUl57HHMBGjouhA3YAOrp8mOtB2D27omUdXxMzVSBldPNOoY-F4mvjydXuQA6Q5IlCCN8Fea1b0SsjPMrpao2LDPpbSpRq9HklDQJYxs3A/s1600/Port+22+Firewall+Rule.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="301" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjbT-hhAqNhrkdRfofWDqSI-wFTkOrrVNvrULwUl57HHMBGjouhA3YAOrp8mOtB2D27omUdXxMzVSBldPNOoY-F4mvjydXuQA6Q5IlCCN8Fea1b0SsjPMrpao2LDPpbSpRq9HklDQJYxs3A/s1600/Port+22+Firewall+Rule.png" width="320" /></a></div>
<br />
Now to the fun stuff, load balancing.<br />
<br />
You need to create a pool containing the servers you want to load balance to, and a virtual server to forward a port to and use the pool.<br />
<br />
In Services > Load Balancer > Pool, click the plus to create a new pool.<br />
Since you wanted pfsense to know what is available, wired or wireless, and send traffic to whatever is available we want to select 'Load Balance'. Give it a description. The servers are listening on port 22 for SSH so we want to balance across that port. Add the static IPs that you set earlier and save.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih02UVmnIidvi-HeI2iCcSkmwbogA5e_4DLbbMGfdJM41e2R2Xh_Ri11xLNzSzWtBVlohGUq4FN8JduXVlBDRQcV1y5XsM9yu4heTd5_zFWdd_AYtF8KAs-NxbPIXVa49g9ZXe8i3M5dBC/s1600/SSH+pool.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="247" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEih02UVmnIidvi-HeI2iCcSkmwbogA5e_4DLbbMGfdJM41e2R2Xh_Ri11xLNzSzWtBVlohGUq4FN8JduXVlBDRQcV1y5XsM9yu4heTd5_zFWdd_AYtF8KAs-NxbPIXVa49g9ZXe8i3M5dBC/s1600/SSH+pool.png" width="320" /></a></div>
<br />
Now in Services > Load Balancer > Virtual Server, click the plus to create a new virtual server.<br />
Give it a name, the IP address is your WAN IP (or alias for the WAN IP) I wanted to use a non standard port, so chose port 1023, and you select the pool to use, in my case 'Server_SSH_Pool' and save,<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3OwkpCxIaEhnRT-WS2ko_Wm6U9EKMt4V-PR6XMBtBSeQ2XcggSDW5UyQI2pyYZ2Szun3x1mAJO-S8LLv_LDWcw3ZHKvusWeZXjzBoN0B1k9rV4JICfHmpaB1zGPUhrJd-J7aeQ70EdkrD/s1600/Virtual+Server.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3OwkpCxIaEhnRT-WS2ko_Wm6U9EKMt4V-PR6XMBtBSeQ2XcggSDW5UyQI2pyYZ2Szun3x1mAJO-S8LLv_LDWcw3ZHKvusWeZXjzBoN0B1k9rV4JICfHmpaB1zGPUhrJd-J7aeQ70EdkrD/s1600/Virtual+Server.png" width="320" /></a></div>
<br />
Apply changes. I rebooted the server to be sure.<br />
<br />
Now get onto the same network that your WAN connects to and try to SSH.<br />
<br />
ssh://username@10.1.1.123:1023<br />
<br />
where username is the username of an SSH user on the two servers in the load balancer pool.<br />
<br />
It should ask you for the password and you should be in.<br />
log out, change the server to connect to the LAN via its other network interface wired or wireless. Then back on machine on your WAN try to SSH again to the same address.<br />
<br />
You should now be able to get in from your WAN by using the one IP address and port 1023, no matter if your server is connected to the LAN via wired or wireless. (or a second NIC, it doesn't have to be wired and wireless) You are just load balancing across two different IPs so those could be different servers as well - that's how you load balance HTTP web requests to different web servers to handle load, my case just needed SSH instead.<br />
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-39074453280435944372014-08-11T18:18:00.000+12:002014-08-11T18:18:13.829+12:00Raspberry Pi RTC ModuleWell I purchased <a href="http://nicegear.co.nz/raspberry-pi/high-precision-real-time-clock-for-raspberry-pi/">this</a> High Precision Real Time Clock for my Raspberry Pi.<br />
<br />
They had a nice article on how to get it working <a href="http://nicegear.co.nz/blog/using-an-i2c-real-time-clock-rtc-with-a-raspberry-pi/">here</a>.<br />
<br />
I pretty much followed it exactly and it worked fine, but I am going to relist the steps here in case I need them again later or the article moves etc.<br />
<hr />
<br />
<div class="p1">
<pre class="prettytext"><div class="p1">
# Remove the module blacklist entry so it can be loaded on boot</div>
<div class="p1">
sudo sed -i 's/blacklist i2c-bcm2708/#blacklist i2c-bcm2708/' /etc/modprobe.d/raspi-blacklist.conf</div>
<div class="p2">
</div>
<div class="p3">
# Load the module now</div>
<div class="p3">
sudo modprobe i2c-bcm2708</div>
<div class="p2">
</div>
<div class="p3">
# Notify Linux of the Dallas RTC device</div>
<div class="p3">
# on my 256Mb Pi I used.</div>
<div class="p3">
echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-0/new_device</div>
<div class="p3">
# on my new Pi B+</div>
<div class="p3">
#echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device</div>
<div class="p2">
</div>
<div class="p3">
# Test it out.</div>
<div class="p2">
sudo hwclock</div>
</pre>
<hr />
</div>
<div class="p1">
</div>
once that was done:
<br />
<pre class="prettytext"><div class="p1">
</div>
<div class="p1">
# Add the RTC device on boot</div>
<div class="p1">
sudo sed -i 's#^exit 0$#echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device#' /etc/rc.local</div>
<div class="p1">
#dont forget to change i2c-0 or i2c-1</div>
<div class="p1">
</div>
<div class="p1">
echo exit 0 | sudo tee -a /etc/rc.local</div>
<div class="p1">
</div>
<div class="p2">
#This doesn't cover automatically setting the clock on boot and but you can do so by adding another line (above exit 0) to rc.local with;</div>
<div class="p1">
</div>
<div class="p1">
hwclock -s</div>
</pre>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-28231424907063070672014-07-19T12:23:00.003+12:002014-07-19T12:23:38.139+12:00Using Stat command to get file info for a scriptI was wanting to get the last modified date of a file to use in a OS X shell script.<br />
<br />
It seemed that using the 'stat' command was the way to go in order to get details about the file.<br />
<br />
MAC OS X Developer Docs on stat command are <a href="https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/stat.1.html">here</a> or you can 'man stat' on the command line.<br />
<br />
Wading my way through the different formats that could be returned I came up with:<br />
<br />
Find the last accessed time on a file<br />
<br />
<pre class="prettyprint">stat -f "%Sa" /path/to/file
Jul 19 12:05:26 2014</pre>
<br />
<br />
Find the last modified time on a file<br />
<br />
<pre class="prettyprint">stat -f "%Sm" /path/to/file
Oct 5 08:46:15 2013</pre>
<br />
<br />
Find the creation time on a file. (ie the Birth time of the inode)<br />
<br />
<pre class="prettyprint">stat -f "%SB" /path/to/file
Jul 18 19:21:39 2014</pre>
<br />
Not to be confused with %Sc which was the last time the inode changed, not the last change time.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-2497053525717392372014-03-20T19:16:00.001+13:002014-03-20T19:16:08.291+13:00Window 7 Desktop Picture via .bat scriptI have a case when I wanted to set my desktop background at startup via a bat script.<br />
<br />
put a wallpaper.jpg picture that you want on your desktop somewhere.<br />
<br />
Create a [whatever].bat file in a location,
<br />
<br />
<pre class="prettyprint">ECHO OFF
reg add "HKCU\Control Panel\Desktop" /v Wallpaper /f /t REG_SZ /d C:\path\to\wallpaper.jpg
RUNDLL32.EXE USER32.DLL,UpdatePerUserSystemParameters ,1 ,True</pre>
<br />
<br />
You could run the .bat now if you want.
<br />
To have it apply each time you restart, put a shortcut to the .bat file C:\Users\[<u>your account name</u>]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\StartupUnknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-40726780456000091962014-03-15T15:45:00.004+13:002016-08-11T20:58:26.854+12:00Installing pfsense on an HP T5720<div class="p1">
Well after some time spent on on some unsuccessful projects, after getting inspired from <a href="http://www.youtube.com/watch?v=71S9fek0FKA">this video</a></div>
<div class="p1">
<br /></div>
<div class="p1">
I decided that making my own router would be a good idea!</div>
<div class="p2">
<br /></div>
<div class="p1">
Some friends of mine had tried <a href="https://www.pfsense.org/">pfsense</a> so I thought that I would give that a go.</div>
<div class="p2">
<br /></div>
<div class="p1">
I had some old hardware that I bough cheap a while ago when I wanted to do something, I just didn't know what. So I decided to use an old <a href="https://www.google.com/search?q=HP+T5720&espv=210&tbm=isch&tbo=u&source=univ&sa=X&ei=NKUjU4mwJIiWkgXBmYCYBQ&ved=0CDIQsAQ">HP T5720 Thin Client</a> that I had.</div>
<div class="p2">
<br /></div>
<div class="p1">
It seemed to be perfect for this setup, a small, silent, power efficient, powerful enough little server.</div>
<div class="p2">
<br /></div>
<div class="p1">
The HP 5720 has 512Mb of Flash HD, the one I purchased had 1Gb SODIMM RAM already and came with a PCI Riser card. So I put in a 2x 100/1000 PCI Ethernet Card that I had on a server I had and decided to give it a go.</div>
<div class="p1">
<br /></div>
<div class="p1">
Here is mine when set up:</div>
<div class="p1">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3aa1Wf3B04XpjXt4l9RusQZ7aYz0LV_kt2F-zG0aUpXgaCgdCcrdunqDg1jm6fnbMINNYhz2ALrrfaRGIo2_o_qVhm_H3IZDPZbB1f05pMkAENmMpITI7wdO5y-yyTjjBVgTnQcIy0zeX/s1600/T5720_Setup.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3aa1Wf3B04XpjXt4l9RusQZ7aYz0LV_kt2F-zG0aUpXgaCgdCcrdunqDg1jm6fnbMINNYhz2ALrrfaRGIo2_o_qVhm_H3IZDPZbB1f05pMkAENmMpITI7wdO5y-yyTjjBVgTnQcIy0zeX/s1600/T5720_Setup.JPG" width="320" /></a></div>
<div class="p2">
<br /></div>
<div class="p1">
Parts:</div>
<div class="p1">
HP T5720 Thin Client with associated parts (power etc) and PCI Riser Card.</div>
<div class="p1">
1x PCI Ethernet Card</div>
<div class="p1">
Monitor during install.</div>
<div class="p1">
Keyboard During install.</div>
<div class="p1">
External CD drive during install.</div>
<div class="p2">
<br /></div>
<div class="p1">
I set the BIOS to boot of USB, hooked up my external CD Drive, hooked up the T5720 onboard Ethernet to my ADSL modem and booted off the pfsense Live CD.</div>
<div class="p2">
<br /></div>
<div class="p1">
I tried the default boot at first, but I kept having ACPI error messages scrolling past. So I rebooted and selected option 2 to start pfsense with ACPI disabled.</div>
<div class="p2">
<br /></div>
<div class="p1">
When it asked if I wanted to go to Installer or continue with Live CD, I selected Install.</div>
<div class="p2">
<br /></div>
<div class="p1">
This takes me to the ncurses install menus. I selected the default.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2DCRbseaqBTrkN2BDodRXFU1-uKhONng5_Yglt862jMopt3OQkSALA0DSty-trbxUOAJ59dgQ5-sJux680dQOKYCGreqo9xtwZ13X6mJFzZSs-qxZA-JEbLORugr-OLk_eQzaS2Xg4w1A/s1600/Screen2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2DCRbseaqBTrkN2BDodRXFU1-uKhONng5_Yglt862jMopt3OQkSALA0DSty-trbxUOAJ59dgQ5-sJux680dQOKYCGreqo9xtwZ13X6mJFzZSs-qxZA-JEbLORugr-OLk_eQzaS2Xg4w1A/s1600/Screen2.png" width="320" /></a></div>
<div class="p2">
<br /></div>
<div class="p1">
I selected Quick/Easy Install. </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-b7oVkN60s3dBj8d3HMfSw8fEfoB6u2l47i64etxBG6ZfYl75KSZR6C3bEwy0KobxTB4KkiR0r5I7AQhip6ii4iK4asZatQxxyULlmuAPH_6ykAt4DZ3IrpgVdu2zEMioylQqdsGA2euf/s1600/Screen3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-b7oVkN60s3dBj8d3HMfSw8fEfoB6u2l47i64etxBG6ZfYl75KSZR6C3bEwy0KobxTB4KkiR0r5I7AQhip6ii4iK4asZatQxxyULlmuAPH_6ykAt4DZ3IrpgVdu2zEMioylQqdsGA2euf/s1600/Screen3.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="p2">
I had some popoups about how it would erase everything etc. but it kicked off. During the install there were some errors, like this, </div>
<div class="p2">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcQNFTFQRRitOwfnXM1f87kgb4dlnUAq8aRADzcxUGec8ZfWqDrG2ayKqJ9x6bhAzo_rGU0UzScS8jLo89nihdAI-HstkwySZw9KNOSAw_oamSsfYfjZD2ez8Sh5xLx1PsbOkUaJTJtZLA/s1600/Screen4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcQNFTFQRRitOwfnXM1f87kgb4dlnUAq8aRADzcxUGec8ZfWqDrG2ayKqJ9x6bhAzo_rGU0UzScS8jLo89nihdAI-HstkwySZw9KNOSAw_oamSsfYfjZD2ez8Sh5xLx1PsbOkUaJTJtZLA/s1600/Screen4.png" width="320" /></a></div>
<div class="p2">
<br /></div>
<div class="p2">
<br /></div>
<div class="p1">
but I skipped those and it seemed to install okay.</div>
<div class="p2">
<br /></div>
<div class="p1">
after install, I shutdown, set the bios to boot from Flash, disconnected the CD drive and started it up.<br />
<br />
EDIT - After installing pfsense 2.1.2 on an external hard drive, I was getting booting errors.<br />
I solved them by at the pfsense menu, hitting space, and then 7 to go into the loader prompt and inputting<br />
<br />
<pre style="background-color: #f9f9f9; border: 1px dashed rgb(47, 111, 171); line-height: 1.1em; padding: 1em;">set kern.cam.boot_delay="10000"
boot</pre>
</div>
<div class="p2">
<br />
I then once it booted okay, I installed nano as mentioned below, etc, but also added to /boot/loader.conf the line<br />
<br />
kern.cam.boot_delay="10000"<br />
<br />
in order to make it persistent.<br />
<br />
END EDIT<br />
<br /></div>
<div class="p1">
I was then in the main pfsense command line menu.</div>
<div class="p1">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeDS29RWPBlTsXBQ_2HprZLnO31f-4rErGlTDR6iH-gmcE2hn4KBuQBH7vDC593e-YlHUSk_KnkTd0Tj49WpjmbVsn9tlKengPLlrKmPQLPDbvMN371-KAk0p3COwGRCEJYL-1_YIwk9-1/s1600/Screen5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjeDS29RWPBlTsXBQ_2HprZLnO31f-4rErGlTDR6iH-gmcE2hn4KBuQBH7vDC593e-YlHUSk_KnkTd0Tj49WpjmbVsn9tlKengPLlrKmPQLPDbvMN371-KAk0p3COwGRCEJYL-1_YIwk9-1/s1600/Screen5.png" width="320" /></a></div>
<div class="p1">
<br /></div>
<div class="p2">
<br /></div>
<div class="p1">
I still had the ACPI errors scrolling past, so I needed to stop those on the default option at pfsense startup.</div>
<div class="p2">
<br /></div>
<div class="p1">
I needed to google how to turn it off, but once I found out how it was easy.</div>
<div class="p2">
<br /></div>
<div class="p1">
I went to the shell (option 8)</div>
<div class="p1">
and installed nano using: </div>
<div class="p1">
<pre class="prettyprint"></pre>
<pre class="prettyprint">pkg_add -r nano</pre>
</div>
<div class="p1">
<br />
EDIT<br />
on pfsense 2.2.2 you use pkg to install other packages<br />
<pre class="prettyprint">pkg install nano</pre>
<br />
END EDIT<br />
<br /></div>
<div class="p1">
To default ACPI to off I modified /boot/device.hints file adding:</div>
<div class="p1">
<pre class="prettyprint"></pre>
<pre class="prettyprint">hint.acpi.0.disabled="1"</pre>
</div>
<div class="p2">
<br /></div>
<div class="p1">
The machine I was on, was also on the ADSL LAN, and not hooked up to my pfsense box.</div>
<div class="p1">
I could see from the pfsense menu what IP was assigned to my WAN interface so I tried to connect to that using my browser to use the web configuration.</div>
<div class="p1">
That was denied and is the pfsense default not to allow connections to the webconfigurator over the WAN interface.</div>
<div class="p1">
you could temporarily disable the packet filter by going to the shell and running: </div>
<div class="p1">
<pre class="prettyprint"></pre>
<pre class="prettyprint">pfctl -d</pre>
</div>
<div class="p1">
<br />
Then you should be able to get to the web configuration over the WAN.</div>
<div class="p2">
<br /></div>
<div class="p1">
I just hooked my computer up to the pfsense box LAN interface and rebooted both my machine and the pfsense box.</div>
<div class="p2">
<br /></div>
<div class="p1">
in doing that, I think I bumped the PCI card, as the pfsense box came up only recognizing the onboard interface.</div>
<div class="p2">
<br /></div>
<div class="p1">
I reseated and re-powered the pfsense box, and it came back up. But the LAN interface no longer seemed to be a DHCP server and I could't get in to the web GUI.<br />
<br /></div>
<div class="p1">
So how to start the DHCP server on the LAN interface?<br />
<br />
Easy, on the console just assign it a static IP and it will ask you if you want to turn on DHCP for the interface.</div>
<div class="p1">
Give it an IP range and you're back up and running. Your computer on the LAN interface will now be able to get an IP, get to the web configuration, and probably can already access the net if your ADSL is up and has assigned your WAN interface an IP.</div>
<div class="p2">
<br /></div>
<div class="p1">
So now I will be spending some time, configuring it with all the rules and options I want, maybe adding wireless, maybe mounting the T5720 onto something. Lots to play with now.</div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-3330329492225976194.post-88754634939194567022013-10-07T19:33:00.004+13:002016-04-24T16:26:38.863+12:00Picture of the Day - Part 3Continuing on from Part 1 and Part 2.<br />
<br />
I wasn't happy with the results of the Automator workflow.<br />
It was nice to have a play around and see what it could do, but it seemed that I was wanting to do some more advanced functions, like text append, that just weren't available or easy in Automator.<br />
<br />
So I used my Bash scripting power to come up with another approach that gave me the flexibility that I needed.<br />
<br />
<pre class="prettyprint">
#!/bin/bash</pre>
<pre class="prettyprint">#build up the url
MYURL="http://en.wikipedia.org/wiki/Template:POTD/";
DATE=`date +%Y-%m-%d`
MYURL=$MYURL$DATE
temp=$(/opt/local/bin/lynx -dump -nonumbers -listonly -image_links $MYURL | grep en\. | grep -E "(.jpg|.JPG)" | grep -v thumb)
temp2=$(/opt/local/bin/lynx -dump -nonumbers -listonly -image_links $temp | grep upload | grep -E "(.jpg|.JPG)" | grep -v thumb | uniq)
#get the image
/opt/local/bin/wget --no-check-certificate -O /Users/jono/Documents/Backgrounds/1.jpg $temp2</pre>
<br />
To break it down,<br />
First I would build up the URL in the form that I needed.<br />
<br />
Then I would use the command line browser lynx to grab the image links out of that URL. I would filter the results on some text like 'en.' (to make sure I hit en.wikipedia.org) and '.jpg' (to make sure I just got jpg results) but I didn't want any URLs returned with the text 'thumb' - as they were thumbnails, so I used the grep filter 'grep -v thumb' to NOT include those results.<br />
<br />
So I should now have the URL of the wikipedia file document in the form<br />
http://en.wikipedia.org/wiki/File:xxxxxxxxxx.jpg<br />
<br />
That file document, again had just a larger version of the thumbnail on that page, but it linked to the original higher resolution image.<br />
<br />
So I ran lynx again, applied pretty much the same filters, and made sure that I only had unique results (the pipe to uniq command)<br />
<br />
I now have the link to the full resolution uploaded file and I use the command wget to save it straight to the location I wanted named as the filename I wanted (1.jpg)<br />
<br />
No need to save it and then move and rename, like I tried to do in Automator.<br />
<br />
Now my geektool geeklet that is looking in that location every 5 secs or so kicks in and changes the desktop background to the newly download picture.<br />
<br />
Now you can just set that up as a login script and you can have dynamic fresh Picture of the Day each time you log in.<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-74734573509494436862013-10-06T18:13:00.002+13:002013-10-06T18:13:27.570+13:00Picture of the day - Part 2Picking up where <a href="http://www.jds5nz.geek.nz/2013/10/picture-of-day-part-1.html">Part 1</a> left off, I tried to do a better way to create a picture of the day for Geektool to use.<br />
<br />
As Wikipedia picture of the day was in the standard format<br />
<br />
<div class="p1">
http://en.wikipedia.org/wiki/Template:POTD/yyyy-mm-dd </div>
<div class="p1">
<br /></div>
<div class="p1">
I decided to just grab what I needed.</div>
<div class="p1">
At first I researched using variables in Automator, but it seem to handle appending text,all the forums had people creating Applescripts to build up dynamic text.</div>
<div class="p1">
<br /></div>
<div class="p1">
So I whipped up the applescript:<br />
<br /></div>
<pre class="prettyprint"> set myURL to "http://en.wikipedia.org/wiki/Template:POTD/"
set myshort to short date string of (current date)
set myday to items 1 through 2 of myshort
set mymonth to items 4 through 5 of myshort
set myyear to items 7 through 10 of myshort
set myURL to myURL & myyear & "-"
set myURL to myURL & mymonth & "-"
set myURL to myURL & myday
return myURL</pre>
<div class="p1">
<br /></div>
<div class="p1">
in order to get constancy on the date I had to force the short dat to be 2 digits\2digits\4 digits</div>
<div class="p1">
You can do this in System Preferences > Language and Text > Formats > Customize</div>
<div class="p1">
that gave the short date the format 01/01/1970 where I could use the "to items 1 through 2" to pick it apart so I could use it as I wanted.</div>
<div class="p1">
<br /></div>
<div class="p1">
So I came up with what I hoped was a working workflow:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCPf3Yd36fZV_mJ1i7OwmsUPFInqpjHlkxstBBvqr6dyaENEh0dTFqzMjXoaDUdBDhROZYAxooRyrOEZJvYU5NXoGw4OOS9XVLiTFKuP5-ItUSOubnPt1zxAXktIqoyiSaZy3ag7AZTrJu/s1600/POTD_workflow2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="608" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCPf3Yd36fZV_mJ1i7OwmsUPFInqpjHlkxstBBvqr6dyaENEh0dTFqzMjXoaDUdBDhROZYAxooRyrOEZJvYU5NXoGw4OOS9XVLiTFKuP5-ItUSOubnPt1zxAXktIqoyiSaZy3ag7AZTrJu/s640/POTD_workflow2.png" width="640" /></a></div>
<div class="p1">
<br /></div>
<div class="p1">
Except it didn't work.</div>
<div class="p1">
It dumped the files to folder abc123 okay, again it had the extra images I didn't need as well as the POTD in .jpg format.</div>
<div class="p1">
Putting in a 'view results' into each step of the workflow, I could see what was going on.</div>
<div class="p1">
It seems that my 'Filter Finder Items' wasn't working as I expected. It didn't return anything to be renamed, and then moved. Maybe I wasn't using it properly and selecting Desktop > abc123 properly.</div>
<div class="p1">
Maybe I could work it out, but I still wasn't happy that the Save Images was only getting the thumbnail of the Picture of the Day.</div>
<div class="p1">
<br /></div>
<div class="p1">
How I solved it in a way I was happy with will be part 3.</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-40019624100721977072013-10-06T11:53:00.003+13:002013-10-06T18:14:30.559+13:00Picture of the day - Part 1Okay, so I use the great app <a href="http://projects.tynsoe.org/en/geektool/">Geektool</a> to change/show some desktop pictures.<br />
<br />
I have Geektool configured to look in my backgrounds folder for a file 1.jpg and display it as my background picture. I thought it would be cool if that picture changed daily.<br />
<br />
So what site has a great looking picture of the day? <a href="http://en.wikipedia.org/wiki/Wikipedia:Picture_of_the_day">Wikipedia</a> of course.<br />
<br />
So my idea was to use Mac OS X Automator to follow this workflow:<br />
<br />
Use the main wikipedia URL<br />
Get the links from the page<br />
Filter them down as the POTD always contained http://en.wikipedia.org/wiki/Template:POTD/ then todays date<br />
Get the contents of the page<br />
Save images<br />
<br />
So I created this workflow, which worked okay.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit5AF4dEDOToZuylxraj0bas9hzAxAy7iVJrJ5KyxM36LRWfs7Xgm9Eoe9RDPuIRAwukhtWrT2dYBAoDmbWfuxPNZp4v2A8RuCRqN-NBG8zceXhJQ_QoO7mZfKeDb9LR4yjAU_NqKZZvvQ/s1600/POTD_workflow1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="572" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit5AF4dEDOToZuylxraj0bas9hzAxAy7iVJrJ5KyxM36LRWfs7Xgm9Eoe9RDPuIRAwukhtWrT2dYBAoDmbWfuxPNZp4v2A8RuCRqN-NBG8zceXhJQ_QoO7mZfKeDb9LR4yjAU_NqKZZvvQ/s640/POTD_workflow1.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
That dumped the files to the folder abc123 on my desktop but it wasn't efficient. It would grab all the other images like the wikipedia logo as well as the picture of the day as small thumbnails.</div>
<div class="separator" style="clear: both; text-align: left;">
I tried to use automators various other finder functions to move and rename, but I didn't have much luck.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I thought that I could do better by getting only the exact image I wanted at the size I wanted, so see what else I tried in <a href="http://www.jds5nz.geek.nz/2013/10/picture-of-day-part-2.html">Part 2</a>.</div>
<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-27570463968315538172013-08-18T14:08:00.003+12:002013-08-18T14:08:53.857+12:00Conditional Statement in Bash on OS XOk,<br />
I had a bit of trouble getting a conditional statement to evaluate on my bash script in OS X.<br />
I was trying to perform an action if I was online or not.<br />
<br />
A good way to test if you are online - ping google of course!<br />
<br />
For testing purposes I just got the computer to use text to speech to let me know the result.<br />
Here is my working example, spaces are important!<br />
<br />
<pre class="prettyprint">#!/bin/bash</pre>
<pre class="prettyprint">
</pre>
<pre class="prettyprint">FLAG=0
ping -q -c 1 google.com && FLAG=1</pre>
<pre class="prettyprint">if [ $FLAG = "1" ] ; then
say $FLAG</pre>
<pre class="prettyprint">else </pre>
<pre class="prettyprint">say $FLAG</pre>
<pre class="prettyprint">fi
exit</pre>
<br />
If you can ping google,the computer will speak "one"<br />
<br />
If you you want to test, change google.com to something you cant resolve such as googlekdfsjbg.com and run it again.<br />
<br />
You shouldn't be able to ping googlekdfsjbg.com so the computer will speak "zero"<br />
<br />
Of course this is a simple example and you need to tailor to your situation, just because you can't ping google doesn't mean you are not online. For example pings could be blocked on your network, however this suits my situation.<br />
<br />
enjoy!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-12400993917454056942013-08-01T20:30:00.004+12:002015-11-29T11:26:26.225+13:00Raspberry Pi Temperature Sensing.Thanks to Adafruits Raspberry Pi tutorials on <a href="http://learn.adafruit.com/adafruits-raspberry-pi-lesson-11-ds18b20-temperature-sensing">temperature sensing</a>,<br />
and this <a href="http://www.whiskeytangohotel.com/2013/07/raspberry-pi-charting-ambient-vs.html">blog</a> on Raspberry Pi temperature sensing to <a href="http://sen.se/">Sen.se</a>.<br />
<br />
I decided to do my own.<br />
I also wanted to store the results locally, so I also saved it to a file.<br />
<br />
<span style="font-family: inherit;">I used a <span style="background-color: white; line-height: 16.796875px;">DS18B20 1-wire temperature sensor</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">Adafruit T-Cobbler</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">Breadboard and wires.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;"><br /></span></span><span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">I wired it up just like they did in their diagrams.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;"><br /></span></span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKWgoLjrqszv5L_vGLngWH0BU3_oNwcSfBudZzy5JQabgjO-tcngQ1UdX3GuUHs0LEXI1Ns0pkhVma8Z_epunKj0dFP-cTYM9pUGQW2Jz97lnddIWu1ZUamHRZu1BQvKm4i1dvQk9p6Cl8/s1600/Pi_temp.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKWgoLjrqszv5L_vGLngWH0BU3_oNwcSfBudZzy5JQabgjO-tcngQ1UdX3GuUHs0LEXI1Ns0pkhVma8Z_epunKj0dFP-cTYM9pUGQW2Jz97lnddIWu1ZUamHRZu1BQvKm4i1dvQk9p6Cl8/s320/Pi_temp.jpg" width="320" /></a></div>
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;"><br /></span></span><span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">Add one wire support.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">In /boot/config.txt add</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">dtoverlay=w1-gpio</span></span><br />
<ol class="linenums" style="box-sizing: border-box; color: #333333; font-family: Consolas, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace; font-size: 13px; line-height: 19.5px; margin: 0px; padding: 0px; white-space: pre;">
</ol>
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">I subscribed to Sen.se and in your profile you can find your API key.</span></span><br />
<span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;"><br /></span></span><span style="font-family: inherit;"><span style="background-color: white; line-height: 16.796875px;">After checking out their tutorials I then wrote a bash script to grab the the temperature, then use curl and JSON to upload it.</span></span><br />
<span style="background-color: white; color: #525252; font-family: "helvetica neue" , "helvetica" , "arial" , sans-serif; font-size: 14px; line-height: 16.796875px;"><br /></span>Here is the script replace SERIALNUMBERHERE with the serial number of your sensor.<br />
API KEY HERE with your API key, and SENSEFEEDID with your Sen.se feed id.<br />
<br />
<pre class="prettyprint">#!/bin/bash
sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices/SERIALNUMBERHERE/
URL="http://api.sen.se/events/?sense_key=API KEY HERE"
DATE=$(date)
NOW=$(date +"%d_%m_%Y")
DATA=$(cat w1_slave)
DATA1=${DATA:69:2}
DATA2=${DATA:71}
DATA3=$DATA1.$DATA2
OUTPUT="$DATE , $DATA1.$DATA2"
echo $OUTPUT >> /root/output_$NOW.csv
curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"feed_id": SENSEFEEDID,"value": '$DATA3'}' $URL
</pre>
I then use Cron to schedule a reading every few minutes.<br />
<br />
Then back in Sen.se you can graph it or manipulate it like you want.<br />
<br />Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3330329492225976194.post-55126732996343511602013-07-29T19:17:00.003+12:002013-07-29T19:17:24.444+12:00First Post.Well its about time. Here it is. A blog. Yeah. You know what a blog is.Unknownnoreply@blogger.com0