Loisaida Sam

Nov 072014
 

Backstory: we moved into a new apartment a few weeks ago, and being that we no longer live in Manhattan, we actually have an apartment big enough that my stereo system doesn’t have to sit right next to my TV. What this boils down to is that the wall where our TV/cable/internet hookup lives is on a different side of the room than my stereo/turntable setup.

The Problem: I’m no longer able to use my Airport Express to wirelessly stream music over my stereo (which I previously did with the assistance of AirFoil), and I’m looking for an alternate solution.

In short, I need something that plugs into an AUX port of my stereo that also hooks up to my home wifi network that will allow me to stream music from sources such as Spotify, iTunes, Youtube, etc. If it has a power jack and can plug into the wall to power itself, that’s great too.

What I’ve Found: There are a variety of offerings that seem to be in this space.

Here’s some of what I’ve found:

  • Airport – from $99 for Airport Express, what I currently have, but the router is not near the Airport, so this won’t work
  • Sonos Connect – $349 / Connect:Amp – $499 – similar to Airport Express, but ridiculously expensive
  • Apple TV – $99 / Google Chromecast – $35 – these are interesting, but are for streaming things to your TV – I want to stream things to my stereo
  • gramofon – $49 – seems to only work for Spotify and WahWah(?) :\
  • Blueflame Wireless Music Receiver – $29.99 – doesn’t seem to be out yet according to their website, although Target has some pretty shitty reviews
  • Beep – $? – seems to be limited to Pandora + local music
  • Rocki – $49 – limited to Soundcloud/LastFM

That’s what I can find so far – does anyone have any other suggestions/ideas?

At this point I’m thinking I should just buy a REALLY long ethernet cable and wire it carefully along the doorframes so I can continue to use my Airport Express…

Nov 032014
 

http://media.kohls.com.edgesuite.net/is/image/kohls/982103_Black?wid=500&hei=500&op_sharpen=1

Recently I bought a three-pack of these cool Nike Dri-FIT Crew Socks and I guess they mold them specifically for your left and right foot?

In getting ready for work this morning, I grabbed a pair of these bad boys, and I noticed that more often than not, the laundry place where I get my laundry done seems to pair them correctly (meaning that each “L” sock is paired with a corresponding “R” sock). I was wondering if they’re just hyper-considerate laundry folders over there, or if maybe it was just a coincidence.

Not recalling my statistics, I wrote a brute-force script to figure out what percentage of the time they would be bundled “correctly” when bundled at random:

https://gist.github.com/loisaidasam/1307fa9988404cbe1bed

And I found the answer to be an astonishing 40%!

$ python socks.py 3 -n 100000
3 pairs of socks
100000 iterations
{False: 60011, True: 39989}
Good 39.99% of the time 

I don’t know about you, but I find that percentage to be super high! We’re saying that when choosing socks in random order, that almost half of the time they’ll end up being bundled “correctly” with three bundles of properly matched “R” and “L” socks!

Update: I finished getting ready and hopped on my bike, and as I was commuting into work I started thinking about my results, specifically wondering if I could come up with a statistical explanation, and I think I figured it out.

Steps and corresponding probabilities:

  1. Choose one sock at random (cool 100% of the time, hard to mess this one up)
  2. Choose a sock that matches (cool 60% of the time – of the 5 remaining socks, 3 should be the correct match, and 2 the wrong one)
  3. Choose another remaining sock at random (cool 100% of the time)
  4. Choose a sock that matches this sock (cool 66.666…% of the time – of the remaining 3 socks, 2 are the correct match and 1 is wrong)
  5. The last two socks will always match each other (100%)

Now using statistics, you multiply the probabilities of these events happening (right?):

1.00 * 0.60 * 1.00 * 66.666 * 1.00

or in fractions

3/5 * 2/3

or

2/5

or

40%

Yay, math!

Oct 292014
 

This morning I set out on a quest to grab ESPN’s latest headlines using pup.

Long story short: I couldn’t figure out how to do it using pup alone.

Luckily, Eric Chiang (pup’s creator) came to my rescue with a solution using pup and jq in combination, and I’ve since written a command-line script for grabbing ESPN’s latest headlines, as well as modified my motd to include them!

https://gist.github.com/loisaidasam/2625769862c81f943f58

Happy ESPN’ing! :)

Oct 282014
 

So first off, let me start by saying that I noticed that my last post is entitled NYC Subway Data, Part 4 – moar data!. I later noticed that there is no “Part 3” in this series. There never was. Too bad, it will remain a mystery.

Going forward, I’m happy to introduce MTA Fare Buster!!!

Based on Ben Wellington (iQuantNY)‘s post on the leftover money that you commonly end up with when buying a metrocard, I did some research and despite there being a few similar apps out there on the Android market, one was good but not updated with the latest bonus policy, one doesn’t give you options, and one wasn’t free, so I decided to write my own.

Full source code here: https://github.com/loisaidasam/mta-fare-buster-android

Happy commuting!

Oct 202014
 

After spending some fun time with the subway schedule data the other night, I’m a bit more curious now about usage.

On the data list I found the following resources:

(could be helpful for finding fare type popularity? dunno how interesting that is…)

Location data, cool! Through the NYC open data site, I even found this cool little map showing the NYC subway entrances (I’m assuming based on this data):

