Posts

Facebook "Thank you" moments

Few years ago, Facebook launched their "7 years look back" videos. where any Facebook user can go to  https://www.facebook.com/lookback  to find a video generated for him, showing highlights over his historical activities and photos, beautifully animated along with a nice background music, and it went viral. everybody like to watch and share his highlights. Nowadays, something more of that kind is up.  Facebook launched "Thank you" videos. Facebook users can visit  https://www.facebook.com/thanks  with a list of friends on the side. Upon selecting a friend, a video will be generated with a wonderful theme and soundtrack showing highlights between you both. with generic thank you words. The content is usually photos where  are you both tagged in, or posts made by one of you where the other is tagged. Of course starting with your spouse by default :) The wonderful part is that you can go through the list, and see highlights of you and different people...

Stress Testing with Siege and Bombard, know your limits

Image
I couldn't find a clear quick intro on getting siege and bombard in action, so I'm writing one here. Siege is a load testing and benchmarking utility that has been available for quite a while, It allows you to hit your web application on a specific url (or a set of urls in a file) with specific concurrency and size settings.  siege summarizes the measures of the test outcome including: Transaction rate (requests/sec) Actual concurrency (even if you hit with 200 concurrent connections, your server might be responding with just 80) Average, longest and shortest response time example: triggering 200 concurrent users, each hitting the url twice siege -c200 -r2 http://www.modsaid.com/ summary: Transactions:         400 hits Availability:      100.00 % Elapsed time:       38.44 secs Data transferred:        0.26 MB Response time:       10.09 secs Tra...

Linode finally back to the new baseline of VPS Hosting

2 days ago Linode finally announced their new VPS Hosting offering with doubling the RAM and moving to Fast SSD storage SSD Storage will allow much faster operations for both setup operations, compilation and ongoing running services. And the new memory upgrade is considered a drop in the pricing to the half, since people can now use the same server Ram with half the price they used to pay. The smallest Instance offered by linode is now the 2GB Instance with $20/mo as stated in their pricing list: Plan RAM SSD CPU Transfer Outbound Bandwidth Price Linode 2G 48 GB 2 cores 3 TB 250 Mbps $0.03/hr | $20/mo Linode 4G 96 GB 4 cores 4 TB 500 Mbps $0.06/hr | $40/mo Linode 8G 192 GB 6 cores 8 TB 1 Gbps $0.12/hr | $80/mo Linode 16G 384 GB 8 cores 16 TB 2 Gbps $0.24/hr | $160/mo Linode 32G 768 GB 12 cores 20 TB 4 Gbps $0.48/hr | $320/m...

Redmine service hook for github

Github services github.com allows you to activate some service hooks on your code repository. Hooks include lots of interesting functionality like posting email notification about commits among others. At eSpace , we use github.com as our code repository, and redmine as our project management tool and issue tracking. We wanted commits to reflect automatically in the project management tool, which will keep the whole team feeling the progress directly. All service hooks are open source, you'll need to add them to  https://github.com/github/github-services  by Forking  https://github.com/github/github-services implementing ur new service or patch sending pull request to the original repo Redmine service hook A service already existed for redmine to cover the following need: For code browsing to work well in redmine, it was found that the best way to do it with git, is to let redmine watch a local clone of the repo... upon pushing new commits to github...

Organize your readings with Pocket, opportunity for more

I have been using pocket for a while now to queue all the articles I want to read, so I can avoid interruptions and read them when the time is more convenient.  This was actually the philosophy of the app since it was known as Read It Later . This allows me to go through the list later on mobile while i'm in transportation or waiting at some facility. Seems perfect,  but actually things don't go just perfect.  not something wrong in the app, but rather myself.  Like lots of people out there, I'm a lazy procrastinating person. I'm working on fixing this, however, it is a fact I have to admit. This resulted in a fact that I queue lots and lots of stuff in pocket, and read a lot lot less than what's there.  Saving things on pocket queue gives you a sense that it won't be lost and you can always get back to read it whenever you want. well... sometimes this "whenever" is not good with lazy people. With a clear options to ignore those people, which...

Exporting data from remote mysql instance in csv, using mysql client and sed

Mysql allows exporting query results to csv using the INTO OUTFILE , like the following example: SELECT a,b,a+b INTO OUTFILE '/tmp/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM test_table; This, however, will cause the data to be exported to the file system of the database server.  Sometimes you do not have access to that server and you are only connected remotely from a different machine using mysql command line. One way to export the data is to pass a query and redirect the output to a file as follows $ mysql -u USERNAME -p PASSWORD -h DB_SERVER mydb -e "SELECT a,b,a+b INTO OUTFILE FROM test_table;" > output.txt This will do the trick, except that the resulting file is TAB separated instead of CSV. You can simply download the file and open it using any text editor and replace all tabs with commas. but that's not practical for large data sets.  Instead, we...

