Skip to content

Instantly share code, notes, and snippets.

View schell's full-sized avatar
🥑
mmm

Schell Carl Scivally schell

🥑
mmm
View GitHub Profile
@schell
schell / birds-of-ruin-theme.el
Created May 22, 2021 16:45
Birds of Ruin - Emacs theme
(deftheme birds-of-ruin
"Created 2021-03-16.")
(custom-theme-set-faces
'birds-of-ruin
'(cursor ((t (:foreground "#865C38" :background "#E6E1C4"))))
'(fixed-pitch ((t (:family "Monospace"))))
'(variable-pitch ((((type w32)) (:foundry "outline" :family "Arial")) (t (:family "Sans Serif"))))
'(escape-glyph ((t (:foreground "#BE73FD"))))
'(homoglyph ((((background dark)) (:foreground "cyan")) (((type pc)) (:foreground "magenta")) (t (:foreground "brown"))))
@schell
schell / .spacemacs
Last active October 27, 2022 23:41
Spacemacs config
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@schell
schell / mogwai_ssr.md
Last active July 26, 2020 00:06
mogwai server side rendering notes

mogwai uses web-sys and wasm_bindgen to accomplish DOM creation and dynamic updates. Mogwai's main type Gizmo<T> has a type variable T meant to be filled by web-sys types that represent DOM nodes. Since web-sys's operations rely on javascript->wasm interop, any server side (ie rust only) pre-rendering should not happen through the normal browser-bound mogwai codepath. Of course using web-sys in this way would compile fine - but attempting to build the DOM and run a mogwai Gizmo when compiled to native code would cause a panic. Not all is lost though, as this actually points us in the direction of a sane implementation so long as we don't get carried away.

mogwai is meant to be a lightning fast frontent library, not a feature-rich web development framework. There are already plenty of heavy frameworks (I'm looking at Yew, kid). To this end I don't want to push mogwai into becoming an "isomorphic" framework (ie one that can run the same code on both server and browser). Instead I would

@schell
schell / electronic_basics.md
Last active May 17, 2020 16:58
electronics basics
  • Understand the concepts of voltage, resistance and current
  • Use Ohm's Law to calculate voltage, current and resistance
  • Use Kirchhoff's Laws to calculate voltage and current
  • Understand the meaning of and calculate energy and power
  • Use resistors in various configurations, like in voltage dividers and voltage ladders
  • Read the value of a resistor from its package
  • Use pull-up and pull-down resistors
  • Understand the use of capacitors
  • Use capacitors as energy stores and filters
  • Calculate the RC time constant of a capacitor
@schell
schell / HH_contract_2.md
Last active May 11, 2020 20:18
HH sensor circuit #2 contract description

HH task #2 Contract

This is the decscription of a task that requires some EE skills.

description

The task in question is to create and test (by breadboarding) a circuit that uses a [small, through-hole photointerrupter][sensor] that can be reliably read by a raspberry pi GPIO input pin (3.3v). The purpose of the circuit is to detect when an object (like a sheet of paper) passes through the photointerrupter by reading a boolean on/off signal. The circuit should be prioritized for low-power use and polling speed, if possible.

@schell
schell / release_asset.sh
Created January 24, 2020 19:44
bash script to create releases with upload asset
#! /bin/bash
# requires curl and jq on PATH: https://stedolan.github.io/jq/
# create a new release
# user: user's name
# repo: the repo's name
# token: github api user token
# tag: name of the tag pushed
create_release() {
user=$1
@schell
schell / syntax_macro.rs
Last active October 16, 2019 20:07
lots of derivations
#[macro_export]
macro_rules! syntax_for {
( $x:expr ) => {
impl From<$x> for Expression<$x> {
fn from(v: $x) -> Expression<$x> {
Expression::from_term(Term::new(v, 1.0))
}
}
impl Add<f64> for $x {
@schell
schell / .spacemacs
Created September 6, 2019 19:44
.spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
@schell
schell / KindMVC.hs
Created April 19, 2019 00:28
THC inspired HKDs
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module Lib
( someFunc
) where
@schell
schell / typograffiti.hs
Created October 11, 2018 20:07
things to do with typograffiti
-- It would be nice to introduce more layout options. Something like annotated text
-- in iOS/UIKit.
-- | This is how Sandy uses cairo/pango.
-- https://github.com/isovector/sequoia/blob/master/src/Game/Sequoia.hs#L262-L284
renderElement :: Engine -> Element -> Cairo.Render ()
renderElement _ (TextElement (Text { textColor = (Color r g b a), .. })) = do
Cairo.save
layout <- Pango.createLayout textUTF8