https://nycopendata.socrata.com/Transportation/Subway-Entrances/drex-xx56?

THIS is interesting because hourly turnstile data COULD be helpful for trying to estimate station popularity at a given time of day/day of week/etc. The only problem is that the Remote Unit/Control Area/Station Name Key data doesn’t really matchup with the GTFS dataset Stops identifiers:

Remote Booth Station Data

vs.

GTFS Stops Data

Hopefully more soon…

Oct 142014
 

A follow up to my last post about trying to make something useful of the NYC subway data provided by the MTA…

I was googling around to try and see if I could find a list of stations per subway line, and didn’t really find any good answers.

I did find this post, essentially asking for the same thing I was looking for:

http://stackoverflow.com/questions/25634764/scrape-mta-subway-data/26353509#26353509

And decided that I’d lend a hand and help out, so I came up with this:

https://github.com/loisaidasam/sub

(feel free to upvote my answer)

Happy commuting y’all!

Oct 142014
 

So I became a commuter today (we moved to Brooklyn on Saturday, yay!), and although it’s only been a short time, I’ve already had a few ideas for apps that might make commuting better.

One such idea will require some data about the NYC Subway System. I debated using pup to scrape the data I want from Wikipedia or something, but then started looking at the vast list of NYC developer resources.

The NYC MTA developer resources are a bit of a mess, so this post serves to help those that find themselves lost.

There are two kinds of data that these guys offer:

1. Realtime feeds

Here’s a list of realtime feeds that they offer (note it’s limited to only a few lines, which I’m sure they’ll expand upon with time): http://datamine.mta.info/list-of-feeds

To use the realtime feeds you’ll need an API key, which you can register for here: http://datamine.mta.info/user/register

2. Static feeds

To get the basic line information, you can go here http://web.mta.info/developers/developer-data-terms.html, read the terms, and click the Yes, I agree to these terms and conditions. link to get access to all the static data (WITHOUT REGISTERING).

A word to the wise, the data is in GTFS format.

Also all of the official colors are here: http://web.mta.info/developers/resources/line_colors.htm

Happy developing

Oct 012014
 

Ever since I found out about pup I can’t stop using it. I absolutely love it. So why not post another use case?

I’ve had my eye on the CMJ Artists Lineup page and figured that’s a good enough use case:

curl -s http://www.cmj.com/marathon/cmj-2014-artists/ | pup .one-half .entry-title text{} | grep -v "Playing CMJ 2014"

VOILA!

https://gist.github.com/loisaidasam/624523054327cd819dc1

Can you tell that I’m super excited for CMJ?!

Sep 182014
 

Preface: we have a few Graphite-powered Grafana dashboards at work that I wanted to rotate through on a regular basis on our team’s display monitor to give us a better idea of what’s going on.

I don’t know much about Applescript, but I found this article that offers some Applescript to rotates through Safari tabs.

That worked, but fullscreen Safari didn’t look great with tabs, so we used this article to create a Chrome version as well.

Here are the code snippets: https://gist.github.com/loisaidasam/00b8bf0ec540718cf237

For those new to Applescript, open up Applescript Editor (you can find it using Spotlight) and try pasting the following code into the top pane and hitting the big green Run button:

display dialog "Hello world."

Voila!

There are plenty of Applescript tutorials out there, so feel free to dive in.

update Damian walked in and cued us into Grafana’s Playlist feature. Doh! Oh well, it was still a good learning experience.

Sep 172014
 

I just came across (via jdp) this awesome command line dealie called pup:

https://github.com/EricChiang/pup

Totally awesome! The HTML equivalent to jq, it allows you to parse HTML using CSS selectors from the command line.

For example, say I wanted to get the top 10 current headlines from Hacker News:

$ curl https://news.ycombinator.com | pup td.title a text{} | head -n 10
Artificial sweeteners induce glucose intolerance by altering the gut microbiota
Show HN: CleverDeck – I built the spaced repetition app I always wanted
I was asked to crack a program in a job interview
Stuff Goes Bad: Erlang in Anger
Suture – Supervisor Trees for Go
The Design and Implementation of the FreeBSD Operating System, 2nd ed.
Easel Is Shutting Down
Dremel Releases a Mass-Market 3D Printer
The Traveling Salesman with Simulated Annealing, R, and Shiny
The New Yahoo Developer Network

SO COOL!!!

How about another example: let’s grab all mentions of apple-related things on the first 5 pages of Hacker News to see how popular all of this insanity is these days:

$ for page in {1..5} ; do curl -s -S https://news.ycombinator.com/news?p=$page | pup td.title a text{} | awk '{print tolower($0)}' | egrep 'apple|ios|osx|swift|xcode|iphone' ; done ;
ios 8 reviewed
swype - ios 8 keyboard
stripe lands apple in quest for $720b in payments
ios8 adoption, hour by hour
ios 8 review
why apple didn't use sapphire for iphone screens
a history of misses for radioshack
predictive photo sharing with ios8
everything that went wrong while building the tumblr ios share extension
apple pay and nfc are obsolete: this is how payments could work in the future
the iphones 6
apple watch: initial thoughts and observations
build your own apple ibeacon with a raspberry pi
interactive iphone 6 experiment in webgl

So awesome!!! Thank you Eric Chiang!