- GitHub actions config
name: Deploy
on:
push:
function setRotation(node, angle){ | |
let { x, y, width, height, rotation } = node; | |
const theta = angle * (Math.PI / 180); | |
const originTheta = rotation * (Math.PI / 180); | |
const centerX = x + width / 2; | |
const centerY = y + height / 2; | |
const originX = (-Math.cos(originTheta) * x + y * -Math.sin(originTheta) - centerY * -Math.sin(originTheta) - centerX * -Math.cos(originTheta) + centerX) - width; |
get_available_port(){ | |
port=$1 | |
taken=$((echo > /dev/tcp/localhost/$port) &> /dev/null && echo 0 || echo 1) | |
if [ $taken -eq 1 ]; then | |
echo $port | |
else | |
get_available_port $((port + 1)) | |
fi | |
} |
forward_port_80_to(){ | |
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port $1 | |
sudo iptables -t nat -S PREROUTING | grep 'dport 80' | grep -v $1 | sed s/-A/-D/ | while read -r delete_rule; do | |
sudo iptables -t nat $delete_rule | |
done | |
} |
function onDocumentClick(){ | |
const start = performance.now(); | |
runAfterFramePaint(() => { | |
const end = performance.now(); | |
console.log(`Time to paint: ${end - start}ms`); | |
}); | |
} | |
function onDocumentKeyDown(event: KeyboardEvent){ |
(function() {var video; document.querySelectorAll('video').forEach(function(vid) { if (!vid.paused) video = vid; }); if (video) { video.webkitSetPresentationMode('picture-in-picture') } })() |