push local database to heroku
In case you already have data, you have to do the reset. Make sure you know what you’re doing, because the reset is a destructive operation.
fixing chrome's open link blank page behaviour
Whenever clicking a link that should open chrome, like for example a link in the terminal, I always got a new chrome window with a blank page. Turns out it was because the file in $HOME/.local/share/applications/google-chrome.desktop had this as Exec:
instead of:
Found the answer here
gnu parallel processing example
Here’s a simple script that does work :)
When running this, I get the following output on my machine:
If we would like to run the script for more than one argument, it would take us some time. Luckily, we can use parallel to speed things up:
As we can see from the timestamps, both scripts started at the same time, and were executed in parallel. The -j+0 flag tells parallel to use as many cores as possible to complete the jobs.
Alternatively, this has a simpler syntax:
or, with a shell glob:
More examples here
GNU citation:
1
O. Tange (2011): GNU Parallel - The Command-Line Power Tool, The USENIX Magazine, February 2011:42-47.
refresh_token not sent in google oauth2 response
I kept receiving tokens such as:
when making calls to google api, even though I was doing the call like this:
As it turns out, you only get the refresh_token on the first authorization, so you should save it then. To address this, go to google apps, and revoke the app’s access to your API ( calendar in my case ), and go through the authorization flow again.
This time you’ll receive a refresh_token as well.
enumerable#find raise exception
The following will raise an exception, and you won’t have to deal with nil:
ruby hash self merge
Useful trick, if you have a hash like this:
and you would like to get to a hash containing the same keys, but the count of the values:
hash#merge takes the following params: