Skip to content

Instantly share code, notes, and snippets.

View danvas's full-sized avatar

Daniel Vasquez danvas

View GitHub Profile
@danvas
danvas / README.md
Last active November 28, 2023 20:22
Signing AWS API requests

Signing AWS API requests

Implentation of calculating a signature for signing AWS API requests. Specifically, this script invalidates all files (/*) in a Cloudfront distribution via a signed API request.

To run it, edit the .sh file by settting AWS_ACCESS_KEY, AWS_SECRET_KEY, and DISTRIBUTION_ID with your values, and source the file in a shell:

source signedAWSRequest.sh
@danvas
danvas / README.md
Last active November 28, 2023 20:20
Authorization code flow with PKCE
// Statistics refresher: The R-squared formula
// Time complexity: O(3n)
package main
import "fmt"
type Point struct {
x, y float64
}

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 November 22, 2011 02:30
Member-function definitions for class Complex.
// Assignment 8: Complex.cpp
// Member-function definitions for class Complex.
// Author: Daniel Vasquez
// Date: Nov. 24th, 2011
#include "Complex.h"
// Default constructor
Complex::Complex( )
@danvas
danvas / maze1.1.cpp
Created November 17, 2011 23:41
maze
// 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 };
@danvas
danvas / Ex08_25.cpp
Created November 17, 2011 04:27
A maze!
// 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 October 13, 2011 21:10
C++ code that calculates compound interests. (Exercise from Deitel & Deitel)
#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 October 13, 2011 05:59
PyMel function that copies the value(s) of the attribute from sourceObj to targetObj. Handles multi-attributes.
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 September 16, 2011 21:20
To find vector between curve points.
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],