Skip to content

Instantly share code, notes, and snippets.

View Avi-D-coder's full-sized avatar

Avi Dessauer Avi-D-coder

View GitHub Profile
@mfenniak
mfenniak / immich.nix
Last active September 20, 2024 20:58
NixOS configuration for Immich, based upon upstream docker-compose.yml
{ 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/someone@example.com"; # TODO: if external volumes are desired
@Helw150
Helw150 / parallel_t5.py
Last active May 10, 2023 14:52
Flan T5 Parallel Usage
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(
@stecman
stecman / NewKittyWindow.scpt
Last active June 3, 2025 20:51
New Kitty terminal window global hotkey on Mac OSX
# 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.
@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active August 12, 2025 12:57
Optics Cheatsheet
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
@etorreborre
etorreborre / fzf.ghci
Last active March 15, 2021 17:43
fzf
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:
@edmundsmith
edmundsmith / writeup.md
Created July 7, 2019 20:47
Method for Emulating Higher-Kinded Types in Rust

Method for Emulating Higher-Kinded Types in Rust

Intro

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:

Placing External Iterators in Category Theory

Disclaimer: I may have no idea what I'm talking about!

Excuse the Pikelet syntax

The problem

[0..10] 
@vincenthz
vincenthz / CStruct.hs
Last active September 1, 2019 10:45
CStruct in haskell
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
module CStruct where
@trusktr
trusktr / DefaultKeyBinding.dict
Last active August 5, 2025 07:35
My DefaultKeyBinding.dict for Mac OS X
/* ~/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