Using Google Adwords to max out Dropbox referrals

I stumpled upon Vladik Rikhter’s post via Hacker News on how to utilize Google Adwords to max out your Dropbox referrals for less than $10. Basically, you set up an ad campaign that leads people to sign up for a Dropbox account via your referral link, giving them 2.25 GB (250 MB extra for using a referral link) of free storage while you benefit 250 MB (or 500 MB if your account is linked to your school email). My initial attempt at this did not yield any clicks, probably because many people were following this method. I waited two weeks and I still didn’t get any referrals; this was probably brought forth by the publicity generated by Lifehacker’s post (see this too). After about 3 months of waiting, I raised my max bid to $0.10/click, and I got 5 referrals in a 24 hour period. I then raised my max bid to $0.20/click and I completed my quota in a day (I’m at 18.3 GB right now with my student email linked to my account). My total cost was $5.34 since I had many referrals prior to using the campaign (was at 9.3 GB). FYI, the default auto bid was around $0.14/click, so this amount should give you enough referrals in a 24 hour period.

Note to self: use Google Adwords when I need people to click on a link (e.g., for referrals).

Mount box.net on Ubuntu Linux via webDAV

I recently signed up for a free 50gb account at Box.net. At the time of this writing, Box.net does not have an application to sync files from a Linux machine to their servers. I followed this guide and this post to mount the service to a local directory. I did:

<pre class="src src-sh">sudo apt-get install davfs2

emacs -q -nw /etc/davfs2/secrets ## added the following to the end of the file: “https://www.box.net/dav username password” mkdir /mnt/box.net ## added the following to /etc/fstab ## following equivalent to defaults except noauto instead of auto; http://www.tuxfiles.org/linuxhelp/fstab.html https://www.box.net/dav /mnt/box.net davfs rw,suid,dev,exec,noauto,nouser,async,uid=vinh,gid=vinh 0 0

Now do sudo mount /mnt/box.net to have have it mounted. Note that the account will automatically mount at startup.

Input/Ouput error

If you get an input/output error when copying files to your box.net folder, then add the following to your /etc/davfs2/davfs2.conf (per this post):

use_locks       0

Automount

I have the noauto option in /etc/fstab because I don’t want the box.net directory to be mounted at boot time. Why? Mounting requires an internet connection, and a network cable might not always be plugged; a mount error would require manual intervention (Skip or Manual mount) at startup. Instead, we should automatically mount the box.net directory whenever a network connection is made by placing the following script,

#! /bin/bash

mount /mnt/box.net

as /etc/network/if-up.d/mountBoxDotNet; remember to make it executable with chmod +x.

Filtered response in gmail

I use my gmail account to manage multiple email accounts/addresses. I recently wanted to set up a vacation responder for one of my email address. However, the default vacation responder in gmail uses the default email account to send and there is no option to activate vacation responder for a single email address. I found this post on lifehacker that shows how one could set up a flexible auto response system with the use of a gmail account dedicated to auto response. Let gmail 1 be my primary account, and gmail 2 be my dedicated account. Basically,

  1. Add gmail 2 as a forwarding account in gmail 1.
  2. Set up a filter in gmail 1 that forwards to gmail 2.
  3. Add gmail 1 as an account in gmail 2 so that gmail 2 can send as gmail 1.
  4. Set up vacation responder in gmail 2.

Now, emails sent to gmail 1 that fits the condition of the forwarding filter (e.g., “to:work.address@my.company.com”). Remember to turn off the filter in gmail 1 and vacation responder in gmail 2 when the auto-response is no longer needed.

Automatic email notifications for Google Docs Forms

I use Google Docs to collect data using the Forms feature. People can just fill out the form and data will be automatically entered into a spreadsheet for me. It really makes data collection easy in simple cases. For example, creating a contact form using Google Docs is fairly straightforward. Google can even notify you when someone submits a form. However, the notification feature is weak in that it doesn’t provide any useful or customizable data; it just lets you know someone submitted a form. Luckily, Google has a scripts feature. This mail merge feature shows how you can email a list of people individualized emails. To get more useful notifications, you can write a script that will run whenever submits a script. This is a very useful example. I’ll reproduce it here:

  <pre class="example">var formSheet = SpreadsheetApp.getActiveSheet();

var firstRow = 2; //Skip a row for column labels var lastForm = formSheet.getLastRow(); var lastCol = formSheet.getLastColumn(); var flagCol = null; var subject = formSheet.getName() + ” Form”; var mailTo = “”; var collaborators = SpreadsheetApp.getActiveSpreadsheet().getCollaborators(); for(var i=0; i < collaborators.length; i++){ mailTo += collaborators + “,”; } var labels = formSheet.getRange(1, 1, 1, lastCol).getValues()[0]; //get column Labels

