Skip to content

Instantly share code, notes, and snippets.

Avatar
🌊
Coding physically-based animation software

Rafael Campos jehutymax

🌊
Coding physically-based animation software
  • Rooster Teeth Animation; ICMC-USP
  • Austin, TX
View GitHub Profile
@jehutymax
jehutymax / fd_bvp.py
Created Dec 3, 2019
Approximate u''(x) = sin^2(x/2), 0 < x < 2*Pi with boundary conditions u(0) = 0 and u(2*Pi) = 2*Pi. using: (1) 2nd-order accurate finite-difference approximation; (2) 4th-order accurate finite-difference approximation; (3) 4th-order extrapolation method on two grids; (4) 4th-order deferred correction; - spectral collocation Plot the error as h, …
View fd_bvp.py
import fd.fd_stencil as fd
import numpy as np
import math
import matplotlib.pyplot as plt
"""
Approximate u''(x) = sin^2(x/2), 0 < x < 2*Pi
with boundary conditions u(0) = 0 and u(2*Pi) = 2*Pi.
using:
- 2nd-order accurate finite-difference approximation;
@jehutymax
jehutymax / houdini-selectionToCurvePythonScript.py
Last active May 29, 2018
Houdini Shelf Tool - Transform point selection into a Curve SOP
View houdini-selectionToCurvePythonScript.py
import toolutils
# Works in Houdini 16.5, assumes points are selected inside /obj/geo1.
selection = toolutils.sceneViewer().currentGeometrySelection()
node = selection.nodes()[0]
points = node.geometry().globPoints(selection.mergedSelectionString())
curve = hou.node('/obj/geo1/').createNode('curve')
pstr = ''
for i in range(len(points)):
View TestOpenVDBStaggeredGrid.cpp
struct SillyFunction
{
SillyFunction() {}
Vec3d operator()(const Vec3d& xyz) const
{
return Vec3d(3.0 * xyz.y() + 1.0, 5.0 * xyz.z() + 7.0, -1.0 * xyz.x() - 9.0);
}
};
TEST(Grids, MacGrid)
View TestOpenVDBStaggeredGrid.cpp
struct SillyFunction
{
SillyFunction() {}
Vec3d operator()(const Vec3d& xyz) const
{
return Vec3d(3.0 * xyz.y() + 1.0, 5.0 * xyz.z() + 7.0, -1.0 * xyz.x() - 9.0);
}
};
TEST(Grids, MacGrid)
@jehutymax
jehutymax / guest_hash_generator.py
Created Jun 3, 2016
Create a 4-digit hash code for each guest loaded from a CSV file
View guest_hash_generator.py
import csv
import base64
import hashlib
f = open('guests.csv', "r", encoding='utf-8', errors='ignore')
csv_f = csv.reader(f)
for row in csv_f:
s = ''
for element in row:
s += element
@jehutymax
jehutymax / python-mailgun.py
Created Jun 3, 2016
Send e-mails using Mailgun from a Python script
View python-mailgun.py
import string
import requests
html = 'https://s3.amazonaws.com/.../email.htm'
content = requests.get(html)
DJANGO_MAILGUN_SERVER_NAME = ''
DJANGO_MAILGUN_API_KEY = ''
recipient_list = ['email@one.com', 'email@two.com']
View django-generateDataModel.sh
## This is very Mac-specific, but there are other ways of obtaining the same package
brew install graphviz
pip install pygraphviz
## django-cookiecutter ships with 'django_extensions'
## if not being used, do it manually by
pip install django-extensions
## and in the settings.py config file of your django app,
## 'django_extensions' has to be added.