Skip to content

Instantly share code, notes, and snippets.

View garyfeng's full-sized avatar

Gary Feng garyfeng

  • Educational Testing Service
  • United States
View GitHub Profile
@garyfeng
garyfeng / Docker desktop alternative for Mac.md
Created April 27, 2023 19:53
Getting a docker desktop alternative working on my Intel Mac

Docker Desktop has been not free since 2021, and I have been looking for/procrastinating on an alternative. My requirements:

  1. Free and open source, no vaperware
  2. I need docker not other container technologies
  3. docker-compose is a must
  4. Easy and clean installation. No messing around.
  5. For local testing only. I don't need a cluster or performance.
  6. GPU support is nice but CPU is fine.

Much blog surfing later, I decided on https://rancherdesktop.io/, among minikube, podman and other highly recommended alternatives.

@garyfeng
garyfeng / Benchmark Data Backend
Last active February 2, 2020 01:31
System Diagrams for Benchmark
%% This is the source for Mermaid diagram generator
%% Open https://mermaid-js.github.io/mermaid-live-editor, and paste in this content to the editor window on the left
graph TD
subgraph Data Topics
D1([Observables])
D2([Responses])
D3([Diagnostics])
D1 --> UX4
D2 --> UX4
@garyfeng
garyfeng / 2017Writing_descFeature_g4.py
Last active July 17, 2018 03:37
The following scripts were used on 2018-07-09 to generate descriptive writing features for 2017 reporting. It's done on Kurt, using the pdia docker. Steps:
# Functions for extracting the descriptive features for the 2017 operational analysis
# Changes from make2017FinalFeatures.py:
# - min
#############
import StringIO
import os
import traceback
// sample code for calculating the caret cursor position in CKEditor
// including functions to deal with cross-browser inconsistencies for end-of-the-line
// A hack to get text from HTML
// http://stackoverflow.com/questions/5002111/javascript-how-to-strip-html-tags-from-string
var html2text = function (html) {
// testing the idea of using .toString() with a replacement trick
// knowing that .textContent doesn't preserve the newlines, let's replace </p> with 2 newline chars
// This is ignoring all other HTML/CSS markups, such as <br>, tables, etc.
@garyfeng
garyfeng / Keystroke logging implementation.markdown
Created June 15, 2016 02:22
Keystroke logging implementation
@garyfeng
garyfeng / HeatmapWithTransparentBackground.svg
Created June 2, 2016 13:40
Adding a transparent background image to Plot.ly's SVG output. Two changes: (a) set opacity in `<g class="subplot xy" style = "opacity:0.5">`, and (b) adding an image in the "layer-below >> imagelayer" group.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<style>
/*
Taken from http://moderndata.plot.ly/custom-styling-for-ipython-notebooks-with-3-lines-of-code/
Modified for Gary Feng's Jupyter notebooks
*/
/*
html {
font-size: 62.5% !important; }
@garyfeng
garyfeng / Keystroke logging implementation.markdown
Created September 23, 2015 15:25
Keystroke logging implementation
@garyfeng
garyfeng / getListAttribute.r
Last active September 23, 2015 14:12
Creating an operator to extract a named member of a list that is in a list. Why? Read on. [Now part of the "pdata" library at github.com/garyfeng/pdata.
# To create an operator to extract a named member of a list that is in a list.
# This may sound confusing, but imagine you have a data.frame where a variable/column is a list of lists,
# and the lists have named members, e.g.,
# df$itinary <- list(list(from="NYC", to="LA", via="train"), list(from="LA", to="SF"), ...)
# You want to get the "from" value of itinary as a vector. You can do
# df$itinary@"from" or `@`(df$itinary, "via")
# Typically you'd use ```sapply(x, function(m) {m[["from"]]})```. The following is an extention to the idea in 2 ways:
# 1). We define a in-fix operator `@` that does so in a way that is syntactically more natural
# 2). We added error handling, in the case of bad indecies, etc.
require(testthat)
@garyfeng
garyfeng / interp.r
Created May 30, 2015 20:27
R tricks with lazyeval::interp():
# taken from
# http://cran.rstudio.com/web/packages/dplyr/vignettes/nse.html
# What if you need to mingle constants and variables? Use the handy lazyeval::interp():
library(lazyeval)
# Interp works with formulas, quoted calls and strings (but formulas are best)
interp(~ x + y, x = 10)
#> ~10 + y
interp(quote(x + y), x = 10)
#> 10 + y