Skip to content

Instantly share code, notes, and snippets.

View ibizaman's full-sized avatar

Pierre Penninckx ibizaman

View GitHub Profile
@ibizaman
ibizaman / Failing log - remote .json file
Created March 1, 2015 21:29
Logs for self-hosted versionning with .json file over scp
INFO interface: output: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
INFO interface: output: ==> build: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
==> build: Box 'archlinux-x86_64' could not be found. Attempting to find and install...
INFO interface: detail: Box Provider: virtualbox
INFO interface: detail: build: Box Provider: virtualbox
build: Box Provider: virtualbox
INFO interface: detail: Box Version: >= 0
INFO interface: detail: build: Box Version: >= 0
build: Box Version: >= 0
INFO runner: Preparing hooks for middleware sequence...
@ibizaman
ibizaman / input
Last active August 29, 2015 14:01
============== GOOD ===============
.. ipython:: python
from baron import parse, dumps
source_code_string = "a = 1"
ast = parse(source_code_string)
generated_source_code = dumps(ast)

Use vagrant to develop baron and redbaron

Copy the files bootstrap.sh, Vagrantfile and test_baron.sh. In the same directory:

git clone https://github.com/Psycojoker/baron.git
git clone https://github.com/Psycojoker/redbaron.git

vagrant up

@ibizaman
ibizaman / gist:1ff9a8092f4bbac79292
Last active August 29, 2015 14:01
Error log as applicative function
class MyClass:
def __init__(self):
self.errors = []
self.warnings = []
def apply(self, function, *args):
result, self.errors, self.warnings = function(*args, errors=self.errors, warnings=self.warnings)
return result
def applicative_functor_style(self, ast):
@ibizaman
ibizaman / dumper.py
Created May 19, 2014 10:02
finder refactor
from .render import RenderWalker
def dumps(tree):
return Dumper().dump(tree)
class Dumper(RenderWalker):
def on_constant(self, constant, pos, key):
self.dump += constant
@ibizaman
ibizaman / Vagrantfile
Last active May 1, 2019 19:53
installing mysql on raspberry under qemu
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :raspberry do |box|
box.vm.box = "precise64"
box.vm.box_url = "http://files.vagrantup.com/precise64.box"
box.vm.network :private_network, ip: "192.168.42.12"
box.vm.provision :shell, :path => "bootstrap_prod.sh"
"comparison": [
("key", "first", True),
("formatting", "first_formatting", True),
("key", "middle_left_formatting", "complex"), # not ou is
("formatting", "middle_formatting", "complex"),
("key", "middle_right_formatting", "complex"), # in ou not
("key", "value", "no_complex"),
("formatting", "second_formatting", True),
("key", "second", True),
============================================== FAILURES ==============================================
__________________________________ test_backslash_not_in_formatting __________________________________
def test_backslash_not_in_formatting():
> check_dumps("if a not \\\n in b: pass\n")
tests/test_dumper.py:527:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>> tokenize("from future import feature")
[('NAME', 'f'), ('NAME', 'r'), ('NAME', 'o'), ('NAME', 'm'), ('SPACE', ' '), ('NAME', 'f'), ('NAME', 'u'), ('NAME', 't'), ('NAME', 'u'), ('NAME', 'r'), ('NAME', 'e'), ('SPACE', ' '), ('NAME', 'i'), ('NAME', 'm'), ('NAME', 'p'), ('NAME', 'o'), ('NAME', 'r'), ('NAME', 't'), ('SPACE', ' '), ('NAME', 'f'), ('NAME', 'e'), ('NAME', 'a'), ('NAME', 't'), ('NAME', 'u'), ('NAME', 'r'), ('NAME', 'e'), ('ENDMARKER', ''), None]
# 3.2
>>> open("test_oauth.py", "r").read()[:30]
'\xef\xbb\xbf# -*- coding: utf-8 -*-\n\n""'
>>> import baron.helpers
>>> baron.helpers.show(open('test_oauth.py').read())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/vagrant/baron/baron/helpers.py", line 7, in show