Skip to content

Instantly share code, notes, and snippets.

View sdressler's full-sized avatar

Sebastian Dressler sdressler

View GitHub Profile
@sdressler
sdressler / dag.py
Created July 14, 2018 13:03
Naive Scheduler
#!/usr/bin/env python3
import asyncio
import time
class Scheduler(object):
def __init__(self, tasks, graph, entrypoint):
self.tasks = tasks
self.graph = graph
@sdressler
sdressler / gist:5492072
Created April 30, 2013 21:23
Proposed Multiline Grid Widget
#!/usr/bin/python3
import npyscreen, curses
class DividedMultiLine(npyscreen.wgwidget.Widget):
_subwidget = npyscreen.Textfield
def __init__(self, screen, values = None, **keywords):
super(DividedMultiLine, self).__init__(screen, **keywords)
import npyscreen, curses
class FolderTreeAction(npyscreen.MLTreeAction):
def __init__(self, *args, **keywords):
super().__init__(*args, **keywords)
self.F = keywords['F']
def actionHighlighted(self, act_on_this, key_press):
self.F.get_content(act_on_this.getContent())
@sdressler
sdressler / gist:5450705
Created April 24, 2013 08:50
npyscreen form with status line
import npyscreen, curses
class StatusWidget(npyscreen.wgwidget.Widget):
def update(self, clear=True):
if clear == True:
self.clear()
self.status = npyscreen.Textfield(self.parent, rely=self.rely, relx=0, editable=1)
@sdressler
sdressler / psort.c
Created April 23, 2013 08:05 — forked from Alexis-D/psort.c
#include <stdlib.h>
#include <string.h>
#define INITIAL_SHIFT (((sizeof (long long)) - 1) * 010)
#define NTHREADS 64
#define SWITCH_TO_INSERTION 16
#define SWITCH_TO_QSORT 8192
#define DO_NOT_RADIX 2626144
/*