Friday, December 9, 2016

[MAC] - Add open terminal here mac


From Mac OS X Lion 10.7, Terminal includes functionality as a Service. 

Like most Services, this option is disabled by default and you'll need to enable.

Go to: 

System Preferences > Keyboard > Shortcuts > Services Enable New Terminal at Folder. 




Monday, December 5, 2016

SQL Developer for Mac OSX won't start


Right click on the SQLDeveloperApp from applications folder and click show package content. 

Then navigate to /Contents/Resources/sqldeveloper/sqldeveloper/bin/ and open terminal in this folder. 

After terminal open write ./sqldeveloper to run application.


Oracle SQL Developer
Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
Found /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java to run this product, and the major version of this Java is 1.6.
The mandatory minimum major version to run this product is 1.8.
This product cannot run with this Java.



Now you can see the error message.

Thursday, August 25, 2016

Execute command ls -la from ll


Execute command ls -la from shortcut:

Step 1: 
Verify shortcut exists 
$ ll
-bash: ll: command not found

Step 2: 
Create shortcut for command ll
$ alias ll="ls -la" 

Step 3: 
Execute command ll
$ ll

total 0
drwxrwxr-x@    11    root    146140024    374    Aug 23 12:31    . 

drwxr+xr-x+    172    root    146140024    5848    Aug 23 12:31    .. 

Monday, May 2, 2016

Remove string from filename on terminal


Open terminal on your folder and write the command:

for i in ./*STRING-TO-REMOVE*;do mv -- "$i" "${i//STRING-TO-REMOVE/}";done

Replace STRING-TO-REMOVE to your string!


example:

list of files inside folder

file1-demo.pdf
file2-demo.pdf
file3-demo.pdf
file4-demo.pdf
[...]

i need to remove string "-demo" from filename

execute on terminal:

for i in ./*-demo*;do mv -- "$i" "${i//-demo/}";done

result:
file1.pdf
file2.pdf
file3.pdf
file4.pdf
[...]

Saturday, January 16, 2016

[Terminal] - Convert cdr to iso


Open terminal and go to folder where your cdr file are located.

hdituil convert YOUR-CDR-FILE.cdr -format UDTO -o OUTPUT-FILE-NAME.iso

Wednesday, January 13, 2016

[Terminal] - How to get last n lines from file


I want create a file with last 10 lines from big-data-file.txt

big-data-file.txt (contains 100 lines)
1
2
3
4
5
...
96
97
98
99
100

to do that, open command line and execute:

tail -n 10 big-data-file.txt > small-file.txt

Where 10 is the number of lines you want

the results is:

small-file.txt (contains 10 lines)
91
92
93
94
95
96
97
98
99
100


Tuesday, January 12, 2016

[OSX] - Open windows link

Download and install free app WinShortcutter for:
            OSX 10.8
            OSX 10.7
            OSX 10.6
            OSX 10.5

After install application, open system preference choose Keyboard icon and select tab "Shortcuts". In left side select "Services" option and the right side choose "Open as Windows Link".


Now you have the option to open link everywhere with right click up link



The orifinal link \\srv-name\main-folder\project-folder\file.png was converted to smb://srv-name/main-folder/project-folder/file.png

Friday, January 8, 2016

[Sublime] - Add comma to end line

Using combination keys CMD + SHIFT + f to open find options


Select first square option (regular expression) and fill "Find" with $ and Replace fill with , (comma)


Final result:


Thursday, January 7, 2016

[SIGIL] - Replace link with regex

Add anchor value after link URL

Working with Sigil [ePUB editor] and need to add anchor and value after link URL. The value is the same is this same inside title attribute for element "a".
Have this:
<dt id="note_758" class="calibre23">[<a title="758" href="../META-INF/page.xhtml" class="calibre24">←758</a>]</dt>

And need that:
<dt id="note_758" class="calibre23">[<a title="758" href="../META-INF/page.xhtml#758" class="calibre24">←758</a>]</dt>

Using regex to find and replace
find: title=\"(\d+)\" href=\"..\/META-INF\/titlepage.xhtml\"

replace with: title="\1" href="../META-INF/titlepage.xhtml#\1"

Monday, January 4, 2016

[Terminal] - How to solve "sudo: cannot get working directory" error

If you get the following error 
List all files, first level folders, and their contents 
sudo: cannot get working directory 
moving to a different directory! 
cd ~/ 
This error means that the directory you are supposedly in is no longer exists.