Friday, December 27, 2013

file table is full on macos

ah, the mac which "just works".

this happens now when I try to preview a directory full of images from one of my surveillance cameras, of about 2900 in this case.

looks like something is using too many files.  I'm going to try rebooting and not starting everything and see what happens.

this message comes out of the console log in my case.

here is a google group discussion with a message with some sysctl command suggestions.

https://groups.google.com/forum/#!topic/uk.comp.sys.mac/Qw7QxZGXGak

> Third time now. Machine hasn't been touched in almost a week, I come
> back and find it has hung - hard power off, then after reboot i find
> the kernel log full of 'file table is full'.
>
> Any ideas how to go about tracing this?
This limit is controllable using sysctl. To see the current values:
sysctl kern.maxfiles kern.maxfilesperproc
Mine says 12288 and 10240. OS X *used* to read in definitions when it
booted from /etc/sysctl.conf, but you can change those values on the
fly.
Why you're running out is more of a mystery. I suppose you could run
lsof regularly over a period and see what changes.

Thursday, December 26, 2013

yum notes Redhat Enterprise Linux 6.2 or such.

to find out what package contains a command using yum.  must have repository set up.

yum whatprovides vnc-server

To set up repository after installation to use dvd as source:

put this in /etc/yum.repos.d/rhel-media  (any file name will do)

[rhel-media]
name=Red Hat Enterprise Linux 6.2
baseurl=file:///mnt/cdrom/Server/

file:///mnt/cdrom/
gpgcheck=0
enabled=1
gpgkey=file://etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


The gpgkey can be left out if the gpg checking is off (as shown)  noted only if you want to mess with such.  for media it isn't much use if you know where your media came from.

yum will find and install any package on the dvd.  Create another file in the repos directory for any additional media.  This example uses the 6.2 install media dvd 1 as an example.

Gui application install front end for system, also invoked by system->administration->add/remove software with gnome desktop

 gpk-application

run from a gnome command window at user level command line (not root).

Jay's 3174 setup instructions

