Showing posts with label Google Apps. Show all posts
Showing posts with label Google Apps. Show all posts

Monday, 15 December 2014

How to : Password protect a zip file on Linux




Its useful to quickly password either one or a number of files on Linux. For example to transit some files between sites on a USB drive. The encrypt option on the zip command line tool will encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt

Note : The Zip encryption is not very strong and could be cracked so use with caution

  • To encrypt a single file :

$ zip --encrypt Example.zip examplefile1
Enter password:
Verify password:

  • To encrypt a multple files :

$ zip --encrypt ExampleMulti.zip examplefile1 examplefile2 examplefile3
Enter password:
Verify password:

  • Tu uncompress the zip file :

$ unzip Example.zip
Archive: Example.zip
[Example.zip] examplefile1 password:

Sunday, 13 April 2014

Paint Format : Google Doc's most useful time saving tool

After moving to only using Google Doc's for content creation one of the few but vital things I found to be lacking was the support for applying the same format to multiple sections at a time in a document.

After some searching I found the solution was the Paint format icon :


To be honest I had never really noticed this icon before and had presumed it was related to images. In fact this turns out to be the most useful and underrated Google doc feature.

Example of  Paint Format usage

A typical use case is you have a document with lots of text in it but some of the text in various places requires to be different. For example below I would like every line with a command starting # to be 'Courier New' with Font size of 10 :



Its very time consuming (especially in very large documents) to go to each line individually and select 'Courier New' with Font size of 10 each time.

Fast Track Process - Single Change
  • Define the first line as you would like e.g. 'Courier New' with Font size of 10
  • Press the 'Paint format' icon once and it will be grey


  • Use the mouse to highlight the full line you want to be the same
  • The line will now automatically change to 'Courier New' with Font size of 10





 Fast Track Process - Multiple Changes

  • In the above example the change only occurs for one selection. 
  • In large doc's we need to be able to apply the same format for many lines
  • Press the 'Paint format' icon twice and it will be grey
  • Every line you now highlight will change  to the new format
  • Disable by a single click to the 'Paint format' icon




Edit Google Docs using Vim with googlcl



Installation
  • On Ubuntu or Linux Mint : 
$ sudo apt-get install -y googlecl

Authorization
  • The first time you access the service you need to Authorise the googlecli
  • Run the following command
$ google docs list
  • You will then be prompted for your email address and a browser will open asking for Authorization from this computer
  • Enter the provided browser Authorization code to the CLI
  • After this your Google Docs will be listed
Google Docs list with grep
  •  You can grep on the list command e.g.
 $ google docs list | grep Linux
  • Other Unix commands can be used in a similar way
Configuration File

  • Once the Authorization has occurred you can review the config file :
$ cat ~/.config/googlecl/config
  • Example configuration file :
$ cat ~/.config/googlecl/config

[DOCS]
spreadsheet_format = xls
format = txt
spreadsheet_editor = openoffice.org
presentation_format = ppt
presentation_editor = openoffice.org
document_format = txt
drawing_format = png
skip_auth = True
user = cwishaw@example.com

[CALENDAR]
fields = title,when

[GENERAL]
regex = True
url_field = site
missing_field_value = N/A
fields = title,url-site
cap_results = False
max_retries = 2
hostid = example@computername
retry_delay = 0.5
date_print_format = %b %d %H:%M

[YOUTUBE]
max_results = 50

[CONTACTS]
fields = name,email

 

Set Vim as Default Editor
  • Update [DOCS] section with line in red
[DOCS]
 

editor = vim
spreadsheet_format = xls
format = txt
spreadsheet_editor = openoffice.org
presentation_format = ppt
presentation_editor = openoffice.org
document_format = txt
drawing_format = png
skip_auth = True
user = cwishaw@example.com

  • Open a Google Doc e.g.
$ google docs edit "Hello Google Docs"
  • Edit and save it as normal


  • View in Google Doc's


Alias Setup

  • It can be useful to have some alias setup e.g.
alias gvi='google docs edit $1'
alias glist='google docs list'

  • Command examples 
$ glist | grep -i hello
$ gvi "Hello Google Docs"


Further References

Hyperlinks in Google Spredsheets



  • It can be really useful to include a hyperlink within a Google Doc spreadsheet
  • Documentation on this feature I found can be tricky to implement
  • The following shows how you can quickly insert this.

Format 

  • You can use the following format as a template to change as appropriate :

 =HYPERLINK("www.wikipedia.org", "Search Wikipedia") 

  • This will produce the link shown in the image at the toop of the post
  • I also found the following works using a semicolon in place of a colon 

  =HYPERLINK( "www.wikipedia.org" ; "Search Wikipedia")

Help Syntax Missing Quote Information

  • In a cell you can type '=HYPER' then autocomplete will show the syntax


  • This shows the format as 
HYPERLINK(URL, cell_text)
  • Which I found did _not with a 'Parse Error' was  : 
=HYPERLINK(www.wikipedia.org, Search Wikipedia)
=HYPERLINK(www.wikipedia.org, "Search Wikipedia")
=HYPERLINK("www.wikipedia.org", Search Wikipedia)
=HYPERLINK("www.wikipedia.org", Wikipedia)