Skip to content

Instantly share code, notes, and snippets.

View smarr's full-sized avatar
👨‍🏫
Researching and Lecturing

Stefan Marr smarr

👨‍🏫
Researching and Lecturing
View GitHub Profile
class DomainObj(object):
def __init__(self):
self._owner = None
class Domain(object):
def request_exec_on_with(self, method_name, target, *args):
fun = getattr(target, method_name)
@smarr
smarr / gist:096856bccc40f36d1e2c
Created August 23, 2014 20:38
AddFieldWriteEnforced trace
[1c56f76bbf44] {jit-backend-dump
BACKEND x86_64
SYS_EXECUTABLE ??
CODE_DUMP @101501000 +0 48894D58488945604889556848895D70488975784889BD800000004C8985880000004C898D900000004C8995980000004C89A5A00000004C89ADA80000004C89B5B00000004C89BDB80000008F45208F45104889E848BBD0A530000100000048832B084C8BBC24900000004C8BB424880000004C8BAC24800000004C8B642478488B5C2470488B6C24684881C498000000C3
[1c56f76c9275] jit-backend-dump}
[1c56f76d1bce] {jit-backend-dump
BACKEND x86_64
SYS_EXECUTABLE ??
CODE_DUMP @101501092 +0 48894D58488945604889556848895D70488975784889BD800000004C8985880000004C898D900000004C8995980000004C89A5A00000004C89ADA80000004C89B5B00000004C89BDB800000049BB38F23D0001000000498B1B49BB30F23D000100000049C7030000000049BB38F23D000100000049C7030000000048895D388F45208F45104889E848BBD0A530000100000048832B084C8BBC24900000004C8BB424880000004C8BAC24800000004C8B642478488B5C2470488B6C24684881C498000000C3
[1c56f76d4ee5] jit-backend-dump}
diff -r ae1f561d0a35 rpython/translator/c/test/test_typed.py
--- a/rpython/translator/c/test/test_typed.py Tue Sep 23 15:29:32 2014 -0400
+++ b/rpython/translator/c/test/test_typed.py Wed Sep 24 11:39:30 2014 +0200
@@ -487,6 +487,14 @@
fn = self.getcompiled(snippet.lshift_func, [int])
fn(1, expected_exception_name='OverflowError')
+ fn2 = self.getcompiled(snippet.lshift_func_2, [int, int])
+
+ assert fn2(1, 32) == 4294967296
@smarr
smarr / scrapping-vlille.php
Last active August 29, 2015 14:09
Scrap Lille's Velo availability
<?php
// scrapping the V'Lille Bicycle availability
$index = file_get_contents('http://www.vlille.mobi/index.php?id=158'); //('index158.html');
$lines = explode("\n", $index);
class Item {
public $name;
public $velos;
public $places;
@smarr
smarr / gist:fbce40cb0197e3b2667e
Created December 26, 2014 22:55
FieldLoop trace, with new object model
# Loop 2 (FieldLoop>>$blockMethod@30@15 while <WhileMessageNode object at 0x1007672b0>: FieldLoop>>$blockMethod@31@15) : loop with 519 ops
[p0, p1]
+116: label(p0, p1, descr=TargetToken(4302785856))
debug_merge_point(0, 0, 'FieldLoop>>$blockMethod@30@15 while <WhileMessageNode object at 0x1007672b0>: FieldLoop>>$blockMethod@31@15')
+116: i2 = instance_ptr_eq(p1, p0)
guard_true(i2, descr=<Guard0x1030e3440>) [p1, p0]
debug_merge_point(1, 1, 'FieldLoop>>#$blockMethod@30@15')
+136: guard_not_invalidated(descr=<Guard0x1030e33d0>) [p0]
+136: p3 = getfield_gc_pure(p0, descr=<FieldP som.vmobjects.block.Block.inst__outer_tmps 40>)
+147: p5 = getarrayitem_gc(p3, 0, descr=<ArrayP 8>)
@smarr
smarr / gist:ed7f52ed3dc4a48cec61
Created March 15, 2015 21:43
Translation issue
[translation:info] Error:
[translation:info] File "/Users/smarr/Projects/SOM/pypy/rpython/translator/goal/translate.py", line 316, in main
[translation:info] drv.proceed(goals)
[translation:info] File "/Users/smarr/Projects/SOM/pypy/rpython/translator/driver.py", line 531, in proceed
[translation:info] return self._execute(goals, task_skip = self._maybe_skip())
[translation:info] File "/Users/smarr/Projects/SOM/pypy/rpython/translator/tool/taskengine.py", line 114, in _execute
[translation:info] res = self._do(goal, taskcallable, *args, **kwds)
[translation:info] File "/Users/smarr/Projects/SOM/pypy/rpython/translator/driver.py", line 276, in _do
[translation:info] res = func()
[translation:info] File "/Users/smarr/Projects/SOM/pypy/rpython/translator/driver.py", line 343, in task_rtype_lltype
module Arithmetics
import java.lang.System
function gcd = |x, y, repeat| {
var res = 0_L
for (var i = 0_L, i < repeat, i = i + 1_L) {
var a = x
var b = y
while a != b {
@smarr
smarr / mandelbrot.golo
Created July 2, 2015 11:54
Mandelbrot
# Copyright © 2004-2013 Brent Fulgham
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
#
<?php
/*
@License Public Domain
@author Carsten Dobschat <version 1.3> <http://www.dobschat.de/index.php/dobschat/entry/serendipity-s9y-importer-for-wordpress-13/>
@author Michael Tyson <version 1.2> <http://michael.tyson.id.au/2008/09/04/serendipity-s9y-importer-for-wordpress/>
@author Aaron Brazell <version 1.1> <http://technosailor.com/2007/01/02/new-version-of-serendipity-s9y-to-wordpress-importer-available/>
@version 1.4
Changelog:
@smarr
smarr / beanplots.R
Last active December 10, 2015 03:18 — forked from yannabraham/beanplots.R
Fixed small typo
## reproduce the figures from http://www.jstatsoft.org/v28/c01/paper using ggplot2
library(ggplot2)
## parameters
set.seed(2710)
## Figure 1
d <- rnorm(50)