Re: 3174 ( and Jay's parms)

Last year, Jay sent me these customization parms which worked well
for me. (Thanks again, Jay) I found that the 3278, 3178, 3191 (from
heaviest to lightest) work the best. The 3279 seems to work okay but
as I indicated previously, graphics support is disabled.
Dave S.
(Following from Jay)-------------------------------------
Here you go:

This configuration is defined to use 2 physical terminals with 5
logical
terminal sessions each. There is no SNA host on my network, so SNA
parameters are only specified enough to keep the customization
procedure
happy. My controller does not have AEA hardware, so it's disabled and
no
customization is done for it. Questions not specified here are
allowed to
default.

Main menu option 1, customization:

Model/Attach:

098 FOO (online test password)
099 whatever (product assistance data)
100 63R (controller model)
101 7 (host attach via Token Ring)
102 1 (LAN adapter type)

Token-Ring Description:

080 4000 C0A8 4902 (address; 40000 + hex value of IP address)
082 1 (16 MBPS ring speed, with no early release)

LAN:

106 4000 C0A8 4902 04 (address and SAP)
107 4000 C0A8 4901 04 (gateway address and SAP; dummy value)
108 23V4504 (my machine S/N)
110 2 0000 (MLT configuration: allow controller to assign addresses)
116 1_ __ (MLT addressing)

Common SNA:

all defaults

117 - Port Assignment:

Enter 5 for IS for first two ports (26-00 and 26-01), and any others
you
intend to use.

Frame Relay Description:

300 0 (disable frame relay)

End-User Productivity Functions:

001 0000 (Local Copy print queue buffer size)
002 1 (calculator function - RPN)
003 0 (5250 emulation off)
004 5 (LAN T1 timer)
005 07 (LAN retry count)
006 N (copy from session to session)
007 N (HAP sharing for local copy)
008 Y (CSCF IML passwor drequired)
009 all 0s (nonstandard options)

Save your responses.

Main menu option 5, AEA/TCP/IP configuration:

AEA and TCP/IP Configure:

700 0 1 (disable AEA, enable TCP/IP)

Port set:

1 Name 3270DISP, session limit 5, port type 1

Port to Port Set Map:

Enter 1 in ports 26-00 and 26-01. (And any others you intend to use.)

There will be 4 AEA and TCP/IP station sets.

Set 1:
721 UNUSED SNA (station set name)
722 3H (station type: 3270 host)

Set 2:
721 TELNET (station set name)
722 TH (telnet host)
751 4 (emulate VT220 with 7-bit controls)
763 0 (new line option: don't assume LF with CR)

Set 3:
721 TN3270 (station set name)
722 TH (telnet host)
751 6 (TN3270)

Set 4:
721 3270 DISPLAYS (station set name)
722 3D (station type: 3270 display)
723 3270DISP (port set name)

AEA and TCP/IP Default Destination:

Leave all entries blank. This will force all logical terminals to the
connection menu.

TCP/IP Options Menu:

052 192.168.073.002 (3174 IP address; change as needed for your LAN)
054 255.255.255.000 (IP subnet mask; change as needed)
057 N (3174 will not do IP routing)
058 010 (maximum telnet sessions; set to 5*number of devices)
059 00 (maximum printer connections)
060 0020 (TCP/IP buffer space, in KB; adjust as needed once you see
how much
memory is actually used)
062 Y (routing field support)
064 Y (all routes broadcast)

TCP/IP Routing Information:

Enter one route, no destination IP address, type D (default), router
IP
address 192.168.073.001 (or whatever your default gateway is).

TCP/IP Domain Name Services: (Change these as needed.)

Controller Hostname: MRSQUEAK
Controller Domain Name: CONMICRO CX (note the space instead of dot)
Domain Nameserver IP Addresses: 192.083.120.001

TCP/IP Controller Defined Nicknames:

Leave blank. (Unless you want to define the equivalent of /etc/hosts.)

Save responses. You're done.

Wednesday, December 25, 2013

Grabbing X11 display into an mpg file (example from ffmpeg man pages Ubuntu)

I didn't know this had been integrated or that there was a method for ffmpeg input to be the x display.

EXAMPLES

   Video and Audio grabbing
       If you specify the input format and device then ffmpeg can grab video and audio directly.

               ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg

       Note that you must activate the right video source and channel before launching ffmpeg with any TV viewer such as
        xawtv ("http://linux.bytesex.org/xawtv/") by Gerd Knorr. You also have to set the audio recording levels correctly with a standard mixer.

   X11 grabbing
       Grab the X11 display with ffmpeg via

               ffmpeg -f x11grab -s cif -r 25 -i :0.0 /tmp/out.mpg

       0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.

               ffmpeg -f x11grab -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg

       10 is the x-offset and 20 the y-offset for the grabbing.

               ffmpeg -f x11grab -follow_mouse centered -s cif -r 25 -i :0.0 /tmp/out.mpg

       The grabbing region follows the mouse pointer, which stays at the center of region.

               ffmpeg -f x11grab -follow_mouse 100 -s cif -r 25 -i :0.0 /tmp/out.mpg

       Only follows when mouse pointer reaches within 100 pixels to the edge of region.

               ffmpeg -f x11grab -show_region 1 -s cif -r 25 -i :0.0+10,20 /tmp/out.mpg

       The grabbing region will be indicated on screen.

               ffmpeg -f x11grab -follow_mouse centered -show_region 1 -s cif -r 25 -i :0.0 /tmp/out.mpg

       The grabbing region indication will follow the mouse pointer.

Grabbing input from other devices:

http://ffmpeg.org/ffmpeg.html

Video and Audio grabbing

If you specify the input format and device then ffmpeg can grab video and audio directly.
ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg
Or with an ALSA audio source (mono input, card id 1) instead of OSS:
ffmpeg -f alsa -ac 1 -i hw:1 -f video4linux2 -i /dev/video0 /tmp/out.mpg
Note that you must activate the right video source and channel before launching ffmpeg with any TV viewer such as xawtv by Gerd Knorr. You also have to set the audio recording levels correctly with a standard mixer.

Changing out soundtrack with ffmpeg. Example of moving ogg soundtrack to matroska (mkv)

Matroska file format (mkv) is specified with -f matroskaoption. It should be supported by ffmpeg (version 0.7.3) in Ubuntu 11.10.

Use ffmpeg -formats for a list of supported file formats.

To merge specific streams (audio or video) from several files use -i option for each input and -map input_index[:stream_index]. For example, the following command merges the first stream of the first input with the second input and keeps the codecs:
 
ffmpeg -i input.mkv -i input_audio.ogg -map 0:0 -map 1 -vcodec copy -acodec copy output.mkv


http://ffmpeg.gusari.org/viewtopic.php?f=25&t=611
 
ubuntu video conversion
 
http://ubuntuguide.org/wiki/Video_Conversion#FFMPEG
 

Monday, December 9, 2013

disabling warnings in MS VS

Used to have to do this, this posting shows how to do a bad practice.  It does however have an example of how to disable warnings in c++ on VS.

// document here exactly why you can not use strncpy_s
#pragma warning( push )
#pragma warning( disable : 4996 )
// your code that uses strncpy instead of strncpy_s
#pragma warning( pop ) 
 
how-to-achieve-strncpy-functionality-with-strncpy-s-function

Friday, November 15, 2013

Windows USB drivers for Galaxy Note 2 SGH-T889 phone



Drivers from samsung for my Note 2 phone

http://phones-usb-drivers.blogspot.com/2013/05/download-samsung-sgh-t889-galaxy-note.html

http://downloadcenter.samsung.com/content/SW/201212/20121217102504170/Samsung_USB_Driver_for_Mobile_Phones_v1.5.14.0.exe

Hopefully will allow ADB connect up from development laptop.

raspberry pi jtag

This example is for using an raspberry pi as a run control, not for using jtag ON the raspberry pi.  An example below is for debugging arm devices.

http://blog.oxplot.com/debrick-wrt54gl-raspberrypi/

TJTAG part copied here for reference.

UPDATE: TJTAG with RPi support is now available and it’s preferred to this version.
The updated README should have all the information you need to build this on Pi and let it help save your day. But if you’re lazy like me, here’s a quick guide:
  1. Connect the boards as per the wiring diagram above.
  2. Power up your router.
  3. On your Pi:
    $ cd ~
    $ git clone https://github.com/oxplot/hairydairymaid-wrt54g-pi
    $ cd hairydairymaid-wrt54g-pi
    $ CFLAGS='-D RASPPI' make
    $ ./wrt54g -probeonly
    
    If it gets stuck, try adding /noemw option.
There are many guides elsewhere describing how to use this tool to restore your router to an operational state. For more just google for it. There is a document that comes with this program as well (not written by me)—be sure to read it before doing anything.

Lauterbach spec for arm jtag interface.

http://www2.lauterbach.com/pdf/arm_app_jtag.pdf

Here is a link to an example ARM debug port spec.

http://www.pjrc.com/arm/pdf/doc/ARM_debug.pdf

http://www.pjrc.com/arm/pdf/doc/ARM_debug.sup.pdf 

More examples (not for this rpi example, but for standalone jtag)
from:  http://www.edaboard.com/thread10814.html

For JTAG dongle look simple Wiggler:
http://www.elektroda.pl/eboard/viewt...hlight=wiggler
http://www.elektroda.pl/eboard/viewt...hlight=wiggler
http://jtag-arm9.sourceforge.net/hardware.html




and free OCD Commander (Windows and Linux)
http://www.elektroda.pl/eboard/viewt...hlight=wiggler
http://www.ocdemon.net/ocd_dbgr.exe
Free GNU Toolkits for OCDemonTM BDM/JTAG Devices
http://www.ocdemon.com/

Look:
http://www.ocdemon.net/Merchant2/mer..._Code=Software
http://www.ocdemon.net/flsh_pgm.exe


http://www.embedinfo.com/English/Pro...programmer.asp

Embest Online Flash Programmer 2190K
http://www.embedinfo.com/chinese/dow.../FlashProg.zip

Embest Online Flash Programmer user guide 430K
http://www.embedinfo.com/english/dow...rogrammerE.chm



Wednesday, November 13, 2013

jor1k


javascript virtual linux notes for jor1k emulator.

https://github.com/s-macke/jor1k/wiki

requires vde2, virtual distributed ethernet package.

http://vde.sourceforge.net/

this requires libtool, libpcap-dev, libssl-dev to make.   make it on machine hosting the jork emulator.

This supports an ethernet adapter on the jor1k platform.

https://github.com/s-macke/jor1k/wiki/Network-support

http://www.benjamincburns.com/2013/11/10/jor1k-ethmac-support.html

Websockets (mentioned in network, tornado)

http://mbed.org/cookbook/Websockets-Server

Tuesday, November 12, 2013

Getting wireshark going on Snow Leopard



http://michaelgracie.com/2009/10/13/getting-wireshark-running-on-os-x-snow-leopard-10-6/

 tep 1
Download Wireshark from here. Mount the .dmg file.
Step 2
Drag the Wireshark application icon to the handy dandy Applications alias the fine developers at Wireshark provided for you in that disk image. Then, open up the Utilities folder in the disk image, and drag the ChmodBPF folder into the StartupItems alias sitting below it. After that, open up a new finder window and navigate to /usr/local/bin. Open up the Command Line folder in the disk image (under /Utilities) and drag those contents over to /usr/local/bin. You’ll probably have to authenticate at that point, so do so.
Step 3
Open up a terminal window and type in the following commands:
cd /Library/StartupItems
sudo chown -R root:wheel ChmodBPF

You’ll probably be asked to enter an su password. Do so. Then exit terminal.
Step 4
Go to Applications and click on Wireshark. When the application opens you’ll probably see a another window open up along with it containing a bunch of errors. Close that window. Next, select Edit then Preferences from the Wireshark application window. Select Name Resolution, and click the Edit button next to “SMI (MIB and PIB paths”. Click the new button, and enter /usr/share/snmp/mibs/ in the little Directory Path popup window. Click Apply, and then Close.
Step 5
Exit Wireshark and reboot.
All should be well in network protocol analyzer-ville.
Editor’s note: special thanks to Nick Kleinschmidt and Dan Hale for helping out here.
UPDATE: Please note that these instructions applied to Wireshark Version 1.2.2 (SVN Rev 29910), and several comments have suggested that newer versions of Wireshark may no longer support libSMI. For this issue I can only suggest checking the Wireshark user guide and/or the wiki.

running multiple instances of Yawcam



http://www.yawcam.com/forum/viewtopic.php?p=3923

running multiple instances of Yawcam

 by malun » Sat Jan 02, 2010 12:17 am
Yes, you are right, didn't think of that. Yawcam uses the settings located in the home directory for the user running Yawcam. There is however a workaround...

1) Install the first yawcam instance as usual and run it like usual.
2) Make a copy of the yawcam program directory (typically: C:\Program Files\Yawcam) and name the copy Yawcam2. You will now have two program directories for Yawcam:
C:\Program Files\Yawcam
and
C:\Program Files\Yawcam2
3) Create a new directory c:\yawcamsettings
4) Create a new directory c:\yawcamsettings\yawcam2

