Skip to content

Instantly share code, notes, and snippets.

Avatar

Tobias Pape krono

  • Hasso Plattner Institute
  • Potsdam, Germany
View GitHub Profile
@krono
krono / targettestpinning.py
Created Jul 23, 2019
Test the pinning problem
View targettestpinning.py
from rpython.rtyper.lltypesystem import rffi
from rpython.translator.tool.cbuild import ExternalCompilationInfo
eci = ExternalCompilationInfo(
post_include_bits=["""
#ifndef __pinningtest_h
#define __pinningtest_h
#ifdef _WIN32
@krono
krono / xe-update-stats.sh
Created Oct 19, 2018
Update Xen info from an OpenBSD guest
View xe-update-stats.sh
#!/bin/sh
#
# add to /etc/rc.local
# [ -x /usr/local/bin/xe-update-stats ] && /usr/local/bin/xe-update-stats init
# add to `crontab -e`
# 1-59 * * * * /bin/sh /usr/local/bin/xe-update-stats
if [ "$1" = "init" ]; then
@krono
krono / xnf-to-host.sh
Last active Oct 19, 2018
Send ip addresses to Xen for info on OpenBSD
View xnf-to-host.sh
for ifline in $(dmesg | grep address | sed -E -e 's/^(xnf.+)\ at.*address\ ([a-fA-F0-9:]+)/\1=\2/' | sort); do
mac=$(echo $ifline | cut -d= -f2)
if=$(echo $ifline | cut -d= -f1)
for vif in $(hostctl device/vif); do
if [ "$mac" = "$(hostctl device/vif/$vif/mac)" ]; then
ip4=$(ifconfig $if | grep 'inet[^6]' | cut -d ' ' -f2)
ip6=$(ifconfig $if | grep 'inet6' | cut -d ' ' -f2 | cut -d% -f1)
if [ -n "$ip4" ]; then
hostctl attr/eth$vif/ip "$ip4"
fi
View Moep.st
'From Squeak5.2beta of 12 September 2018 [latest update: #18193] on 18 September 2018 at 1:48:53 pm'!
Model subclass: #Moep
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'Moep'!
!Moep methodsFor: 'toolbuilder' stamp: 'topa 9/18/2018 13:48'!
buildContentsWith: builder
View configureMySystem.st
"-=-=-=-=-="
" This gets us Metacello "
"-=-=-=-=-="
Installer gemsource
project: 'metacello';
addPackage: 'ConfigurationOfMetacello';
install.
"Bootstrap Metacello Preview, using mcz files (#'previewBootstrap' symbolic version"
View rsqueak-hotfixes.1.cs
'From Squeak5.0 of 15 January 2016 [latest update: #15117] on 4 February 2016 at 1:52:02 pm'!
Object subclass: #RSqueak
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'RSqueak'!
!AutoStart class methodsFor: 'initialization' stamp: 'tfel 2/4/2016 13:09'!
startUp: resuming
"The image is either being newly started (resuming is true), or it's just been snapshotted.
View ban-ssh.sh
#!/bin/sh
PORT=22
TIMEOUT=600
for IPTABLE in iptables ip6tables; do
case "${IPTABLE}" in
iptables) LOCALHOST="127.0.0.1";;
ip6tables) LOCALHOST="::1";;
esac
View LexiComb.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View boolean.diff
--- binarytrees-generic.rkt 2015-10-28 11:06:42.000000000 +0100
+++ binarytrees-generic-boolean.rkt 2015-10-28 11:51:04.000000000 +0100
@@ -14,15 +14,15 @@
(define-syntax leaf? (make-rename-transformer #'*leaf?))
(define-syntax node (make-rename-transformer #'*node))
(define-syntax node? (make-rename-transformer #'*node?))
-(define-syntax-rule (leaf-val l) (*leaf-val l))
+(define-syntax-rule (leaf-val l) (if (*leaf-val l) 0 1))
(define-syntax-rule (node-left n) (*node-left n))
(define-syntax-rule (node-right n) (*node-right n))
View gist:c990b5f77c64ff1485ac
[14:41:04]ζtobias@Claudio ± structs
~/dev/pypy/pycket % ./pycket-c binarytrees-generic-boolean.rkt 18
stretch tree of depth 19 check: 1
524288 trees of depth 4 check: 262144
131072 trees of depth 6 check: 65536
32768 trees of depth 8 check: 16384
8192 trees of depth 10 check: 4096
2048 trees of depth 12 check: 1024
512 trees of depth 14 check: 256
128 trees of depth 16 check: 64