The following are appendices from Optics By Example, a comprehensive guide to optics from beginner to advanced! If you like the content below, there's plenty more where that came from; pick up the book!
| { config, ... }: | |
| let | |
| immichHost = "immich.example.com"; # TODO: put your immich domain name here | |
| immichRoot = "/tank/immich"; # TODO: Tweak these to your desired storage locations | |
| immichPhotos = "${immichRoot}/photos"; | |
| immichAppdataRoot = "${immichRoot}/appdata"; | |
| immichVersion = "release"; | |
| immichExternalVolume1 = "/tank/BackupData/Google Photos/[email protected]"; # TODO: if external volumes are desired |
| from transformers import AutoTokenizer, T5ForConditionalGeneration | |
| # Model Init | |
| n_gpu = 8 | |
| tokenizer = AutoTokenizer.from_pretrained("google/flan-ul2") | |
| model = T5ForConditionalGeneration.from_pretrained("google/flan-ul2") | |
| heads_per_gpu = len(model.encoder.block) // n_gpu | |
| device_map = { | |
| gpu: list( | |
| range( |
| # Open a new kitty terminal window on MacOS | |
| # | |
| # 1. Copy this script into AppleScript Editor and save it somewhere | |
| # 2. Use something like Apptivate to run the script on a global hotkey: | |
| # http://www.apptivateapp.com/ | |
| # | |
| # Note this script doesn't work well as a Service through Automator as the | |
| # "click menu" functionality requires accessibility privileges granted. | |
| # Services run as the focused app, so that setup would require every context | |
| # the shortcut is run from to have accessibility granted. |
| VERSION='9.4.1-rc1' | |
| # Note: this ghc version requires stack 2.7.3 or newer to install correctly | |
| cd /tmp | |
| mkdir ghc-test && cd ghc-test | |
| wget "https://raw.githubusercontent.com/DanBurton/stack-setup-info-gen/master/output/stack-ghc-$VERSION.yaml" | |
| mv "stack-ghc-$VERSION.yaml" stack.yaml | |
| stack setup | |
| stack repl |
| How to Use Fzf in GHCi | |
| by Vanessa McHale | 2019-08-27 01:27 | |
| I use fzf when I'm on the command-line. To configure GHCi to use fzf instead of haskeline's built-in search: | |
| Put the following in $HOME/.haskeline: | |
| bind: ctrl-r : f z f return | |
| and the following in $HOME/.ghci: |
I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.
There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.
As an example, currently we can express this type:
Disclaimer: I may have no idea what I'm talking about!
Excuse the Pikelet syntax
[0..10] | {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| module CStruct where |
| /* ~/Library/KeyBindings/DefaultKeyBinding.Dict | |
| This file remaps the key bindings of a single user on Mac OS X 10.5 to more | |
| closely match default behavior on Windows systems. This makes the Command key | |
| behave like Windows Control key. To use Control instead of Command, either swap | |
| Control and Command in Apple->System Preferences->Keyboard->Modifier Keys... | |
| or replace @ with ^ in this file. | |
| Here is a rough cheatsheet for syntax. | |
| Key Modifiers |