I hereby claim:
- I am addam on github.
- I am addaddam (https://keybase.io/addaddam) on keybase.
- I have a public key whose fingerprint is 796C 5FBD 3DA7 2B1F BBF5 CF8C E999 6060 AB12 D85C
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
class Barrier { | |
constructor() { | |
this.time = 0 | |
this.state = 0 | |
} | |
start() { | |
return ++this.time | |
} |
vec4 world() { | |
vec4 ndc = vec4( | |
2.0 * (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw - 1.0, | |
(czm_readDepth(depthTexture, v_textureCoordinates) - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2], | |
1.0); | |
vec4 eye = czm_inverseProjection * ndc; | |
return czm_inverseView * eye; | |
} |
template<typename It, typename OutIt, typename UnaryPredicate> | |
It move_if(It begin, It end, OutIt dst, UnaryPredicate pred) | |
{ | |
It last = end; | |
while (begin != last) { | |
if (pred(*begin)) { | |
*dst++ = std::move(*begin); | |
std::swap(*begin, *(--last)); | |
} else { | |
++begin; |
from functools import partial | |
class printer: | |
def __init__(self, *args): | |
self.args = args | |
def __enter__(self): | |
self.f = open(*self.args) | |
return partial(print, file=self.f) | |
def __exit__(self, *args): | |
self.f.__exit__(*args) |
#!/usr/bin/python3 | |
import cv2 | |
import numpy | |
import pyautogui | |
# usage: | |
# after launch, a shot from the camera appears. | |
# mark four corners of the projector by clicking in order: top left, bottom left, bottom right, top right | |
# the program moves mouse when it sees the laser pointer on-screen | |
# the program never exits (you have to kill it) |
#!/usr/bin/python3 | |
import cv2 as cv | |
import dlib | |
from threading import Thread | |
import time | |
pose_model = dlib.shape_predictor("/usr/share/dlib/shape_predictor_68_face_landmarks.dat") | |
detector = dlib.get_frontal_face_detector() | |
def camera(source): |
<html> | |
<head> | |
<title>X3D Viewer</title> | |
<script type='text/javascript' src='http://www.x3dom.org/download/x3dom.js'> </script> | |
<style> | |
canvas { | |
border: 1px solid gray; | |
} | |
</style> | |
</head> |
function tryIndent(event) { | |
if (event.code != "Tab") { | |
return; | |
} | |
event.preventDefault(); | |
var text = event.target; | |
var start = Math.max(text.value.lastIndexOf("\n", text.selectionStart - 1), 0); | |
var end = text.selectionEnd; | |
var str = text.value.slice(start, end); | |
var origLength = str.length; |
#!/usr/bin/python3 | |
import asyncio | |
import asyncpg | |
from time import time | |
try: | |
import uvloop | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) | |
except: | |
pass # it will just be slower, no harm done |