Skip to content

Instantly share code, notes, and snippets.

View wuub's full-sized avatar

Wojciech Bederski wuub

View GitHub Profile
@wuub
wuub / game.py
Created October 18, 2013 21:02
great team, great game :) @PyConPL #Dojo entry team #2
#!/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
@wuub
wuub / README.md
Last active December 25, 2015 20:59
LD_PRELOAD hook for vaurien proof of concept
  1. compile shared library:
$ cc -shared -fPIC -Wl,--no-as-needed -ldl -lpthread -Wl,-soname=forward.so -o forward.so forward.c
  1. Run standard redis server in separate terminal
$ redis-server
@wuub
wuub / gist:6425638
Created September 3, 2013 15:44
SublimeREPL: Python + virtualenv
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
@wuub
wuub / Default.sublime-mousemap
Last active December 20, 2015 06:49
Default.sublime-mousemap
[
{
"button": "button1", "count": 1, "modifiers": ["ctrl", "alt"],
"press_command": "drag_select",
"command": "goto_definition",
"args": {}
}
]
@wuub
wuub / auto_restart_repl.py
Created July 3, 2013 10:04
plugin for automatically restarting interpreters in SublimeREPL
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:
@wuub
wuub / gist:5598688
Last active December 17, 2015 10:58
explanation
##
## 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)
##
@wuub
wuub / Main.sublime-menu
Created March 18, 2013 19:38
py.exe lanucher on windows
[
{
"id": "tools",
"children":
[{
"caption": "SublimeREPL",
"mnemonic": "r",
"id": "SublimeREPL",
"children":
[
@wuub
wuub / gist:3529097
Created August 30, 2012 13:58
Trace an error in logging.xxx()
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):