TannieSpace

geekery, drawing and then some

2009 (old posts, page 6)

Bit.ly + TextExpander + Applescript = WIN!

I wanted an easy way to shorten my URLs through one of the URL-shorteners out there. I liked bit.ly, because it’s nice and short, has an easy to navigate web-interface (without a mouse) and I can use its magic with my terminal (cURL).

I also very much like TextExpander and after googling a bit, I ofcourse found an Applescript for TextExpander and Bit.ly. That link also shows how to set it up in TextExpander, very handy! The script does not however use your actual bit.ly account so you can keep track of the URLs you shorten. I tweaked it and made adjustments and it took hours and ofcourse, then I find this which is almost exactly what I had, except with URL-encoding (yummy). The only problem with that one was that I couldn’t get it to have the URLs show up in my recent history. The ‘history=1’ didn’t seem to work.

I tweaked some more and came up with something that completely does what I want. I use OmniWeb so I replaced the

set the PageURL to (the clipboard as string)

with

tell application "OmniWeb" set PageURL to address of active tab of browser 1 end tell

If you use safari, use

tell application "Safari" set PageURL to URL of front document end tell

I’ve made this as readable as possible, the ‘¬’ do matter in Applescript.

..code:: applescript

tell application “OmniWeb” set PageURL to address of active tab of browser 1 end tell

set login to “YOUR LOGIN” set api_key to “YOUR API KEY” set the EncodedURL to urlencode(PageURL) of me

set curlCMD to ¬¨ “curl —stderr /dev/null “http://api.bit.ly/v3/shorten?format=txt&longUrl=” ¬¨ & EncodedURL & “&history=1&login=” & login ¬¨ & “&apiKey=” & api_key ¬¨ & ”“”

—Run the script and get the result: set bitlyURL to (do shell script curlCMD)

return bitlyURL

on urlencode(theText) set theTextEnc to “” repeat with eachChar in characters of theText

System Message: ERROR/3 (<string>, line 43)

Unexpected indentation.

set useChar to eachChar set eachCharNum to ASCII number of eachChar if eachCharNum = 32 then

System Message: ERROR/3 (<string>, line 46)

Unexpected indentation.
set useChar to “+”

System Message: WARNING/2 (<string>, line 47)

Block quote ends without a blank line; unexpected unindent.
else if (eachCharNum ≠ 42) and (eachCharNum ≠ 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then

set firstDig to round (eachCharNum / 16) rounding down set secondDig to eachCharNum mod 16 if firstDig > 9 then

System Message: ERROR/3 (<string>, line 51)

Unexpected indentation.
set aNum to firstDig + 55 set firstDig to ASCII character aNum

System Message: WARNING/2 (<string>, line 53)

Block quote ends without a blank line; unexpected unindent.

end if if secondDig > 9 then

System Message: ERROR/3 (<string>, line 55)

Unexpected indentation.
set aNum to secondDig + 55 set secondDig to ASCII character aNum

System Message: WARNING/2 (<string>, line 57)

Block quote ends without a blank line; unexpected unindent.

end if set numHex to (“%” & (firstDig as string) & (secondDig as string)) as string set useChar to numHex

System Message: WARNING/2 (<string>, line 60)

Definition list ends without a blank line; unexpected unindent.

end if set theTextEnc to theTextEnc & useChar as string

System Message: WARNING/2 (<string>, line 62)

Block quote ends without a blank line; unexpected unindent.

end repeat return theTextEnc end urlencode

ETA (2010.09.30): bit.ly changed a few things so I changed the script above to reflect that


The drawing habit: day 6.

The bowl. For day 6 I drew my late evening food: a reheated portion of Wagamama’s stir fried rice in my newly purchased bowl (which turned out exactly the right size, yaay!) I got a bit overly enthusiastic with the grains of rice, and drew them much too small but it looked so cool .. D


Cooking and such.

I seem to have lost my cooking-foo. The whole meal / menu-planning doesn’t work for me, I can’t figure out the big secret. I did stumble on Organizing Junkie’s Menu Plan Monday which hopefully give me some inspiration / ideas on how to tackle this.

I did some laundry and cleaning today and paused for drink and food, and then stumbled upon Kay’s cheese-onion butterflies and I thought ‘oh yes! want those!’ so I chopped up my last onion (oops, how can I run out of onions), got the grated Gouda from the fridge, the puff pastry from the freezer and it went completely wrong. It fell apart and I ended up smashing it a bit. It doesn’t look very presentable anymore, and I put it in the oven anyway.

Not feeling the cooking-love today.

ETA: They tasted very good. Ate them all. Tummy hurts now… Cheese snacks


The drawing habit.

I lost my drawing habit. I haven’t done any drawing or doodling in ages. I miss it, and yet I spend more time cleaning up than drawing…

This morning in bed I thought how it takes a month to create a habit, so I figured I’d start drawing one drawing a day in april.

After I got up I thought ‘screw April, start today!’.

So, as of today, for at least a month, I will make at least one drawing (no matter what) to kickstart my habit. I’ll call it my ‘30-day drawing challenge’.

I’ll keep you posted…


Random casserole recipe.

I came up with a random casserole recipe by just tossing stuff together. I have tons of cans with food from my compulsive food-buying so I just mixed what I thought would work (my cans are mostly 1 person portions):

  • 1 small can of brown lentils
  • 1 small can of baked beans in tomato-sauce
  • half a courgette (zucchini I believe you weird USians call it)
  • about 200 grams of baked mushrooms (a leftover, baked in butter and garlic salt, tasty!)
  • 1 small can of cream of mushroom soup (at least, I think you call it that, I’d just call it ‘creamy mushroom soup’)
  • two handfuls of grated cheese (ah well, cup, handfuls, who needs exact science!)

I mixed everything together apart from the cheese, put it into oven-dishes, and topped it with cheese. My cans contained about 200 grams of lentils / beans (about 7 US-oz). The soup was a one-person portion, around 230ml / 7.5oz. I don’t think the exact amount really matters, the general idea / proportion counts more. I think replacing either the lentils or beans with ground beef/pork will also work pretty well (I want to try a tofu version some time soon).

I just love courgette and mushroom…

I did forget to season it with pepper and salt and herbs, but it tasted pretty good just like this, probably thanks to the soup being already seasoned. I liked the mixture of creamy soup and tomato sauce.

I put it in my toaster-oven for about half an hour on 400°F / 200°C, but it’s a toaster-oven, so YMMV.

I ate a tasty portion, put another in my bento for tomorrows lunch and have two portions left for later in the week / freezer. Normally this would make two portions I think. Or Maybe one and a half.

My first attempt to cook from my pantry has turned out pretty well. Very pleased :D

Now I have to think of something to cook with my forgotten-but-stil-ok small sweet peppers…


Mmm bread.

I still have issues eating bread, so I’ve made a bit of my own (totally abused my rice-cooker for it too!). I like pita-breads, they seem to work well, so I searched for a recipe and found one. I will cut the recipe into 1/3 (this worked pretty well with my previous bread), because 1/4 means too many calculations and weird things (call me lazy ;) ).

