Last active
March 8, 2016 11:35
-
-
Save elzibubble/1c2fd446a6688c15b4f9 to your computer and use it in GitHub Desktop.
Utils for manual Python instrumentation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def foo(msg): | |
with open('foo.%d' % os.getpid(), 'a') as fp: | |
fp.write('%s\n' % msg) | |
FOO=0 | |
def fin(msg): | |
global FOO | |
FOO += 1 | |
foo('%s %s' % ('>'*FOO, msg)) | |
def fox(msg): | |
global FOO | |
foo('%s %s' % ('<'*FOO, msg)) | |
FOO -= 1 | |
call setreg('q', "Ofin(\"%s.%s\" % ())\<ESC>mm?^class\<CR>0Wyw``F(a\"\<C-r>\"\", \"\"\<ESC>?def \<CR>wyw``P") | |
map Z Ypl2sox<ESC>dd} |
rm -f foo_; tox -epy27 test_mutate_hook_process; for X in foo_; do echo "\n\n-- $X --"; cat $X; done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://stackoverflow.com/a/8191328/304282