Skip to content

Instantly share code, notes, and snippets.

@stestagg
stestagg / script.py
Last active January 31, 2024 01:03
edge-distance based mesh cleanup
import bpy
import bmesh
import numpy as np
from math import radians
MERGE_THRESHOLD = 0.01
DISSOLVE_ANGLE = 0.5
MAX_ITER = 10
During concurrent starting of nodes and cache put/get operations exception occures. Moreover some threads blocked on waiting for futures completion.
[^CacheAffEarlySelfTest.java] for problem reproducing. Note, that exception reproduces not always.
It's important that each node invokes getOrCreateCache() during concurrent start up. It seems when there are concurrent attempts to start the same cache minor topology version differs for different nodes.
{noformat}
[12:37:58,055][ERROR][ignite-#1395%sys-distributed.GridCacheAffEarlySelfTest1%][GridCacheIoManager] Failed processing message [senderId=603d5257-2001-4365-88cb-d33dc72db006, msg=GridNearAtomicUpdateRequest [nodeId=10cbb4bb-5ad4-4df9-a4c3-e269b0aa3001, futVer=GridCacheVersion [topVer=49642684, nodeOrderDrId=4, globalTime=1438162677968, order=1438162677072], fastMap=false, updateVer=null, topVer=AffinityTopologyVersion [topVer=8, minorTopVer=3], topLocked=false, syncMode=FULL_SYNC, op=UPDATE, keys=[KeyCacheObjectImpl [val=603d5257-2001-4365-88cb-d33dc72
@stestagg
stestagg / starwars.py
Created March 25, 2016 17:41
micropython starwars
import gc
import machine
import pyb
import time
import network
# Configure GPIO pins 0 and 2 to be used for
# the I²C interface
iic = machine.I2C(pyb.Pin(2), pyb.Pin(0))
FROM ubuntu:21.04
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget make clang unzip
#RUN git clone --branch exceptionGroup-stage5 https://github.com/iritkatriel/cpython
RUN wget https://github.com/iritkatriel/cpython/archive/exceptionGroup-stage5.zip
RUN unzip -x *.zip
RUN mv cpython-* cpython
@stestagg
stestagg / example.py
Last active August 7, 2020 16:23
POC exploring possible syntaxes for the python-ideas thread: Package kwkey and PEP 472 -- Support for indexing with keyword arguments
# coding=kw_getitem
class Helper:
def _getitem_wrapper(self, *a, **kw):
a_x = {0: (), 1: a}.get(len(a), (a, ))
return self.__getitem__(*a_x, **kw)
class ObjWithGetitem(Helper):
for i in findings/*/crashes/*
set -l dest desc/(basename $i)
if [ ! -e $dest ]
echo $i
lldb -b --one-line "run $i" --one-line-on-crash 'quit' ./run > $dest
sleep 0.1
end
end
fuzz: image findings
docker run --cpuset-cpus=0 --rm -it -v ${HERE}/findings:/findings pyfuzz /afl-fuzz -m 200 -x /dict.txt -i /tests -o /findings -M master /run
fuzz-extra:
seq 10 | parallel docker run --cpuset-cpus={} --rm -i -v ${HERE}/findings:/findings pyfuzz /afl-fuzz -m 200 -x /dict.txt -i /tests -o /findings -S slave{} /run
import string;
import keyword
import json
import ast
ASSIGN_OPS = """
'+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//='
"""
py:
(cd cpython && make clean)
(cd cpython && env CC=../afl/afl-clang-fast CXX=../afl/afl-clang-fast++ ./configure --cache-file=../config.cache --prefix=${PYROOT} --exec-prefix=${PYROOT})
(cd cpython && env CC=../afl/afl-clang-fast CXX=../afl/afl-clang-fast++ make install -j8)
#include <stdio.h>
#include <Python.h>
#define IN_BUF_SIZE 16384
int main(int argc, char **argv) {
char script[IN_BUF_SIZE + 1];