Jun 112014
 
Raspberry Pi Closeup

Raspberry Pi Closeup (Photo credit: GijsbertPeijs)

A quick one for this morning…

I’m sitting here, have my Raspberry Pi plugged in with an internet dongle, trying to figure out where it lives on my network.

I could type:

$ ping 10.0.1.2

and wait…

$ ping 10.0.1.3

and wait…

$ ping 10.0.1.4

and wait…

or I could just type:

$ arp -a

arp ftw!

Jun 042014
 

If you saw Hilary Parker‘s awesome post Sunsets in Google Calendar using R and got all excited about it, but have no idea how to use R, fear not. This post will help you go the distance!

First, install R. I myself use MacPorts

Susnset statue of Liberty

Susnset statue of Liberty (Photo credit: Adorenomis)

, so I did:

$ sudo port install R

which took a while and had a lot of dependencies, but whatevs, it eventually worked…

Next, save Hilary’s create_sunset_cal.R file somewhere on your computer.

Open that up and modify it to use your own sunset location and lat/lon coordinates (I used Google Maps and looked at the lat/lon coordinates in the URL to fill in the data I wanted). Save it.

Now, in that same folder, open an R prompt like so and do the following:

$ R

> install.packages(“StreamMetabolism”)

… (follow the prompts here, choose a mirror, etc.)

> library(StreamMetabolism)

> source(“/path/to/downloaded/file/create_sunset_cal.R”)

> create_sunset_cal()

then <control> + d to exit your R session.

Congrats, you should now see a file called `sunset.csv`, hooray!

Thanks for the awesome write-up Hilary.

Enhanced by Zemanta
May 302014
 
Django logo

Django logo (Photo credit: Wikipedia)

My finding for today is that you can set up auto-complete for when you start typing something like this in your Django project:

./manage.py function_

but don’t remember exactly what you called that custom manage.py command.

Just download this baby and source it from your .bashrc file:

https://raw.githubusercontent.com/django/django/master/extras/django_bash_completion

And you’re off to the races!

Enhanced by Zemanta
May 012014
 

Introducing… MULTIPLAYER 2048!

http://multiplayer-2048.herokuapp.com

That fun game that just won’t die is back again, this time in multiplayer form!

To play along, join the #2048 channel on Freenode and start issuing commands like “up”/”down”/”left”/”right” (or “u”/”d”/”l”/”r” for short).

From a technical perspective, I forked the original version and modified the controls so that they no longer come from the keyboard. This multiplayer version instead uses Pusher to update clients with realtime events and a Hubot with an IRC adapter and a custom script that calls a Python/Flask webserver, stores the data in a Redis list, and triggers the Pusher updates.

I was on the front page of Hacker News for about five minutes before being booted (still learning the ropes on how HN posting works), so I guess it wasn’t a big hit. I was even in touch with the kind folks over at Pusher who bumped me up to a higher number of allowed simultaneous connections to prepare for HN traffic, but alas I never needed it. Thanks anyway Pusherinos!

Happy 2048ing!

Enhanced by Zemanta
Jan 312014
 
Image representing Craigslist as depicted in C...

Image via CrunchBase

If you’re anything like me, you LOVE the prospect of finding a “new” used bike from Craigslist, but there are some pretty strong pain points there that keep you from doing it regularly:

- so many links to click
- so many bikes that are not my preferred <size|color|brand|etc.>

Enter this little script that goes through, “clicks” all the links for you, and searches for exactly the search terms you’re looking for! Happy Craigslisting!

Enhanced by Zemanta
Sep 182013
 

Happy Tuesday from nerd land!

 

Jul 242013
 
NYC Resistor

NYC Resistor (Photo credit: Wikipedia)

A follow up – this topic isn’t dead after all! Au contraire mon ami, I actually got the thing working!

After my first attempt and failure, I reached out to the fine people of NYC Resistor‘s Microcontrollers listserve asking for help. They were super helpful and offered a variety of suggestions on what the problem could be. You can read the entire thread here: https://groups.google.com/forum/#!topic/nycresistormicrocontrollers/x3Dl-ssQMzU

