Skip to content

Instantly share code, notes, and snippets.

View doctorpangloss's full-sized avatar

Benjamin Berman doctorpangloss

View GitHub Profile
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace ProjectHolste
{
public class RepetitionAlgorithm<T> : IEnumerator<T>
{
@doctorpangloss
doctorpangloss / Embedded.java
Created May 2, 2018 23:38
Create a behaviour by example
package com.hiddenswitch.spellsource.applications;
import com.hiddenswitch.spellsource.Bots;
import com.hiddenswitch.spellsource.Broadcaster;
import com.hiddenswitch.spellsource.Spellsource;
import com.hiddenswitch.spellsource.util.Logging;
import io.vertx.core.Vertx;
import org.apache.commons.lang3.exception.ExceptionUtils;
import static com.hiddenswitch.spellsource.util.Mongo.mongo;
@doctorpangloss
doctorpangloss / libtorrent and rtorrent on mac.sh
Last active February 8, 2021 13:22
Compiling rtorrent on a mac
#!/bin/bash
# Installs the XCode command line tools if you don't have them
xcode-select --install
# Installs brew if you don't have it
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Makes your account the owner of /usr/local, which is preferred on single user Macs
sudo chown -R `whoami` /usr/local
# Installs all the dependencies for building libtorrent and rtorrent
brew install automake libtool boost curl lzlib libsigc++ openssl
# Uninstall libtorrent-rasterbar if you already have it
@doctorpangloss
doctorpangloss / cardimpact.ipynb
Created December 27, 2016 22:10
Single Card Replacement Deck Improvements
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
From Visualizing the Metagame https://hearthsim.info/blog/2016/visualizing-the-metagame/
Of 6112 deck pairs, 157 had 2-card (1 replacement) differences.
Of those 157, 7 pairs had statistically significantly different win rates.
Deck #51 (MIDRANGE_SHAMAN):
Harrison Jones (#1) -> Barnes (#1)
Winrate changes 6.090000 percentage points (2808 matches)
Deck #51 (MIDRANGE_SHAMAN):
function textNodesUnder(el){
var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
while(n=walk.nextNode()) a.push(n);
return a;
}
textNodesUnder(document.body).forEach(function(a) {a.textContent = a.textContent.replace(/data/g,'tuna').replace(/Data/g, 'Tuna');});
@doctorpangloss
doctorpangloss / install_caffe.sh
Last active September 22, 2021 11:45
Installing Caffe on Mac 10.11.5 and later in the 10.11 series, and 10.12.1 and later in the 10.12 series
#!/bin/sh
# Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Apple hides old versions of stuff at https://developer.apple.com/download/more/
# Install the latest XCode (8.0).
# We used to install the XCode Command Line Tools 7.3 here, but that would just upset the most recent versions of brew.
# So we're going to install all our brew dependencies first, and then downgrade the tools. You can switch back after
# you have installed caffe.
# Install CUDA toolkit 8.0 release candidate
# Register and download from https://developer.nvidia.com/cuda-release-candidate-download
// FloorStoreRowDocument has been changed from a class to a struct
var gameDocument = ...
var count = gameDocument.floorStore.rows.Length;
var newFloorStoreRows = new FloorStoreRowDocument [count];
Array.Copy (gameDocument.floorStore.rows, newFloorStoreRows, count);
if (Meteor.isServer) {
WebApp.connectHandlers.use("/test", function (req, res, next) {
var data = '';
req.on('data', function (chunk) {
data += chunk;
});
req.on('end', Meteor.bindEnvironment(function () {
var deserialized = JSON.parse(data);
// Do your work here
console.log(deserialized.d.length);
@doctorpangloss
doctorpangloss / bunderru
Created November 28, 2014 03:51
productive evening
// Copy and paste into console, hit enter
var walker = document.createTreeWalker(
document.body,
NodeFilter.SHOW_TEXT,
null,
false
);
var node;