This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Dump open peripheral documentation to a file. | |
| local args = {...} | |
| if #args ~= 2 then | |
| print ("doc_dump <side> <file>") | |
| return | |
| end | |
| local perf = peripheral.wrap(args[1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # inspired by this post, an a general curiousity... | |
| # https://www.reddit.com/r/math/comments/578drx/i_believe_ive_found_something_very_interesting/ | |
| # it seems that reverse binary primes actually get rarer the further you get | |
| # http://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n/3035188#3035188 | |
| def primes(n): | |
| """ Returns a list of primes < n """ | |
| sieve = [True] * (n/2) | |
| for i in xrange(3,int(n**0.5)+1,2): | |
| if sieve[i/2]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // this is a somewhat non-trivial dnode example setup | |
| // the idea here is to provide example of unified communication for client and server to be able to | |
| // communicate against their api's within scope of each other's functions. | |
| // the server can request of the client/ client of server and ... even deeper chains if required. | |
| // | |
| var dnode = require("dnode"); | |
| var clients = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SCREEN='/usr/bin/screen' | |
| if [ $# -eq 0 ]; then | |
| echo "goscreen <session filter>" | |
| exit 1 | |
| fi | |
| PID=`$SCREEN -ls | grep $1 | cut -d. -f1` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| right="0.5 0 0.5 0 1 0 0 0 1" | |
| left="0.5 0 0 0 1 0 0 0 1" | |
| id=`xinput | grep "PenTablet Pen" | cut -d= -f2 | cut -d\[ -f1` | |
| side="$1" | |
| matrix="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class UserModel { | |
| constructor(opt) { | |
| if (opt.id) { | |
| } | |
| } | |
| get name() { | |
| return 'Prozacgod' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <style> | |
| html, body { | |
| width: 100%; | |
| height: 100%; | |
| } | |
| </style> | |
| </head> | |
| <body background="https://i.imgur.com/HqtEkEl.gifv"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --[[ | |
| Establishing ground: | |
| write a generic coroutine kernel loop, event requests pass back to the main | |
| control loop | |
| also lets write 2 coroutines, and manage a list of them | |
| RESULT: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local event = require('event') | |
| local uptime = require('computer').uptime | |
| local signals = { | |
| _pullSignal = function(timeout) | |
| return event.pull(timeout) | |
| end | |
| } | |
| local p_events = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface EventEmitterHandlers { | |
| [s: string]: IAction1<any>[]; | |
| } | |
| class EventEmitter { | |
| private events: EventEmitterHandlers = {}; | |
| on(event: string, listener: IAction1<any>) { | |
| !(event in this.events) && this.events[event] = []; | |
| this.events[event].push(listener); |