Skip to content

Instantly share code, notes, and snippets.

@heathhenley
heathhenley / investmentmc.ipynb
Created September 24, 2023 19:41
InvestmentMC.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@heathhenley
heathhenley / mc_salesforce_pipeline.ipynb
Created September 23, 2023 17:31
MC_salesforce_pipeline.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import pathlib
path = pathlib.Path(r"C:\Data")
print([f for f in path.glob("**/*.xlsx")])
@heathhenley
heathhenley / iwt_consumer.cpp
Last active August 10, 2023 13:12
Get in-water target bins out of target data
void publish_subscribe_example()
{
/////////////////////////////////////////////
// ZeroMQ pattern: Publish-subscribe
/////////////////////////////////////////////
zmq::context_t context(1);
zmq::socket_t subscr_target_data(context, ZMQ_SUB);
std::string address = "tcp://" + kHost + ":";
std::string port = "61502";
@heathhenley
heathhenley / SalesMarkovChain.ipynb
Last active June 19, 2023 22:03
SalesMarkovChain.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@heathhenley
heathhenley / cmd
Created October 26, 2022 20:51
CMD Shortcut Target
%windir%\system32\cmd.exe /k cd c:\dev && C:\dev\portable-tools\_setup_env_vars.bat && c:\dev\sandbox-heath\aliases.bat && echo Hello!
import numpy as np
import utm
starting_lat = -16.770190621116416
starting_lon = 145.94309647258999
x, y, zone, letter = utm.from_latlon(starting_lat, starting_lon)
# Scalar
print(starting_lat, starting_lon, x, y)
lat_scalar, lon_scalar = utm.to_latlon(x, y, zone, letter)
@heathhenley
heathhenley / check_for_hotkeys.py
Last active December 23, 2021 14:59
Try to register hotkeys to see which are available (out of the options SonaSoft allows)
import itertools
import ctypes
kNO_REPEAT = 0x4000
MODIFIERS = dict(ctrl=0x0002 | kNO_REPEAT,
alt=0x0001 | kNO_REPEAT,
shift=0x0004 | kNO_REPEAT)
def hotkey_is_available(mods, vkey):
hotkey_available = False
@heathhenley
heathhenley / shut_the_box.py
Created November 2, 2021 01:10
Python 3 - Simple Shut the Box Random Simulation
import collections
import logging
import random
def roll(dice, sides_per_die):
""" Roll 'dice' 'sides_per_die'-sided die and return the sum """
return sum([random.randint(1, sides_per_die) for _ in range(dice)])
cache = {}
def fib(n):
if n in cache:
return cache[n]
if n < 2:
cache[n] = 1
else:
cache[n] = fib(n-1) + fib(n-2)
return cache[n]