Using jq to manipulate JSON in command line

Sometimes during the testing of REST API with curl in the command line, we need to process JSON from the response to present it in readable format or check a specific key or value. I used jq utility for that purpose and didn’t pay too much attention to how powerful it can be: Recently, I found this article showed many cool examples of using jq. […]

Read Me Leave comment

How to highlight SVN diff

By default Subversion shows diff without highlighting which makes a bit difficult review of big changes. But that situation can be changed extremely simple and fast. I assume you use Fedora 17. For the other distributions you need just use different package manager, choose correct package name and find configs in the proper places. First of all, install utility colordiff: sudo yum install colordiff Now […]

Read Me Leave comment

How to get size of Mysql tables

In the previous post I wrote about a way to get a Mysql database size from Mysql shell. Now I’d like to share a way to get size of each Mysql table: SELECT table_name,`engine` ,ROUND(data_length/1024/1024/1024,2) total_size_gb, ROUND(index_length/1024/1024/1024,2) total_index_size_gb, table_rows FROM information_schema.TABLES WHERE table_schema = ‘rt3′; It’s useful if you need to know what you should clean in your huge database. [via Techie-Gyan]

Read Me Leave comment

How to rebuild Ubuntu package from the sources

There are two ways (at least) to rebuild Ubuntu package from the source. Using Ubuntu diff file and dpkg-buildpackage Download source from Ubuntu repository. Download Ubuntu diff file and apply it: patch -p1 < ubuntu.diff Build package: dpkg-buildpackage -rfakeroot Using .dsc file and debuild Download .dsc file Run following command: dpkg-source -x file.dsc Note, sometimes the archive with sources should be presented in the same […]

Read Me Leave comment

Fixing GRUB bootloader on dual-boot PC

I have two versions of LinuxMCE on my HTPC – stable 0710 and developer 0810. The 0810 was installed after 0710. So, the GRUB bootloader was placed on 0810 partition. A few days ago I decided re-install 0810 from the scratch and I deleted its partition including GRUB booloader. As result I couldn’t boot 0710 anymore. Thanks to GRUB power and flexibility I was able […]

Read Me Leave comment

Log for Mysql console session

To log Mysql console session use option –tee (two dashes!) with full path to the log file: mysql -uroot my_db –tee=/tmp/mysql_console.log As result the file /tmp/mysql_console.log will contains all commands and queries with result of their executions. That might be helpful to keep your queries for using next time or for troubleshooting. The author of the post, where I found that useful info, said that […]

Read Me Leave comment

VIM and Mysql integration

I use VIM with additional configuration instead of IDE. That configuration includes code explorer using ctag, syntax checking for PHP and Perl and run Perl scripts (syntax highlighting is not a subject of discussion ;)). Also I should run Mysql queries often. So, I decided to add integration with Mysql to VIM. I managed to do that thanks to that simple solution. Just add this […]

Read Me Leave comment

Add history and auto-complete to the SQL*Plus

I was very surprised how pure the Oracle’s command line utility SQL*Plus. Comparing with mysql it lack history, completion and doesn’t allow even edit query. To fix that the utility rlwrap can be used. I installed it via yum under Fedora 11 and run like that: rlwrap sqlplus db_user@db To have auto-complete feature you should find file SQL.dict somewhere (drop the comment, please, if you […]

Read Me Leave comment