• Stars
    star
    188
  • Rank 201,377 (Top 5 %)
  • Language
    Shell
  • License
    MIT License
  • Created almost 13 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple, text-based system for building an easily-searchable knowlegebase on OS X. CLI, LaunchBar and Alfred included.

Quick Question

Pretty version

The qq script and related extensions are designed to keep an archive of files with questions as the filename and answers as the content. It works well with Notational Velocity and nvALT, but can function as an archive of knowledge with nothing but a Mac and a command line. Scripts are included for Quicksilver, LaunchBar and Alfred, as well as a command line tool.

The story behind the script is: I forget everything. I forget what I was working on last night. I forget where I left important things. I forget how I solved a major problem and have to work it out again next time it comes up. I forget where I saved the perfect settings I found for h.264 compression. You get the picture. So I've started building an archive of plain text files with questions and answers, and a system which makes it easy to add new knowledge at any time. The question format makes it easy to query, even when I don't remember the answer at all.

The system is very simple. A bunch of plain text files, each titled with one question and containing one answer. Searching and sorting is handled my the mdfind Spotlight interface with scripts and extensions that focus the search to a narrow scope with predefined options. The knowledgebase that's built is bulletproof and portable, scriptable and easily searchable. Plus, it works the same way as Notational Velocity, so they make a great pair.

I use it with nvALT and sync to Simplenote and Dropbox, which means I can enter new questions and their answers from any mobile device or remote computer, in addition to being able to use the command line tool, Quicksilver actions, LaunchBar actions and Alfred extensions. It keeps me sane.

Installation

