Skip to content

Instantly share code, notes, and snippets.

View amjith's full-sized avatar
🐐

Amjith Ramanujam amjith

🐐
View GitHub Profile
@amjith
amjith / profile_func.py
Created October 13, 2011 04:22
Profiling decorator
def profile_func(filename=None):
def proffunc(f):
def profiled_func(*args, **kwargs):
import cProfile
import logging
logging.info('Profiling function %s' % (f.__name__))
try:
profiler = cProfile.Profile()
retval = profiler.runcall(f, *args, **kwargs)
profiler.dump_stats(filename or '%s_func.profile' % (f.__name__))
@amjith
amjith / wsgi_app.py
Created June 4, 2013 00:09
WSGI app to test the NR disable/enable.
from time import sleep
from webtest import TestApp
import newrelic.agent
newrelic.agent.initialize('newrelic.ini')
def hello_world(environ, start_response):
path = environ.get('PATH_INFO')
if path.startswith('/slow'):
@amjith
amjith / pgstyle.py
Created August 2, 2015 18:10
PGStyle with adjustable colors
from pygments.token import Token
from pygments.style import Style
from pygments.util import ClassNotFound
from prompt_toolkit.styles import default_style_extensions
import pygments.styles
def style_factory(name, completion_selected_color, completion_unselected_color):
try:
style = pygments.styles.get_style_by_name(name)
@amjith
amjith / plugin.py
Created June 18, 2020 05:58
Datasette plugin for updating db and metadata
from datasette import hookimpl
from datasette.database import Database
from starlette.responses import HTMLResponse
from starlette.routing import Router, Route
from starlette.endpoints import HTTPEndpoint
@hookimpl
def asgi_wrapper(datasette):
@amjith
amjith / git-open.sh
Created February 21, 2018 03:05
git-open.sh
#!/bin/bash
dirty=`git status --porcelain -uno | sed s/^...//`
last_modified=`git show --pretty="format:" --name-only HEAD`
if [ -n "$dirty" ]; then
echo $dirty
else
echo $last_modified
fi
@amjith
amjith / gitconfig
Last active February 21, 2018 03:09
gitconfig
[alias]
open = !vim `git-open.sh`
@amjith
amjith / litecli.py
Last active November 24, 2017 06:13
Template for creating awesome REPLs with prompt-toolkit
from prompt_toolkit import prompt
from prompt_toolkit.history import FileHistory
from prompt_toolkit.contrib.completers import WordCompleter
from pygments.lexers.sql import SqlLexer
import sqlite3
history = FileHistory('history.txt')
completer = WordCompleter(['select', 'insert', 'delete', 'drop', 'from'])
connection = sqlite3.connect(':memory:')
@amjith
amjith / precommit
Created August 16, 2017 05:36
precommit hook
#!/bin/sh
pep8radius master --in-place
git diff --cached --name-only | egrep '\.py$'| xargs -l git add
@amjith
amjith / log.json
Created January 11, 2017 22:28
zazu log
{"message":"Plugin failed to load","stack":["Error: Cannot find module 'clone'"," at Module._resolveFilename (module.js:455:15)"," at Function.Module._resolveFilename (/Applications/Zazu.app/Contents/Resources/electron.asar/common/reset-search-paths.js:35:12)"," at Function.Module._load (module.js:403:25)"," at Module.require (module.js:483:17)"," at require (internal/module.js:20:19)"," at Object.<anonymous> (/Users/amjith/.zazu/plugins/tinytacoteam/zazu-clipboard/node_modules/color/index.js:2:13)"," at Module._compile (module.js:556:32)"," at Module._extensions..js (module.js:565:10)"," at Object.require.extensions.(anonymous function) [as .js] (/Applications/Zazu.app/Contents/Resources/app.asar/node_modules/babel-register/lib/node.js:152:7)"," at Module.load (module.js:473:32)"],"plugin":"tinytacoteam/zazu-clipboard","block":"searcher","level":"error","timestamp":"2017-01-11T22:27:08.841Z"}
{"input":",v ","respondsTo":null,"plugin":"tinytacoteam/zazu-chrome-bookmarks","block":

# FAQ

## Core vision

A fully extensible and open source app launcher for hackers, creators and dabblers. It comes with sane defaults to make it useful out of the box. But everything can be changed to fit your needs. Don't let others tell you the best way to be productive, configure it to be perfect for you.

## How do you compare to alternatives?

Zazu is the first launcher to treat plugins as first class citizens. Even the app finder is built as a plugin which can be replaced (if desired). This means plugins are designed as natural extensions of Zazu and they don't require a special trigger such as '/' or ','. This allows a more intuitive desgin that is doesn't hamper discoverability.