Skip to content

Instantly share code, notes, and snippets.

from twisted.web.server import Site, NOT_DONE_YET
from twisted.web.resource import Resource
from twisted.internet import reactor, defer
from twisted.python import log
from PIL import Image
import random
import sys
import io
import urllib
import sys
import os
def tourlpath(a):
drive, path = os.path.abspath(a).replace('\\', '/').split('/', 1)
return 'file:///' + drive + '/' + urllib.quote(path)
import urllib
import os
def tourlpath(a):
drive, path = os.path.abspath(a).replace('\\', '/').split('/', 1)
return 'file:///' + drive + '/' + urllib.quote(path)
directory = '.'
import json
def colorize(a, indent=1, seenobjects=None):
if a is True: return color('true') + 'true' + color('reset')
if a is False: return color('false') + 'false' + color('reset')
if a is None: return color('none') + 'null' + color('reset')
if isinstance(a, int): return color('int') + str(a) + color('reset')
if isinstance(a, float): return color('float') + str(a) + color('reset')
#if seenobjects is None: seenobjects = []
This is a test to see if it works
#include <Keyboard.h>
#include <Mouse.h>
byte invert = 0, active = 0, mactive = 0, state = 0, mstate = 0;
int ontimer = 0, offtimer = 0;
//#define dodebug
void setup() {
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import os
from PIL import Image
import numpy as np
width, height = 800, 600
grid = np.zeros((height, width), dtype=np.uint8)
x = y = int(width / 2)
import os
from PIL import Image
import numpy as np
def getneigh(x, y):
return (
(x, y - 1), # N
(x + 1, y - 1), # NE
import os
from PIL import Image, ImageDraw
import numpy as np
os.chdir(os.path.split(__file__)[0] or '.')
gsize = 100, 100
grid = np.random.randint(0, 2, gsize, dtype=np.uint8)