Now it's time to edit two files in here:
C:\Program Files\Yawcam2
If you are using windows xp or 2000 you can edit the files with notepad as usual, so jump to step 8 below.
If you are using windows vista or 7 you have to run the editor as an administrator, so continue at step 5.

5) Click on the windows start button and type "notepad" in the search field.
6) In the result list, right click on Notepad and choose "Run as administrator"
7) Now open the file in Notepad by clicking "File -> Open..." and browse to the file.

8) Edit the file C:\Program Files\Yawcam2\service_profile.cfg to contain one line like this:
C:\yawcamsettings\yawcam2
9) Edit the file C:\Program Files\Yawcam2\launcher.cfg
Add the word service on the last line. If it's correct the last line will end with: yawcam.Main service

10) Start the second instance of Yawcam by running:
C:\Program Files\Yawcam2\Yawcam.exe
This version will now use settings located here:
c:\yawcamsettings\yawcam2\.yawcam
Browse to this path and see that the .yawcam directry has been created.
11) You now want to create a text file disablerunningcheck.txt here:
c:\yawcamsettings\yawcam2\.yawcam\disablerunningcheck.txt
to get rid of the question when starting the second instance of Yawcam.


I hope the explanation was clear enough...

/malun

Wednesday, November 6, 2013

Raspberry Pi running Ipfire notes

The ipfire firewall is built on a linux system running as a router and firewall, similar to ipcop.  Ipfire is a fork of the ipcop firewall.

history is here

http://en.wikipedia.org/wiki/IPFire

Installing ipfire for use on the raspberry pi is covered elsewhere, this covers notes relative to bringing up the firewall options that are useful on ipcop on ipfire.

1. 
port change 444 to other.

On ipcop you use setreservedports to change 445 to another.

On ipfire you have to edit two files in the apache config, and restart apache:

ipfire listens by default on port 81 (non ssl ) and 444 (ssl).   the ports are listed in

/etc/httpd/conf/listen.conf  Edit them as needed and save.

The server hosts are defined in

/etc/httpd/conf/vhosts.d/ipfire-interface-ssl.conf
/etc/httpd/conf/vhosts.d/ipfire-interface.conf

the ssl one has the definition for 444 (default) and the other defines 81.  Both listen and these file have to be changed.

2.
set up ipfire box as an openvpn client (use the ipfire pi as a field hot spot router, for example)

http://forum.ipfire.org/index.php?topic=8056.0

quoting entry:

I'm currently struggeling to get my IPFire server working as OpenVPN client. The machine is set up inside a rather closed-down network and I would like to connect to an external server using OpenVPN.

However, all the help I can find either helps one configure the IPFire machine as an OpenVPN server or the help for a client configuration is rather limited.

Can anyone please help me out (or point me in the right direction) to get my IPFire machine working as an OpenVPN client?

Thanks in advance.

SOLVED: After running openvpn with the created configuration file:
/usr/bin/openvpn --config /var/ipfire/ovpn/client.ovpn
it created the network "tun0"

All I needed to do after that (I have a 10.13.0.0 255.255.0.0 network) is:
iptables -t nat -A POSTROUTING -s 10.13.0.0/16 -o tun0 -j MASQUERADE

to make sure all the traffic on my network (starting with a 10.13 IP address) goes through the tun0 interface



Friday, November 1, 2013

Bad google (Setting up Gregarius online RSS aggregator to replace iGoogle)

I used iGoogle for reading a variety of page feeds, otherwise know as RSS feeds and now it is gone.  I didn't use the other features, which resemble apps on Android, or plugins  in  Chrome.  I don't think they realized how useful the rss aggregation was when they obsoleted it.  

I could go to this page from any device and have my own sites all summarized with one liner entries, which was updated with refreshes.  The Google backend handled all the rss reading and formatting, not my local device, so the only heavy lifting required by the device was when I clicked thru to a page to read it.

I found this aggregator and struggled to get it set up on linux, there were a couple of vague references I had to do a bit of experimenting with to get going.

the setup I elected is to run it on a LAMP (Linux, Apache, MySql, PHP) server.  It can be run with apache and php standalone on a local device.

it lacks individual user support near as I can tell, so you get a single list of pages batched up from this server.  At least I have a central place for my pasteup and i can export the web page from my local system to any of my devices.

These are notes on how to set up the system filling in the gaps I found in the instructions.  I have found a couple of nice pages explaining the setup, but they suffered in assuming I knew what they were talking about in setting up the database and a few other details.

Gregarius is a bit of a puzzle to set up.  It can be downloaded here gregarius

there are some assumptions which for some are maybe simple for some, but baffled me a bit.

here is a tutorial for setting up the thing

http://www.phpbuilder.com/columns/ian_gilfillan20060103.php3

Problems:

not obvious is the database creation.

I used mysql, and the setups were pretty plain for that.  However they asked for username and password in the install script, and also for admin password.

The install can be run via a gui or you can create a database init yourself manually.  If you are running by gui a file with the dbinnit  is created for download to your apache server.  Once you have that, and install it in the rss file you can create the sql with another script, install.php

Turns out the admin password and account asked for in the gui are for the mysql so it can encode the mysql output with proper passwords for the setup it outputs. 

A script called schema.php has to then be run to output a sql configured for your database, account system and tables.  That file can then run and create the database and configure it.

another problem is some of the weblinks don't pass back to the rss pages on apache. 

