I wrote a simple python script to automate awarding bonuses to workers on Mechanical Turk (mTurK). You can find it here. It requires Amazon Command Line Tools.
I wrote an R function to do this here. The readme on that page also has the plain cURL code and links to the Qualtrics API documentation so you can experiment on your own!
Simple one liner to replace identifiable information (e.g. mTurk workerids). (Has some cons, but it's fast.)
d0$workerid_random <- match(d0$workerid, unique(sort(d0$workerid)))
If you want to be even cooler and use a one-way hash function, here's a one-liner using the
digest() function (from the
library(digest); d0$workerid_hash <- substr(sapply(as.character(d0$workerid), digest, algo="md5", serialize=F), 1, 6)
(the code above: (1) converts workerid into a character string, (2) uses
sapply() to apply
digest() vectorially, (3) takes the first 6 characters of the resulting string.)
During one of our lab hackathons, Justine Kao, Greg Scontras, and I coded up a little interactive web text-visualization demo: colorMeText, which basically colors input text according to ratings using some dictionary (e.g. useful for sentiment analysis, or any other dimension of interest). It's still a work in progress!
Sometimes you just want to concatenate all the data files in a directory into one big file. If it's in a format like .csv, and you want to skip the first header, you can use the following command in Terminal:
awk 'FNR > 1' *.csv > combined_file.csv
Although Preview on a Mac can compress (Export->Quartz Filter->Reduce File Size), the images become really low quality. The solution I used was pdfcompress.com, which provided reasonable results.
I use GIFFun, which is pretty alright if you just need the basic essentials.
There's also a neat guide here that I haven't tried, using ImageMagick on the command line.
If you crop a pdf file in Preview, it doesn't destructively crop it. The parts you cropped out are still hidden in the file (i.e. so you can undo cropping). I've found that this gives trouble with LaTeX when it doesn't recognize the bounding boxes. If you need to destructively crop the file, one way to do it is using Ghostscript. Let's say you want to crop "in.pdf" to "out.pdf" (note that you can't use the same filename, because of the way gs works), at the command line, type:
gs -sDEVICE=pdfwrite -dUseCropBox -sOutputFile=out.pdf - < in.pdf
Here's a simple Macro that you can use so that everytime Microsoft Word opens a new document, it does so at a specific zoom level. (Personally, I like 100% on my Retina Pro.).
1) In Word, Go to Tools->Macro->Macros.
2) On the dropbox after "Macros in", click Normal (Global Template)
3) Create a new Macro called AutoOpen [This particular name seems to be required for it to be run upon opening].
4) Paste the following macro in, where 100 is the desired zoom percentage.
(refs: various places like this and this.)
ActiveWindow.ActivePane.View.Zoom.Percentage = 100
I love having really high sensitivity on my mouse/trackpad. Unfortunately, the maximum that you can go in System Preferences isn't high enough for me. There is a way to increase this sensitivity further. In Terminal, typing:
defaults read -g com.apple.mouse.scaling
will give you the current value of your mouse scaling. You can modify it by changing
write. For example, if you want to set your mouse scaling to 3.0 (the maximum in System Preferences), type:
defaults write -g com.apple.mouse.scaling 3.0
In addition, to change the trackpad, use
com.apple.trackpad.scaling. You can also use
.scrolling to change scrolling speed.