Consciousness found?

This article explains how scientists found quantum vibrations inside brain neurons, the reason we are sentient beings.

The now supported theory, called “orchestrated objective reduction”, apparently “(…) opens a potential Pandora’s Box, but (our) theory accommodates both these views, suggesting consciousness derives from quantum vibrations in microtubules, protein polymers inside brain neurons, which both govern neuronal and synaptic function, and connect brain processes to self-organizing processes in the fine scale, ‘proto-conscious’ quantum structure of reality.”

The lost me at “Pandora” :)

Fish Shell 2.1 messed up prompt

If you upgraded to the Fish Shell version 2.1 you might have noticed your prompt now containing a bunch of new lines (blank). I believe it’s due to the fact that the echo command now produces a new line by default (even though that’s not explicitly stated in the release notes) 1.

To solve it, replace all ocurrences of echo in your Fish prompt function with echo -n <whatever>. This will tell echo to not end with a new line.

Happy Fish'ing ;)

1. Fish developers, correct me if i’m wrong please :)
Google Drive new document bookmark

Here’s a neat trick: Bookmarks to create all sorts of Google Drive documents. This way you don’t have to first access Google Drive and click on new, you can just have the appropriate bookmarks in your browser’s toolbar. Just add these links:

Have fun documenting :)

Pure CSS dancing bender

I love technology :)

bender

Found here.

You should get Training Time for iOS

And why, you might ask? For one because i made it :)

But seriously, if you are into intense, repetition-based training, you might want to take a look at it. It’s an iOS app that allows you to set the duration of each repetition, as well as the resting time between reps. Then all you have to do is hit start and listen to the app as it tells you when to rest and when to exercise.

Because i rarely develop something i don’t want for myself, i’ve been using it for a while, along with a set of 5-6 different exercices, for a total of 7-8 minutes of training everyday and i’ve found it to be a nice and fast way to be in good general shape. Your mileage may vary but you can always top that with, who knows, a bit of Kung Fu ;)

Training Time! can be found on the App Store, here.

Youtube user uploads RSS feed

Ever wondered how to get a YouTube user’s RSS feed so you can keep track of his/her uploads? Here’s how:

https://gdata.youtube.com/feeds/api/users/rubentiagoqcoisa/uploads

Just replace rubentiagoqcoisa with his/her YouTube username and use that url in a feed reader.

You’re welcome!

Call piped shell commands from Objective-C

If you happen to want to know how to run - say - the following command from inside an Objective-C application:

echo "something something" | multimarkdown

So that the fantastic MultiMarkdown runs its magic and transforms something something into <p>something something</p>, then you need to do as below:

- (NSString*) convertMD:(NSString *)data {

    // Task for echo
    NSTask *echoTask = [[NSTask alloc] init];
    [echoTask setLaunchPath: @"/bin/echo"]; // Tell which command we are running
    [echoTask setArguments: [NSArray arrayWithObjects:data, nil]];

    // Task for multimarkdown
    NSTask *mdTask = [[NSTask alloc] init]; // Make a new task
    [mdTask setLaunchPath: @"/usr/local/bin/multimarkdown"]; // Tell which command we are running
    [mdTask setArguments: [NSArray arrayWithObjects:@"--snippet", nil]];

    // Pipes for input and output
    NSPipe *pipeBetween = [NSPipe pipe]; // Handles getting the result of echo and injecting into md
    NSPipe *outPipe = [NSPipe pipe]; // Handles getting the result of md

    // Rig it together
    [echoTask setStandardOutput:pipeBetween];
    [mdTask setStandardInput:pipeBetween];
    [mdTask setStandardOutput:outPipe];

    // Execute
    [echoTask launch];
    [mdTask launch];

    // And get the result data
    NSData *result = [[outPipe fileHandleForReading] readDataToEndOfFile];

    return [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];
}

A couple of notes here:

  • What this does is pipe the result of the echoTask (which will run echo “<whatever you pass in data>”) as input (standard) to the mdTask, which will run multimarkdown –snippet;
  • The outPipe will simply take the output of the mdTask so we can return what multimarkdown created;
  • The commands need the full path in order for the tasks to run;
  • In case you are curious, i’m creating a markdown editor for OSX with realtime preview inline;
  • If you want to test this particular piece of code as-is, make sure you install multimarkdown for OSX first.

Peace

3-sweep : Extracting editable objects from a single photo

Insanely cool. Imagine the applications for game developers: Need a 3D model of a sword? Oh, i have one at home, let’s model it in 2 seconds :)

The only question is where can we find this fantastic piece of software?

Bravo, Russell Brand. I love this dude.

You know, in a non sexual kind of way :)

Russell was kicked out of the GQ awards for reminding the audience that Hugo Boss made the uniforms that the Nazis wore in WW2. Hugo Boss was the event sponsor, hehe.

