Saturday, February 14, 2015

PDF editors and converters free

Split the PDF pages
http://www.splitpdf.com/
Pic to PDF
http://www.convert-jpg-to-pdf.net/
http://www.online-convert.com

PDF editor
http://www.pdfescape.com/

Port forwarding or Virtual box to Local machine/Mac

Connecting VIRTUAL box on mac

The best way to login to a guest Linux VirtualBox VM is port forwarding. By default, you should have one interface already which is using NAT. Then go to the Network settings and click the Port Forwarding button. Add a new Rule:

Host port 3022, guest port 22, name ssh, other left blank.

or from command line

VBoxManage modifyvm myserver --natpf1 "ssh,tcp,,3022,,22"

where 'myserver' is the name of the created VM. Check the added rules:

VBoxManage showvminfo myserver | grep 'Rule'

Please be sure you don't forget to install an SSH server:

sudo apt-get install openssh-server
To SSH into the guest VM, write:

ssh -p 3022 user@127.0.0.1
Where user is your username within the VM.

Remove or Skip invalid locale warning in Ubuntu

WARNING! Your environment specifies an invalid locale.
 This can affect your user experience significantly, including the
 ability to manage packages. You may install the locales by running:

   sudo apt-get install language-pack-UTF-8
     or
   sudo locale-gen UTF-8

To see all available language packs, run:
   apt-cache search "^language-pack-[a-z][a-z]$"
To disable this message for all users, run:
   sudo touch /var/lib/cloud/instance/locale-check.skip

How to cut, grep, remove, print characters or files in linux

awk

Print characters less than 3
................
$ ls 
Applications    Network        Users        bin        dev        home        net        private        tmp        var
Library        System        Volumes        cores        etc        mach_kernel    opt        sbin        usr

$ ls | awk 'length($0) < 4'
bin
dev
etc
net
opt
tmp
usr
var
................

Print or cut only selected column

$ ls -l
total 16
-rw-r--r--+ 1 sasi  staff  39 Feb 18  2014 index.html.en
-rw-r--r--+ 1 sasi  staff  40 Feb 18  2014 ip.php

$ ls -l | awk '{print $2}'
16
1
1

$ ls -l | awk '{print $2, $4}'
16
1 staff
1 staff

Xargs:

Find and remove / copy / move 

$ find /path -iname 'search string' | xargs 'action'

i- ignore case

Example:
$ find /root -iname 'asterisk' | xargs rm -rf 

This will find and remove all the files and dir matching with asterisk




 

Download your applications / app from your appengine

 Make sure you have google's python dependencies and try

Mac:
$appcfg.py -A yourappid -V yourversionnumber download_app.py /path-to-save

Windows:
appcfg -A yourappid -V yourversionnumber download_app 
c:\path\to\download\directory

Javascript, remove extra characters in a string

Trim test Get only numbers:
Get only LowerCase:
Get only Alpha chars:
Code:
function onlyNumbers(x){
 x.value = x.value.replace(/[^0-9]/g,'');
}

function onlyLowercase (x){

x.value = x.value.replace(/[^a-z]/g,'');
}

function onlyAlhpa (x){
x.value = x.value.replace(/[^aA-zZ]/g,'');
}

Get file permission chmod in Octal modes

In Mac
Syntax: stat -f "%A%N"

try
$ls -la

Output:
total 8
drwxr-xr-x+  6 sasi  staff   204 Feb 14 00:17 .
drwxr-xr-x+ 36 sasi  staff  1224 Feb 14 00:17 ..
drwxr-xr-x+  3 sasi  staff   102 Feb 14 00:17 css
drwxr-xr-x+  5 sasi  staff   170 Feb 14 00:17 img
-rw-r--r--+  1 sasi  staff  2303 Feb 14 00:17 index.html
drwxr-xr-x+  4 sasi  staff   136 Feb 14 00:17 js

then try:
$stat -f "%A %N" *   

Output:
755 css
755 img
644 index.html
755 js


Ubuntu, Cent os
$  stat -c %a

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...