Skip to content

Instantly share code, notes, and snippets.

View NathanSweet's full-sized avatar

Nathan Sweet NathanSweet

View GitHub Profile
public class Evapotranspiration {
static public double calculate ( //
int dayOfYear, // 1-366
double tempMinC, //
double tempMaxC, //
double relativeHumidityMin, //
double relativeHumidityMax, //
double windSpeedAvgMs, // At 2 meters above the ground.
double solarRadiationAvgWM2, //
double albedo, // 0.23 for grass.
@NathanSweet
NathanSweet / Play.java
Last active February 18, 2016 03:39
Sync a WAV with Spine playback
// See: http://esotericsoftware.com/forum/Spine-Plugin-in-Support-5859
import java.io.*;
import java.net.Socket;
import javax.sound.sampled.*;
public class Play {
static public void main (String[] args) throws Exception {
if (args.length != 2) {
@NathanSweet
NathanSweet / Reddit_Highlight_New_Comments.user.js
Created December 4, 2015 14:29
Highlight new Reddit comments with this GreaseMonkey user script.
// ==UserScript==
// @name Reddit: Highlight New Comments v3
// @description Highlights comments on Reddit that are new since your last visit.
// @author Chris H (Zren / Shade), Nathan Sweet
// @icon https://reddit.com/favicon.ico
// @namespace http://xshade.ca
// @version 1
// @include /https?:\/\/((www|pay|[a-z]{2})\.)?reddit\.com\/r\/[a-zA-Z0-9]+\/comments\/.*/
// @grant GM_addStyle
// ==/UserScript==
@NathanSweet
NathanSweet / Gimp-gimp_spine.py
Last active February 8, 2018 13:44
Gimp script to export to Esoteric Software's Spine: http://esotericsoftware.com/
Please note this script has moved: https://github.com/EsotericSoftware/spine-scripts
@NathanSweet
NathanSweet / Illustrator-LayersToPNG.jsx
Last active October 15, 2018 06:53
Adobe Illustrator script to export to Esoteric Software's Spine: http://esotericsoftware.com/
Please note this script has moved: https://github.com/EsotericSoftware/spine-scripts
@NathanSweet
NathanSweet / Photoshop-LayersToPNG.jsx
Last active November 7, 2023 04:09
Adobe Photoshop script to export to Esoteric Software's Spine: http://esotericsoftware.com/
Please note this script has moved: https://github.com/EsotericSoftware/spine-scripts
@NathanSweet
NathanSweet / code.css
Last active August 29, 2015 14:02
Generic language syntax highlighting for Hyperlight, which is a PHP-based syntax highlighter: http://code.google.com/p/hyperlight/ Tested with: Java, C#, JavaScript, AS3, C, C++, Lua
.code {
font-family: Consolas, 'Lucida Console', monospace;
font-size: 85%;
line-height: 1.5em;
color: #000;
border: 1px solid #DBDBDB;
padding: 0.5em;
margin-bottom: 1.25em;
white-space: nowrap;
max-height: 600px;
@NathanSweet
NathanSweet / astar for libgdx
Last active October 4, 2024 21:43
A* for libgdx that is simple but optimized, includes runnable demo. Uses a binary heap for the open list. Nodes are cached in a PathNode[], which is also used to make finding a node in the open list fast. A "run id" is used to avoid needing to clear the nodes for a new run.
// A* for libgdx that is simple but optimized.
package test;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
@NathanSweet
NathanSweet / svn-to-git
Last active June 6, 2018 10:38
Migrates multiple SVN repos to Git, without anything fancy (no Ruby, no dependencies, no issues with Cygwin paths). Works with GitHub or any Git repo.
Migrates multiple SVN repos to Git, without anything fancy (no Ruby, no dependencies, no issues
with Cygwin paths). SVN tags are created as Git tags and properly pushed to the Git repo. To run:
1) Edit run-authors.sh to have your SVN repos. Run it to get an authors.txt file.
2) Edit the authors.txt to have the names and emails if you like. You must use GitHub user email
addresses if you want contributions to be associated with GitHub accounts.
3) Edit run-convert.sh to have your SVN repos and project name (for local temp directories). Run it.