Skip to content

Instantly share code, notes, and snippets.

View gbishop's full-sized avatar

Gary Bishop gbishop

View GitHub Profile
@gbishop
gbishop / Nerd.md
Created December 23, 2023 19:14
Make Nerd fonts work with the Chromebook terminal

Make Nerd fonts work with the Chromebook terminal

Here is a too complicated hack to make Nerd fonts work on the Chromebook terminal. There should be an easier way. Please tell me if you find it.

First we need a CORS compliant web server to fetch the font. I didn't want to have to be online to use the terminal so I'm going to run the server locally. Fetch the server.py file (below) and save it to your linux environment. I put it in ~/hacks/nerdfont/server.py. This little script adds the CORS headers to the python3 http server. It will only serve files from the current folder.

In my ~/.bashrc I added these lines:

# make the nerdfont available to the chromebook terminal
@gbishop
gbishop / card_viewer.js
Created January 25, 2023 13:51
Hacked version of Harris's card_viewer
import { nextCard } from "./card_list.js";
import { previousCard } from "./card_list.js";
import { flipCard } from "./card_list.js";
// Variable that controls which side of the flashcard comes up first
//Default is Characters
var firstSide = "Characters";
const labels = [
"English", "Pinyin", "Characters"
@gbishop
gbishop / jsdoc.lua
Created November 22, 2022 12:52
Live jsdoc for luasnip - hacked from their demo
-- experiment with live jsdoc
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local t = ls.text_node
local i = ls.insert_node
local d = ls.dynamic_node
local r = ls.restore_node
local c = ls.choice_node
@gbishop
gbishop / libhack.js
Created September 15, 2022 17:54
A quick bookmarklet or "search engine" hack for jumping to the library proxy.
javascript:(function(){var lib=".libproxy.lib.unc.edu",url=https://${location.host.replaceAll(".","-")}${lib}${location.pathname}${location.search};location.href=url})();
@gbishop
gbishop / Bubble snippet
Created July 22, 2022 17:46
A hack to show how one might add bubbling to THR
// kill any saved interval to make dev easier
if (window.interval) clearInterval(window.interval);
// remember the current url
let url = null;
// Call our read function when the URL changes (there must be a better way)
function pollURL() {
if (document.location.href != url) {
url = document.location.href;
readIt();
}
@gbishop
gbishop / autosave-and-restore.markdown
Created January 3, 2019 18:31
Autosave and restore
@gbishop
gbishop / gist:f1bdcdc8cafe673353c506fd8185410a
Created July 27, 2017 14:48
typescript discriminated union question
interface HomeView {
view: 'home';
}
export interface BookView {
view: 'book';
link: string;
page: number;
}
@gbishop
gbishop / output.txt
Created July 16, 2017 19:35
typescript errors on CSSProperties
rewrite (master *%)$ tsc
src/NavFrame.tsx(53,65): error TS2345: Argument of type '{ width: string; fontSize: string; } | { width: string; height: string; fontSize: string; alignSe...' is not assignable to parameter of type 'CSSProperties'.
Type '{ width: string; height: string; fontSize: string; alignSelf: string; }' is not assignable to type 'CSSProperties'.
Types of property 'alignSelf' are incompatible.
Type 'string' is not assignable to type '"auto" | "center" | "initial" | "inherit" | "unset" | "flex-start" | "flex-end" | "stretch" | "ba...'.
src/NavFrame.tsx(57,65): error TS2345: Argument of type '{ width: string; fontSize: string; } | { width: string; height: string; fontSize: string; alignSe...' is not assignable to parameter of type 'CSSProperties'.
Type '{ width: string; height: string; fontSize: string; alignSelf: string; }' is not assignable to type 'CSSProperties'.
@gbishop
gbishop / index.html
Created July 3, 2017 11:37
JS Bin css transition zoom book // source https://jsbin.com/bucuju
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="css transition zoom book">
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
ul {
@gbishop
gbishop / runner.py
Created September 30, 2016 22:26
A script to time running Jupyter notebooks
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
import sys
import time
notebook_filename = sys.argv[1]
t0 = time.time()