Individual feeds when you access it w/o any apache work go thru to the target sites, but the "group" jumps which the aggregator creates result in a 404.  Searching for that.  Looks like it is pointed at /rss (my sublocation on apache) and the apache isn't redirecting.

This may be the fix for that (from link above)

After you've created some feeds and you attempt to view them (below), you may find that you are getting 404 errors. The most likely reason for this is that your server is not running the Apache mod-rewrite module, so the short url's Gregarius uses by default are not being accepted. Simply go to Admin/Config and change the rss.output.usemodrewrite setting (second from the bottom) to false (screenshot).

Wednesday, October 30, 2013

debian 8 for wandboard


http://wandboard.wordpress.com/

debian 8 for wandboard

You can download the image using the following links
http://www39.zippyshare.com/v/9043871/file.html (part1)
http://www39.zippyshare.com/v/86491193/file.html (part2)
http://www39.zippyshare.com/v/31872725/file.html (part4)
http://www64.zippyshare.com/v/48319927/file.html (part3)
Thank you Martin for the great job.

access:

ssh debian@192.168.1.155 or ssh root@192.168.1.155
password: debian (for both, “debian” and “root” users)

The running webservices can be accessed by doing :
Owncloud —> 192.168.1.155/owncloud
Ampache —> 192.168.1.155/ampache
Aria2       —-> 192.168.1.155/aria2
Webmin  —-> https://192.168.1.155:10000
Phpmyadmin —> 192.168.1.155/phpmyadmin

fix for message in kernel on wandboard (silences it anyway)

 to get rid of messages about voltage changes

COULD NOT SET SOC VOLTAGE BACK!!!!


echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

http://forums.wandboard.org/viewtopic.php?f=12&t=97

Hello There,

I am using 12.04.2 LTS, and I keep getting this error on console "COULD NOT SET SOC VOLTAGE BACK!!!!", it is flooding the logs.

Any idea what it is, and how to stop?

-Yogesh
yogeshj
 
Posts: 3
Joined: Thu Oct 03, 2013 6:49 am

Re: Keep getting error on console COULD NOT SET SOC VOLTAGE BACK

Postby Tapani on Thu Oct 03, 2013 9:19 am
An unfortunate "bug" in the kernel. It is not dangerous, just someone at freescale making unexpected behaviour sound worse than it is.

Try changing the scaling governor, that usually makes it quiet:
Code: Select all
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Saturday, October 26, 2013

ffmpeg transcode of h.264 and ac3 encoded files to play on more devices

many devices won't play ac3 coded media.  this a discussion of recoding

Its been done, and you don't even need to whitelist your chromecast, you just have to enable 'developer mode' in the Google Cast extension. The guy even made a VLC transcoding option, but I just quickly repackage my files with FFmpeg if needed before playback.http://forum.xda-developers.com/showthread.php?t=2398804

I would first use mediainfo to see what your file is already, and check against the list of supported codecs for the Chromecast.
Assuming that you do need to convert, you need to figure out what exactly. For example, a lot of scene(aka pirate) releases that are in MKV are H.264 video(which works just fine on the Chromecast) and AC3 audio(which does not work on the Chromecast). So in a lot of cases, you will just be repacking the audio.
Depending on your FFmpeg, you will have different encoding and decoding libraries. The most surefire way is to just build it yourself - but I think if you're on Ubunut you can install packages for encoders.
But generally, what I do is repack the video(no conversion), and convert the audio to either AAC(preferred), or MP3(a better fallback option if you're using Windows).
I do:

ffmpeg -i <input file> -c:v copy -c:a libfdk_aac <output file>
 
if converting to MP3 audio, you need to specify a specific bitrate:

ffmpeg -i <input file> -c:v copy -c:a libmp3lame -b:a 320k <output file>
 
And lastly, if you video didn't come in H.264 to begin with, go ahead and just re-encode like this:

ffmpeg -i <input file> -c:v libx264 -c:a libfdk_aac <output file>
 
Hope this helps!
Edit: If you convert from a non-H.264 file, the audio may already be in MP3, and then you would only need to convert the video, like so:

ffmpeg -i <input file> -c:v libx264 -c:a copy <output file>
 

chromecast discussion

comment in thread about vlc stream to

It's actually not very hard, since VLC already supports transcoding and streaming to a socket. I found a Java project that was experimenting with it, but I don't have the link available at the moment. I tested it out by running VLC like this:

vlc -Irc --sout="#transcode{vcodec=VP80,vb=1000,width=500,acodec=vorb,ab=128,audio-sync,channels=2,samplerate=44100}:http{mux=webm,dst=:8000/cast.webm}"
 
 
And then told my Chromecast to stream  
http://machine-running-vlc:8000/cast.webm
(you need to write a custom app for that part), and it mostly-worked. I was having problems with video/audio sync, but that might be something I did wrong, I didn't spend very long on it. I imagine once we can release apps somebody will write a simple one that takes a URL and tells the Chromecast to stream it, and that's really all you need

Friday, October 4, 2013

snow leopard on virtual box 4

from:
http://virtualbox-snow-leopard.blogspot.com/

Guide

Prerequisites:
1) VirtualBox 4
2) iBoot and Multibeast.
3) An ISO of Snow Leopard retail version.
4) The DMG of the latest (10.6.6) combo updater.

Instructions:
1) Make a new OSX Server image in Virtualbox, call it "OSX", use all the defaults except make a bigger disk than 20GB - 40GB is a better number.
2) Go to settings and untick the "Enable EFI setting" in the System pane.
3) Mount iBoot.iso and boot from CD drive (you might have to press F12, then 'c').
4) Unmount iBoot, mount Snow Leopard ISO.
5) Press F5, then Enter. It will launch the SL installer.
6) Open Disk Utility. Partition your disk - GUID, Mac OS Journaled. Close Disk Utility. Select the new drive partition you made, and let the install continue.
7) After installation, mount iBoot.iso again and this time choose your new SL installation which will boot.
8) Run the 10.6.6 combo updater, do not allow it to reboot.
9) Run Multibeast, select EasyBeast and the System Utilities. Install it.
10) Unmount the iBoot iso in Virtualbox and reboot into Snow Leopard. iBoot is now no longer required.

Optional Virtualbox settings:
1) Raise the Video memory to 128MB and enable 3D acceleration.
2) Raise the main RAM to 2GB or more if you can spare it.
3) Install the Virtualbox Extension Pack to enable USB device support.

Known issues:
1) "About This Mac" will crash the Finder. System Profiler works properly when invoked directly.
2) Shut down/restart etc. will always kernel panic.
3) There is no choice of resolutions in the Display settings. Use the Virtualbox command line to do e.g. VBoxManage setextradata “OSX” “CustomVideoMode1″ “1600×960×32”
4) Shared Virtualbox folders can't be used due to there being no Virtualbox Guest Additions for Mac (yet?)
5) Sometimes fails to boot and sits on the Apple splash screen spinner forever. Just reset it.
6) Spotlight sometimes hangs, and sometimes has to do a full reindex for no apparent reason.

