Skip to content

Instantly share code, notes, and snippets.

Andrew Fray tenpn

Block or report user

Report or block tenpn

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
@tenpn
tenpn / execute-shell-command-on-buffer
Created Apr 12, 2012
emacs function to execute a shell command with the current buffer filename as an argument
View execute-shell-command-on-buffer
;; eg when in a text file, (execute-shell-command-on-buffer "p4 edit %s") will check out the file in perforce
(defun execute-shell-command-on-buffer (shell-command-text)
(interactive "MShell command:")
(shell-command (format shell-command-text (shell-quote-argument buffer-file-name)))
)
@tenpn
tenpn / CustomSingleContextFactory.cs
Created Nov 22, 2017
fixed CustomSingleContextFactory
View CustomSingleContextFactory.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TenPN.DecisionFlex;
using System;
public class CustomSingleContextFactory : SingleContextFactory
{
public override IContext SingleContext(Logging loggingSetting)
View NewTree.yaml
tree:
model: special_treasure
harvestable:
for: players
reward: coins
canBeDepletedPerPlayer:
health: 1
View NewFisherman.yaml
npc_fisherman_recipe:
model: npc_fisherman
needsToBeCrafted:
recipe:
- [biome2_plant_ingredient, 2]
replacedBy: npc_fisherman
isAnNPC:
clickSpeech: NPCCrafting_npc_fisherman
@tenpn
tenpn / SymbolicationEnabler.cs
Last active Jan 11, 2016 — forked from capyvara/gist:5230032
SymolicationEnabler unity post-processor
View SymbolicationEnabler.cs
/*
The MIT License (MIT)
Copyright (c) 2014 Andrew Fray, Marcelo Oliveira
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@tenpn
tenpn / MersenneTwister.cs
Last active Dec 25, 2015
A C# Mersenne Twister that is serialisable. A bitch of a copyright field.
View MersenneTwister.cs
/////////////////////////////////////////////////////////////////////////////
// C# Version Copyright (c) 2003 CenterSpace Software, LLC //
// & Spry Fox LLC (c) 2013 //
// //
// This code is free software under the Artistic license. //
// //
// CenterSpace Software //
// 2098 NW Myrtlewood Way //
// Corvallis, Oregon, 97330 //
// USA //
@tenpn
tenpn / oldmergedbranches.ps1
Created Oct 9, 2012
a very powershell-y way of getting the most unused git branches. makes an object with properties and sorts it.
View oldmergedbranches.ps1
git branch -r --merged develop | %{$_.trim()} | select @{n='Branch';e={$_}},@{n='LastCommit';e={[datetime](git log $_ -1 --pretty=format:%ci)}} | sort LastCommit
@tenpn
tenpn / mergedoldbranches.ps1
Created Oct 9, 2012
Powershell to find oldest fully-merged branches
View mergedoldbranches.ps1
git branch -r --merged develop | %{$_ + " : " + (git log $_.Trim() -1 --pretty=format:%ct)} | sort {$_.Split(':')[1]}
@tenpn
tenpn / unusedgitremotebranches.sh
Created Oct 8, 2012
a bash script to list unused remote branches
View unusedgitremotebranches.sh
for branch in `git branch -r --merged develop`; do
echo $branch `git log $branch -1 --pretty=format:%ct`
done | sort -k2
@tenpn
tenpn / MapValue.cs
Created Jul 26, 2012
MapValue() takes an input in one range and remaps it to another. Very useful for AI and scripting.
View MapValue.cs
public static float MapValue(float inVal, float inFrom, float inTo, float outFrom, float outTo)
{
float inScale = (inFrom != inTo)
? ( ( inVal - inFrom ) / ( inTo - inFrom ) )
: 0.0f;
float outVal = outFrom + ( inScale * ( outTo - outFrom ) );
outVal = (outFrom < outTo )
? SomeClampFunction( outVal, outFrom, outTo )
: SomeClampFunction( outVal, outTo, outFrom );
return outVal;
You can’t perform that action at this time.