Skip to content

Instantly share code, notes, and snippets.

include Makefile.venv
Makefile.venv:
curl \
-o Makefile.fetched \
-L "https://github.com/sio/Makefile.venv/raw/v2020.05.07/Makefile.venv"
echo "ab60a72bb9215935db6d3d8cd0f8dfe8cd48e8cca0235227ecc476f1cff46e51 *Makefile.fetched" \
| sha256sum --check - \
&& mv Makefile.fetched Makefile.venv
name: datalab-dev
channels:
- conda-forge
- defaults
dependencies:
- jinja2=2.11.2=pyh9f0ad1d_0
- jupyter_client=6.1.3=py_0
- jupyter_core=4.6.3=py37hc8dfbb8_1
- jupyterlab=1.2.6=py_0
- jupyterlab_server=1.0.7=py_0
#
# act: activates a pyenv-managed virtualenv based on args, pwd, or fzf choice
#
act() {
local env="$1"
if [[ "$#" -ne "0" ]]; then
pyenv activate "$1"
return 0
# @description clones git repository (including submodules) and changes working
# directory to it. If `directory` not specified, uses $PROJECTS.
# and if that's not set, fallsback to current directory.
#
# @example gclone git@github.com:loganlinn/blog.git
# @example gclone loganlinn/blog
function gclone {
emulate -L zsh
if [[ "$#" -eq 0 ]]; then
import logging
import click
class ColorFormatter(logging.Formatter):
colors = {
"error": dict(fg="red"),
"exception": dict(fg="red"),
"critical": dict(fg="red"),
#!/usr/bin/env bash
# Usage: log_warning [<message> ...]
#
# Logs a warning message. Acts like echo,
# but wraps output in the standard direnv log format
# (controlled by $DIRENV_LOG_FORMAT), and directs it
# to stderr rather than stdout.
#
# Example:
diff --git a/src/results_notebooks/optimizely/api.py b/src/results_notebooks/optimizely/api.py
index 2eb2fa2..6132c4c 100644
--- a/src/results_notebooks/optimizely/api.py
+++ b/src/results_notebooks/optimizely/api.py
@@ -13,7 +13,7 @@ See Also
import datetime
import os
import re
-from typing import ClassVar, Generic, List, Optional, Type, TypeVar
+from typing import ClassVar, Dict, Generic, List, Type, TypeVar
@loganlinn
loganlinn / graph.py
Created November 27, 2019 20:55
dask graph wrapper a la https://github.com/plumatic/plumbing - experimental
import itertools
from typing import Iterable
import dask
import dask.core
import dask.multiprocessing
import dask.optimization
class LazyGraph:
@loganlinn
loganlinn / board.ex
Last active March 11, 2019 04:06 — forked from jordangarcia/board.ex
defmodule TicTacToe do
defmodule Board do
def create(maxX \\ 3, maxY \\ 3) do
for x <- 0..(maxX - 1),
y <- 0..(maxY - 1) do
{{x, y}, nil}
end
|> Map.new()
|> Map.put_new(:maxY, maxY)
|> Map.put_new(:maxX, maxX)
@loganlinn
loganlinn / custom_map_delegate.kt
Created December 7, 2018 22:42
Kotlin delegate property that allows map key to be different than property name
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
fun <V> map(props: Props, key: String): ReadWriteProperty<Any?, V> {
return object : ReadWriteProperty<Any?, V> {
@Suppress("UNCHECKED_CAST")
override fun getValue(thisRef: Any?, property: KProperty<*>): V = props[key]!! as V
override fun setValue(thisRef: Any?, property: KProperty<*>, value: V) {
props[key] = value