Skip to content

Instantly share code, notes, and snippets.

View eliasdorneles's full-sized avatar

Elias Dorneles eliasdorneles

View GitHub Profile
@eliasdorneles
eliasdorneles / runspider.sh
Last active April 20, 2018 10:33
Script to run spider, saving log output and stuff
#!/bin/bash
set -e
abort() {
echo "$*"; exit 1;
}
usage() {
echo $*
#!/bin/bash
# This script assumes you're using the directory layout described in the
# documentation at: https://voc.readthedocs.io/en/latest/tutorials/tutorial-0.html
set -e
#set -x
abort() {
echo "$*"; exit 1;
}
@eliasdorneles
eliasdorneles / bytecode.java
Created October 15, 2017 23:54
Running python -m voc.java over test class
Magic: cafebabe
Version: 50.0
Constant pool: (160 constants)
1: <Class python/buglong/SomeClass>
2: b'python/buglong/SomeClass'
3: <Class org/python/types/Object>
4: b'org/python/types/Object'
5: b'__VOC__'
6: b'Lorg/python/Object;'
7: b'class$init'
```
09-20 00:56:18.909 4981 4981 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.testhello/android.PythonActivity}: NameError: name '__all__' is not defined
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.app.ActivityThread.-wrap12(ActivityThread.java)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.os.Looper.loop(Looper.java:154)
09-20 00:56:18.909 4981 4981 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6077)
09-20 00:56:18.909
@eliasdorneles
eliasdorneles / log-analysis-result.txt
Last active May 21, 2017 23:26
Log of Ouroboros compilation attempt using VOC
$ egrep '^[a-zA-Z]+Error' log-compilation-full.txt | sed 's/object at 0x[^>]\+/object at 0x.../' | sort | uniq -c | sort -nr
260 AttributeError: 'Attribute' object has no attribute 'id'
82 NotImplementedError: Unknown context <_ast.Del object at 0x...>
76 NotImplementedError: Don't know how to resolve multiple comparators
40 AttributeError: 'NoneType' object has no attribute '_fields'
29 AttributeError: 'Class' object has no attribute 'add_class'
26 NotImplementedError: No handler for YieldFrom
26 NameError: <generator>
22 AttributeError: 'TRY' object has no attribute 'next_op'
20 TypeError: expected AST, got 'NoneType'
@eliasdorneles
eliasdorneles / rc_logo.py
Created May 9, 2017 21:49
RC Logo -- Code Dojo for NGW
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urwid
LOGO = '''
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
MMM MMM
MMM MMMMMMMMMMMMMMMMMMMMMMMMMMM MMM
@eliasdorneles
eliasdorneles / square.py
Created April 25, 2017 18:20
Draw a square in the screen, move it with arrow keys -- experimenting with urwid
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Draw a square in the screen, move it with arrow keys
"""
from __future__ import print_function, absolute_import, division
import urwid
BLOCK = u"""
@eliasdorneles
eliasdorneles / repl-voc.sh
Last active February 28, 2018 00:53
A hack to simulate a REPL for VOC
#!/bin/bash
# For arrow-keys history and other cmdline goodies, install rlwrap and replace
# the first line by: #!/usr/bin/rlwrap bash
# This is a hack to simulate a REPL for VOC (http://pybee.org/voc)
#
# Behind the scenes, every time you try a new expression it appends it to a temporary
# file, recompiles it and re-runs it, omitting the previous output.
#
# This has the caveat that if some expression you enter raises an exception,
@eliasdorneles
eliasdorneles / compiling_toplevel_ouroboros_modules.txt
Last active May 21, 2017 21:40
VOC compiling output for top-level ouroboros modules
Compiling ouroboros/abc.py
Traceback (most recent call last):
File "/home/elias/src/voc-dev/voc/voc/python/ast.py", line 160, in visit
super().visit(node)
File "/home/elias/.pythonz/pythons/CPython-3.4.4/lib/python3.4/ast.py", line 245, in visit
return visitor(node)
File "/home/elias/src/voc-dev/voc/voc/python/ast.py", line 49, in dec
fn(self, node)
File "/home/elias/src/voc-dev/voc/voc/python/ast.py", line 341, in visit_AugAssign
self.context.load_name(node.target.id)
$ asm.sh ../voc/dist/python-java-support.jar:. python.testgen.__init__
java -cp /home/elias/apps/asm-5.2/lib/asm-5.2.jar:/home/elias/apps/asm-5.2/lib/asm-tree-5.2.jar:/home/elias/apps/asm-5.2/lib/asm-analysis-5.2.jar:/home/elias/apps/asm-5.2/lib/asm-util-5.2.jar:../voc/dist/python-java-support.jar:. org.objectweb.asm.util.CheckClassAdapter python.testgen.__init__
org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 10: Insufficient maximum stack size.
at org.objectweb.asm.tree.analysis.Analyzer.analyze(Unknown Source)
at org.objectweb.asm.util.CheckClassAdapter.verify(Unknown Source)
at org.objectweb.asm.util.CheckClassAdapter.verify(Unknown Source)
at org.objectweb.asm.util.CheckClassAdapter.main(Unknown Source)
Caused by: java.lang.IndexOutOfBoundsException: Insufficient maximum stack size.
at org.objectweb.asm.tree.analysis.Frame.push(Unknown Source)
at org.objectweb.asm.tree.analysis.Frame.execute(Unknown Source)