Skip to content

Instantly share code, notes, and snippets.

@prozacgod
prozacgod / signals.lua
Last active May 30, 2017 16:02
OpenComputers signals low level pull signal, with future schedules pseudo signals, and a threadlet kernel.
local event = require('event')
local uptime = require('computer').uptime
local signals = {
_pullSignal = function(timeout)
return event.pull(timeout)
end
}
local p_events = {}
@prozacgod
prozacgod / test_coroutine5.lua
Created May 24, 2017 03:52
opencomputers coroutine event microkernel
--[[
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:
@prozacgod
prozacgod / index.html
Last active April 27, 2017 13:37
tiled trippy
<html>
<head>
<style>
html, body {
width: 100%;
height: 100%;
}
</style>
</head>
<body background="https://i.imgur.com/HqtEkEl.gifv">
@prozacgod
prozacgod / index.ts
Created March 23, 2017 19:25
What is the typeof a class definition in typescript ?
class UserModel {
constructor(opt) {
if (opt.id) {
}
}
get name() {
return 'Prozacgod'
}
@prozacgod
prozacgod / tablet-monitor.sh
Last active February 11, 2017 18:20
Script to switch a drawing tablet between left and right monitors
#!/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=""
@prozacgod
prozacgod / goscreen
Created January 19, 2017 16:44
very simple screen unique session for linux admin
#!/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`
@prozacgod
prozacgod / index.js
Created November 18, 2016 23:36
dnode example - "Non Trivial"
// 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 = [];
@prozacgod
prozacgod / revPrimes.py
Last active October 13, 2016 13:13
A reddit thread interested me while I wound up my day for work, so I wrote this.
# 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]:
@prozacgod
prozacgod / doc_dump.lua
Created July 24, 2016 17:22
This dumps the documentation from an Open Peripheral device. I couldn't find one quickly so I wrote this. Improvements and formating changes welcome... (maybe an HTML dumper would look nice.)
-- 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])

Keybase proof

I hereby claim:

  • I am prozacgod on github.
  • I am prozacgod (https://keybase.io/prozacgod) on keybase.
  • I have a public key whose fingerprint is 7980 85CD 60DC DF93 0332 4524 6A32 C92C 1592 EF16

To claim this, I am signing this object: