You are here

Risharde's Blog

Interstellar was awesome

Wow, I wasn't convinced that Christopher Nolan was a genius when he wrote the new Batman scripts but definitely after seeing Interstellar, I was blown away. Seeing this movie was extremely emotional for me with flashbacks of my father who has passed away and also trying to understand the science behind our universe. This is one of the movies that will make you wonder more about life and the universe in such a way that you get that feeling that there is still so much we need to know.

5 out of 5 stars for a PERFECT movie!

IF

If you are the Lord, God, Almighty, put all this into positive alignment

TCP Forwarding to next server

These rules should work, assuming that iptables is running on server 192.168.12.87 :

#!/bin/sh

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -F
iptables -t nat -F
iptables -X

iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 192.168.12.77:80
iptables -t nat -A POSTROUTING -p tcp -d 192.168.12.77 --dport 80 -j SNAT --to-source 192.168.12.87

pyUSB on Raspberry Pi

sudo python setup.py install

http://stackoverflow.com/questions/29345325/raspberry-pyusb-gets-resourc...

https://pixiescorner.wordpress.com/2009/09/05/utilityconvert-x10-to-inst...

This isn't too bad, but there are a couple quirks to be aware of. One limitation is that sending X10 codes breaks if you go too fast. I added a Wait subroutine (see the end of this page). The PLM seems to need a 500 millisecond pause between X10 commands. Lower delays didn't seem to work.

Also, the indexes are odd. I set up two arrays with the necessary values (see below).

The following also assumes that

house = the X10 house code as an integer, 0 = A, etc
device = the X10 device code as an integer

Put this in the declarations area of your form/module:

Public PLM_X10_House(16) as Byte
Public PLM_X10_Device(16) as Byte

Set the values for those areas somewhere convenient (like Form1.Load):

PLM_X10_House(1) = 96 ' House code A
PLM_X10_House(2) = 224 ' House code B
PLM_X10_House(3) = 32 ' House code C
PLM_X10_House(4) = 160 ' House code D
PLM_X10_House(5) = 16 ' House code E
PLM_X10_House(6) = 144 ' House code F
PLM_X10_House(7) = 80 ' House code G
PLM_X10_House(8) = 208 ' House code H
PLM_X10_House(9) = 112 ' House code I
PLM_X10_House(10) = 240 ' House code J
PLM_X10_House(11) = 48 ' House code K
PLM_X10_House(12) = 176 ' House code L
PLM_X10_House(13) = 0 ' House code M
PLM_X10_House(14) = 128 ' House code N
PLM_X10_House(15) = 64 ' House code O
PLM_X10_House(16) = 192 ' House code P

PLM_X10_Device(1) = 6
PLM_X10_Device(2) = 14
PLM_X10_Device(3) = 2
PLM_X10_Device(4) = 10
PLM_X10_Device(5) = 1
PLM_X10_Device(6) = 9
PLM_X10_Device(7) = 5
PLM_X10_Device(8) = 13
PLM_X10_Device(9) = 7
PLM_X10_Device(10) = 15
PLM_X10_Device(11) = 3
PLM_X10_Device(12) = 11
PLM_X10_Device(13) = 0
PLM_X10_Device(14) = 8
PLM_X10_Device(15) = 4
PLM_X10_Device(16) = 12
To send an X10 On command:

Dim data(3) as Byte

data(0) = 2 ' start first message: send X10 address only
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + PLM_X10_Device(device) ' X10 address (house + device)
data(3) = 0 ' flag = this is the address
SerialPLM.Write(data, 0, 4)
Wait(500)
data(0) = 2 ' start second message: send X10 house + command
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + 2 ' X10 address (house + command)
data(3) = 128 ' flag = this is house + address
SerialPLM.Write(data, 0, 4)
To send an X10 Off command:

Dim data(3) as Byte

data(0) = 2 ' start first message: send X10 address only
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + PLM_X10_Device(device) ' X10 address (house + device)
data(3) = 0 ' flag = this is the address
SerialPLM.Write(data, 0, 4)
Wait(500)
data(0) = 2 ' start second message: send X10 house + command
data(1) = 99 ' 0x063 = Send X10
data(2) = PLM_X10_House(house + 1) + 3 ' X10 address (house + command)
data(3) = 128 ' flag = this is house + address
SerialPLM.Write(data, 0, 4)

import usb.core
import usb.util

# find our device
dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)

# was it found?
if dev is None:
raise ValueError('Device not found')

# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()

# get an endpoint instance
cfg = dev.get_active_configuration()
intf = cfg[(0,0)]

ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT)

assert ep is not None

# write the data
ep.write('test')

Get back your start menu in Windows 8

I've been using Windows 8.1 and absolutely dislike the returned start menu as it lacks a lot of features compared to the Windows 7 start menu.

The good news is that the guys over at Classic Shell has created software to return the taskbar to its rightful bottom of the screen.

You can get it free at http://www.classicshell.net/

Good luck!

DNS Poisoning?

I could be wrong but the site has been up and down for the past month and it seems to be some sort of DNS poisoning that was occurring. It's very weird because nothing changed on the webserver architecture yet the DNS was simply not resolving even though I can confirm bind was answering. Anyways, we're back up and if you're the attacker, it seems I didn't care that much... :) lol

Raspberry PI 2 - Installing Iceweasel

I have been trying to install iceweasel and keep getting a error 404 when using 'apt-get install iceweasel'
So here's the fix:

sudo su
apt-get update
apt-get dist-upgrade
sync
reboot

Then after reboot
sudo su
apt-get install iceweasel

Pages