I hereby claim:
- I am amjith on github.
- I am amjith (https://keybase.io/amjith) on keybase.
- I have a public key ASCybq0HEjJam9F4HCBqN8nVKGXLojzGGReK9y6p4vTLUgo
To claim this, I am signing this object:
regex = '(m.*i.*g)' | |
'main_generator.py' -> 'main_g' | |
'migrations.py' -> 'mig' | |
'django_migrations.py' -> 'mig' | |
'django_admin_log.py' -> 'min_log' |
>>> import re # regex module from standard library. | |
>>> def fuzzyfinder(user_input, collection): | |
suggestions = [] | |
pattern = '.*'.join(user_input) # Converts 'djm' to 'd.*j.*m' | |
regex = re.compile(pattern) # Compiles a regex. | |
for item in collection: | |
match = regex.search(item) # Checks if the current item matches the regex. | |
if match: | |
suggestions.append((len(match.group()), match.start(), item)) | |
return [x for _, _, x in sorted(suggestions)] |
>>> print fuzzyfinder('user', collection) | |
['api_user.doc', 'user_group.doc'] |
>>> collection = open('/usr/share/dict/words').readlines() | |
>>> fuzzyfinder('pgcli', collection) | |
<generator object <genexpr> at 0x102f20eb0> | |
>>> list(fuzzyfinder('pgcli', collection)) | |
['plagioclinal\n', 'plagioclasite\n', 'plagioclastic\n', 'pragmaticality\n', | |
'pyrgocephalic\n', 'phagocytolysis\n', 'phagocytolytic\n', 'phenylglycolic\n', | |
'plagiocephalic\n', 'plagiocephalism\n', 'pathologicoclinical\n', 'periangiocholitis\n', | |
'pathologicohistological\n', 'pathologicopsychological\n'] | |
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) |
import sqlite3 | |
from pygments.lexers.sql import SqlLexer | |
from prompt_toolkit import prompt | |
from prompt_toolkit.history import FileHistory | |
import click | |
from prompt_toolkit.contrib.completers import WordCompleter | |
sql_completer = WordCompleter([ | |
'select', 'insert', 'delete', 'drop', 'from', 'where' | |
]) |
module Pong exposing (..) | |
import Element exposing (..) | |
import Collage exposing (..) | |
import Color exposing (..) | |
import Keyboard exposing (KeyCode) | |
import AnimationFrame | |
import Time exposing (Time) | |
import Html exposing (Html, text) | |
import Html.App as Html |
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:') |
I hereby claim:
To claim this, I am signing this object:
ERROR: [23:00:40][tinytacoteam/zazu-clipboard:clip] | |
Script failed | |
{ | |
"error": {}, | |
"query": "" | |
} | |
ERROR: [23:00:40][tinytacoteam/zazu-clipboard:clip] | |
Script failed | |
{ |