Skip to content

Instantly share code, notes, and snippets.

View luan007's full-sized avatar
🧹
part-time house cleaner

Mike Luan luan007

🧹
part-time house cleaner
View GitHub Profile
@luan007
luan007 / fakeAudio-p5.js
Created March 22, 2019 05:08
Visual Sketches
var tm = 0;
function drawAudio() {
tm += 0.01;
p.push();
p.translate(1920 / 2, 1080 - 150);
var w = 8;
p.stroke(255);
for (var x = -50; x <= 50; x++) {
@luan007
luan007 / boilerplate.js
Created February 13, 2019 14:01
[Vue Stuff]
import "./main.less"
import Vue from 'vue'
import "./markdown.less";
// import root from "./root.vue";
window.sharedData = {
env: window["env"] || {}
};
for (var i in q) {
@luan007
luan007 / commando.js
Last active December 10, 2018 08:44
[Arduino.LibTinyEV] EventLoop - starting point for motor projects, WIP #arduino #ev
const TEST = false;
const SERIAL = "/dev/tty.usbmodem1411";
const BAUD = 115200;
const LOG_RAW_DATA = false;
const LOG_OUTGOING = true;
const LOG_INCOMING = true;
const LOG_INCOMING_STR = false;
const rl = require('readline');
var _if = rl.createInterface(process.stdin, process.stdout);
@luan007
luan007 / intel-multi-screens-fpga.ino
Last active December 10, 2018 08:40
[Arduino.CompletedItems] project controllers
#include "FastLED.h"
#define RECT_LEN 58
#define RING 45
#define CENTER 40
#define RING_TOTAL RING+CENTER
CRGB RECT_LEDS[RECT_LEN];
CRGB RING_LEDS[RING_TOTAL];
CRGB RECT_LEDS_BUF[RECT_LEN];
@luan007
luan007 / fast_encoder.ino
Last active December 3, 2018 11:08
[Arduino.BuildingBlocks] encoders and so on
#define ENCODER_A_PIN 2
#define ENCODER_B_PIN 3
#define SEND_INTERVAL 100
volatile long deltaPos;
volatile bool change = false;
long last_send = 0;
void read_quadrature() {
@luan007
luan007 / adaptive_mag_to_heading.cs
Created November 30, 2018 09:47
[Calculations]
private float maxx = 0f;
private float minx = 0f;
private float maxy = 0f;
private float miny = 0f;
//https://github.com/dthain/QMC5883L/blob/master/QMC5883L.cpp
float heading(float x, float y, float z)
{
maxx = x > maxx ? x : maxx;
@luan007
luan007 / how-to.md
Last active November 29, 2018 11:18
[Unity.WindowAccrossMonitors] as-is

run.bat

Code:

Intel_Boxes.exe -popupwindow 

unity

@luan007
luan007 / frag.glsl
Created November 27, 2018 09:33
[THREE.CustomPointShader] Custom point shader sample here #shader #three
uniform vec3 color;
// uniform sampler2D texture;
varying float vLight;
varying float vBoost;
varying vec2 vUv;
void main() {
// vec2 lightness = (gl_PointCoord - 0.5) * 10.0;
// float lt = max(0.0, 1.0 - sqrt((lightness.x * lightness.x) + (lightness.y * lightness.y)));
// vec3 c = vec3(pow(lt, 3.0), pow(lt, 4.0), pow(lt, 6.0));
@luan007
luan007 / updatable.js
Last active November 27, 2018 09:02
[JS.RenderLoop] stuff like updatable & easer
//tiny updatez
const PRECISION = 0.01;
var deltaT = 0;
export function ease(f, t, sp, precision) {
precision = precision || PRECISION;
if (Math.abs(f - t) < precision) {
return t;
}
return f + (t - f) * sp * deltaT;
@luan007
luan007 / Billboard.cs
Last active November 30, 2018 03:21
[Unity.Snippets] random stuff, often used during testing =
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//Rotating Billboard for Cube
public class Billboard : MonoBehaviour
{
Camera m_Camera;
void Start()