Please see UPDATED: Using Let’s Encrypt to Secure WordPress on AWS Lightsail for an updated version of this tutorial.
I can only access certain servers at work over SSH if I am using a machine with a certain static IP address. I wanted to be able to mount the servers file space using SFTP on a Macbook Air when I am either at home or at a remote location. I investigated a lot of different ways to accomplish this with little success. After a lot of trial and error I was able to create a Socks proxy to my work machine using ssh and then mount the server file systems by using Cyberduck and enabling the use of the socks proxy.
First, I needed to create the socks proxy. In order to do this I had to SSH into my work machine and dynamical forward a port 8080. You may forward any port that is not being used greater than 1024. This will send any traffic on that port through the tunnel and out of the machine that you are connected to.
ssh [email protected] -D8080
After I have created the SSH connection with the dynamic port forwarding, I enabled the socks proxy in OSX Network Preferences -> Advanced -> Proxies. Check the “SOCKS Proxy” box. Then, set the “SOCKS Proxy Server” to 127.0.0.1:8080. Finally, add the IP or Domain of the machine that has the SSH connection to the “Bypass proxy settings for these Hosts & Domains” box.
Now enable the proxy in Cyberduck. Go to “Cyberduck” -> “System Preferences” -> “Connection” and check the box that says “Use system proxy settings”.
Now every connection in Cyberduck will flow through your SOCKS proxy that you set up so you can mount the remote server file system over SFTP.
I was launching a new WordPress website at work that was developed by an outside agency. This site was using twitteroauth built into the theme to access the twitter API. Where I work all the web servers are behind a firewall with a strict whitelist for all incoming and outgoing connections besides the incoming HTTP and HTTPS requests. This makes it difficult to access the twitter API because it could be a different IP address every time. To solve this issues my work provides a proxy server to make requests out to. So my research began.
WordPress began to provide configuration settings in the wp-config.php file for them (http://wpengineer.com/1227/wordpress-proxysupport/):
define('WP_PROXY_HOST', '192.168.84.101'); define('WP_PROXY_PORT', '8080'); define('WP_PROXY_USERNAME', 'my_user_name'); define('WP_PROXY_PASSWORD', 'my_password'); define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');
Unfortunately, the developers built the twitter api into their theme so I had to manually track down the API calls to modify them to use the WordPress configuration settings. In the twitteroauth.php file in the themes folder I was able to add three lines to the
curl_setopt parameters to function http (http://php.net/manual/en/function.curl-setopt.php):
curl_setopt($ci, CURLOPT_PROXY, '192.168.84.101'); curl_setopt($ci, CURLOPT_PROXYPORT, 8080); curl_setopt($ci, CURLOPT_HTTPPROXYTUNNEL, 1);
Everything worked once I added those three lines.
Update: Check out this Instructable –Legend of Zelda Bartop Arcade Cabinet
In an old episode on Hak5, Wess Tobler (@Dankiswess) did segment on making a MAME bar top arcade cabinet. This segment inspired me to make my own MAME (Multiple Arcade Machine Emulator) arcade cabinet, so I began doing research on different MAME cabinet designs. Bartop Arcade had many different designs and templates for bar top arcades. Below is the design and template that I based my MAME cabinet off of.
Items need for the build phase:
- 1 – 4’x8’x5/8″ MDF sheet
- Box of screws
- LCD Monitor (I used a 19″ LCD that I had lying around)
- Two Player Complete Do It Yourself Arcade Kit from X-Arcade
- A computer (I choose to use my existing Windows 7 tower)
- Table saw
- Drill with a 1 1/2″ drill bit.
For the build phase I used the template that I found from Bartop Arcade and cut out each piece. I decided against having a slide out drawer, so I had to make some slight modifications. Below is a picture of the cabinet about 90% into the build phase.
After cutting and assembling the exterior of the cabinet, I had to wire all the buttons. Once that was done it was onto the software configuration.
Not only was Hyperspin a superior looking front-end, it would allow me to run many different emulators including a NES and SNES emulator. Hyperspin does most of its configuration through GUIs and XML files. Below is a image of the cabinet 90% complete running PAC-MAN.
Hyperspin also allowed for configuring other applications to open from within it. I configured it to run Aussie Juke as one of the emulators. Also, after reading a comment by Moonlit on episode five of TheNewTech.tv, I decided to modify the registry entry for explorer.exe to boot to Hyperspin.
There are several things I have to do to complete this project. First, I need to finish the marquee. The marquee will end up being a Cylon eye covered by a tinted plexiglass. Second, I need to mount the PC hardware inside the cabinet.
On an episode of Hak5 they discussed setting up a garage door to be opened with a mobile device. Unfortunately, the audio was missing on the section where they discussed building/configuring the actual hardware to operate the garage door. This episode inspired me to start working on some home automation that could be accessed with any internet capable device without the need to install any software on the device. I wanted to be able to control several lights throughout my house and my garage.
I decided to use x10 to give me a starting point.
X10 is an international and open industry standard for communication among electronic devices used for home automation, also known as domotics. It primarily uses power line wiring for signaling and control, where the signals involve brief radio frequency bursts representing digital information. A wireless radio based protocol transport is also defined – wikipedia
- 10KΩ Resistor
- x10 PSC04
- x10 Lamp Module
- x10 Universal Relay Module
- RJ11 Cable
- RJ11 Jack
- A LAMP server with an open USB port
Step 1: Building and Configuring the Arduino
Follow the wiring schematics below for wiring your Arduino to an RJ11 Jack.
Data Pin = Pin 8
Zero Crossing Pin = Pin 9
First, wire the 5v connection on the Arduino to the 10KΩ resistor. This will be wired to the data pin 8. Second wire data pin 8 to the black wire on the RJ 11 surface jack. Wire the green and red wires on the RJ11 surface jack together and wire them to the ground pin on the Arduino. Finally wire the data pin 9 to the yellow wire on the surface jack (sometimes you may have to swap the data pin and the zero crossing pin depending on if the RJ11 cord is a cross over or not)
Grab the x10 Library from arduino.
Clone my github repository https://github.com/jfurcean/House-Control.git.
Push the arduino/x10House.pde to the arduino. This code reads data in the form of ascii characters over the USB. It converts the characters into x10 byte codes that are used with the x10 Library. It then uses the x10 Library to push x10 commands out to the PSC04 moudle over RJ11.
Step 2: Configuring the Webserver
A webserver running PHP with an open USB port is required. I used a LAMP server running Ubuntu 11.04. Drop the contents of www from my github repository into your active web directory. Inside index.php you must set $serialPath to the path that your arduino is connected to. For example
$serialPath = “/dev/ttyUSB0″;
If your using Apache as your webserver you must allow Apache to write to that path name.
sudo chgrp www-data /dev/ttyUSB0
sudo chmod 775 /dev/ttyUSB0
The web application reads config files to display certain x10 actions. When viewing the web application you need to make sure userName set. For example:
This will then use john.xml as the config file. The config file determines what stuff you can control.
<module name=’Living Room’ house=’a’ unit=’1′ type=’light’/>
<module name=’Bed Room’ house=’a’ unit=’3′ type=’light’/>
<module name=’Garage’ house=’a’ unit=’2′ type=’button’/>
Step 3: Add/Wire x10 Modules
All that is left is to plug any lamp into a lamp module, an appliance into an appliance module or wire a garage door, sprinkler, etc to the universal relay module.
Step 4: Enjoy
Enjoy being able to control your house from any internet capable device connected to your network
Light Control via iPod Touch
Garage Door Control via iPod Touch
Questions? Comments? Suggestions?
Please feel free to contact me