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.