Wednesday, August 23, 2017

Get Response Time with Curl - curltime

Save this script in your path  (echo $PATH) as curltime:

#!/bin/bash

/usr/bin/curl -o /dev/null \
-s -w "    time_namelookup:  %{time_namelookup}\n       time_connect:  %{time_connect}\n    time_appconnect:  %{time_appconnect}\n   time_pretransfer:  %{time_pretransfer}\n      time_redirect:  %{time_redirect}\n time_starttransfer:  %{time_starttransfer}\n                    ----------\n         time_total:  %{time_total}\n" \
$1


Make it executable

chmod 0755 /usr/local/bin/curltime


Now you can use it to check the response time of an url. Ex:

curltime https://marca.com

Source: based on https://viewsby.wordpress.com/2013/01/07/get-response-time-with-curl/

Wednesday, June 14, 2017

Merge 2 commits when there are commits in between

Super handy trick based on based on https://stackoverflow.com/questions/30704254/merge-two-commits-where-commits-are-between

Lets say we have 2 commit we want to merge

f68ffb5 commit 6
...
d294fac commit 1


This is important: you have to give reference to a commit before the first one involved (in this case, the one that you want to squash to). Here we make the "before" reference with ^.

# rebase to the commit **before** commit 1
git rebase -i d294fac^

You invoked an interactive rebase. An editor window opens. Rearrange commits as desired (read the notes in the editor that opens)

In this list the commits go in reverse order (not as in git log): from the earliest to the latest.

Rearrange lines in the following way:

pick d294fac     //--- commit 1
squash f68ffb5   //--- commit 6
pick       //--- commit 2
pick       //--- ommit 3
pick       //--- commit 4
pick       //--- commit 5


or (leave the squashed commits in last place)
pick d294fac     //--- commit 1
squash f68ffb5  
//--- commit 6
pick      
//--- commit 2
pick      
//--- ommit 3
pick      
//--- commit 4
pick      
//--- commit 5