Skip to content

Instantly share code, notes, and snippets.

View adrianseeley's full-sized avatar

Adrian Seeley adrianseeley

  • Adrian Seeley
  • Canada
View GitHub Profile
@adrianseeley
adrianseeley / reforce1.lua
Created May 16, 2015 14:15
Reforce 1, mario laps, exponentially slower to cover new ground
function tablelength(T)
local count = 0
for _ in pairs(T) do
count = count + 1
end
return count
end
@adrianseeley
adrianseeley / pippy.js
Created May 4, 2015 12:25
Pippy.js: Quote Tracker (NodeJS + SQLite3 + Forex)
var request = require('request');
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('fx.db');
var heartbeat = 10000;
function parse_quote (str) {
var quote = [];
var lines = str.split('\n');
for (var line_idx = 0; line_idx < lines.length; line_idx++) {
var line = lines[line_idx];
@adrianseeley
adrianseeley / LTTBD.cs
Created May 3, 2015 13:22
Largest-Triangle-Three Bucket Downsampling Graphs in C# (For an Array of Floats) http://i.imgur.com/UwhvV45.png
public float[] Downsample(float[] array, int Length)
{
int insert = 0;
float[] window = new float[Length];
float[] window_x = new float[Length];
int bucket_size_less_start_and_end = Length - 2;
float bucket_size = (float)(array.Length - 2) / bucket_size_less_start_and_end;
int a = 0;
int next_a = 0;
@adrianseeley
adrianseeley / Program.cs
Last active August 29, 2015 14:16
Kaggle OCR KNN K=10 From Scratch (http://www.kaggle.com/c/digit-recognizer) Score: 0.89843
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Kaggle_OCR_KNN
{
class Program
@adrianseeley
adrianseeley / oryql.cs
Last active August 29, 2015 14:16
oryql rg
List<KeyValuePair<float, string>> train_documents =
csv.read_train_documents(
new Dictionary<string, float>() {
{"A", 0f},
{"T", 0f},
{"Y", 1f},
{"N", -1f},
{"U", 0f},
{"L", 0f},
}, @"C:\Users\Admin\Desktop\stash\document_train.csv",
@adrianseeley
adrianseeley / EaseManagerScript.cs
Created January 2, 2015 12:52
EaseManagerScript.cs For Unity
using UnityEngine;
using System.Collections;
public class EaseManagerScript : MonoBehaviour {
public float LINEAR (float current_step, float total_steps, float start_value, float value_change) {
return value_change * (current_step / total_steps) + start_value;
}
public float SIN_IN (float current_step, float total_steps, float start_value, float value_change) {
return -value_change * Mathf.Cos(current_step / total_steps * (Mathf.PI / 2)) + value_change + start_value;
}
@adrianseeley
adrianseeley / msago.js
Last active August 29, 2015 14:05
MS to Time Ago
function msago (ms) {
function suffix (number) { return ((number > 1) ? 's' : '') + ' ago'; }
ms = new Date().getTime() - ms.getTime();
var temp = ms / 1000;
var years = Math.floor(temp / 31536000);
if (years) return years + ' year' + suffix(years);
var days = Math.floor((temp %= 31536000) / 86400);
if (days) return days + ' day' + suffix(days);
var hours = Math.floor((temp %= 86400) / 3600);
if (hours) return hours + ' hour' + suffix(hours);
@adrianseeley
adrianseeley / 7 4 Shoreline
Last active November 18, 2018 14:39
Guitar
[Intro]
E
E C#m (8x)
[Chorus]
E C#m
It's a shoreline
E C#m
And it's high speed
E C#m
@adrianseeley
adrianseeley / Honey.cs
Last active August 29, 2015 14:01
“Sway” Trained Sinus Activated Neural Networks - Monte Carlo Exploration of Optimization Volumes (C#, IRIS, GATO2014)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Windows.Forms;
@adrianseeley
adrianseeley / knn.js
Created May 13, 2014 12:43
KNN RE:FERNANDO
var fs = require('fs');
function raw_to_json () {
var raw_txt = fs.readFileSync('raw.txt', 'utf8');
raw_txt = raw_txt.split('\r\n');
for (var line = 0; line < raw_txt.length; line++) {
raw_txt[line] = raw_txt[line].split(' ');
for (var component = 0; component < raw_txt[line].length; component++)
raw_txt[line][component] = parseFloat(raw_txt[line][component]);
}