Skip to content

Instantly share code, notes, and snippets.

View berberman's full-sized avatar
😭
I may be slow to respond.

Potato Hatsue berberman

😭
I may be slow to respond.
  • Gensokyo
  • 03:21 (UTC -08:00)
View GitHub Profile
@berberman
berberman / simplex.nb
Created April 17, 2024 00:41
Naive simplex
simplex[a_, c_, bIdx1_, ab_, itr_] :=
Module[{cols, colB, b, bInv, bIdx = bIdx1, rc, theta, j, aj, s, cb,
u, l, fc, thetas, n = 0},
cols = Transpose[a];
While[n++ < itr,
colB = cols[[#]] & /@ bIdx;
Print["basic indices=", bIdx];
b = Transpose[colB];
Print["basic matrix=", MatrixForm[b]];
bInv = Inverse[b];
@berberman
berberman / PJSK.hs
Created January 21, 2024 21:43
PJSK sticker to Telegram sticker
#! /usr/bin/env -S NIXPKGS_ALLOW_UNFREE=1 nix-shell
#! nix-shell -i runghc -p "haskellPackages.ghcWithPackages (p: with p; [ shake ])" imagemagick steam-run
module Main where
import Development.Shake
import Development.Shake.FilePath
main :: IO ()
main = shake shakeOptions $ do
action $ do
@berberman
berberman / Zhang.hs
Last active January 19, 2024 02:20
土法记账
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
module Zhang where
import Control.Monad (forM_)
import Data.Function (on)
import Data.List (maximumBy, minimumBy, (\\))
@berberman
berberman / proposal.md
Last active April 8, 2023 16:54
Fcitx 5 Android Plugin

Fcitx 5 Android Plugin

Plugin

  • May contain the shared library of an existing addon or a new addon created in plugin's native code, or only provide data e.g. tables/lua extensions
  • Has a particular prefix in the package name: org.fcitx.fcitx5.android.plugin
  • Has a plugin descriptor in resouce, a XML file which includes:
    • plugin api version
    • gettext message domain (optional)
  • Has a data descriptor and FHS hierarchy in assets
@berberman
berberman / Gen.hs
Created May 27, 2022 22:47
Fcitx 5 Quick Phrase for Agda Input
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wall #-}
module Gen where
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Void (Void)
@berberman
berberman / Test.hs
Created July 9, 2021 11:20
SYB Test
{-# LANGUAGE RankNTypes #-}
module Test where
import Data.Generics
import Data.Void (Void)
myGeq :: forall a. Data a => a -> a -> Bool
myGeq a b = myGeq' a b
where
myGeq' :: GenericQ (GenericQ Bool)
#! /usr/bin/env nix-shell
#! nix-shell --pure -i "runghc -- -package --ghc-arg=ghc" -p "haskellPackages.ghcWithPackages (p: with p; [ ghc-exactprint pretty-simple ])"
import GHC.Hs.Dump
import Language.Haskell.GHC.ExactPrint.Parsers
import GHC.Utils.Outputable
import System.Environment
import Text.Pretty.Simple
main :: IO ()

Keybase proof

I hereby claim:

  • I am berberman on github.
  • I am berberman (https://keybase.io/berberman) on keybase.
  • I have a public key whose fingerprint is 3E1E A2B6 AB05 352D 855F F562 C4F9 3F1E D397 E8CF

To claim this, I am signing this object:

Nix 4 hrs 53 mins ██████████▏░░░░░░░░░░ 48.8%
Agda 3 hrs 4 mins ██████▍░░░░░░░░░░░░░░ 30.7%
Haskell 1 hr 7 mins ██▎░░░░░░░░░░░░░░░░░░ 11.2%
Kotlin 24 mins ▊░░░░░░░░░░░░░░░░░░░░ 4.0%
Other 13 mins ▍░░░░░░░░░░░░░░░░░░░░ 2.2%
@berberman
berberman / agda-mode.json
Created July 5, 2020 02:30
Agda mode input method for vscode plugin `generic input method`.
[
{
"body": "≠",
"description": "≠",
"label": "=n"
},
{
"body": "∼",
"description": "∼",
"label": "~"