Skip to content

Instantly share code, notes, and snippets.

Daniel Vasquez danvas

Block or report user

Report or block danvas

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
View linearRegression.go
// Statistics refresher: The R-squared formula
// Time complexity: O(3n)
package main
import "fmt"
type Point struct {
x, y float64
}
View keybase.md

Keybase proof

I hereby claim:

  • I am danvas on github.
  • I am danvas (https://keybase.io/danvas) on keybase.
  • I have a public key ASDUr9SFP2AJGFF3T7W__gbPSeHP8C5syP_Y0ZixtY0eAwo

To claim this, I am signing this object:

@danvas
danvas / Complex.cpp
Created Nov 22, 2011
Member-function definitions for class Complex.
View Complex.cpp
// Assignment 8: Complex.cpp
// Member-function definitions for class Complex.
// Author: Daniel Vasquez
// Date: Nov. 24th, 2011
#include "Complex.h"
// Default constructor
Complex::Complex( )
View maze1.1.cpp
// Assignment 07: maze.cpp
// Program that raverses mazes on a right-hand rule basis.
// Author: Daniel Vasquez
// Date: Nov. 17th, 2011
#include <iostream>
using std::cin;
using std::cout;
enum Direction { DOWN, RIGHT, UP, LEFT };
View Ex08_25.cpp
// Exercise 8.25 Solution: Ex08_25.cpp
// This solution assumes that there is only one
// entrance and at most one exit for a given maze, and
// these are the only two zeroes (at most) on the borders.
// NOTE: Your solution should work for all 3 test mazes below
#include <iostream>
using std::cin;
using std::cout;
@danvas
danvas / ex05_11.cpp
Created Oct 13, 2011
C++ code that calculates compound interests. (Exercise from Deitel & Deitel)
View ex05_11.cpp
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
for (int interest = 5; interest <=10; interest++)
{
double amount = 1000.00;
@danvas
danvas / hlCopyAttr.py
Created Oct 13, 2011
PyMel function that copies the value(s) of the attribute from sourceObj to targetObj. Handles multi-attributes.
View hlCopyAttr.py
import pymel.core as pm
sourceObj = pm.ls('aFluidShape')[0]
targetObj = pm.ls('myFluidShape')[0]
def hlCopyAttr(sourceObj, targetObj, attribute):
"""Copies the value(s) of the attribute from sourceObj to targetObj. Handles multi-attributes."""
if pm.attributeQuery(attribute, node = targetObj.name(), exists=True): # Execute only if the entered attribute exists
multiAttrCheck = pm.attributeQuery(attribute, node=targetObj.name(), m=1) # Check if it's a multi-attribute or not
if multiAttrCheck: # If the attribute is a multi-attribute, copy the values from each instance
@danvas
danvas / vect.py
Created Sep 16, 2011
To find vector between curve points.
View vect.py
def vect(curv, pt2 = 1, pt1 = 0):
"""Returns a vector from two cvs on a curve. The argument curv is a PyMEL instance or string. For example:\vect('curve1', pt2 = 5, pt1 = 2) gives you a direction (i.e. vector) from cv[2] to cv[5] in curve1"""
if type(curv) == str:
curv = pm.ls(curv)[0]
if curv.getShape().numCVs() <= pt2:
print('\n!! There are {0} cvs. Make sure your pt2 value is less than {0}. !!'.format(curv.getShape().numCVs()))
else:
return [curv.cv[pt2].getPosition()[0] - curv.cv[pt1].getPosition()[0],
View curvesFromParticles.py
import pymel.core as pm
def getCurves(tstep, deg=3):
"""Generate cv curves from particle paths.
Sample the path every tstep in the current time range and generate curve with degree deg.
Before executing, select particle in object mode (i.e. curves from all points) or component mode (i.e. curves from selected points)."""
global curvesData #FIX! I hate this global variable... find other way to collect data
curvesData = {}
tmin = int(pm.playbackOptions(q=1, min=1))
tmax = int(pm.playbackOptions(q=1, max=1))
View cacheCloud090.py
"""
*** Cache Cloud ***
Version 0.9.0
by Daniel Vasquez
Updated: August 12, 2011
Email: dan@heylight.com
Web: heylight.com
Description:
Python script that creates Maya Particle Disk Cache (PDC) files from a sequence of point cloud data, and also gives you the choice of importing a single point cloud. It could be useful with all the open source data being released from Kinect hacks or 3D scanners. You can start by playing around with Radiohead's House Of Cards data: http://code.google.com/p/radiohead/downloads/list
You can’t perform that action at this time.