Friday, February 5, 2010

Useful URL tips for google and youtube

A short list of simple but useful tips for youtube and google URLs.

Link to a specific time in a youtube video

Attach #t=AmB where A is minutes and B is seconds to a youtube URL, to link to that specific time in the video.

Example: http://www.youtube.com/watch?v=wRnSnfiUI54#t=0m16
links to the specific moment where Kirk shouts KHAAAAAANNN!

Google in English

Occasionally, google gets it in it's mind that you want the interface translated to some language other than English, because you are in a country that speaks that language, or because of (broken?) geo-profiling. To clear this, visit

http://www.google.com/ncr

Google query on the fly

If you need to do a quick google query, and want to limit the bandwidth used by only loading the results, or the pages loaded because you're in an awkward text-based browser, learn this URL scheme:

http://www.google.com/search?q=a+google+query, where a+google+query can be replaced with whatever you're searching for.

That is all.

Thursday, February 4, 2010

I digress: The elusive experience of being lost in a familiar place

Deviating a bit from the set topic of this blog, I thought I'd share a quest of mine in life: Loosing myself in familiar places.

When I was very young, probably around 8-10 years of age, I had a most peculiar experience as I woke up one morning. I was convinced I was lying in one direction in bed (not that I remember specifically which orientation, but for the sake of the story, let's say I imagined myself facing the wall next to my bed), only to open my eyes and find out I was facing away from the wall. For the briefest of moments, I experienced a peculiar but pleasant feeling of confusion.

It is hard to put this experience in words, but if you have ever had a false awakening (that is, dreaming you woke up and started doing your morning routine, only to wake up for real moments later and finding you're still in bed), the experience is somewhat similar.

Ever since this morning in my childhood, on some level, I have been chasing this experience. It is quite elusive, as it is very hard to make yourself forget how you got somewhere, since trying typically has you paying more attention to where you are. I have indeed experienced it more times, usually while lost in deep thought about some matter, only to realized I've been wandering around randomly.

These events are rare, probably occurring order of magnitude once a year. But today, was one of those days. While pondering a problem from a textbook on plasma physics I was reading, I went to the lavatory, only to realize I had no idea which floor I was on.

They seem like such tiny and insignificant events, but given their rare and transient nature, I feel it's necessary to cherish and take the opportunity to explore them.

Thursday, December 3, 2009

How some CAPTCHAs are being broken (and how to fix it)

I've noticed that CAPTCHAs are becoming increasingly futile in combating automated sign-ups, as well as becoming increasingly prevalent in places where it doesn't make sense to put them. So a while back, I connected the dots into a theory on how CAPTCHAs are being circumvented in bulk quantities (after some further research, it turns out that this method is actually in use).

It's essentially a form of covert crowdsourcing: If you have a high-traffic site that requires a sign-up, you could in theory simultaneously create an account on some other CAPTCHA-enabled site by forwarding the CAPTCHA to the user signing up on your site, and as your user solves it, forward the result to your own sign-up session on the target site.

There's a lot going on in this, so I'll divide it into two parallel time lines (blue italic is malicious site, red is target site):


  • User loads registration sign-up page

  • Sign-up session on target site is started, malicious site downloading CAPTCHA image

  • Malicious site presents target site's CAPTCHA as it's own

  • User fills out details and solves CAPTCHA

  • User's CAPTCHA-result is used to register on target site



Now this is a known method, but there is an obvious way of deterring this sort of thing that for some reason doesn't seem to be widespread: To embed something that indicates the origin of the CAPTCHA onto the image. If the users see an URL and a logo belonging to a different web site than they are signing up on, they would naturally grow suspicious, and as this method mostly lends itself to targeting specific websites (and these would be bigger targets), the target will likely be big enough to be recognizable to the average person, which makes all the more suspicious.

Monday, November 16, 2009

C & Bash frankensources

Heh, I stumbled upon an amusing overlap in C preprocessor syntax and shellscript comments. You can piggyback a C program onto a shell script, so that it's both possible to compile the file with a C compiler, and let bash evaluate it.

#if 0
echo "Hello from bash!"
exit
#endif
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
puts("Hello from C!");
return EXIT_SUCCESS;
}


Note that it's not possible to put a shebang in the beginning of the script (or other shell script comments) and compile it, as that upsets the preprocessor.

$ sh frankenscript.sh.c
Hello from bash!
$ gcc frankenscript.sh.c -o test
$ ./test
Hello from C!


You could also have the script, when run as bash code, compile it self as C sources and run the result.

#if 0
file=`mktemp`
gcc -o $file $0
$file
rm $file
exit
#endif
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[]) {
puts("Hello from C!");
return EXIT_SUCCESS;
}


...

$ sh frankenscript2.sh.c
Hello from C!
$


Don't get me wrong, it's a perverse crime against nature and should never be used, but still, an amusing diversion.

Tuesday, October 27, 2009

Small ternary (base 3) computer on a binary microcontroller

This isn't my work, but I've done some degree of work in the field of ternary computing through the ternary computer emulator Tunguska I whipped up a few years ago (I'm slowly working on a major re-write, but other things keep stealing my time). Which is kinda cool. I do believe I'm the only person in existence who has written something even remotely close to a C compiler for a base 3 computer.

Anyway, enough of my esoteric feats, this is pretty neat: "Ternary Computer is now emulated in binary microcontroller"

There's more information on the 3niti project here: http://www.3niti.org/

Thursday, October 22, 2009

HAPPY CAPS LOCK DAY EVERYONE

HAPPY CAPS LOCK DAY EVERYONE!

OCTOBER 22 IS INTERNATIONAL CAPS LOCK DAY, AND THIS BLOG FOR ONE EMBRACES THIS IMPORTANT INTERNATIONAL HOLIDAY.

BECAUSE, WHEN WAS THE LAST TIME YOU TYPED IN ALL UPPER CASE LETTERS? AREN'T YOU FEELING A LITTLE BIT GUILTY ABOUT NOT USING THE CAPS LOCK KEY AS MUCH AS YOU COULD? JOIN THE FESTIVITIES! JUST HIT CAPS AND TYPE AWAY.

Tuesday, October 6, 2009

MIDI programming in Linux

For no particular reason other than curiosity, I decided to venture into MIDI programming. In Linux. There are two problems with this idea:
  1. MIDI programming...: While actual MIDI programming isn't that difficult, you are definitely not in Kansas any more. These music guys are a separate subspecies to the garden variety geek.
  2. ... In Linux: Doing this is painful. It's sort of like going to the dentist, finding out that nobody is there, and that you have to fix your teeth on your own, and while there are plenty of instructions on how to operate the equipment, they all say different things, and most of them were written on USENET or some obscure mailing list well over a decade ago, discussing deprecated versions of the dentistry instruments you have in front of you.

Anyway, after 3 or 4 kernel recompiles; installation of a virtual synthesizer (fluidsynth) that didn't compile properly out of the box, so I had make countless small alterations to it[1]; and a ton of sheer luck, I managed to get my program to send MIDI instructions to fluidsynth, that actually reacted to them and made noise.

I wrote a small program that uses my low-end Wacom tablet to create a theremin-like instrument by mapping pitch bend to one axis and volume to the other, but it really didn't turn out too impressive. The tablet doesn't have enough resolution to allow playing more than just a few octaves with any sort of precision.

It's technically doable, but the end result is somewhat of an anticlimax. It was a fun afternoon's work, but when push comes to shove, a pretty fruitless venture.

[1] I think my GCC version or libc version is buggy or something. It's ridiculously pedantic.