Links:

http://www.virtualbox.org
http://tonymacx86.com/
http://store.apple.com/us/product/MC573Z/A
http://support.apple.com/kb/dl1349


****************************************
version 2
Prerequisites:
1) Virtualbox 4 with the Oracle VM VirtualBox Extension Pack installed.
2) Snow Leopard retail DVD or ISO.

Instructions:
1) Make a new OSX Server image in Virtualbox, call it "OSX", use all the defaults except make a bigger disk than 20GB - 40GB is a better number.
2) Go into the settings.
3) If you have enough RAM, change the RAM to 2048MB, but no more.
4) Change the Video RAM to 64MB, and enable 3D Acceleration.
5) Make sure that the Audio is set to Intel HDA, and make sure that the DVD is ahead of the Hard Disk in the boot device order.
6) In the Storage tab, either mount the Snow Leopard ISO, or direct it to your physical DVD drive with the Snow Leopard disk in it.
7) Quit the Virtualbox manager.
8) Open a command prompt and 'cd' to your Virtualbox install directory (Probably "c:/Program Files/Oracle/Virtualbox".
9) (The following step might not be necessary, or actually do anything. Unconfirmed)... If you are on a 64 bit host type: VboxManage modifyvm "OSX" --firmware efi64
10) Type: VBoxManage setextradata "OSX" VBoxInternal2/EfiGopMode 4
Alternatively use 0, 1, 2 or 3 to set the video resolution according to:
0 - 640x480
1 - 800x600
2 - 1024x768
3 - 1280x1024
4 - 1440x900
11) In a text editor, edit the OSX.vbox file found in ~USERNAME/VirtualBox VMs/OSX/
12) Find the line that says ExtraDataItem name="VBoxInternal2/EfiGopMode" value="4"/
13) Below this line, paste the following (exactly, all on one line, inside angled quotes as with the other entries*)
ExtraDataItem name="VBoxInternal2/SmcDeviceKey" value="ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"/
14) Save the file and close your text editor.
15) Double click on the OSX.vbox file to launch the virtual machine.
16) After a little while, the Snow Leopard installer will start.
17) Open Disk Utility. Partition your disk - GUID, Mac OS Journaled. Close Disk Utility. Select the new drive partition you made, and let the install continue.
18) Optionally customize your install to remove language support, X11 support, printer drivers etc.
19) At the end of installation, it may crash when trying to reboot. In any case, unmount the DVD or ISO before either rebooting or resetting the Virtual machine.
20) Snow Leopard will boot from hard disk, go through the initial setup steps such as choosing timezone.
21) Run Software Update and bring everything up to date.
22) Take a backup of the OSX.vbox file in case Virtualbox manager later makes a change to it that causes your installation not to boot (e.g. removing the SmcDeviceKey line).

After installation (optional, maybe risky):
1) If CPU usage is always 100%, delete /System/Library/Extensions/AppleIntelCPUPowerManagement.kext and run 'sudo kextcache -system-caches' and reboot.
2) Edit the OSX.vbox file and raise the VRAM to 128MB.
3) If you deleted the kext above, you can add an extra CPU in Virtualbox manager.
4) EpiGopMode 5 is 1920x1200 if you have a big enough monitor.
5) Enable 64 bit Kernel by editing /Library/Preferences/SystemConfiguration/com.apple.Boot.plist
Change
Kernel Flags

to
Kernel Flags
arch=x86_64

Known issues:
1) Bootup is a verbose textual process rather than the Apple logo and spinner. Seems to be due to '-v' being hardcoded as a boot option in the emulated NVRAM.
2) Shared Virtualbox folders can't be used due to there being no Virtualbox Guest Additions for Mac (yet?)

* Blogspot won't let me enter things that look like raw HTML/XML.

Monday, September 30, 2013

mac os command line tricks

various command line tricks for macos

cpu type

sysctl -n machdep.cpu.brand_string
system_profiler | grep Processor

disk info / mount umount

diskutil list
diskutil unmount /dev/disk1s2
diskutil mount /dev/disk1s2

user control

pkill -u username
ps -u username   

Mountain Lion X system XQuartz
http://xquartz.macosforge.org/landing/

