Skip to content

Instantly share code, notes, and snippets.

Irene Alvarado irealva

Block or report user

Report or block irealva

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@irealva
irealva / addTwitterFollowingToList.js
Created Dec 16, 2017
Add all the Twitter users you are following to a Twitter list.
View addTwitterFollowingToList.js
/*
Author: Irene Alvarado
Description: Add all the Twitter users you are following to a Twitter list.
Useful if using services such as TweetDeck to search only through people you are following
To run: first install twit through node `npm install twit`, then run `node addTwitterFollowingToList.js`
Change your API keys and list configurations where the comments say TODO.
Note about API limits: Twitter sets limits for how many users you can add to a list within 12 hours.
@irealva
irealva / moveMirrorCosineDistance.js
Created Jul 18, 2018
Gist for Move Mirror blog post: cosine distance
View moveMirrorCosineDistance.js
// Great npm package for computing cosine similarity
const similarity = require('compute-cosine-similarity');
// Cosine similarity as a distance function. The lower the number, the closer // the match
// poseVector1 and poseVector2 are a L2 normalized 34-float vectors (17 keypoints each
// with an x and y. 17 * 2 = 32)
function cosineDistanceMatching(poseVector1, poseVector2) {
let cosineSimilarity = similarity(poseVector1, poseVector2);
let distance = 2 * (1 - cosineSimilarity);
return Math.sqrt(distance);
@irealva
irealva / moveMirrorVPTree.js
Last active Apr 8, 2019
Gist for Move Mirror blog post: vp tree
View moveMirrorVPTree.js
const similarity = require('compute-cosine-similarity');
const VPTreeFactory = require('vptree');
const poseData = [ […], […], […], …] // an array with all the images’ pose data
let vptree ; // where we’ll store a reference to our vptree
// Function from the previous section covering cosine distance
function cosineDistanceMatching(poseVector1, poseVector2) {
let cosineSimilarity = similarity(poseVector1, poseVector2);
let distance = 2 * (1 - cosineSimilarity);
@irealva
irealva / moveMirrorWeightedDistance.js
Created Jul 18, 2018
Gist for Move Mirror blog post: weighted distance
View moveMirrorWeightedDistance.js
// poseVector1 and poseVector2 are 52-float vectors composed of:
// Values 0-33: are x,y coordinates for 17 body parts in alphabetical order
// Values 34-51: are confidence values for each of the 17 body parts in alphabetical order
// Value 51: A sum of all the confidence values
// Again the lower the number, the closer the distance
function weightedDistanceMatching(poseVector1, poseVector2) {
let vector1PoseXY = poseVector1.slice(0, 34);
let vector1Confidences = poseVector1.slice(34, 51);
let vector1ConfidenceSum = poseVector1.slice(51, 52);
You can’t perform that action at this time.