This, amongst other fantastic truths about the extremely poor people that usually attend fashion shows and awards. Priceless!

If you don’t know about this guy, then check out some of his videos on youtube (especially the one where he makes fun of MSNBC reporters, to their face). Besides being an outstanding comedian, you can tell by his discourse that he is a freaking genius and a very common sense kind of person.

Error compiling pg Ruby gem on OSX

If you get this error (or similar) while trying to run bundle install on one of your Ruby projects or trying to install the pg gem:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

/Users/void/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb --with-iconv-include=/usr/local/opt/libiconv/include --with-iconv-lib=/usr/local/opt/libiconv/lib
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

The solution is to install the gem like this:

sudo env ARCHFLAGS="-arch i386" gem install pg -- --with-pg-include=/Library/PostgreSQL/8.4/include/ --with-pg-lib=/Library/PostgreSQL/8.4/lib/

Note: Replace 8.4 with your installed PostgreSQL version in the above command.

Internet speed test from the command line

Here’s a neat trick: Measuring your Internet download speed from the command line.

Basically you need wget to download a big file (download to /dev/null will not waste disk space ;)) and simply check the average speed at the end.

Something like:

wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip

Will give you:

Resolving speedtest.ams01.softlayer.com... 159.253.132.18
Connecting to speedtest.ams01.softlayer.com|159.253.132.18|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11536384 (11M) [application/zip]
Saving to: ‘/dev/null’
100%[====================================================================================================================================================================================================================================>] 11,536,384   897KB/s   in 13s
2013-09-05 17:36:36 (901 KB/s) - ‘/dev/null’ saved [11536384/11536384]

In this case, my download speed was 901KB/s.

But it gets better: Since you might not be near the server i am using to test, you can pick a closer one. Just replace the “ams01” part of the url with one of the servers on this page. For simplicity, i’ve compiled a list:

  • Amsterdam, The Netherlands: ams01 (the one used in my test)
  • Singapore, Singapore: sng01
  • Seattle, USA: sea01
  • San Francisco, USA: sjc01
  • Dalas, USA: dal01
  • Dalas, USA: dal05
  • Dalas, USA: dal07
  • Houson, USA: hou02
  • Washington DC, USA: wdc01

So for example - if you live near San Francisco - use “http://speedtest.sjc01.softlayer.com/downloads/test10.zip” as the url (notice the change in bold).

Bonus: Create a shell alias and you can call the speed test anytime using - well - “speedtest”. Here’s an example for the FiSH shell and bash.

FiSH: Add to your config.fish

function speedtest; wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip; end

BASH: Add to your .bash_profile

alias speedtest='wget -O /dev/null http://speedtest.ams01.softlayer.com/downloads/test10.zip'

Happy (fast) Interneting.

New keyboard and KeyRemap4MacBook key bindings

Das Professional S - Mechanical Keyboard Bought a new keyboard, the DAS Keyboard Professional S. Maybe now i’ll finally learn how to code properly :)

Also, took some time to create key bindings for media and brightness controls (for KeyRemap4MacBook) for it. Feel free to use my private.xml file and modify as you see fit. The script will only modify keys when the external keyboard is connected. Also, you might need to use the app’s EventViewer to change the Vendor and Device ID values :)

I tried to get the sleep key to lock my mac, but i think i’ll need to tinker with AppleScript to accomplish that one. Just haven’t had the time yet.

Here’s the script:



  
  
    DAS
    0x24f0
  
  
    DAS_KEYBOARD
    0x0137
  

  
  
    KeyCode::VK_OPEN_URL_APP_Lock
    file:///Applications/QuickLock.app
  

  

  
  
    DAS Media Volume Mute
    private.das_vol_mute
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F1, KeyCode::VK_CONSUMERKEY_VOLUME_MUTE
  
  
    DAS Media Volume Down
    private.das_vol_down
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F2, KeyCode::VK_CONSUMERKEY_VOLUME_DOWN
  
  
    DAS Media Volume Up
    private.das_vol_up
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F3, KeyCode::VK_CONSUMERKEY_VOLUME_UP
  
  
    DAS Media Play/Pause
    private.das_play_pause
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F5, KeyCode::VK_CONSUMERKEY_MUSIC_PLAY
  
  
    DAS Media Prev
    private.das_prev
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F7, KeyCode::VK_CONSUMERKEY_MUSIC_PREV
  
  
    DAS Media Next
    private.das_next
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F8, KeyCode::VK_CONSUMERKEY_MUSIC_NEXT
  

  
  
    DAS Brightness Down
    private.das_brightness_down
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F9, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_DOWN
  
  
    DAS Brightness Up
    private.das_brightness_up
    DeviceVendor::DAS, DeviceProduct::DAS_KEYBOARD
    __KeyToKey__ KeyCode::F10, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_UP
  

  
  

Why remove Dilbert from my reading list?

Because of this:

Dilbert feed gone