Skip to content

Instantly share code, notes, and snippets.

View mndrake's full-sized avatar
🏠
Working from home

David Carlson mndrake

🏠
Working from home
View GitHub Profile
@mndrake
mndrake / charting_example.ipynb
Created June 29, 2015 12:54
charting example using IfSharp
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mndrake
mndrake / install.R
Created August 11, 2015 19:37
h2o domino
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Install h2o
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# The following two commands remove any previously installed H2O packages for R.
if ("package:h2o" %in% search()) { detach("package:h2o", unload=TRUE) }
if ("h2o" %in% rownames(installed.packages())) { remove.packages("h2o") }
# Next, we download packages that H2O depends on.
if (! ("methods" %in% rownames(installed.packages()))) { install.packages("methods") }
library(xgboost)
library(Matrix)
library(data.table)
library(caret)
source('gini.R')
df <- read.csv('data/train.csv')
df.matrix <- model.matrix(Hazard~.-1,df)
set.seed(107)
@mndrake
mndrake / Excel4.cs
Last active December 21, 2015 23:19
A C# wrapper class for the Excel4/Excel12 methods contained in Excel-DNA to mimic basic methods of the COM object model
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
namespace Excel4
{
@mndrake
mndrake / Utopia.fsx
Created January 15, 2014 17:45
Agent based calculation engine
open System
open System.Collections.Generic
open System.Collections.ObjectModel
open System.ComponentModel
open System.Threading
open Microsoft.FSharp.Control
open Microsoft.FSharp.Reflection
type Value =
| Dirty
namespace Utility
{
using System;
using System.Collections.Generic;
// based on:
//http://stackoverflow.com/questions/2852161/c-sharp-memoization-of-functions-with-arbitrary-number-of-arguments
public static class Memoizer
{
@mndrake
mndrake / dplyr_sql_extension.R
Last active August 24, 2016 00:26
extension methods for dplyr remote tables
library(dplyr)
library(nycflights13)
conn <- nycflights13_sqlite()
flights_sql <- tbl(conn, 'flights')
weather_sql <- tbl(conn, 'weather')
`[.tbl_sql` <- function(x, condition) {
x %>% select_(condition)
}
library(shiny)
shinyServer(function(input, output, session) {
# Return the components of the URL in a string:
output$urlText <- renderText({
paste(sep = "",
"protocol: ", session$clientData$url_protocol, "\n",
"hostname: ", session$clientData$url_hostname, "\n",
"pathname: ", session$clientData$url_pathname, "\n",
@mndrake
mndrake / start.sh
Last active June 17, 2018 15:22
domino start script for jupyterlab
#!/bin/bash
set -o nounset -o errexit -o pipefail
IP_ADDR=$(/sbin/ifconfig eth0 | grep "inet addr" | cut -d ":" -f2 | cut -d " " -f1)
CONF_DIR="$HOME/.ipython/profile_default"
CONF_FILE="${CONF_DIR}/ipython_notebook_config.py"
mkdir -p "${CONF_DIR}"
cat <<EOF >>"${CONF_FILE}"
@mndrake
mndrake / init.vim
Last active June 17, 2018 19:39
neovim init.vim
"*****************************************************************************
"" Vim-PLug core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
endif
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
let g:vim_bootstrap_langs = "html,javascript,python,scala"