Skip to content

Instantly share code, notes, and snippets.

hello

@neftaly
neftaly / castShapeDown.js
Last active May 7, 2023 05:59
react-three-rapier scene query
import { Quaternion, Euler } from 'three'
// Reusuable objects to save on GC
const quaternion = new Quaternion()
const euler = new Euler()
// TODO: Do we need to do this or will Rapier just accept a Three quaternion?
const rotationToQuaternion = (rotation) => {
const { w, x, y, z } = quaternion.setFromEuler(euler.set(...rotation))
return { w, x, y, z }
@neftaly
neftaly / gist:55a0b569169a08b4500357ea7dca9abf
Created February 16, 2022 04:56
AXIS M7011 firmware v5.90.1 (10/2015)
AXIS M7011 firmware v5.90.1 (10/2015)
https://drive.google.com/file/d/1KCPKUMBI9H7JoiBssCY9Fnxe6oRkdFwP/view?usp=drive_web
@neftaly
neftaly / MapCamera.jsx
Last active February 19, 2023 08:40
react-three-fiber declarative map controls
import { useEffect, useRef } from 'react'
import { useThree } from '@react-three/fiber'
import { PerspectiveCamera } from '@react-three/drei'
import useCamera from './useCamera'
// Camera bound to origin/coords state
const MapCamera = props => {
const invalidate = useThree(s => s.invalidate)
const groupRef = useRef()
const cameraRef = useRef()
@neftaly
neftaly / ControlRig.jsx
Created July 9, 2020 03:45
rstream-gestures multitouch with react
import React, { useEffect } from 'react'
import { useThree } from 'react-three-fiber'
import { GestureType, gestureStream } from '@thi.ng/rstream-gestures'
import { map } from '@thi.ng/transducers'
import { tryCatch } from 'ramda'
// Calculate the difference between 2 [x,y] vectors
const calcDelta = (key, a, b) => [a[key][0] - b[key][0], a[key][1] - b[key][1]]
// Calculate the angle and distance between 2 pointers
@neftaly
neftaly / index.js
Created February 24, 2020 07:17
meiosis + flyd + immutable
import React, { memo } from 'react';
import { render } from 'react-dom';
import { stream, scan } from 'flyd';
import { fromJS } from 'immutable';
const Box = memo(props => {
const { id, value } = props;
// Show re-renders by changing bg color
const color = Math.round(Math.random() * 1000);
return (
@neftaly
neftaly / README.md
Last active September 1, 2021 17:16
GitHub actions: Build node package & upload ./dist to S3 bucket

This is a simple CI/CD config for Github Actions. Hopefully it saves you some time. It runs npm run build, then overwrites a folder in a s3 bucket with the local dist folder.

I have not thoroughly tested the module cache system (.npm instead of node_modules).

This guide is licensed under CC0 (public domain).

Steps

  1. Add .github/workflows/deploy-to-s3.yml to your repo
@neftaly
neftaly / cyberpunk2077-ssh.md
Created June 10, 2019 03:36
Cyberpunk 2077 internal-cdprojektred.com SSH session
neftaly@nef-w10:~$ ssh samurai@internal-cdprojektred.com -p 2020
samurai@internal-cdprojektred.com's password:
WhenItsReady

 ___________  ____________ _____   ___ _____ _   _______  ______ ___________
/  __ \  _  \ | ___ \ ___ \  _  | |_  |  ___| | / /_   _| | ___ \  ___|  _  \
| /  \/ | | | | |_/ / |_/ / | | |   | | |__ | |/ /  | |   | |_/ / |__ | | | |
| |   | | | | |  __/|    /| | | |   | |  __||    \  | |   |    /|  __|| | | |
| \__/\ |/ /  | |   | |\ \\ \_/ /\__/ / |___| |\  \ | |   | |\ \| |___| |/ /
#include <FastLED.h>
#define DATA_PIN 5
#define LED_TYPE WS2812
#define COLOR_ORDER GRB
#define NUM_LEDS 480
CRGB leds[NUM_LEDS];
int pos = 0;
@neftaly
neftaly / i3-laptop
Last active February 22, 2021 03:36
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8