Backup and Restore Git Repositories

Sometimes you need to move repositories from your local git server to github.com, bitbucket.org or vice versa. the situation where you want to archive the whole "bare" repo, not just a clone with the master or a single branch. Backup can be done simply by adding --bare to the clone command git clone --bare git @github .com:modsaid/test-repo.git This will result in a cloned repo on the filesystem that is similar in structure to a bare repository Restoring can be done by creating an empty repository on your git server (github.com or bitbucket.org). and running cd test-repo.git git push --mirror git @bitbucket .org:modsaid/test-repo.git voila

Migrating repos from SVN to git

It is straight forward to migrate your old SVN code to git. I highly advice everyone to do that even if they're not going to publish it on github or actually use it. but backing up a git repo can get to be very handy. Thanks to  Kevin Menard  for his   svn2git , the migration can be very straight forward.  I have created a usage repo,  using-svn2git , to speed things by adding it to Gemfile and using a specific rvm gemset, assuming you are using rvm. to make it as simple as: git clone bundle install start the migration... Of course having the standard SVN repo structure will save you a lot. You will probably only have to maintain the proper author.txt mapping file between svn and git users (example of the file is in the repo). I have tried to keep the  readme  short and to the point. I hope you find it useful. Regards

Writing usable scripts in Ruby

Usable command line tools/scripts There are a lot of command line tools written in ruby, python, bash, c or any other languages. They are usable simply because there is a standard way in dealing with them this way can be summarized in the following points: There has to be a usage example/brief help at the finger tips of the user ( by running with  -- help      or -h) arguments should have default values which are explained in the help misusage or missing mandatory arguments should fire the help message ruby tools OptionParser  is part of the standard library in ruby that takes care of this script packaging.  they show long and short examples This is an example of the script: require 'optparse' options = {} OptionParser.new do |opts| opts.banner = "Usage: script_name.rb [options]" opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|   options[:verbose] = v end end.parse! p options p ARGV # Actual script co...

Success of Startups

Entrepreneurship has become one of the one of the most interesting topic in the business side in any country in the world. While it is digging its way in the middle east, there is some sort of confusion and a lot of aspects related to that topic. A Startup can act and advance to tackle business opportunities in a way that competes with large enterprises. and most of the times, they need to be supported by Investors to back them up. One of the things that started to really bother me in the culture is the definition of success of a startup. No one denies that a decent revenue generating startup is a successful one. However, some people believe that just raising an investment is a success.... umm, debatable. I believe we can make some kind of analogy with some entities that showed up in the past decade like biznas and skybiz (I'm sure some of you will remember those names).   they used an invalid scheme summarized as: People can register and join the network for a fee (as an i...

Utilizing Page Caching while using query string parameters using Nginx

One of the common practices for ruby on rails developers is to wrap all parameters in the URI itself, so they can easily make use of page caching. Sometimes having a lot of parameters can start being confusing specially with the ordering of the parameters to match the defined routes. Let's elaborate with an example. Consider an API that provides a list of entries, with possible filters: http://api.example.com/feed.json This can simply be page cached, rails will place the proper feed.json file in the public directory. If we wanted to add use some supported filters like: date (in the format of 2012-03-25) order (by date, score or relevance) page (used to get the next pages of the feed) limit (or the page size.. the expected number of entries per response) type (some app related filter. let's assume the values can be: post, comment, announcement) If we used the simply form of http://api.example.com/feed.json?date=2012-03-25&page=2&limit=20&type=comment&order=score ...

Cuban Pete

Image
They call me Cuban Pete I'm the King of the Rumba beat When I play the marracas I go chick-chicky-boom chick-chicky-boom Yes, Sir, I'm Cuban Pete I'm the craze of my native street when I start to dance everything goes chick-chicky-boom chick-chicky-boom There Senoritas they sing and how they swing with this rumbero it's very nice so full of spice and when they dance and they bring a happy ring of vaqueros singing a song all the day long So if you like the beat take a lesson from Cuban Pete and I'll teach you to chick-chicky-boom chick-chicky-boom chick-chicky-boom Si, Senorita, I know that you will like the chicky boom chick 'cause it's the dance of Latin romance and Cuban Pete doesn't teach you in a hurry like Arthur Murray I come from Havanah and there's always manana * * * They call me Sally Sweet I'm the Queen of Delancy Street When I start to dance everything goes chick-chicky-boom chick-chicky-boom Excuse me Mister Pete have the Cub...