ClearOS/Apache and Mod_Rewrite

Installing WordPress on your ClearOS box? Want to use permalinks? Enable them and find out that you are getting a 403 Forbidden? If you are getting a 403, like I was, then here is the quick fix for you.

In your .htaccess file, add this line to the top:

Options +SymLinksIfOwnerMatch

That should clear up the 403 for you.

Plex (on ClearOS) and Subscene.com Subtitles

(These directions should work on most linux installs of Plex)

I have kids, three of them. This makes actually hearing a movie or TV show damn near impossible, so I usually have the subtitles on – you get used to it after a while.

Since I have been using Plex (before on Zentyal and now on ClearOS) I have been manually downloading subtitles from Subscene.com and adding them to specific Plex movies as I watch them. A tedious process. I already have my system set to automatically download my torrents directly to the media folders, then Plex auto refreshes and the movies are good to go (works for the most part, I need to work out some permission issues). Now I have found a way to automate the subtitle process. I just got it working so I have not tested it fully yet. But so far it appears to be working.

Go here for the Plex plugin
https://github.com/kronenthaler/plex-subscene

On ClearOS 6.5 the plexmediaserver folder is located at
(this seems to be the location for most Linux based Plex installs)

  1.  

    Just add it to your plugin folder (may need to change permissions).

  2. Then open Plex in a browser.
  3. Go to your Plex SERVER SETTINGS > AGENTS.
  4. From there click on Movies or TV Shows and your new plugin should appear under Freebase or TheTVDB.
  5. Configure how you like from there.
  6. When done with settings, go into Tv and Movies and force a library refresh, this should update your existing movies/shows with subtitles.

Oh, and it’s not my fault if you break something…

UPDATED 2-11-2017: It seems the original Plex Subscene plugin I was using and mentioned in this post is no longer available at Github. The page has also been removed. I found this https://github.com/pannal/Sub-Zero.bundle/releases in my searches while looking for a replacement. It is a different plugin called Sub-Zero. It does much more than the plugin mentioned in this post. Download that one and give it a shot. If you get stuck check out this blog for help https://blog.rylander.io/2016/02/26/install-sub-zero-a-plex-plug-in-based-on-subliminal-to-download-subtitles/.

 

ClearOS HTTPD & Reverse Proxy

I already host a few domains on my ClearOS box with no problems, but they are all hosted on the Clear box itself. I recently had the need to point a subdomain to another machine on my network. In Apache2 this is reverse proxy (pointing a domain/subdomain to an internal IP address). A few Googles here and there and all I could find was a few 3-4 year old posts regarding the topic. It mentions installing and building Pound, and a few other options. None of those seemed to be right. A bit more Googling and I finally found it. Its super easy.

All I had to do was modify my existing /etc/httpd/conf.d/flex-80.conf file, nothing to install.

Heres where I found the solution
http://www.clearfoundation.com/component/option,com_kunena/Itemid,232/catid,17/func,view/id,32097/#32108

The forum support for ClearOS sucks, and everything I find is years old. Hopefully this helps someone, this solution worked for me using ClearOS 6.5 (as of 12/2014).

😀

Raspberry Pi High CPU Utilization

So if you are coding in python for your Raspberry Pi and your script runs a loop you may have noticed the high cpu utilization, or not. I have not had an issue (yet) with the Pi running in the 90%, I have had a test Pi on my bench running for a few days with no problems so far. Least to say that it still is an issue.

Now I cannot claim to be the author of this fix, I found it while digging through the RPi forums one day. If your Pi is having this issue, simply add this line of code here and there during your loop:

time.sleep(0.1)

TA-DA! It really is that simple. I added one time.sleep(0.1) call between each of my IF/THENs and I watched (via top) my cpu go from 90-98% to under 5%!!

My adventures in 433mHz with a Raspberry Pi B+

So I bought some 433mHz modules off of eBay for dirt cheap. The “standard” 4 pin receiver and 3 pin transmitter. For the life of me I could not get them to work. Everything I found online appeared to be related to the RPi A I am pretty sure because NONE of the instructions worked for me. I was able to download, compile and run the commands but with zero results. I tried damn near all tutorials I could find out there. Nothing work but I did get close a few times. The part that really irritated me was that I had hooked up LEDs to the Tx and Rx pins to see if it was working. It was, I could see the LEDs flicker away when I pressed buttons, but no results with sniffing.

Finally I was able to send and receive a signal. RFSniffer finally worked off of pin 13/GPIO 27/wiringPi 2 on my Raspberry Pi B+. I curse the people that decided to use a completely different number schemes!! I used this http://shop.ninjablocks.com/blogs/how-to/7506204-adding-433-to-your-raspberry-pi to get the sniffer working, with the above pins, but without the ninja block stuff.

I don’t have FTDI, it hasn’t arrived yet, so I used my Arduino Duemilanove to flash the Mini Pro, but it didn’t work. To get the Arduino Mini Pro to flash I had to switch the Tx and Rx pins. You will find all the directions out there say to connect the Arduino’s Rx to the Minis Tx and vice versa, but that was not the case for me. I did find one post on the Arduino forums that mentioned switching them, I had to flip-flop the pins and then it worked! Tx to Tx and Rx to Rx. I got my Mini Pro off eBay for cheap, it has no name on it, but it does have a red PCB and a small Sparkfun logo. Works like a charm this way. Just remember to set the Arduino IDE to your Mini Pro or you will get errors. I also HAD to remove my Duemilanove’s chip to flash the Mini. I tried it with it in and it did NOT work.

As for the receiver some say to use 5v to power, the board even says 5v. But I have also read people using 3.3v to power it. I used 3.3v to power it when I was testing. To use 5v and the RPi you need to drop the voltage or you will damage the Pi. Use a voltage divider with a 1K and 2K ohm resistors to do it. Google Images has plenty of examples. http://forum.arduino.cc/index.php?topic=136788.0

Heres the code I used to finally get it to work:

———————
(1) Raspberry Pi B+
(1) XY-MK-5V 433mHz Receiver (4 pins, both data are the same)

(1) Arduino Mini Pro
(1) FS1000A 433mHz Transmitter (3 pins)

RFSniffer (on the RPi for receiving)
RCSwitch (on the Arduino for transmitting)

I used 2 LEDs on the Tx and Rx data pins, and 10K ohm pulldown resistor for the button. I also soldered on 17cm (about 6.5″) of 22awg solid copper wire for antennas.
———————

Some useful links
http://arduino.cc/en/Tutorial/ButtonStateChange

So far so good. Do not blame me for anything bad that happens to you or your RPi/Arduinos, consider yourself warned. Double check your wiring!!