- compile shared library:
$ cc -shared -fPIC -Wl,--no-as-needed -ldl -lpthread -Wl,-soname=forward.so -o forward.so forward.c
- Run standard redis server in separate terminal
$ redis-server
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from __future__ import with_statement, division, absolute_import, print_function | |
| import sys | |
| ROOMS = { | |
| 'start': { | |
| 'desc': """You are in Szczyrk in a very beutiful hotel. It is very modern and |
$ cc -shared -fPIC -Wl,--no-as-needed -ldl -lpthread -Wl,-soname=forward.so -o forward.so forward.c
$ redis-server
| You can use: | |
| - virtualenvwrapper (http://virtualenvwrapper.readthedocs.org/en/latest/) with default WORKON_HOME=~/.virtualenvs (most likely you don't have to change anything) | |
| - venv.bash (https://github.com/wuub/venv) | |
| - manually create virtualenv in one of directories scanned by SublimeREPL "python_virtualenv_paths": ["~/.virtualenvs", "~/.venv"] | |
| I'll assume venv.bash as it's the thing I use + it's only a syntax-sugar on top of virtualenv w/o additional features or things to understand. | |
| $ cd ~ | |
| $ curl https://raw.github.com/wuub/venv/master/venv.bash -o venv.bash | |
| $ source venv.bash |
| [ | |
| { | |
| "button": "button1", "count": 1, "modifiers": ["ctrl", "alt"], | |
| "press_command": "drag_select", | |
| "command": "goto_definition", | |
| "args": {} | |
| } | |
| ] |
| import sublime, sublime_plugin | |
| def auto_restart_repl(view): | |
| restart_args = view.settings().get('repl_restart_args', None) | |
| if not restart_args: | |
| return | |
| from SublimeREPL.sublimerepl import manager | |
| rv = manager.repl_view(view) | |
| if rv: |
| ## | |
| ## I want a worker that can perform jobs declared in 'tasks' entry_points | |
| ## of installed packages. | |
| ## | |
| ## This allows external services to schedule [package_name].[task_name] | |
| ## w/o knowledge about internal layout of python package providing the task. | |
| ## | |
| ## With this pattern it's also relatively easy to disable support | |
| ## for arbitrary code execution (think os.unlink) | |
| ## |
| import logging.handlers | |
| def emit(self, record): | |
| """ | |
| Emit a record. | |
| Output the record to the file, catering for rollover as described | |
| in doRollover(). | |
| """ | |
| try: | |
| if self.shouldRollover(record): |