Command line : Put the qq script into a folder in your path and make it executable with chmod a+x /path/to/qq. Edit the script to set the location of your notes folder and the extension you use. You may want to set a different preferred "question" prefix if you already have one (or don't want filenames that need constant escaping).

Quicksilver : Move the two .scpt files into ~/Library/Application Support/Quicksilver/Actions/. These scripts require that the above command line script is in place and need to be edited with the proper full path to the script.

LaunchBar : Move the two .scpt files into ~/Library/Application Support/LaunchBar/Actions/. These scripts require that the above command line script is in place and need to be edited with the proper full path to the script.

Alfred : The Alfred extensions are standalone and do note require the qq script to be installed. Simply import the extensions into Alfred and the qq and qa commands will be available. Once imported, there are several configuration variables that need to be set in the top of the script.

Notational Velocity/nvALT : By nature, you don't need anything special to use this system with NV. You just need to save your notes to plain text files if you want them to be accessible to mdfind and other system tools. : To get simple command line access to the question in your NV folder, set up the configuration in the qq script above to point to your NV notes folder. This will allow you to run speedy queries confined to just that directory, and enter notes quickly from other sources. Notes entered from the command line or LaunchBar/Alfred will show up instantly in your NV notes list.

CONFIGURATION

Configuration is done via environment variables:

  QQ_NOTES_DIR - Path to Markdown files
  QQ_NOTES_EXT - Extension of answer files (default md)
  QQ_NOTES_PRE - Prefix of question files (default ??)
  QQ_EDITOR    - Text editor to use (default $EDITOR)
  QQ_USE_FZF   - If fzf is available, it will be used by default. Set this 
                 to false to override

Example:

 export QQ_NOTES_DIR="/Users/ttscoff/Dropbox/Notes"
 export QQ_NOTES_EXT="md"

Usage

Command line : Add questions and answers using qq -a "Question" "Answer", e.g. qq "What is the answer to life, the universe and everything?" "42". If -a is specified without any additional arguments, qq will enter interactive mode and ask you for the question and the answer individually, accepting input from STDIN. : Ask a question using qq fragmented question, e.g. qq meaning universe. See the Querying section for more information on composing fragmented queries.

Quicksilver : Add a question and answer by launching Quicksilver and entering a string in the format "question: answer", e.g. "what is the meaning of life, the universe and everything: 42" (activate text entry with the "'" key). Press tab, select the "Quick Answer" action and hit Enter. : Ask a question by typing launching Quicksilver and entering a fragmented query (activate text entry with the "'" key). Press tab, select the "Quick Question" action and hit Enter.

LaunchBar : Add a question and answer by launching LaunchBar and typing "qa". Select the "Quick Answer" action and hit Space. Then type a string in the format "question: answer", e.g. "what is the meaning of life, the universe and everything: 42". : Ask a question by typing "qq" and selecting the "Quick Question" action. Hit space and type a fragmented query.

Alfred : To add a question and answer to your archive, open Alfred and type "qa". Enter the question and answer in the format "question: answer", e.g. "qa is there anybody out there?: nope". : To query your archive, type "qq" and enter a fragmented query.

Notational Velocity/nvALT : Notes will be prefixed with the string specified in the configuration (default "??"). You can start a search with the prefix and follow it with a fragmented query to find the question (and answer) you're looking for. Add new questions and answers by typing the prefix and the question in the search field, press enter to create a new note, and type the answer and any additional meta.

Composing questions

Ask yourself what question the search for this answer began with. Will that be the question you ask again when you've forgotten the answer a year (or month) later? Think about how you, personally, would phrase the question and shape it around keywords that you're pretty sure you would repeat.

Keep your questions in a natural language format, but avoid contractions and use "who, when, where, what, how and why" as much as possible. These words make it easy to sort out different types of questions about the same subject.

Querying

When querying, only use operative terms to get the best results. "Where did I leave my glasses" will return poor results if the question you labeled it with was "Where did I put my glasses". Instead, query "where glasses" and you'll find the note instantly.

Running qq -l at the command line with no arguments will list all of the questions and their answers in your archive. This can be handy for using with grep to parse out pieces of questions and/or answers that you couldn't find otherwise.

Additional meta

You can add additional meta within the contents of the file to help in locating the answer later by using the format @(meta information). Anything within the parenthesis will be included in search, but the whole tag will be excluded from results in the qq script and the LaunchBar/Alfred actions.

An example of this would be a question like "What brand of cleaner did I use during the move?" The answer you gave was a cleaning solution you were really impressed with. A year later the only thing you may remember to ask is "cleaner," but you might not even remember that was the term you used. So you add "@(solution cleaning favorite)" to the answer. Now you can search for "favorite cleaning" or "cleaning solution" and still get the question you were looking for. It's similar to using tags, but you can be more verbose without cluttering up your pool of existing tags. In the example case, you can also use just the root or part of a word, e.g. qq fav clean to expand matching possibilities.

Copy to clipboard

If your answer includes a command, url or other piece that you probably want to grab, you can surround it with @copy(part to copy) and the contents of the tag will be copied to the clipboard when the question is answered. The '@copy(' and ')' parts will be stripped from the answer given, but its contents will remain inline.

Auto-open related urls

If you add one or more @open() tags, the contents will be passed to the open command with the -g flag (open in background). You can use this to add related urls to the query. It's not a perfect system because if you ask a broad question and get 20 answers, each with one or more urls, they'll all open. But it's handy once in a while.

Redacting answers

If you're using Quicksilver, LaunchBar or Alfred it's assumed that you can locate the question file and open it in an editor of choice easily enough. It's even simpler if your questions are stored in Notational Velocity/nvALT as you can edit them at the same time you search for them.

From the command line you can use the -e argument to open the first result for the following query in the editor you specified in the configuration (mate by default). It expects a command-line tool, not an OS X application name. Most editors have these available.

More Repositories

1

doing

Ruby
1,036
star
2

mdless

Ruby
787
star
3

Slogger

Social logging script for Day One
Ruby
762
star
4

KeyBindings

DefaultKeybindings.dict for Mac OS X
HTML
689
star
5

cheaters

Customizable cheat sheet system for OS X
HTML
461
star
6

popclipextensions

Brett's PopClip Extensions
Python
431
star
7

MarkedCustomStyles

Custom Style Repository for Marked2.app
CSS
416
star
8

Brett-s-TextExpander-Snippets

General-use snippets for TextExpander on Mac
PHP
129
star
9

fish_files

Shell
125
star
10

OTask

Ruby CLI for OmniFocus
Ruby
122
star
11

na

Bash function for displaying next actions in plain-text files per project directory
Shell
113
star
12

nvremind

A scheduled background task to scan nvALT notes for @reminder() tags and trigger notifications based on dates.
Ruby
98
star
13

bunch

Documentation repository for Bunch.app
Ruby
88
star
14

vitag

Ruby
86
star
15

hookapp

HTML
81
star
16

Pinboard-to-OpenMeta

Saves Pinboard bookmarks as local webloc files on a Mac. Can add thumbnails and save PDF's, with external apps. Works with Tags.app or the OpenMeta cli utility.
Ruby
79
star
17

gather-cli

Swift
73
star
18

JekyllPlugins

A small collection of (often lame) Jekyll plugins
SCSS
65
star
19

ubersicht-widgets

CoffeeScript
62
star
20

niftymenu

JavaScript
59
star
21

hook_goodies

AppleScript
59
star
22

snibbets

Ruby
46
star
23

where

Shell
38
star
24

BetterTouchTool-Widgets

Ruby
38
star
25

searchlink

Ruby
34
star
26

howzit_old

Ruby
32
star
27

ExtraInfoPlus

AppleScript
32
star
28

blogsmith-tmbundle

TextMate bundle for blogging platforms with poor/no xmlrpc support
Ruby
31
star
29

bookmark-cli

CLI for OS X that returns a base64 string of bookmark data for a file, or locates a file given a base64 string
Objective-C
31
star
30

popupsCSS

iOS-esque popup styles
28
star
31

jquery-tldr

JavaScript
26
star
32

dotfiles

Various config files
Shell
24
star
33

tagbak

Ruby
24
star
34

nvWikiLink

Universal system for creating plain text wiki links to nvALT notes
Ruby
22
star
35

sidecar

Sidecar jacket for Simplify
HTML
19
star
36

jtag

Ruby
19
star
37

coughbutton

An iPhone-based cough button for your Mac using PHP and MuteMyMic
JavaScript
18
star
38

delimport-pinboard

Index your Pinboard bookmarks using Spotlight on Mac OS X.
Objective-C
18
star
39

CodeReminder

Ruby
17
star
40

MarkdownURLs.safariextension

The source for the TabLinks Safari Extension
JavaScript
16
star
41

na_gem

a command line tool for adding and listing project todos
Ruby
16
star
42

mmd2cheatset

Ruby
16
star
43

howzit

Ruby
14
star
44

notehub

Ruby
14
star
45

reiki

Shell
13
star
46

Character-pair-autocompletion

Character pair autocomplete is now possible on any Mac app using these TextExpander custom snippets including on selected text.
13
star
47

ttscoff.github.com

Brett Terpstra's GitHub website
CSS
12
star
48

bunchcli

Ruby
12
star
49

Twilight2.tmTheme

A mod of the classic Twilight theme for TextMate and Sublime Text
11
star
50

starter-book

An online book.
11
star
51

Sublime-Bunch

Bunch is a Mac automation app that runs on plain text files with the extension `.bunch`. It has its own "language", and this package provides syntax highlighting for Bunch files, as well as light/dark color schemes, snippets for common commands, and completion for app names.
Python
10
star
52

podtagger

Automated ID3 tagging for podcasts
Ruby
9
star
53

VSCode-Bunch

9
star
54

TextBuddyScripts

JavaScript
9
star
55

TabLinks

HTML
8
star
56

loadbar

CoffeeScript
8
star
57

LuckyCharms-tmTheme

A light theme for Sublime Text, VS Code, and Vim
Vim Script
8
star
58

fuzzy_cd

Shell
6
star
59

MailMateMate.mmBundle

Ruby
6
star
60

quix-mann

Merlin Mann's Custom Quix Commands
6
star
61

bookmarklets

Repo to run bookmarklets from inline scripts on github.com
JavaScript
5
star
62

omf-fuzzy_cd

Shell
4
star
63

EditScript

Ruby
3
star
64

itunescontrol-tmbundle

iTunes Controller for TextMate, highly experimental
Ruby
2
star
65

Dictionary-tmbundle

Various dictionary, spellchecking and thesaurus commands for TextMate
2
star
66

omf-packages

1
star
67

Marked

Marked.app - MultiMarkdown Preview Everywhere
1
star
68

homebrew-thelab

Ruby
1
star
69

htmlexperiments

Just dicking around
1
star