Time machine backup (use on ssh to remote

tmutil startbackup
tmutil stopbackup

shell history incantation

history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head -15

ruby installs utilities / packages







notifier

sudo gem install terminal-notifier

use case

terminal-notifier -message "Hello, this is my message" -title "Message Title"

flags changing

chflags nohidden /path/to/hide/file.txt

download history:

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'

sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent' | sort

force time update

sudo ntpdate -u time.apple.com

   

Sunday, September 29, 2013

vmware usb mount esxi5

here is a note on how to mount a usb key or get it recognized by the hypervisor system (esxi system) and not use it to passthru to a guest on the system.

bad news, it only works with FAT16 file systems.

http://www.virtuallyghetto.com/2012/03/how-to-access-usb-storage-in-esxi-shell.html

only USB storage devices formatted with FAT16 can be accessed in the ESXi shell and is applicable to both ESXi 4.1 and 5.0. 

Step 1 - Login to ESXi Shell via SSH and disable the USB Arbitrator service (this is automatically enabled by default to allow pass-through of USB devices to your VMs) using the following command: /etc/init.d/usbarbitrator stop
Step 2 - Plug-in your USB device to your ESXi host and you can verify by using the two ESXCLI commands: verifying the storage device using the command: esxcli storage core device list | grep -i usb or viewing the mounted filesystems using the command: esxcli storage filesystem list
Step 3 - Lastly, after you verify the USB device can be seen by the ESXi host, you can of course browse and access your USB device by looking under /vmfs/volumes/

Te re-enable pass-through of USB devices to your VMs, you just need to start the usbarbitrator service. - See more at: 

http://www.virtuallyghetto.com/2012/03/how-to-access-usb-storage-in-esxi-shell.html#sthash.GBWjrX7X.dpuf


Sunday, September 15, 2013

expired certifications on mac os packages

Apparently Apple leaves up packages with fairly early cert expirations hanging around, and you get mysterious crap problems trying to load them.

I found two approaches. 

One is to set the time on your system to a date when the cert has not expired.  this will be okay if the certs created during install do not also expire.  That approach worked fine for this problem, installing xcode 3.6.2 on 10.6.8 Snow Leopard.

A second approach is to fix the certs.  Two postings from "manageingosx" are copied explaining the problem and a fix.

stackoverflow   fix
------------------
http://stackoverflow.com/questions/10002393/instaling-xcode-3-2-5-on-osx-10-6-8-produces-the-error-the-operation-couldnt

11 down vote accepted
I also had the problem installing the downloaded version of XCode 3.2.6 from Apple, checked the log and got the "untrusted" error and found my way here to discover the Package Signature issues. Some of those tools only work on Lion though, and much of this is catch 22 for people as we are using 10.6 and so have to use Xcode 3.2.6...
Anyway, to cut a long story short, change the system date back to Feb 2012 (before the certs expired in March 2012) and then install.... worked fine for me, such a simple solution - far too long to get there though...
EDIT : Sorry, only just clicked though to see your link about the date/time, I went straight to the repackager. If it's okay, I'll leave this here as it gives a direct answer to the question for people like me who have just found this on Google etc

------------------


http://managingosx.wordpress.com/2012/03/24/package-apocalypse/

http://managingosx.wordpress.com/2012/03/24/fixing-packages-with-expired-signatures/


Package Apocalypse

Earlier this week a certificate Apple had used to sign flat packages over the last couple of years or so expired. This caused Apple to have to reissue a lot of update packages. This greatly affected sites running an Apple software update server, either Apple’s flavor, or the open-source Reposado replacement. See http://support.apple.com/kb/HT5198 for more info on how this affects Software Update.
This also affects some update packages you might have downloaded from http://support.apple.com/downloads. If they are flat packages, it’s possible they may also be signed with an expired certificate. Such packages can be manually installed – Installer.app will display a warning, but you can choose to ignore the warning and proceed.
But if you have a mechanism that uses Apple’s command-line installer tool, these packages will fail to install. This will affect popular tools like InstaDMG, DeployStudio, Apple’s System Image Utility, and any software distribution mechanism that makes use of the command-line installer tool. Some examples include Munki, Casper, and AbsoluteManage.
Worse, this problem affects at least one software package originally distributed on DVD: iLife ’11. If you’ve imported the packages for iLife ’11 into your software distribution mechanism, they may now fail to install because of the expired certificate.
I am working on a tool to fix affected packages. (UPDATE: see this post.) But in the meantime, if you want to get an idea of how many packages you have that are affected by this issue, you might want to make use of a tool I wrote. It will scan a directory of packages or disk images containing packages and print information on any packages with bad or expired certificates.
Get it here.
The tool relies on a pkgutil option introduced in Lion, so you’ll need to run this on Lion!
An example of checkPackageSignatures.py in use:

./checkPackageSignatures.py /Volumes/LaCie/InstaDMG/pkgs-10.6.8/

/Volumes/LaCie/SIU/Snow Leopard/pkgs-10.6.8/Install iTunes.pkg:
Package "Install iTunes":
Status: signed by a certificate that has since expired
/Volumes/LaCie/SIU/Snow Leopard/pkgs-10.6.8/JavaForMacOSX10.6Update4.pkg:
Package "JavaForMacOSX10.6Update4.pkg":
Status: signed by a certificate that has since expired
/Volumes/LaCie/SIU/Snow Leopard/pkgs-10.6.8/MacOSXUpdCombo10.6.8.pkg:
Package "MacOSXUpdCombo10.6.8.pkg":
Status: signed by a certificate that has since expired

Use this tool to scan any collection of packages you have to see which are affected by this issue. If a replacement package is available from Apple, you should replace it. If there is no replacement, there is hope. Keep checking back here for an update soon.

-----------

Fixing packages with expired signatures

In my previous post, I provided a tool to enable you to check your collection(s) of packages to determine if any are affected by the Package Apocalypse.
But what to do once you’ve found packages with expired signatures? If Apple has provided an updated replacement package at http://support.apple.com/downloads/, it’s probably best to replace the package with the expired signature with the updated one.
But that might not always be possible — Apple has not provided replacements for every package that has been affected, or the replacement might not be practical to use.

For example, the packages included in the iLife ’11 Install DVD have expired signatures. The only “replacement” available would be the Mac App Store versions of the iLife 11 apps. Not all iLife ’11 apps from the DVD have App Store equivalents, and distributing the App Store versions is a whole different set of issues.
So the ideal solution here is to somehow fix the packages with expired signatures so they will work with your software distribution mechanism. It turns out that you can do this with an Apple-provided tool — pkgutil.

pkgutil --expand SomeFlat.pkg /tmp/SomeFlat.pkg
pkgutil --flatten /tmp/SomeFlat.pkg SomeFlatFixed.pkg

Expanding and reflattening a flat package has a side-effect of removing the package signing. the command-line installer tool will happily (at least as of this writing) install unsigned flat packages.
So there you have it — a way to fix packages broken by the Package Apocalypse. But it’s a tedious process. To help, I offer yet another tool — flatpkgfixer.py.
This tool will remove package signing either from a single flat package:

./flatpkgfixer.py /path/to/expired.pkg /path/to/new_fixed.pkg

or can fix up an entire disk image containing packages:

./flatpkgfixer.py /path/to/iLife11.dmg /path/to/iLife11_fixed.dmg

This tool is brand new, and could very well have bugs, but I hope it’s useful to some!

Thursday, September 12, 2013

Answer about the tape drive on Voyager from NASAJPL AMA on Reddit

Monday, September 9, 2013

centos 6.4 on a macbook pro a1150



adding in openvpn

https://www.digitalocean.com/community/articles/how-to-setup-and-configure-an-openvpn-server-on-centos-6

adding remmina (mixed success)

http://tekhnojuan.wordpress.com/2013/05/21/installing-remmina-on-centos-6-3/

main problem with remmina so far is need for freerdp.  looks like it will take some search to find that dependency if need to use rdp

Russian addons:

http://mirror.yandex.ru/fedora/russianfedora/russianfedora/free/el/releases/6/Everything/i386/os/

flash
http://www.if-not-true-then-false.com/2010/install-adobe-flash-player-10-on-fedora-centos-red-hat-rhel/

openvpn:
https://www.digitalocean.com/community/articles/how-to-setup-and-configure-an-openvpn-server-on-centos-6

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022290


Monday, September 2, 2013

copying audio track from mp4, flv, etc. to mp3 on ubuntu 12.04

Using command line

  1. First install the tools
    sudo apt-get install ffmpeg libavcodec-extra-53 libav-tools
    
  2. Use this simple command to extract the audio file
    avconv -i /input-file-name-with-path output-filename.mp3
    
    For example to convert the "How fast.ogg" video file into how-fast.mp3 use this command:
    avconv -i /usr/share/example-content/Ubuntu_Free_Culture_Showcase/How\ fast.ogg how-fast.mp3
     
    from: http://askubuntu.com/questions/80954/how-can-i-extract-audio-from-mp4-or-flv-video-files 

Thursday, August 8, 2013

Wandboard info

report on the specs for wandboard:

http://www.cnx-software.com/2012/10/07/69-89-wandboard-freescale-i-mx6-solo-and-dual-development-boards/

another bloggers report on unboxing:

http://www.cnx-software.com/2013/02/21/wandboard-dual-unboxing-and-quick-start-guide/

Wandboard is a baseboard by wandboard.org and an embedded EDM module plugged into it.  The reports above cover the dual option.  For some reason they don't support (or didn't in October 2012 when the blog entry was written) the SATA connection on the baseboard.

