Skip to content

Instantly share code, notes, and snippets.

@paw-lu
paw-lu / altair_material.py
Created February 9, 2022 17:43
A material theme for Altair
def material():
"""
Material theme for altair.
Based on material design's data visualization guidance.
https://material.io/design/communication/data-visualization.html
"""
mark_color = "#6300EE"
grid_color = "#E0E0E0"
default_font = "Roboto, Helvetica, Arial, sans-serif"
# Requires GitHub Repositories https://marketplace.visualstudio.com/items?itemName=GitHub.remotehub
ghcode () {
if [[ -z "$1" ]]
then
echo "Usage: ghcode paw-lu/nbpreview"
else
local repo="$1"
open -a 'Visual Studio Code' "vscode://GitHub.remotehub/open?url=https://github.com/${repo}"
fi
}
@paw-lu
paw-lu / timg_bug.py
Last active June 16, 2021 02:39
Minimal example of over 256 color bug on timg
import base64
import io
import timg
from PIL import Image
image = ("iVBORw0KGgoAAAANSUhEUgAAAX4AAAEDCAYAAAAyZm"
"/jAAAAOXRFWHRTb2Z0"
"d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMiwgaHR0cHM6Ly9tYXRwbG90"
"bGliLm9yZy8rg+JYAAAACXBIWXMAAAsTAAALEwEAmpwYAAATJElEQVR4nO3d"
@paw-lu
paw-lu / lunar.sh
Created June 3, 2021 21:15
lunar fix
❯ tccutil reset all fyi.lunar.Lunar
tccutil: Failed to reset all approval status for fyi.lunar.Lunar
"""Add Optional typing to Python files."""
import pathlib
import re
from pathlib import Path
def add_optional_typing(file: Path) -> None:
"""Add Optional typing to Python files."""
file_contents = file.read_text()
missing_optional_re = re.compile(r'(\w+: )("?\S+"?)( = None)')

Contributor Guide

Thank you for your interest in improving this project. This project is open-source under the `MIT license`__ and welcomes contributions in the form of bug reports, feature requests, and pull requests.

Here is a list of important resources for contributors:

Copyright {% now 'utc', '%Y' %} {{ cookiecutter.author }}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@paw-lu
paw-lu / Apache-2.0.rst
Created December 15, 2020 04:05
License previews
@paw-lu
paw-lu / LICENSE_apache.rst
Last active December 15, 2020 02:33
GitHub renders of licenses written in reStructuredText.
         Apache License
   Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
+ [pyenv:22] enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath
+ [pyenv:29] '[' -z '' ']'
++ [pyenv:31] type -p greadlink readlink
++ [pyenv:31] head -1
+ [pyenv:31] READLINK=/usr/bin/readlink
+ [pyenv:32] '[' -n /usr/bin/readlink ']'
+ [pyenv:57] '[' -z '' ']'
+ [pyenv:58] PYENV_ROOT=/Users/paulo/.pyenv
+ [pyenv:62] export PYENV_ROOT
+ [pyenv:65] '[' -z '' ']'