Skip to content

Instantly share code, notes, and snippets.

View eliasdorneles's full-sized avatar

Elias Dorneles eliasdorneles

View GitHub Profile
@eliasdorneles
eliasdorneles / plot_event_times.py
Last active May 27, 2019 16:31
Script to plot event times from a log quickly
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Plot events over a time axis
"""
# Relies on matplotlib and dateutil
from __future__ import print_function, absolute_import, division
import sys
import dateutil.parser
import datetime
@eliasdorneles
eliasdorneles / urwid_master_detail.py
Last active September 4, 2018 22:14
Sample implementation of Master-Detail UI problem for the console using urwid, written to answer an SO question: https://stackoverflow.com/a/52174629/149872
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Sample program demonstrating how to implement widgets for a master-detail UI
for a list of records using the urwid library (http://urwid.org)
"""
from __future__ import print_function, absolute_import, division
from functools import partial
import urwid
@eliasdorneles
eliasdorneles / voc-stdlib-support-status.html
Last active May 17, 2018 17:57
VOC stdlib support status
<html>
<head>
<title>VOC stdlib modules status</title>
<style>
body {
font: 1.2em "Open Sans", sans-serif;
}
.td {
padding: 2px 0;
border: 1px solid #444;
@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 $*
@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,
#!/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 / 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)