Skip to content

Instantly share code, notes, and snippets.

View emdete's full-sized avatar
🙂

M. Dietrich emdete

🙂
View GitHub Profile
#!/usr/bin/env python3
__copyright__ = "Copyright (c) 2008-2021 M. Dietrich <mdt@emdete.de>"
__license__ = "GPLv3"
from math import modf
from datetime import datetime
from curses import wrapper
from os import system
from logging import getLogger, StreamHandler
package de.emdete.roberta;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.fhg.iais.roberta.connection.IRobot;
import de.fhg.iais.roberta.connection.IConnector;
import de.fhg.iais.roberta.connection.wired.arduino.Arduino;
#!/usr/bin/env python3
#
# This is regren, a regular expression renamer. It allows to rename files by
# regular expressions given on the command line, but instead of actually doing
# that job it spits out the commands for a shell to do so. You just start
# preparing your command line and check the result and if you are happy with it
# you add a `| sh` to commit the change to the filesystem.
#
# The first argument is the regex to search in the filename, if no match is
# found not rename is issued.
@emdete
emdete / bf.py
Created January 4, 2017 13:32
brainfuck implementation in python with debugging
#!/usr/bin/env python3
DEBUG = True
def debug(ip, program, dp, tape, stack):
global DEBUG
if DEBUG:
print(program)
print('{}{}{}'.format(' ' * ip, '^', ip))
for n, d in enumerate(tape):
if n == dp:
@emdete
emdete / spread.py
Last active March 17, 2016 21:32
legend animation example
#!/usr/bin/env python
from matplotlib import animation
from time import time
from random import randint
import matplotlib.pyplot as plt
import numpy as np
class LiveCounter(object):
def init(self):
plt.ylim((0, self.maxy))
#!/usr/bin/env python3
from tkinter import *
'''
Fullscreen test program using tkinter. Enter 'f' or F11 to make the current
window fullscreen. Enter 'o' to open a second window in fullscreen.
'''
class MainWindow(object):
def __init__(self):
self.state = False
@emdete
emdete / cutter.py
Created October 12, 2015 11:15
program to select two square from an image and write LeTeX code (using AddToShipoutPictureBG) to allow double side square picture books.
#!/usr/bin/env python3
from re import compile as re_compile
from select import select
from sys import stdin
from time import time
from os.path import exists
from os import listdir, makedirs
from PIL.Image import frombytes, open as fromfile, eval as image_eval, merge as image_merge
from PIL.ImageTk import PhotoImage
from PIL.ImageOps import invert, autocontrast, grayscale, equalize, solarize
import android.database.Cursor;
import java.util.Iterator;
import java.util.NoSuchElementException;
public class CursorI implements Iterable<Cursor> {
Cursor cursor;
class IteratorI implements Iterator<Cursor> {
Cursor cursor;
IteratorI(Cursor cursor) {
this.cursor = cursor;
def get_orders(x=0, y=0):
DIRECTIONS = ((1, 0, ), (0, 1, ), (-1, 0, ), (0, -1, ), )
c = 2
while True:
d = DIRECTIONS[c % 4]
for n in range(c / 2):
yield x, y
x, y = x + d[0], y + d[1]
c += 1