Skip to content

Instantly share code, notes, and snippets.

@balaam
balaam / stats.lua
Last active September 2, 2015 04:09
Stats
mBase =
{
body = 4,
mind = 5,
vitality = function(stats)
local bodyWeighting = 0.5
local mindWeight = 0.1
return stats:Get("body") * bodyWeighting + stats:Get("mind") * mindWeight
end,
hp_max = function(stats)
@balaam
balaam / pick_sketch.lua
Last active March 20, 2016 10:29
Quick code sketch for picking from six cards
function shuffle(t)
local n = #t
while n > 2 do
local k = math.random(n)
t[n], t[k] = t[k], t[n]
n = n - 1
end
return t
end
#!/opt/local/bin/lua
--
-- Simple parser
--
if not arg[1] then
print "Need a filename as an argument."
return
end
@balaam
balaam / Watch.lua
Created October 4, 2016 07:45
A Lua project for Dinodeck that lets the user explore the global memory space
Watch = {}
Watch.__index = Watch
function Watch:Create()
local this =
{
key = {},
keyRoot =
{
id = "_G",
cursor = 1,
@balaam
balaam / gist:5e03065b4ec0dcda60fab7aa1a45229f
Created December 16, 2017 10:41
My horrible hacking of the quick tag anki plugin
# Quick Tagging is an anki2 addon for quickly adding tags while reviewing
# Copyright 2012 Cayenne Boyer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@balaam
balaam / gist:8c4bfe0c716bda03222c7669f5dcf905
Created March 2, 2018 10:14
Instance Helper for Scriptable Objects
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
using UnityEditor;
public class ScriptableObjectInstanceHelper
{
[MenuItem ("Assets/Create Instance", false, 0)]
private static void CreateInstance ()
# import the main window object (mw) from aqt
# from the anki tutorial: https://apps.ankiweb.net/docs/addons.html
from aqt import mw
# import the "show info" tool from utils.py
from aqt.utils import showInfo, getTag, tooltip
# import all of the Qt GUI library
from aqt.qt import *
from aqt.reviewer import Reviewer
using System;
using System.Collections;
using System.Collections.Generic;
class MainClass {
public static void PrintList<T>(List<T> l)
{
for (int i = l.Count - 1; i >= 0 ; i--)
using System;
using System.Collections.Generic;
public class Program
{
enum eStat
{
HPNow,
HPMax,
alias night="pmset displaysleepnow && osascript -e \"set volume output volume 34\""