You want to print your Insta photos or just keep them save and archived? Out of luck - there is no obvious way to download them, unless you manually click save on every one of them. Yes, there are a few services that claim they can download it for you, but none of them worked sufficiently well in my case. And so I set about writing a bash script. Here is how to use it:

  1. Go to https://www.instagram.com/username/, hit “load more” and scroll down until you are satisfied.
  2. Right click -> inspect element -> click once at the top “html” parent node and hit ctrl+c to copy the generated html into the clipboard. Instagram is foxy and with its implementation on React it does not leak you with all the urls easily. That’s why we could not just wget the page to begin with.
  3. In any text editor, paste the html with ctrl-v and save the file into username.txt.
  4. Paste the script into getit.sh, make it executable by chmod +x getit.sh and finally run it with ./getit.sh.
# split into new line with every new src tag
cat $username.txt | sed -e 's/src=\"/\'$'\n/g' > lines.txt

# collect the urls using regex
cat lines.txt | grep '^https.*n\.jpg' -o > urls.txt

# replace the default resolution to the max resolution
cat urls.txt | sed 's/s640x640/sMax/g' > urls_max.txt

# loop over the urls and curl them down using the digit-name from the url
while read p; do
  name=$(echo $p | egrep '[0-9]{8}_[0-9]+_[0-9]+' -o)
  echo downloading $name ...
  curl $p > $name.jpg
done < 'urls_max.txt'

Profit! Yosemite

(Read More...)

The revelation of the day: Polymer and Vulcanization for web dev.

Polymer is a new library from Google that aims to extend basic HTML components with very neat and universal, yet blazingly fast and easy DOM level components. The idea is that you can use nice and beautiful components made by best designers just in any framework you like. Paper cards are great - supporting material design. And yes, they are responsive - all the nasty screen size adaptation is taken care of.

The second one is the concept of vulcanization, which is just an idea of combining all the html together in one file, and all the js in the other, so that the client would only need to do a minimal number of http requests, which dramatically reduces the load time.

(Read More...)

I have never heard of Jeff before, today I’ve heard he is like a star, and now I can see why. Below is the list of things known to be true about Jeff (copied from Evan Putra Limanto answer on Quora)

  • Jeff Dean proved that P=NP when he solved all NP problems in polynomial time on a whiteboard.
  • Jeff Dean’s PIN is the last 4 digits of pi.
  • When Jeff gives a seminar at Stanford, it’s so crowded Don Knuth has to sit on the floor. (TRUE)
  • Jeff Dean once bit a spider, the spider got super powers and C readability
  • Once, in early 2002, when the index servers went down, Jeff Dean answered user queries manually for two hours. Evals showed a quality improvement of 5 points.
(Read More...)

Yosemite is awesome! The best time to go is Spring: you would have plenty of flow for the waterfalls, and it is much nicer to hike without extensive sweating.

How to go Yosemite in the cost efficient manner and without six-months-in-advance-reservation? Here is a short guide. Camp 4

(Read More...)

In this document we provide a brief discussion on the LWR algorithm and somewhat detailed description on how to run our code using each tool on the provided VirtualBox VM (code is available on project’s github).

Document structure:

  1. Locally Weighted Linear Regression
  2. Hadoop Ecosystem Overview
  3. Setting Up OS Env
  4. NoSQL implementations:

1. Locally Weighted Linear Regression

Often, when working with real data, we realize that our data doesn’t really lie on the straight line - in other words linear regression fails to capture a lot of variation. When that happens we can use a higher degree polynomial of our features to fit data perfectly. The problem with such parametric approach is two-fold: first, we need to manually choose the “right” degree of polynomials which leads to either underfitting or overfitting; second, we don’t take advantage of the new data that will flow in - once the model is set it is not going to change.

To address these issues we want to implement Locally Weighted [Linear] Regression (LWR), which, assuming sufficient size of the training set, makes the choice of features much less critical. Additionally, LWR is a lazy learning approach and allows us learn on the newly obtained data. Given the goal of Big Data analytics, we definitely want to make use of all the data, yet we are concerned with the computational efficiency. Thus we would like to use NoSQL tools to implement LWR. Now let us briefly discuss the math behind the LWR algorithm, evaluate its time complexity and find possibilities for optimization via parallelization.

(Read More...)