2015-11-01 14:02:14 -06:00
# MarkIt
2015-11-10 01:15:35 -06:00
![Screenshot ](markit.png )
2015-11-10 06:54:15 -06:00
`markit` is a cmdline bookmark management utility written using Python3 and SQLite3. `markit` exists because of my monumental dependency on < a href = "http://historio.us/" > historious</ a > . I wanted the same database on my local system. However, I couldn't find an equally flexible cmdline solution. Hence, `MarkIt` !
2015-11-08 16:23:36 -06:00
2015-11-09 23:04:34 -06:00
The SQLite3 database file is stored in `$HOME/.cache/markit/bookmarks.db` for each user.
2015-11-08 16:23:36 -06:00
2015-11-08 16:04:49 -06:00
`markit` is GPLv3 licensed.
If you find `markit` useful, please consider donating via PayPal.
< a href = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMLTQ76JSXJ4Q" > < img src = "https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" alt = "Donate Button with Credit Cards" / > < / a >
# Features
- Add, update or remove a bookmark
- Add tags to bookmarks
2015-11-10 05:20:30 -06:00
- Optionally fetch page title data from the web (default: disabled)
2015-11-08 16:04:49 -06:00
- Use (partial) tags or keywords to search bookmarks
2015-11-11 06:29:38 -06:00
- Any or all search keyword match options
2015-11-09 09:38:44 -06:00
- Unique URLs to avoid duplicates, show index if URL already exists
2015-11-10 05:20:30 -06:00
- Open bookmark in browser using index
2015-11-08 16:04:49 -06:00
- Open search results in browser
- Browser (Chromium and Firefox based) errors and warnings suppression
2015-11-09 23:23:35 -06:00
- Show single bookmark by ID or all bookmarks in a go
2015-11-08 16:04:49 -06:00
- Delete all bookmarks
2015-11-10 05:20:30 -06:00
- Add a bookmark at N< sup > th</ sup > index, to fill deleted bookmark indices
2015-11-10 06:49:09 -06:00
- Secure parameterized SQLite3 queries to access database
2015-11-08 16:04:49 -06:00
- Handle first level of redirections (reports IP blocking)
- Unicode in URL works
2015-11-09 09:38:44 -06:00
- UTF-8 request and response, page character set detection
2015-11-08 16:04:49 -06:00
- Works with Python 3.x
- Coloured output for clarity
2015-11-11 08:33:45 -06:00
- Easily create batch add or update (refresh) scripts
2015-11-11 06:29:38 -06:00
- Unformatted selective output (for creating batch update scripts)
2015-11-08 16:04:49 -06:00
- Manpage for quick reference
- Optional debug information
- Fast and clean (no ads or clutter)
- Minimal dependencies
- Open source and free
# Installation
`markit` requires Python 3.x to work.
1. If you have git installed (the steps are tested on Ubuntu 14.04.3 x64_64):
< pre > $ git clone https://github.com/jarun/markit/
$ cd markit
$ sudo make install< / pre >
To remove, run:
< pre > $ sudo make uninstall< / pre >
2. If you do not have git installed:
2015-11-10 00:55:54 -06:00
Download the < a href = "https://github.com/jarun/markit/releases/latest" > latest stable release< / a > or < a href = "https://github.com/jarun/markit/archive/master.zip" > development version< / a > source code. Extract, cd into the directory and run:
2015-11-08 16:04:49 -06:00
< pre > $ sudo make install< / pre >
If you do not want to install, `markit` is standalone:
< pre > $ chmod +x markit
$ ./markit ...< / pre >
2015-11-08 16:29:17 -06:00
# Usage
2015-11-10 01:15:35 -06:00
< b > Operational notes:< / b >
- It's advisable to copy URLs directly from the browser address bar, i.e., along with the leading `http://` or `https://` token. `markit` looks up title data (found within < title ></ title > tags of HTML) from the web ONLY for fully-formed HTTP(S) URLs.
- If the URL contains characters like `;` , `&` or brackets they may be interpreted specially by the shell. To avoid it, add the URL within single `'` or double `"` qoutes.
- The same URL cannot be added twice. You can update tags and re-fetch title data. You can also delete it and insert at the same index.
- You can either add or update or delete record(s) in one instance. A combination of these operations is not supported in a single run.
- Search works in mysterious ways:
2015-11-11 06:29:38 -06:00
- Substrings match (`match` matches `rematched` ) for URL, tags and title.
- All the keywords are treated together as a `single` tag in the `same order` . Bookmarks with partial or complete tag matches are shown in results.
- `-s` : match any of the keywords in URL or title. Order is irrelevant.
- `-S` : match all the keywords in URL or title. Order is irrelevant.
- Search results are indexed serially. This index is different from actual database index of a bookmark reord which is shown within `()` after the URL.
2015-11-10 01:15:35 -06:00
< b > Cmdline help:< / b >
2015-11-08 16:29:17 -06:00
< pre > Usage: markit [OPTIONS] KEYWORDS...
Bookmark manager. Your private Google.
Options
2015-11-08 17:51:25 -06:00
-a URL tag 1, tag 2, ... add URL as bookmark with comma separated tags
2015-11-10 05:20:30 -06:00
-d N delete entry at DB index N (from -P output)
2015-11-08 16:29:17 -06:00
-D delete ALL bookmarks
2015-11-10 05:20:30 -06:00
-i N insert entry at DB index N, useful to fill deleted index
-o N open URL at DB index N in browser
-p N show details of bookmark record at DB index N
-P show all bookmarks along with index from DB
2015-11-11 05:41:53 -06:00
-s keyword(s) search all bookmarks for a (partial) tag or any keyword
-S keyword(s) search all bookmarks for a (partial) tag or all keywords
2015-11-10 05:20:30 -06:00
-u N update entry at DB index N
2015-11-10 03:11:05 -06:00
-w fetch title info from web, works with -a, -i, -u
2015-11-11 01:28:37 -06:00
-x N works with -P, N=1: show only URL, N=2: show URL and tag
2015-11-08 16:29:17 -06:00
-z show debug information
you can either add or update or delete in one instance
any other option shows help and exits markit
Keys
1-N open Nth search result in browser. Enter exits markit.< / pre >
2015-11-01 14:02:14 -06:00
2015-11-08 16:32:12 -06:00
# Examples
2015-11-11 02:46:31 -06:00
1. < b > Add</ b > a new bookmark with tags `linux news` and `open source` :
2015-11-10 00:34:37 -06:00
< pre > $ markit -a http://tuxdiary.com linux news, open source
Added at index 15012014< / pre >
The assigned automatic index 15012014 is unique, one greater than highest index already in use in database.
2015-11-11 02:46:31 -06:00
2. Add a bookmark, < b > fetch page title</ b > information from web:
2015-11-10 02:31:35 -06:00
< pre > $ markit -a -w http://tuxdiary.com linux news, open source
2015-11-10 00:34:37 -06:00
Title: [TuxDiary | Linux, open source and a pinch of leisure.]
Added at index 15012014< / pre >
2015-11-11 02:46:31 -06:00
3. < b > Update</ b > existing bookmark at index 15012014 with a new tag:
2015-11-10 02:31:35 -06:00
< pre > $ markit -u 15012014 -w http://tuxdiary.com linux news, open source, magazine
2015-11-10 00:34:37 -06:00
Title: [TuxDiary | Linux, open source and a pinch of leisure.]
Updated< / pre >
2015-11-11 02:46:31 -06:00
4. < b > Delete</ b > bookmark at index 15012014:
2015-11-10 00:34:37 -06:00
< pre > $ markit -d 15012014< / pre >
2015-11-11 02:46:31 -06:00
5. < b > Delete all</ b > bookmarks:
2015-11-10 00:34:37 -06:00
< pre > $ markit -D< / pre >
2015-11-11 02:46:31 -06:00
6. < b > Insert</ b > a bookmark at index 15012014 (fails if index or URL exists in database):
2015-11-10 03:11:05 -06:00
< pre > $ markit -i 15012014 -w http://tuxdiary.com/about linux news, open source
2015-11-10 00:34:37 -06:00
Title: [A journey with WordPress | TuxDiary]
Added at index 15012014< / pre >
This option is useful in filling deleted indices from database manually.
2015-11-11 02:46:31 -06:00
7. < b > Show info</ b > on bookmark at index 15012014:
2015-11-10 00:34:37 -06:00
< pre > $ markit -p 15012014< / pre >
2015-11-11 02:46:31 -06:00
8. < b > Show all</ b > bookmarks with real index from database:
2015-11-10 00:34:37 -06:00
< pre > $ markit -P< / pre >
2015-11-11 02:46:31 -06:00
9. < b > Open URL</ b > at index 15012014 in browser:
2015-11-10 05:20:30 -06:00
< pre > $ markit -o 15012014< / pre >
2015-11-11 06:29:38 -06:00
10. < b > Search</ b > bookmarks for a tag matching `*kernel debugging*` or any of the keywords `*kernel*` and `*debugging*` in URL or title (separately):
2015-11-10 00:34:37 -06:00
< pre > $ markit -s kernel debugging< / pre >
2015-11-11 06:29:38 -06:00
10. < b > Search</ b > bookmarks for a tag matching `*kernel debugging*` or all the keywords `*kernel*` and `*debugging*` in URL or title (separately):
< pre > $ markit -S kernel debugging< / pre >
12. Show < b > debug info</ b > :
2015-11-10 00:34:37 -06:00
< pre > $ markit -z< / pre >
2015-11-11 06:29:38 -06:00
13. Show < b > help</ b > :
2015-11-10 00:34:37 -06:00
< pre > $ markit< / pre >
2015-11-11 06:29:38 -06:00
14. Check < b > manpage</ b > :
2015-11-10 00:34:37 -06:00
< pre > $ man markit< / pre >
2015-11-11 06:29:38 -06:00
15. MarkIt doesn't have any < b > import feature</ b > of its own. To import URLs in bulk, create a script with URLs and tags like the following (check TIP below):
2015-11-11 01:48:23 -06:00
< pre > #!/bin/bash
markit -aw https://wireless.wiki.kernel.org/ networking, device drivers
markit -aw https://courses.engr.illinois.edu/ece390/books/artofasm/ArtofAsm.html assembly
markit -aw http://www.tittbit.in/
markit -aw http://www.mikroe.com/chapters/view/65/ electronics
markit -aw "http://msdn.microsoft.com/en-us/library/bb470206(v=vs.85).aspx" file systems
markit -aw http://www.ibm.com/developerworks/linux/library/l-linuxboot/index.html boot process< / pre >
2015-11-11 01:54:30 -06:00
Make the script executbale and run to batch add bookmarks.
2015-11-11 08:33:45 -06:00
16. To < b > update all URLs</ b > (refresh) along with your tags, first get the unformatted selective output with URL and tags:
2015-11-11 01:48:23 -06:00
< pre > $ markit -P -x 2 | tee myurls< / pre >
2015-11-11 01:54:30 -06:00
Add `markit -wu ` in front of all the lines (check TIP below). Should look like:
2015-11-11 01:48:23 -06:00
< pre > #!/bin/bash
markit -wu 50 https://wireless.wiki.kernel.org/ networking, device drivers
markit -wu 51 https://courses.engr.illinois.edu/ece390/books/artofasm/ArtofAsm.html assembly
markit -wu 52 http://www.tittbit.in/
markit -wu 53 http://www.mikroe.com/chapters/view/65/ electronics
markit -wu 54 "http://msdn.microsoft.com/en-us/library/bb470206(v=vs.85).aspx" file systems
markit -wu 55 http://www.ibm.com/developerworks/linux/library/l-linuxboot/index.html boot process< / pre >
Run the script:
< pre > $ chmod +x myurls
$ ./myurls< / pre >
2015-11-11 01:54:30 -06:00
2015-11-11 02:31:04 -06:00
< b > TIP:< / b >
To add the same text at the beginning of multiple lines using vim editor:
- Press `Ctrl-v` to select the first column of text in the lines you want to change (visual mode).
- Press `Shift-i` and type the text you want to insert.
- Hit `Esc` , wait 1 second and the inserted text will appear on every line.
Using sed:
< pre > $ sed -i 's/^/markit -wu /' filename< / pre >
2015-11-08 16:04:49 -06:00
#License
GPL v3
Copyright (C) 2015 by Arun Prakash Jana < engineerarun@gmail.com>
2015-11-01 14:02:14 -06:00
2015-11-10 00:34:37 -06:00
# Contributions
I would love to see pull requests with the following features:
- Exact word match (against substring in a word as it works currently. Hint: REGEXP)
- Parse full page data??? Might end up writing a search engine like Google. ;)
- Optional password protection
2015-11-01 14:02:14 -06:00
# Developer(s)
2015-11-10 00:34:37 -06:00
Arun Prakash Jana < engineerarun@gmail.com>