for(var i=0; i < labels.length; i++){ //Find which column contains the Sent Flag if(labels[i] == “Email Notice Sent”){ flagCol = i; break; } } if(flagCol === null){//Sent Flag Col not found, create it formSheet.insertColumnsAfter(lastCol++, 1); formSheet.getRange(1, 1, 1, lastCol).getCell(1, lastCol).setValue(“Email Notice Sent”); SpreadsheetApp.flush(); flagCol = lastCol; }

for(var i = lastForm; i >= firstRow; i–) { //Loop through forms, last first var form = formSheet.getRange(i, 1, 1, lastCol); var formVals = form.getValues()[0];

var message = “”; var html = “”;

if(formVals[0] != “” && formVals[flagCol] != true){ //Skip empty and email sent rows for(var col=0; col < lastCol; col++) { //Build the message if(col != flagCol){ message += labels[col] + “: ” + formVals[col] + “nn”; html += “

” + labels[col] + “:”

htmlVal = formVals[col].toString().replace(//g, “>”).replace(/[rn]/g, ” “); if(typeof(formVals[col]) == “string” && formVals[col].length > 100){ html += “

” + htmlVal + “

“; } else { html += htmlVal + “

“; } } }

GmailApp.sendEmail(mailTo, subject + “: ” + formVals[1], message, {“htmlBody”: html}); form.getCell(1, flagCol+1).setValue(true); SpreadsheetApp.flush(); // Make sure the cell is updated right away in case the script is interrupted } }

The syntax is fairly obvious if you ever programmed before. I successfully modified the script for my own use.

Create a website instead of a blog from WordPress using the right theme

WordPress is no doubt a great blogging platform. However, it is also a user-friendly Content Manangement System (CMS) that can be used to run a website. However, you have to tweak it to not look like a blog and more like a traditional website. The easiest way to do so is probably through an appropriate theme. I ran into the Phanatics theme, which looks very asthetically appealing with a monetary fee for its license. I also found the free Weaver theme to also be good looking.

For basic sites that I don’t want to host, I’ll probably still be using Google Sites. For sites that I want more control over and be able to host, I’ll rely on WordPress with an appropriate theme.

Some modifications for WordPress

I recently changed my WordPress theme to Reflex+, a theme that resembles the current look of Google+ and other Google related services. I had to make some manual modifications.

Excerpt vs. full content for each post

On the main index page, you can either show just an excerpt or the full content of each post. I like the full content. To get the index page of your current theme to show the entire content of each post, find a line in ./blog/wp-content/themes/reflex-plus/index.php similar to

#+END_EXAMPLE



and change it to



#+BEGIN_EXAMPLE

My changes:

»').''); */ /*vinh: display full content instead of summary */?>
»').''); ?>

Edit link style

I don’t like it when links are not visually different than normal text. I followed this post and modified ./blog/wp-content/themes/reflex-plus/style.css:

div.post a:link {
color: #09C;
}

div.post a:visited {
color: #006;
text-decoration: none;
}

Adding instructions or comments to the comments section

I wanted to give instructions on writing Markdown Syntax, source code, and LaTeX near the comments box. I modified ./blog/wp-includes/comment-template.php as follow:

/* 'comment_notes_after' => '

' . sprintf( __( 'You may use these HTML tags and attributes: %s' ), ' =' . allowed_tags() . '=' ) . '

', */ /* vinh */
'comment_notes_after' => '

Use [[http://daringfireball.net/projects/markdown/syntax][Markdown Syntax]] for markup.
Surround blocks of code with 
 and 
. For syntax highlighting of specific languages, use the appropriate "brush alias" from [[http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/][this]] list. For example, surround php code with
 and 
. LaTeX code can be surrounded by "backslash left parenthesis" and "backslash right parenthesis" or "backslash left square bracket" and "backslash right square bracket". ',

Anonymous web-surfing with Tor

I wrote about Tor in the past but I never tried using it. I installed it on my Ubuntu laptop and tested using it via Firefox and [Torbutton]. Now that it’s set up, when I want to surf the web anonymously, I just need to launch Firefox and toggle Torbutton to be on. Even though the Tor daemon is running in the background, I won’t use it on a day to day basis.

I also downloaded the Tor Browser Bundle for multiple platforms per this post and placed them in Lightweight Portable Linux (LPS) USB stick so I can use them on other people’s computer should the need come. Of course, if I wanted to be even more discreet, I would boot up LPS directly.