Skip to content

Instantly share code, notes, and snippets.

View pmp-p's full-sized avatar
🚜
coding or farming

Paul m. p. Peny pmp-p

🚜
coding or farming
View GitHub Profile
@pmp-p
pmp-p / build.xml
Created October 7, 2017 03:40 — forked from j16sdiz/build.xml
<?xml version="1.0"?>
<!-- ant build file for Freenet -->
<project name="Freenet" default="dist" basedir=".">
<property name="freenet-cvs-snapshot.location" location="../fred/lib/freenet-cvs-snapshot.jar"/>
<property name="freenet-ext.location" location="../fred/lib/freenet-ext.jar"/>
<property name="svn.revision" value="@custom@"/>
<property name="source-version" value="1.5"/>
<property name="build" location="build/"/>
<property name="build-test" location="build-test/"/>
@pmp-p
pmp-p / micropython.py
Last active November 16, 2018 04:02
micropython module emulation for cpython
# micropython module for cpython, partial implementation, License MIT http://github.com/pmp-p
import builtins
def schedule(fn, a):
# emulate "schedule" function https://docs.micropython.org/en/latest/library/micropython.html?highlight=schedule#micropython.schedule
# Schedule the function func to be executed “very soon”.
# The function is passed the value arg as its single argument.
# “Very soon” means that the MicroPython runtime will do its best to execute the function at the earliest possible time,
# given that it is also trying to be efficient, and that the following conditions hold:
@pmp-p
pmp-p / line_by_line.py
Created October 14, 2018 00:42 — forked from LiquidFenrir/line_by_line.py
execute a python script line by line from another python script, using threads and bdb
import sys
import bdb
import threading
class ActualRunner(bdb.Bdb):
def __init__(self):
bdb.Bdb.__init__(self)
self.line_no = -1
self.program_done = False
@pmp-p
pmp-p / a_clockwork.py
Last active October 16, 2018 13:57
asyncio repl clock with PyOS_InputHook
#!/usr/local/bin/python3.7 -i
# ^-------------- ****** N.B. USE THE -i parameter ******
import builtins
import asyncio
#handy modules you can have preloaded on repl
import os,sys,time
def schedule(fn, a):
@pmp-p
pmp-p / aioprompt.py
Created November 10, 2018 15:18
minimalist async repl ( with a clock ! )
# === utilities ===================
import builtins
builtins.__print__ = print
def pdb(*a,**k):
k.setdefault( 'file', sys.__stderr__ )
@pmp-p
pmp-p / pandasync.py
Last active September 25, 2020 21:29
async repl with panda3d
# tested py3.7.1+patch panda3d input overhaul 2018-11-11
#==== display coroutines values ================
#1: coroutine()
#2: x=coroutine();x
#3: x=await coroutine()
#1/2/3
import sys
import asyncio
import builtins
@pmp-p
pmp-p / basic.py
Created November 30, 2018 14:49 — forked from croxis/basic.py
CEFPython for Panda3D
from cefpython3 import cefpython
import os
import sys
from panda3d.core import loadPrcFileData
loadPrcFileData("", "Panda3D example")
loadPrcFileData("", "fullscreen 0")
loadPrcFileData("", "win-size 1024 768")
@pmp-p
pmp-p / docker_alpine_midipix_build.sh
Last active May 21, 2023 06:57
build midipix via docker alpine:latest + midipix_build
#!/bin/bash
echo "The serial file in that directory should contains something like: export KEY=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
. serial
mkdir -p work
cat > work/docker_midipix_build.sh <<EOS
@pmp-p
pmp-p / uping.py
Last active January 19, 2019 08:15 — forked from shawwwn/uping.py
µPing: Ping library for MicroPython
# µPing (MicroPing) for MicroPython
# copyright (c) 2018 Shawwwn <shawwwn1@gmail.com>
# License: MIT
# Internet Checksum Algorithm
# Author: Olav Morken
# https://github.com/olavmrk/python-ping/blob/master/ping.py
# @data: bytes
def checksum(data):
if len(data) & 0x1: # Odd number of bytes
@pmp-p
pmp-p / tinypacks.py
Created January 19, 2019 13:41
tinypacks µpython/python3 (from https://github.com/francc/tinypacks)
#!/usr/bin/env python3
#
# TinyPacks - Copyright (c) 2012 Francisco Castro <http://fran.cc>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions: