Skip to content

Instantly share code, notes, and snippets.

View JT5D's full-sized avatar
💭
Multiversing...

JT5D JT5D

💭
Multiversing...
View GitHub Profile
@JT5D
JT5D / index.html
Created February 1, 2023 19:05
MediaPipe - Pose
<body>
<style>
.square-box {
width: 33%;
height: 0;
padding-top: 33%;
position: absolute;
right: 20px;
top: 20px;
}
@JT5D
JT5D / index.html
Created February 1, 2023 19:03
MediaPipe - Holistic
<div class="container">
<video class="input_video"></video>
<div class="canvas-container">
<canvas class="output_canvas" width="1280px" height="720px">
</canvas>
</div>
<div class="loading">
<div class="spinner"></div>
<div class="message">
Loading
@JT5D
JT5D / umap_sparse.py
Created March 30, 2021 09:43 — forked from johnhw/umap_sparse.py
1 million prime UMAP layout
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@JT5D
JT5D / Shannon-Entropy.js
Created April 10, 2020 03:54
Calculate the entropy of a string by determining the frequency of each character, then summing each character's probability multiplied by the log base 2 of that same probability, taking the negative of the sum.
// Shannon entropy in bits per symbol.
function entropy(str) {
const len = str.length
// Build a frequency map from the string.
const frequencies = Array.from(str)
.reduce((freq, c) => (freq[c] = (freq[c] || 0) + 1) && freq, {})
// Sum the frequency of each character.
return Object.values(frequencies)
@JT5D
JT5D / FFmpeg-batch-convert-wavs-to-mp3s.sh
Created February 27, 2017 05:57
Script + FFmpeg command to batch-convert directory of WAVs to MP3s
#!/bin/bash
for f in *.wav; do ffmpeg -i "$f" -ab 320k "${f%.wav}.mp3"; done
#run this script on an scheduled cron job or from the command line.
#to run this script from the command line, open your terminal & cd into your folder of WAVs like so: 'cd myfolder'. hit return.
#now type 'sh FFmpeg-batch-convert-wavs-to-mp3s.sh'. hit return to run the script & watch the magic.
#all converted MP3s will be placed in the same directory as the original WAVs.
@JT5D
JT5D / circle_detection.py
Created February 9, 2017 04:41 — forked from martinsik/circle_detection.py
Circle detection with OpenCV 3.0
import cv2
import time
import math
import numpy as np
capture = cv2.VideoCapture(0)
print capture.get(cv2.CAP_PROP_FPS)
t = 100
w = 640.0
@JT5D
JT5D / GDocService.cs
Created September 9, 2016 08:57 — forked from radiatoryang/GDocService.cs
Fetches a public Google Spreadsheet in Unity. (Doesn't work in Webplayer due to the security sandbox.)
// To prepare a Google Spreadsheet for this:
// make sure the spreadsheet has been published to web (FILE >> PUBLISH TO WEB), which is NOT the same as sharing to web
// To use in a different script:
// 1) include "using Google.GData.Client;"
// 2) include "using Google.GData.Spreadsheets;"
// 3) call "GDocService.GetSpreadsheet( string spreadsheetKey );", see DebugTest section for sample usage
using UnityEngine;
using System.Collections;
@JT5D
JT5D / VRUtility.cs
Created September 9, 2016 08:56 — forked from radiatoryang/VRUtility.cs
a script I give to my Unity VR students that demonstrates a few useful "quality of VR" features for their games -- lowering visual quality for higher framerate, and HMD recentering
using UnityEngine;
using System.Collections;
using UnityEngine.VR; // you always need this to use special VR functions
public class VRUtility : MonoBehaviour {
// Use this for initialization
public void Start () {
// set render quality to 50%, sacrificing visual quality for higher FPS
@JT5D
JT5D / 3d-multiverse-visualization.markdown
Created August 22, 2016 01:49
3D Multiverse Visualization
@JT5D
JT5D / Shield_on_off_hello.ino
Created August 16, 2016 06:11 — forked from aurman/Shield_on_off_hello.ino
Arduino On Off Hello
//*****************************************************************************
/// @file
/// @brief
/// Arduino SmartThings Shield LED Example
//*****************************************************************************
#include <SoftwareSerial.h> //TODO need to set due to some weird wire language linker, should we absorb this whole library into smartthings
#include <SmartThings.h>
#define PIN_THING_RX 3