One of the things I found very strange is the fact that most operations that came with iOS prior iOS 5 which revolved around UIImage didn’t take into account the orientation of the image. This meant that if you want to read a picture from the camera roll and resize it, you’d have to roll your own code to correctly flip and/or rotate the image according to its orientation value.
[Read More]Clone S3 Bucket Script
I had to backup an S3 bucket so I whiped out a small script to clone a bucket.
It’s written in Python and depends on the excellent Boto library. If you are running Python < 2.7 you’ll also need the argparse library (both available also via pip).
View the gist here: https://gist.github.com/1275085
Or here below:
“Those who don’t know history are destined to repeat it.”
I know the title is a bit alarming, but that was my first thought after reading @bryce‘s latest post “The Rising Generation“.
Briefly, he mentioned a 25 y/o asking a question on Quora about how was life before everyone had a cell phone and no one talked a lot or texted in public areas. Bryce also say that the new entrepreneurs, like the ones in yesterday’s Y Combinator Demo Day have different expectation, understanding and perceived value of technology than any other that has come before them.
[Read More]Python Implementation of Twitter’s Snowflake Service
A while back Twitter announced the Snowflake service. Snowflake is a unique ID generator that is fast and generate 64bit integer unique ids that are “roughly sortable”. That is, newer ids are bigger than older ones, up to a certain point.
The service was originally written in Scala (which runs on the JVM) and has a Thrift interface, which means you can talk to it from almost any thinkable programming language.
[Read More]Determine if an Email address is Gmail or Hosted Gmail (Google Apps for Your Domain)
For my latest venture, MyFamilio, I needed to know if a user’s Email address is a Gmail one so that I could show the user his/her contacts from Gmail.
Figuring out if the user is on Gmail is usually easy – the Email ends with @gmail.com. But what happens for all of those Google Apps for Your domain (like my own, which uses the @sandler.co.il domain) ?
Well, you can easily detect that by running a DNS query on the MX record.
[Read More]Forecast: Cloudy – My New Cloud Related Technical Blog
I’ve started a new technical blog which talks about the cloud. It’s called Forecast: Cloudy and it will feature thoughts, ideas and some code driven mostly from my experience running services on cloud infrastructure.
The first post (after the traditional “Hello World“) already has some code :-)
Check it out and don’t forget to tell me what you think about it.
Extract GPS Latitude and Longitude Data from EXIF using Python Imaging Library (PIL)
I was searching an example of using Python Imaging Library (PIL) to extract the GPS data from EXIF data in images.
There were various half baked examples that didn’t handle things well, so I baked something of my own combining multiple examples.
You can get it here: https://gist.github.com/983821
Or see it embedded below:
Twitter’s Kestrel init script for Ubuntu 10.04 Lucid
Twitter’s Kestrel is a cool scala based queue server (based on Blaine Cook‘s (@blaine) Ruby based Sterling).
The two main features I like about Kestrel are:
- Sort-of-transactional – If I take an item I can make sure others can’t get it. If the connect drops it will go back on the queue.
- Read behind mode – If a certain queue reached a maximum pre-configured amount of RAM or items it will stop storing messages in RAM and will write it directly to the queue log file.
If you happen to be running it on Ubuntu 10.04 and want to use the provided init script (kestrel.sh) you’ll notice that it just won’t run.
[Read More]PPTP VPN on Ubuntu 10.04 for your iPhone / iPad
Below are the steps necessary to connect your iPhone / iPad or any other computer via a PPTP VPN.
Why would I want to do this? For various reasons such as allow you to access information and servers that are behind a firewall, or maybe you just need to route traffic through different servers.
I’ve tested this on a 256mb Rackspace Cloud instance running Ubuntu 10.04 and with an iPhone and an iPad. Thanks to Yaniv for debugging the instructions.
[Read More]Varnish High, Ever increasing CPU usage workaround
If you are using Varnish version >= 2.1 and experiencing an ever increasing CPU usage up to a point where you need to restart the service to force CPU usage to drop you may want to add the “-h classic” argument to the command line.
This will revert to use the older hashing method instead of the newer “critbit” that was first introduced in version 2.1.
You can read a little bit more about it on the Yedda Dev Blog.
[Read More]