What it boiled down to was that the loop inside of the pulseIR() function stipulates in the comments that “38 kHz is about 13 microseconds high and 13 microseconds low”, and after experimenting with some timings I realized that the calls to `digitalWrite()` were taking longer than the proposed “3 microseconds”. I lowered the value of `hangoutTime` from 10 down to 7 and voila, it works! It was as simple as that one change! I modified the gist accordingly, and now I’m in business!

Thanks again NYCR!

Enhanced by Zemanta
Jul 232013
 
elevator

elevator (Photo credit: Jose R. Borras)

So I was leaving work today when something interesting happened… I got in the elevator, and there was a girl in there. She anxiously checked her phone while we waited for the elevator to descend. Another guy got in before we got there, and the three of us waited for that door to open at the ground floor. When it did, the guy walked to the right, to the north exit of the building. I then did the gentlemanly thing to do and let the girl exit the elevator ahead of me. She walked to the left, to the south exit of the building, where I was also going. We went through both sets of doors, and she turned to the right to walk west down the street, the same direction I was planning on going. Maybe I’m paranoid, but after about a half of a block I noticed that she stopped, paused, looked around, and allowed me to pass, and in my paranoid mind this is because she got the feeling that I was following her.

Now this isn’t the first time that this has happened (not the same girl other times), and I’m sure it won’t be the last, so I started thinking about this mathematically. My statistics are a bit rusty (maybe someone can remind me what operation would solve this), so I relied on scripting out a brute force solution:

Assuming there are four exits to the building, what is the probability that at least one other person in the elevator with this girl will choose the same exit as her?

Running this a few times, I got these results:

Would you look at that! It seems that with only 3 more people in the elevator, it is actually more likely than not that one of them will go out the same exit as her!

Conclusions:

These ladies leaving their work places should stop being paranoid that someone is following them!

(a more likely conclusion: this whole scenario occurred entirely in my head and I am the one who should stop being so paranoid!)

Enhanced by Zemanta
Jul 122013
 

Howdy guys and girls! It’s summertime and it’s hot in New York City. You always hear about those blog posts about people setting up an Arduino to control their air conditioners remotely, and I figured I was due for my own, so here it is. Unfortunately, I was unsuccessful. Hopefully someone can read through what I did and I can follow up with a successful completed post. Either way, here we go…

Synopsis:

After some research, I realized that I don’t want to deal with any electronic internals of the air conditioning unit (as I am no electronic engineer, just a computer scientist dressed up as one), so I will be communicating with it by simulating the requests of the remote control with my Arduino via infrared.

Parts:

Setup:

Arduino Setup

As you can (hopefully) see, I have my Arduino and a breadboard with the IR Receiver plugged into digital pin 2, ground, and 5V. I also have the IR Emitter plugged directly into digital pin 12 and ground. (Side note: do I need any resistors anywhere here? I know about Ohm’s Law, but I’m not sure exactly how to apply it here)

Part 1. Detecting the IR Signal:

I attempted to follow Adafruit’s tutorial on reading an IR Sensor, modifying the Serial monitor output so that I could reuse it for Part 2. Here is the sketch I am using:

Now when I upload that sketch to my Arduino, point my A/C remote control at my IR Receiver, and press the power button, I get the following results:

Part 2. Blasting the IR Signal:

Next, I attempted to follow Adafruit’s next tutorial on Making an Intervalometer to blast the pattern that I’d received in the last sketch using my IR Emitter. Here is the sketch, you’ll see that my code varies a bit for simplicity:

As you can see, it attempts to send the IR signal that we got from Part 1, sleeps for 10 seconds, and then tries again, forever.

Now this is the sad part – I point this sucker at my air conditioner hoping for some grand moment of joy, and nothing happens!

:(

Does anyone have any ideas on what I could be doing wrong?

Enhanced by Zemanta