Skip to content

Instantly share code, notes, and snippets.

View splch's full-sized avatar

Spencer Churchill splch

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@splch
splch / server.go
Created September 7, 2021 15:02
slc.is/#Grokking%20Go
package main
import (
"crypto/tls"
"fmt"
"log"
"net/http"
"time"
"github.com/NYTimes/gziphandler"
@splch
splch / heat_blink.py
Created September 12, 2021 23:01
Blink the Raspberry Pi Pico faster with heat.
@splch
splch / collatz.hs
Created February 24, 2022 07:16
Creates collatz sequences in Haskell
collatz :: Integer -> Integer
collatz n =
if even n
then n `div` 2
else 3 * n + 1
collatzSeq :: Integer -> [Integer]
collatzSeq n =
if n == 1 -- base case
then 1 : []
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'equalStacks' function below.
class Node:
def __init__(self, info):
self.info = info
self.left = None
self.right = None
self.level = None
def __str__(self):
return str(self.info)
@splch
splch / init.el
Created April 19, 2022 20:04
emacs configuration generated by https://emacs.amodernist.com/
;;; Personal configuration -*- lexical-binding: t -*-
;; Save the contents of this file under ~/.emacs.d/init.el
;; Do not forget to use Emacs' built-in help system:
;; Use C-h C-h to get an overview of all help commands. All you
;; need to know about Emacs (what commands exist, what functions do,
;; what variables specify), the help system can provide.
;; Add the NonGNU ELPA package archive
(require 'package)
@splch
splch / readability.css
Last active November 29, 2022 23:04
CSS rules optimized for site readability
:root {
--bg-color: #ffffff;
--font-color: #000000;
/* highest contrast colors
for light and dark themes */
--red: #ec0000;
--green: #008900;
--blue: #5f5fff;
--gray: #757575;
}
@splch
splch / LICENSE
Created April 27, 2022 13:26
This license applies to every gist I create, unless otherwise stated.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
@splch
splch / isWorn.js
Created September 6, 2022 14:52
detect if a bangle watch is being worn
function isWorn() {
console.log(Bangle.isCharging(), E.getTemperature(), Bangle.getAccel().mag);
if (Bangle.isCharging())
return false;
if (E.getTemperature() >= 33.1)
// https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8266026/table/T2/
return true;
if (Bangle.getAccel().mag >= 1.02)
return true;
return false;