def thread_body(queue): pixels = NeoPixel(DATA_PIN, N_PIXELS, brightness=BRIGHTNESS, auto_write=False) updates = {'RAINBOW': Rainbow(pixels), 'ANT': Ant(pixels), 'OCD': Ocd(pixels), 'FLASH': Flash(pixels), 'IMPLODE': Implode(pixels), 'ERROR': Error(pixels), 'QUIT': Quit(pixels)} assert set(updates.keys()) == MODES mode = "OCD" while True: try: new_mode = queue.get_nowait() assert new_mode in MODES, "unknown mode %s" % mode if new_mode != mode: updates[new_mode].setup() mode = new_mode except: pass sleep = updates[mode].exec_update() if mode == "QUIT": break time.sleep(sleep)
def startFlash(self, disk): processed_disk_name = self.preprocessDeviceName(disk) print("Processed File Name: " + processed_disk_name) flashing_operation = Flash(processed_disk_name, self.disk_image_path, disk) flashing_operation.start() self.flashing_operations.append(flashing_operation)
def flash(drawing, data, width, height, reflect, opts=None): opts = opts or {} flash = Flash(width=width, height=height) flashes = [flash] nodes = len(data) // 2 for i in range(nodes): if flash.current_point().within_perimeter(flash.end, 10): flash = Flash(width=width, height=height) flashes.append(flash) else: flash.random_walk(data[i] * random.randrange(1, 7)**e, data[nodes - i - 1], mix=0.0) for flash in flashes: drawing = flash.render(drawing, opts.get('thickness')) return drawing
#Author Name - Imaya Bharathi #Date - 11-10-2019 - 12-10-2019 #purpose - sample flask app to keep the container running from flash import Flash app = Flash(__name__) @app.route("/") def honeypot(): return ('Hi from honeypot!') if __name__ == "main": app.run(debug=True, port=2222)
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('-p', dest='portname', default=None) parser.add_argument('-d', dest='debug', action='store_true') args = parser.parse_args() port = args.portname if port == None: print('No port specified.') exit() from flash import Flash flash = Flash() flash.debug = True flash.open(port) try: input('Waiting rvl ready') data = [] data.append(0x03) flash._write(data, 259, True) finally: flash.close()
for i in range(4): backgrounds[i] = pygame.image.load( os.path.join('images', f'background_{i}.png')) points = Points() with open('river_system.txt') as input_file: points.read(input_file) levels = Levels('levels.txt') power_towers = PowerTowers(screen) vehicles = Vehicles(screen, points) destinations = Destinations(screen) hotels = Hotels(screen) travellers = Travellers(screen) flash = Flash(screen) map = Map( screen=screen, power_towers=power_towers, vehicles=vehicles, destinations=destinations, hotels=hotels, travellers=travellers, ) timer = Timer(screen) level = 0 background_index = 0 done = False
[Plasma(strip2D), 30], [Fire(strip2D), 30], [Fire2(strip2D), 30], [Night(strip2D), 30], [Fade1(strip2D), 3], [Fade2(strip2D), 3], [Stars1(strip2D), 15], [Stars2(strip2D), 10], [Hourglass(strip2D), 30], [Matrix(strip2D), 20], [Power(strip2D), 12], [Weird1(strip2D), 12], [Weird2(strip2D), 12], [Weird3(strip2D), 20], [Lighthouse(strip2D), 10], [Flash(strip2D), 10], ] def globalStop(self): print( "globalStop" ) self.artnet.clear() self.send() strip2D.strip.globalStop = globalStop #count = 0 count = random.randint(0, len(effects) - 1) dowait = False