Skip to content

Instantly share code, notes, and snippets.

This file has been truncated, but you can view the full file.
<kml xmlns="http://www.opengis.net/kml/2.2"><Document>
<Placemark>
<ExtendedData>
<Data name="zone_id"><value>6393</value></Data>
<Data name="zone_name"><value>YAK119</value></Data>
<Data name="fillColor"><value>#009300</value></Data>
<Data name="zone_group_id"><value>1</value></Data>
<Data name="zone_status_text"><value>0% to goal</value></Data></ExtendedData>
<Polygon>
<outerBoundaryIs>
@chrisranderson
chrisranderson / find_uncommitted_changes.sh
Last active December 6, 2023 19:06
Offboarding: find untracked/uncommitted changes recursively
#!/bin/zsh
# Constants
DEPTH=5 # Default depth
SEARCH_PATH="." # Default search path (current directory)
# Main function
main() {
find_git_repos_with_changes "${SEARCH_PATH}" "${DEPTH}"
}
function which_all() {
# Like `which`, but prints each location it finds
# on $PATH, not just the first one. zsh only.
#
# Example:
# > which_all conda
# /opt/homebrew/Caskroom/miniconda/base/bin/conda
# /opt/homebrew/Caskroom/miniconda/base/condabin/conda
# /opt/homebrew/bin/conda
@chrisranderson
chrisranderson / code_cohesion_visualizer.py
Last active February 14, 2022 16:38
Visualize a graph of code cohesion
"""
# Create statement list
For each statment:
Create a node
For each statement
For each name in that statement:
For each reference of that name to other statements:
create an edge from statement A to statement B
@chrisranderson
chrisranderson / google-calendar-hide-appointment-names.js
Last active October 10, 2022 15:26
Hide names of appointments in google calendar
document.styleSheets[0].insertRule('span.evt-lk, .cloc, .rem-done, .rb-ni, .cbrdcc {color: rgba(255, 255, 255, 0) !important;}', 1)
// thanks to David Walsh: https://davidwalsh.name/add-rules-stylesheets
/*
Bookmarklet of this code generated by http://mrcoles.com/bookmarklet/
javascript:(function()%7Bdocument.styleSheets%5B0%5D.insertRule('span.evt-lk%2C%20.cloc%2C%20.rem-done%2C%20.rb-ni%2C%20.cbrdcc%20%7Bcolor%3A%20rgba(255%2C%20255%2C%20255%2C%200)%20!important%3B%7D'%2C%201)%7D)()
*/
@chrisranderson
chrisranderson / hallway.t
Created September 19, 2016 22:44
hallway matching
local qs = require('qs')
local std = require('qs.lib.std')
local distrib = require('qs.distrib')
local cmath = terralib.includec('math.h')
local torch_image = require('image')
local torch = require('torch')
local math = require('math')
local max = math.max
local min = math.min
local mod = math.mod
@chrisranderson
chrisranderson / dp.js
Created August 17, 2016 23:29
dirichlet process
// dirichlet process implementation
// determine which portion of the stick it landed on
var portion_hit = function (stick_location, cumulative_sum) {
var finder = function(current) {
if (current == stick_location.length) {
return -1
} else if (cumulative_sum[current] > stick_location) {
return current
} else {
@chrisranderson
chrisranderson / monty-hall.scm
Last active February 18, 2019 12:39
Church solution to the Monty Hall problem
; The Monty Hall problem: can be executed online here: https://probmods.org/play-space.html
(define door-options (list 0 1 2))
(define (random-list-index l)
(sample-discrete (make-list (length l) (div 1 (length l)))))
(define (filter-out a-list value)
(filter (lambda (x) (if (equal? x value) #f #t)) a-list))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@chrisranderson
chrisranderson / stan-model-cache.py
Created April 7, 2016 02:43
Caches your Stan model, and recompiles if it has changed since the cache was created.
import pystan
import pickle
import os.path, time
def compile_model():
with open('model.stan', 'r') as my_file:
model_code = my_file.read()
stan_model = pystan.StanModel(model_code=model_code)