I’ll still make eight, just eight small ones :D

They’ll fit in my bento too!


To wishlist or not to wishlist.

Recently I started keeping a wishlist of things I wanted to buy, however, not just now. It also helps with having a ‘cooling down’ period after I decide I want-want-want something, as advised by many personal finance blogs out there (in one form or the other). At first I thought it was silly, I’d remember the things, but after using it for a while I found it actually really helps. Not only does this immediately stop me from impulse buying, it also helps me (eventually) buy more focussed. When I put an item on the list, I also put the price I found it for next to it, and where I saw it. Usually, I’ll also add a photo to it. (I use Shopper on my iPhone, which I also use for my normal groceries). By adding the price, I can keep my eye open for a special offer for the same product, or, when I decide I really want to buy it, I can do focussed research to find the product at the best price.

I did do research before, especially for needed items, but my wants sort of slipped past that research stage more quickly. By keeping this list I force myself to not only wait, I also make sure I do plenty of research (and then in the process drop the product all together).

I’ve also noticed it becomes easier to throw things of the list after a while, and this in turn leads to it getting easier to not want to put something on there to begin with. Don’t want to waste my time with things I won’t buy anyway :) By seeing the silly stuff on my list, I feel less tempted by more silly stuff. And seeing the total amount doesn’t hurt either!

I currently have 5 items on my list (I dropped some earlier): 1. Griffin Clarifi iPhone case 2. Neocube magnets 3. Sigg Thermo Mug 4. Portable foldable water-drinking reservoir for the dog 5. A 5x5x5 Rubik’s Cube

All wants, I don’t need any of them really. They’re just so much fun! ;)


What not to spend money on…

I’m a bit of a compulsive spender. There, I said it.

Unlike others, I don’t buy shoes or clothes. I buy boxes. And organising stuff. Sites like The daily planner and The container store make my heart beat faster. And Thinkgeek.

Oh, and pens.

And I buy a lot of food.

Only on occasion do I not use the things I purchase, this happens Maybe a couple of times per year. I don’t buy 50 pairs of shoes, new skirts because they’re on sale etc.

But I am a compulsive spender and this has to stop. I have more pens than I could possible ever get empty (granted, drawing just goes a lot better with the right pen, but I have multiple so that shouldn’t become a problem any time soon). I have a gazillion (lovely) boxes. No more buying food when I have plenty in my pantry. Make shopping lists and stick to them. Time to grow up ;)