martedì, dicembre 27, 2016

Ping host and log output with timestamp

If you have some random network issue (specially on virtual machine) and you have to collect the time when it occur this command line can be helpful for you.

ping host | perl -nle 'BEGIN {$|++} print scalar(localtime), " ", $_' > outputfile

Source: http://stackoverflow.com/questions/10679807/how-to-timestamp-every-ping-result

venerdì, ottobre 28, 2016

httpie - http for everyone!

The life for a web app developer it's so difficult without a real tool for test HTTP request/response, in particular with xhr ajax near-realtime apps.

HTTPie - aitch-tee-tee-pie - (httpie.org) is an open source CLI HTTP client that will make you smile: a user-friendly curl alternative that provides a simple http command designed for painless debugging and interaction with HTTP servers, RESTful APIs, and web services.

For example, it's very simple to make a simple GET request with only one parameter:

# http httpbin.org/ip

It's available on multiplatform (Linux, Windows, MacOS X) and it's well documented.

So, what else ? Go to documentation, read all and make your http request easy!

giovedì, febbraio 04, 2016

Windows Shortcuts

General

  • Win+Up Maximize
  • Win+Down Restore / Minimize
  • Win+Left Snap to left
  • Win+Right Snap to right
  • Win+Shift+Left Jump to left monitor
  • Win+Shift+Right Jump to right monitor
  • Win+Home Minimize / Restore all other windows
  • Win+T Focus the first taskbar entry (Pressing again will cycle through them, you can can arrow around.)
  • Win+Shift+T cycles backwards.
  • Win+Space Peek at the desktop
  • Win+P External display options (mirror, extend desktop, etc)
  • Win+# (# = a number key) Launches a new instance of the application in the Nth slot on the taskbar. Example: Win+1 launches first pinned app, Win+2 launches second, etc.
  • Win + + and Win + – (plus or minus key) Zoom in or out.

Explorer

  • Alt+P Show/hide Preview Pane


Taskbar modifiers

  • Shift + Click on icon Open a new instance
  • Middle click on icon Open a new instance
  • Ctrl + Shift + Click on icon Open a new instance with Admin privileges
  • Shift + Right-click on icon Show window menu (Restore / Minimize / Move / etc) Note: Normally you can just right-click on the window thumbnail to get this menu
  • Shift + Right-click on grouped icon Menu with Restore All / Minimize All / Close All, etc.
  • Ctrl + Click on grouped icon Cycle between the windows (or tabs) in the group



sabato, gennaio 23, 2016

How to get the sizes of the tables of a mysql database

If you have a very big database with a lot of tables and you want to know which tables use more spaces, run the following query replacing %DB_NAME% with your database and %TABLE_NAME% if you know the table name.

SELECT 
    table_name AS `Table`, 
    round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`,
    round((data_length / 1024 /1024), 2 ) `Data Length in MB` , 
    round((index_length / 1024 /1024), 2) `Index Length in MB` , 
    round(data_free / 1024 /1024, 2) `Free space in MB` 
FROM information_schema.TABLES 
where round(data_free/1024/1024) > 500 
    AND table_schema = "$DB_NAME"
    AND table_name = "$TABLE_NAME";


Ref: http://stackoverflow.com/questions/9620198/how-to-get-the-sizes-of-the-tables-of-a-mysql-database