I have the quad, and am running ubuntu 12.04.  Main problem is that the kernel is a bit laggard, @ 3.05, and there is a power code bug causing a complaint when going into idle.  I have a workaround to keep the board up all the time, which of course isn't optimal.

Typical crap, at the last job I used Freescale, the kernel blobs were buggy and had this sort of crap.  at least I have the source, and will be able to spin my own kernel.

Here is an entry from the guy about EDM modules

http://www.cnx-software.com/2012/06/10/technexion-edm-modules-open-software-and-somewhat-open-hardware-arm-x86-cpu-modules/

Thursday, August 1, 2013

gpio on the Raspberry Pi

Here are some links

installing wiringpi2

http://raspi.tv/how-to-install-wiringpi2-for-python-on-the-raspberry-pi#install

using wiringpi2 for gpio

http://raspi.tv/2013/how-to-use-wiringpi2-for-python-on-the-raspberry-pi-in-raspbian

wiring table (blocked site)


Second part:
http://raspi.tv/2013/how-to-use-wiringpi2-for-python-with-pull-ups-or-pull-downs-and-pwm

Third part:
http://raspi.tv/2013/using-the-mcp23017-port-expander-with-wiringpi2-to-give-you-16-new-gpio-ports-part-3

example from part 1

import wiringpi2 as wiringpi  
from time import sleep       # allows us a time delay  
wiringpi.wiringPiSetupGpio()  
wiringpi.pinMode(24, 1)      # sets GPIO 24 to output  
wiringpi.digitalWrite(24, 0) # sets port 24 to 0 (0V, off)  
  
wiringpi.pinMode(25, 0)      # sets GPIO 25 to input  
try:  
    while True:  
        if wiringpi.digitalRead(25):     # If button on GPIO25 pressed   
            wiringpi.digitalWrite(24, 1) # switch on LED. Sets port 24 to 1 (3V3, on)  
        else:  
            wiringpi.digitalWrite(24, 0) # switch off LED. Sets port 24 to 0 (0V, off)  
        sleep(0.05)                      # delay 0.05s  
  
finally:  # when you CTRL+C exit, we clean up  
    wiringpi.digitalWrite(24, 0) # sets port 24 to 0 (0V, off)  
    wiringpi.pinMode(24, 0)      # sets GPIO 24 back to input Mode  
    # GPIO 25 is already an input, so no need to change anything 


x
Pi hardware info page:

http://elinux.org/RPi_Hardware#Schematic_.2F_Layout


info on the BCM2835 GPIO's

http://elinux.org/RPi_BCM2835_GPIOs

Good website for using GPIO with the RPI

http://wiringpi.com/

Broadcom Arm peripheral spec:
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf


Monday, July 15, 2013

Ubuntu 12.04 command line wireless config

http://ubuntuforums.org/showthread.php?t=1798927

Only fubar is that some package to supply and handle the wireless passkey is missing and has to be installed, not so easy w/o a net connection (or any other for that matter).  Might want to find the rpm's and be able to store them in a directory on an Ubuntu 12.0.4 boot device as a totally net free way to get it going.

Get Wireless WPA2 working with command line only

I wanted to run a little media server in my house, shared with my laptop only, so I could free up space on my laptop drive.

I took one of my Linux boxes out of my render farm and loaded up a minimal install, command line only of Ubuntu Lucid from the mini ISO (32 bit). I had to plug in a lan cable to install, but I wanted to move my box back out to the "farm" that doesn't have wired access to my intranet.

After much research, trial and error, this is what worked for me. My wireless card uses an Atheros AR5001X+ chip, and it works with the desktop cd out of the box. I found the "just works" desktop install uses the ath5k driver that is now included in Lucid, but I'm not using a desktop or window manager. I haven't tried this on server version, if you do, let others know what you had to install to get it to work.

The things I do tell you about, I instruct you as if you are a newbie, however I have left out some things that users should know or be able to lookup easily, like if you want a static address instead of using dhcp. You may not need all of the steps or you may have to do more research and troubleshooting.

Find your wireless card (you may need to lookup what to do if it is not recognized at all)

List all pci devices, only show network devices (-v verbose, -vv very verbose):
>>lspci –vv | grep Network

List all hardware (| less lets you pause at each page – arrow keys, page down/up to navigate, q to quit)
>>lshw | less

(If your modem is usb, learn about the lsusb command)

Check to see if network card is detected so you don't have to load a driver (where wlan0 is your card’s interface id found in previous step):
>>ifconfig wlan0

To load a driver, that is already on your system (my card was detected and the correct driver loaded from the kernel):
>>sudo modprobe drivername

If you forget to type sudo and get errors, then type:
>>sudo !!
which will execute the last command with sudo in front of it.

(you can learn about loading other drivers like broadcom bcm43xx at help.ubuntu.com)

List your wireless card’s device id:
>>iwconfig

if the command is not found (not in mini.iso) then you will need to install the wireless tools:
>> sudo apt-get install wireless-tools

If your router uses WPA or WPA2 security then install wpa supplicant:
>> sudo apt-get install wpasupplicant

(my wireless will never connect if my lan cable is plugged in, so after installing you may need to unplug your network cable too)

Scan for networks:
>>sudo iwlist scanning

If no results for your interface then enable device (and rescan):

>>sudo ip link set wlan0 up

Add your network information to wpa supplicant configuration file (where santa is the name of the network you are trying to connect to and hohohohohoho is the password for that network) (all 3 commands):
>>sudo su

root>>wpa_passphrase santa hohohohohoho >> /etc/wpa_supplicant.conf

root>>exit

Edit the file you just created/appended:
>>sudo nano /etc/wpa_supplicant.conf
<Add to the top:>
Ctrl_interface=/var/run/wpa_supplicant

<although your wireless may work just fine now, mine kept timing out, so to make WPA2 connect faster, I added this inside network={} below ssid and above psk>
scan_ssid=1
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
group=CCMP

<CTRL-O> <ENTER> to save the changes to the file
<CTRL-X> to exit the editor

If you are using WPA instead of WPA2, look up the wpa_supplicant.conf examples and find what you need (WPA instead of RSN, TKIP instead of CCMP or both, etc.)

Run wpa_supplicant:
>>sudo wpa_supplicant –D wext –i wlan0 –c/etc/wpa_supplicant.conf

Should see WPA: Key negotiation completed… CTRL-EVENT-CONNECTED
<CTRL-C> (stops the process running in the foreground of the command line/terminal)

Run wpa_supplicant in the background (up arrow, right arrow to end, add –B):
>>sudo wpa_supplicant –D wext –i wlan0 –c/etc/wpa_supplicant.conf -B

Wait a bit, then check for connection (mine wouldn't connect on the second try, I had to reboot, enable my device, then go straight to running in the background):
>>ip addr

Should see wlan0:… inet 192.168…
if so ping your router (you will need to know its ip address):
>>ping 192.168.0.1 –c 4

Should see less than 100% packet loss

and/or ping the web:
>>ping google.com –c4

Network unreachable on internet? Do you have the correct gateway (your router number or isp gateway – all zeros indicates the default gateway)? Any of these commands should tell you:

>>sudo netstat –nr
>>sudo route
>>/sbin/route -n

If you still can't connect to the internet, but are connected to your lan, with all zeroes for your gateway, try (192.168.0.1 should be your router IP address or your internet provider's gateway - which they would have given you if needed):
>>sudo route add default gw 192.168.0.1 wlan0

Check for connection again, ping, etc. It should be working now.

Once you have it working, get your wireless connection to come up automatically on boot (auto brings up the interface, iface says it will get an ip assigned from the dhcp server):
>>sudo nano /etc/network/interfaces
<Add to the bottom:>

auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant –Dwext –iwlan0 –c/etc/wpa_supplicant.conf –B
post-down killall –q wpa_supplicant

<CTRL-O> <ENTER> to save the changes to the file
<CTRL-X> to exit the editor

Reboot:
>>sudo shutdown –r now

After you have logged in, check for an ip address:
>>ip addr

If you have no typos in your files, you should now have wireless internet access every time you boot up.
Last edited by marjiea1; July 7th, 2011 at 02:33 AM.

Thursday, July 11, 2013

Bit torrent sync

This is a setup which uses bit torrent for syncing instead of rsync.  rsync requires a special access to the rsync demon to do network syncing.  Bit torrent protocol uses a more common method to sync.

http://blog.bittorrent.com/2013/05/23/how-i-created-my-own-personal-cloud-using-bittorrent-sync-owncloud-and-raspberry-pi/

Here is the basics of the setup from above.  Assumes a pi with raspbian installed.

Step 2: Installing BitTorrent Sync

Make sure you have an ethernet cable plugged in to your RasPi, and fire up lxterminal (there is a shortcut on the desktop). We’ll need to download the binary for Sync. To do this, type in:
wget "http://btsync.s3-website-us-east-1.amazonaws.com/btsync_arm.tar.gz"
Then change the download directory:
cd /home/pi
extract the tar.gz:
tar -zxvf btsync_arm.tar.gz
And finally, run the program:
./btsync
Now, we want to make sure Sync will run at startup. This requires an extra step. In terminal, change your directory to the config folder:
cd ~/.config/
Create a new folder called “autostart”
mkdir autostart
Now create a new text document. You can use the leafpad program that comes pre-installed. The contents of the text document need to be as follows:
[Desktop Entry]

Type=Application

Exec=/home/pi/btsync
Save this file in the newly created ~/.config/autostart as: syncstart.desktop
Sync is now up and running on your tiny Raspberry Pi. You can access the web GUI by opening a browser and typing in [YOUR IP ADDRESS]:8888/gui. For example: 192.168.1.2:8888/gui. You can find the IP address for your RasPi by opening terminal and typing in: ifconfig
sync-SS
At this point, you can stop right here. If your SD card is big enough, you can set up Sync and have your always-on Sync device….but why stop there? Lets add a thumb drive so that we can have more space.

Step 3: Adding a thumb drive

As mentioned, you have plenty of options for adding hard drive space to your Raspberry Pi. If you want to, you can plug in an external hard drive and go crazy. For this blog post however, I’m just using a micro-sd thumb drive. I love how small it is.
Plug the thumb drive in to the Raspberry Pi. (if you are short on usb ports, I would suggest setting up remote desktop). Open up terminal and type in:
df -h
Find your thumb drive. Mine was at the bottom and was called /dev/sda1. Take note of the name. You’ll need it. Format your hard drive by doing the following (replace sda1 with the name of your drive):
sudo umount /dev/sda1
sudo mkfs.ext4 /dev/sda1 -L SYNC
If you aren’t interested in Owncloud, then you can stop here and simply set up Sync to point to /media/SYNC. If you are interested in Owncloud, then keep reading.

step 4: Setting up Owncloud

Setting up Owncloud on linux is a mess of various terminal commands. Thankfully, Github user Petrockblog has made it very simple. He created a shell script for installing and updating Owncloud. Simply do the following:
Install Github:
sudo apt-get update
sudo apt-get install -y git dialog
Download the latest setup script:
cd
git clone git://github.com/petrockblog/OwncloudPie.git
And execute the script:
cd OwncloudPie
chmod +x owncloudpie_setup.sh
sudo ./owncloudpie_setup.sh
…and wait. This will take a while. Grab a coffee. Watch this video. When it is done, you can navigate to [Your IP Address]/owncloud to set everything up. It is very important that you click on “advanced” and set your data folder to /media/SYNC before finishing setup.
owncloud

Step 5: Combining BitTorrent Sync and Owncloud

First we need to clear up a few file permissions. Add sync to the www-data group:
sudo usermod -a -G www-data sync
Allow sync to write to the thumb drive:
sudo chmod -R 770 /media/SYNC 
Now open up the BitTorrent Sync WebUI (YourIpAddress:8888/gui) and add a folder. You’ll want to add: /media/SYNC/USERNAME/files where “username” is the name you selected when setting up Owncloud. Generate a key and you are done. You can now use that key to set up a folder on any computer you want. Any files added to that folder will be synced to your RasPi and be available through the Owncloud web interface. While this is pretty cool, there’s just one more little step to make this much more useful.

Step 6: Set up Owncloud to be accessed from anywhere (including mobile phones)

To access our files from anywhere, we’ll need to first set up a static IP address. If you used the wifi dongle I recommended, you can simply plug it in and it will work. Open terminal and type in:
sudo nano /etc/network/interfaces
You’ll need to make a few changes in order to get a static IP address. Below is what I ended up using after a bit of trial and error. Your address, gateway, net mask, SSID, and PSK will need to be changed according to your network. The settings may be different if you used a different wireless adaptor, or if you are only using an ethernet cable.
auto lo
iface lo inet loopback

iface eth0 inet static
        address 192.168.1.20
        gateway 192.168.1.1
        netmask 255.255.255.0

auto wlan0
#allow-hotplug wlan0
iface wlan0 inet static
        address 192.168.1.22
        gateway 192.168.1.1
        netmask 255.255.255.0
        wpa-ssid "YOUR SSID"
        wpa-psk "YOUR PSK"
#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Finally, you’ll need to forward a port so that owncloud can be accessed from outside networks. I just forwarded port 80 for the IP address of my RasPi. In this example, my IP address when using wifi is 192.168.1.22. The procedure for forwarding ports is different for every router. If I grab my real IP address from a site such as this one, I can now access Owncloud and my Sync files from anywhere by going to [MyRealIpAddress]/owncloud (where the IP address is what you find from the website I linked to). You can also set up Owncloud with an Android or iOS client for mobile access.
owncloud2