├── hello-emacs ├── js │ ├── typescript │ │ ├── .projectile │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ ├── main.ts │ │ ├── typings.json │ │ ├── package.json │ │ └── lib.ts │ ├── react-purescript │ │ ├── .projectile │ │ ├── .gitignore │ │ ├── main.html │ │ ├── test │ │ │ └── Main.purs │ │ ├── package.json │ │ ├── bower.json │ │ └── src │ │ │ └── Main.purs │ ├── react-typescript │ │ ├── .projectile │ │ ├── .gitignore │ │ ├── lib.ts │ │ ├── typings.json │ │ ├── tsconfig.json │ │ ├── package.json │ │ └── ui.tsx │ ├── react-native-purescript │ │ ├── .projectile │ │ ├── index.android.js │ │ ├── tools │ │ │ └── from-tsd │ │ │ │ ├── .gitignore │ │ │ │ └── package.json │ │ ├── index.ios.js │ │ ├── .gitignore │ │ ├── test │ │ │ └── Main.purs │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── RN.js │ │ │ └── Main.purs │ │ └── bower.json │ ├── .gitignore │ ├── plain-es6-tern │ │ ├── .jsbeautifyrc │ │ ├── .jshintrc │ │ ├── .tern-project │ │ ├── package.json │ │ ├── main.js │ │ ├── lib.js │ │ └── README.md │ ├── typescript-webpack │ │ ├── src │ │ │ ├── shared │ │ │ │ ├── index.tsx │ │ │ │ └── types.tsx │ │ │ ├── backend │ │ │ │ └── main.tsx │ │ │ └── web │ │ │ │ └── main.tsx │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ ├── package.json │ │ ├── webpack.config.js │ │ └── tslint.json │ └── react-tern │ │ ├── .jsbeautifyrc │ │ ├── .eslintrc │ │ ├── .tern-project │ │ ├── lib.jsx │ │ └── package.json └── README.md ├── plt-and-algo ├── .gitignore ├── cps-interp-osr │ ├── Makefile │ ├── .clang_complete │ ├── README.md │ ├── common.hpp │ ├── value.hpp │ ├── info.hpp │ └── interp.cpp ├── coq │ ├── cat-theory-for-cs │ │ ├── .projectile │ │ ├── _CoqProject │ │ ├── README.md │ │ ├── base.v │ │ └── Makefile │ └── .gitignore ├── final-tagless-interpreter │ ├── LICENSE │ ├── Setup.hs │ ├── src │ │ ├── Lib.hs │ │ └── Tagful0.hs │ ├── test │ │ └── Spec.hs │ └── app │ │ └── Main.hs ├── folding-through-a-fixed-point │ ├── LICENSE │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ └── app │ │ └── Main.hs ├── perceptron-rs │ ├── .gitignore │ ├── README.md │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── digit_recognition.rs ├── cek-mach │ ├── src │ │ └── Lib.hs │ ├── .gitignore │ ├── Setup.hs │ ├── ChangeLog.md │ ├── app │ │ └── Main.hs │ ├── test │ │ ├── Spec.hs │ │ └── TestCEK.hs │ ├── README.md │ └── package.yaml ├── hello-ocaml │ ├── dune-project │ ├── scm_main.ml │ ├── dune │ ├── .gitignore │ ├── scheme.ml │ └── hello.ml ├── idris-tutorial │ ├── .gitignore │ ├── hello.idr │ ├── Makefile │ ├── Pi_1.idr │ └── Primitives.idr ├── ll-comp-with-cps │ ├── .gitignore │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ ├── README.md │ ├── app │ │ └── Main.hs │ └── src │ │ ├── Lib.hs │ │ ├── Lang.hs │ │ └── Sample.hs ├── monorepo │ ├── lean │ │ └── hello │ │ │ ├── .gitignore │ │ │ ├── lean-toolchain │ │ │ ├── Hello │ │ │ ├── PropInterlude.lean │ │ │ └── Monad.lean │ │ │ ├── lake-manifest.json │ │ │ ├── Main.lean │ │ │ ├── Hello.lean │ │ │ └── lakefile.lean │ ├── kt │ │ ├── lib │ │ │ ├── src │ │ │ │ ├── main │ │ │ │ │ └── kotlin │ │ │ │ │ │ └── com │ │ │ │ │ │ └── gh │ │ │ │ │ │ └── om │ │ │ │ │ │ ├── shuati │ │ │ │ │ │ └── index.kt │ │ │ │ │ │ ├── plt │ │ │ │ │ │ ├── root.kt │ │ │ │ │ │ └── incremental │ │ │ │ │ │ │ ├── README.md │ │ │ │ │ │ │ └── afp │ │ │ │ │ │ │ └── adaptive.kt │ │ │ │ │ │ └── g │ │ │ │ │ │ └── observer │ │ │ │ │ │ ├── listv1 │ │ │ │ │ │ └── randtest.kt │ │ │ │ │ │ └── README.md │ │ │ │ └── test │ │ │ │ │ └── kotlin │ │ │ │ │ └── com │ │ │ │ │ └── gh │ │ │ │ │ └── om │ │ │ │ │ ├── plt │ │ │ │ │ └── LibraryTest.kt │ │ │ │ │ └── g │ │ │ │ │ └── observer │ │ │ │ │ └── listv1 │ │ │ │ │ └── proptest.kt │ │ │ └── build.gradle.kts │ │ ├── build.gradle │ │ ├── .gitignore │ │ ├── gradle │ │ │ ├── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ │ └── libs.versions.toml │ │ ├── .gitattributes │ │ ├── local.properties │ │ └── settings.gradle.kts │ ├── rs │ │ ├── Cargo.toml │ │ ├── driver │ │ │ ├── src │ │ │ │ └── main.rs │ │ │ └── Cargo.toml │ │ ├── lib │ │ │ ├── Cargo.toml │ │ │ ├── src │ │ │ │ ├── lib.rs │ │ │ │ ├── fibo_x64.s │ │ │ │ ├── fibo_aarch64.s │ │ │ │ └── fibo.rs │ │ │ ├── examples │ │ │ │ └── fibo.rs │ │ │ └── build.rs │ │ └── .gitignore │ ├── .gitignore │ ├── .gitattributes │ └── README.md ├── webrtc-p2pframe │ ├── static │ │ ├── .gitignore │ │ └── go.htm │ ├── .gitignore │ ├── src │ │ ├── main.ts │ │ ├── lib.tsx │ │ └── ws.ts │ ├── .babelrc │ ├── typings.json │ ├── tsconfig.json │ └── package.json ├── lambda-cookied-four-ways │ ├── src │ │ ├── Lib.hs │ │ ├── IdInt.hs │ │ └── HOAS.hs │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ ├── app │ │ └── Main.hs │ └── README.md ├── sea-of-nodes │ ├── scala-src │ │ ├── dots │ │ │ └── .gitignore │ │ ├── ast-src │ │ │ ├── arr-store-load.ast │ │ │ ├── one-block.ast │ │ │ ├── while-ret.ast │ │ │ ├── sum-loop.ast │ │ │ ├── ssa-swap.ast │ │ │ ├── simple-if.ast │ │ │ ├── arr-store-load-loop.ast │ │ │ ├── lsra-loop-liverange-hole.ast │ │ │ ├── multi-ifs.ast │ │ │ ├── click-gvn-sample.ast │ │ │ ├── fibo-iter.ast │ │ │ ├── if-in-loop.ast │ │ │ ├── lsra-spill-simple.ast │ │ │ └── nested-loop.ast │ │ ├── loc-count.sh │ │ ├── .gitignore │ │ ├── build.sbt │ │ ├── src │ │ │ └── main │ │ │ │ └── scala │ │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── overmind │ │ │ │ └── seaofnodes │ │ │ │ ├── backend │ │ │ │ └── Shared.scala │ │ │ │ ├── ast │ │ │ │ ├── Stmts.scala │ │ │ │ └── Exprs.scala │ │ │ │ └── hir │ │ │ │ └── nodes │ │ │ │ └── Edge.scala │ │ └── TODO │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ ├── app │ │ └── Main.hs │ └── src │ │ └── Lib.hs ├── incremental-tc │ ├── src │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── om │ │ │ │ └── inctc │ │ │ │ ├── scratch.kt │ │ │ │ ├── ScratchJ.java │ │ │ │ ├── logging.kt │ │ │ │ └── graph │ │ │ │ └── traversal.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── com │ │ │ └── github │ │ │ └── om │ │ │ └── inctc │ │ │ ├── AppTest.kt │ │ │ └── PrettyPrinterTest.kt │ ├── .gitignore │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── README.md │ ├── .gitattributes │ ├── settings.gradle │ └── notes │ │ └── README.md ├── partial-eval │ ├── readings │ │ ├── .gitignore │ │ └── LIST.md │ ├── peaapg │ │ ├── README.md │ │ ├── .gitignore │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── src │ │ │ ├── main │ │ │ │ └── kotlin │ │ │ │ │ └── com │ │ │ │ │ └── gh │ │ │ │ │ └── om │ │ │ │ │ └── peaapg │ │ │ │ │ ├── Library.kt │ │ │ │ │ └── ch3 │ │ │ │ │ └── fc │ │ │ │ │ └── ast.kt │ │ │ └── test │ │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── gh │ │ │ │ └── om │ │ │ │ └── peaapg │ │ │ │ └── LibraryTest.kt │ │ ├── .gitattributes │ │ ├── settings.gradle │ │ └── build.gradle │ └── attic │ │ ├── Setup.hs │ │ ├── test │ │ └── Spec.hs │ │ ├── app │ │ └── Main.hs │ │ └── src │ │ ├── Lib.hs │ │ ├── Expr.hs │ │ └── PEval.hs ├── f-bounded-polymorphism │ ├── rec.hs │ └── NOTES.md ├── pi-singletons │ ├── Setup.hs │ └── pi-singletons.cabal ├── datatypes-ala-carte │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ └── app │ │ └── Main.hs ├── pickler-combinators │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ ├── app │ │ └── Main.hs │ ├── src │ │ └── Lib.hs │ └── pickler-combinators.cabal ├── iu-essentials-of-compilation │ ├── tools │ │ └── .gitignore │ ├── .gitignore │ ├── README.md │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitattributes │ ├── src │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── gh │ │ │ │ └── om │ │ │ │ └── iueoc │ │ │ │ ├── App.kt │ │ │ │ ├── util.kt │ │ │ │ └── son │ │ │ │ └── phases │ │ │ │ └── phase.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── com │ │ │ └── gh │ │ │ └── om │ │ │ └── iueoc │ │ │ ├── test_both_interp.kt │ │ │ └── test_sexpr_parser.kt │ └── settings.gradle ├── software-foundation │ ├── .gitignore │ └── idris │ │ └── basics.idr ├── pat-werewolf │ ├── README.md │ └── ww.curry ├── ui-layout-system │ ├── .gitignore │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitattributes │ ├── settings.gradle │ ├── src │ │ └── test │ │ │ └── kotlin │ │ │ └── com │ │ │ └── om │ │ │ └── kitsink │ │ │ └── layoutpg │ │ │ └── AppTest.kt │ └── build.gradle ├── ioc-free-vs-di │ └── kt │ │ ├── .gitignore │ │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ │ ├── lib │ │ ├── build.gradle │ │ └── src │ │ │ └── main │ │ │ └── kotlin │ │ │ └── com │ │ │ └── github │ │ │ └── om │ │ │ └── ioccmp │ │ │ ├── trad │ │ │ ├── package-info.java │ │ │ └── hand-wired-provider.kt │ │ │ └── reader │ │ │ └── reader-monad.kt │ │ ├── .gitattributes │ │ ├── app │ │ ├── src │ │ │ └── main │ │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── om │ │ │ │ └── ioccmp │ │ │ │ └── app │ │ │ │ └── App.kt │ │ └── build.gradle │ │ ├── settings.gradle │ │ └── buildSrc │ │ ├── src │ │ └── main │ │ │ └── groovy │ │ │ ├── com.github.om.ioccmp.kotlin-library-conventions.gradle │ │ │ ├── com.github.om.ioccmp.kotlin-application-conventions.gradle │ │ │ └── com.github.om.ioccmp.kotlin-common-conventions.gradle │ │ └── build.gradle ├── the-little-typer-kt │ ├── README.md │ ├── .gitignore │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitattributes │ ├── src │ │ └── main │ │ │ └── kotlin │ │ │ └── om │ │ │ └── lang │ │ │ └── pie │ │ │ ├── App.kt │ │ │ ├── elab.kt │ │ │ ├── core.kt │ │ │ ├── ast.kt │ │ │ ├── value.kt │ │ │ └── util.kt │ ├── settings.gradle │ └── build.gradle ├── soot-hello │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── .gitattributes │ ├── src │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── github │ │ │ │ │ └── om │ │ │ │ │ └── soothello │ │ │ │ │ └── analyzee │ │ │ │ │ ├── IFactory.java │ │ │ │ │ ├── Foo.java │ │ │ │ │ ├── YoloEndpoint.java │ │ │ │ │ ├── YoloResource.java │ │ │ │ │ ├── IService.java │ │ │ │ │ ├── RuntimeChecks.java │ │ │ │ │ ├── FooServiceFactory.java │ │ │ │ │ ├── AnalyzeeMain.java │ │ │ │ │ ├── FooResourceFactory.java │ │ │ │ │ ├── FooResource.java │ │ │ │ │ ├── FooService.java │ │ │ │ │ ├── AbstractFactory.java │ │ │ │ │ └── DepResolver.java │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── github │ │ │ │ └── om │ │ │ │ └── soothello │ │ │ │ └── ow2main.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── com │ │ │ └── github │ │ │ └── om │ │ │ └── soothello │ │ │ └── AppTest.kt │ ├── settings.gradle │ └── build.gradle ├── static-analysis │ └── spa │ │ └── README.md ├── swift-pipes │ ├── deps │ └── READMD.md ├── README.md ├── defunctionalization │ ├── Sample.hs │ └── README.md └── tapl │ └── SystemF.hs ├── writings ├── kotlin-compiler │ ├── dylib-runner │ │ ├── lib │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── java │ │ │ │ └── yux │ │ │ │ └── ktcpg │ │ │ │ └── lib │ │ │ │ └── Lib.kt │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ ├── .gitattributes │ │ ├── app │ │ │ ├── build.gradle │ │ │ └── src │ │ │ │ ├── test │ │ │ │ └── kotlin │ │ │ │ │ └── yux │ │ │ │ │ └── ktcpg │ │ │ │ │ └── AppTest.kt │ │ │ │ └── main │ │ │ │ └── kotlin │ │ │ │ └── yux │ │ │ │ └── ktcpg │ │ │ │ ├── App.kt │ │ │ │ └── ktsyntax.kt │ │ └── settings.gradle │ ├── notes │ │ ├── .gitignore │ │ ├── main.pdf │ │ ├── .latexmkrc │ │ └── .vscode │ │ │ └── settings.json │ ├── runner │ │ ├── dst.txt │ │ └── yux │ │ │ └── main.kt │ └── README.md ├── README.md ├── lazy-usefulness-state-monad │ ├── Setup.hs │ ├── test │ │ └── Spec.hs │ ├── app │ │ └── Main.hs │ ├── lazy-usefulness.cabal │ └── stack.yaml ├── latex-usage │ └── dot2texi │ │ ├── sample.pdf │ │ └── sample.tex ├── wifi-router-test │ ├── glinet.ping │ ├── att-orig.ping │ └── glinet-only.ping ├── diy-passport-photo │ ├── README.md │ └── consts.py ├── jit-reading │ ├── v8-pipeline.md │ ├── v8-node.md │ └── v8-node-reducer.md ├── list-pattern-matching.md ├── cross-compile-rust-for-android.sh └── multiple-ssh-keys-github.md ├── wow-scripts ├── wa2-damage-taken-5 │ ├── .gitignore │ ├── convert-all-tga.sh │ ├── stack.lua │ ├── Makefile │ ├── varargs-fu.lua │ └── queue-test.lua ├── arpg-macros │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle.kts │ ├── .gitignore │ ├── src │ │ └── main │ │ │ └── kotlin │ │ │ └── com │ │ │ └── gh │ │ │ └── om │ │ │ └── gamemacros │ │ │ ├── Main.kt │ │ │ └── PlatformSpecific.kt │ └── build.gradle.kts ├── blizz-api-kt │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── .gitignore │ │ │ └── java │ │ │ └── com │ │ │ └── gh │ │ │ └── om │ │ │ └── blizzapi │ │ │ ├── util.kt │ │ │ ├── base │ │ │ ├── config.kt │ │ │ ├── bapi.kt │ │ │ └── character_state.kt │ │ │ └── auth_bearer.kt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitattributes │ ├── .gitignore │ ├── settings.gradle │ └── README.md ├── time-to-die-improved │ ├── README.md │ └── ttd.lua ├── README.md ├── swing-timer │ └── README.md ├── priest-shield │ └── main.lua ├── simc-apl-tools │ ├── PrettyPrint.hs │ ├── acls │ │ └── convoke │ └── Apl.hs ├── poe │ └── hello.main.kts └── legion-info ├── README.md ├── mobile-dev ├── extract-apk │ └── notes.md ├── dagger-playground │ ├── src │ │ ├── main │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── om │ │ │ │ └── gh │ │ │ │ └── dagger │ │ │ │ └── pg │ │ │ │ ├── App.kt │ │ │ │ └── binds │ │ │ │ └── binds.kt │ │ └── test │ │ │ └── kotlin │ │ │ └── com │ │ │ └── om │ │ │ └── gh │ │ │ └── dagger │ │ │ └── pg │ │ │ └── AppTest.kt │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── .gitattributes │ ├── settings.gradle │ └── build.gradle ├── ios-playground │ └── view-controllers │ │ └── PlayWithViewControllers │ │ └── Assets.xcassets │ │ └── Contents.json ├── ndk-standalone │ ├── mk-executables │ └── ndk-executable-base └── rtl-pg │ └── hello.htm ├── .gitignore └── .gitmodules /hello-emacs/js/typescript/.projectile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/.gitignore: -------------------------------------------------------------------------------- 1 | stack.yaml 2 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/Makefile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/.projectile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/.projectile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript/.gitignore: -------------------------------------------------------------------------------- 1 | /*.js* 2 | -------------------------------------------------------------------------------- /plt-and-algo/coq/cat-theory-for-cs/.projectile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/.projectile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | /*.js* 2 | -------------------------------------------------------------------------------- /plt-and-algo/folding-through-a-fixed-point/LICENSE: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/perceptron-rs/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/index.android.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib where 2 | 3 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 2.8) 2 | -------------------------------------------------------------------------------- /plt-and-algo/idris-tutorial/.gitignore: -------------------------------------------------------------------------------- 1 | *.ibc 2 | *.bin 3 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/.gitignore: -------------------------------------------------------------------------------- 1 | stack.yaml 2 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/.gitignore: -------------------------------------------------------------------------------- 1 | /.lake 2 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/lib/build.gradle: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/.clang_complete: -------------------------------------------------------------------------------- 1 | --std=c++14 2 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/static/.gitignore: -------------------------------------------------------------------------------- 1 | *.bundle.js* 2 | -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/.gitignore: -------------------------------------------------------------------------------- 1 | *.gen 2 | 3 | res 4 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/notes/.gitignore: -------------------------------------------------------------------------------- 1 | __latexindent_temp.tex 2 | -------------------------------------------------------------------------------- /hello-emacs/js/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .tern-port 3 | typings 4 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work/ 2 | cek-mach.cabal 3 | *~ -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib where 2 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/dots/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/resources/.gitignore: -------------------------------------------------------------------------------- 1 | config.toml 2 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/tools/from-tsd/.gitignore: -------------------------------------------------------------------------------- 1 | *.d.ts 2 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/main/kotlin/com/github/om/inctc/scratch.kt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/lean-toolchain: -------------------------------------------------------------------------------- 1 | leanprover/lean4:stable 2 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/readings/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | !*.md 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SYNOPSIS 2 | 3 | Miscellaneous code snippets and writings. 4 | 5 | -------------------------------------------------------------------------------- /hello-emacs/README.md: -------------------------------------------------------------------------------- 1 | ### SYNOPSIS 2 | 3 | Emacs project configuration files. 4 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 2 3 | } 4 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/src/shared/index.tsx: -------------------------------------------------------------------------------- 1 | export * from './types'; 2 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/README.md: -------------------------------------------------------------------------------- 1 | Exercises and programs for PEaAPG. 2 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true, 3 | "esversion": 6 4 | } -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /hello-emacs/js/react-tern/.jsbeautifyrc: -------------------------------------------------------------------------------- 1 | { 2 | "indent_size": 2, 3 | "e4x": true 4 | } 5 | -------------------------------------------------------------------------------- /mobile-dev/extract-apk/notes.md: -------------------------------------------------------------------------------- 1 | https://gist.github.com/ctrl-freak/24ac0e61b7cf550a6945 2 | -------------------------------------------------------------------------------- /plt-and-algo/f-bounded-polymorphism/rec.hs: -------------------------------------------------------------------------------- 1 | newtype Fix f = Fix { unFix :: f (Fix f) } 2 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/pi-singletons/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /wow-scripts/time-to-die-improved/README.md: -------------------------------------------------------------------------------- 1 | Originally from https://wago.io/4klO1AOPW? 2 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/ChangeLog.md: -------------------------------------------------------------------------------- 1 | # Changelog for cek-mach 2 | 3 | ## Unreleased changes 4 | -------------------------------------------------------------------------------- /plt-and-algo/datatypes-ala-carte/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/shuati/index.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.shuati -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/pickler-combinators/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /writings/README.md: -------------------------------------------------------------------------------- 1 | # SYNOPSIS 2 | 3 | Some coding-related writings, mostly about Haskell. 4 | -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/tools/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by viewer.kt 2 | out.dot 3 | -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/.gitignore: -------------------------------------------------------------------------------- 1 | .babel-build 2 | twistd.pid 3 | node_modules 4 | typings 5 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/runner/dst.txt: -------------------------------------------------------------------------------- 1 | compiler/cli/cli-runner/src/org/jetbrains/kotlin/runner 2 | -------------------------------------------------------------------------------- /writings/lazy-usefulness-state-monad/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work 2 | .*.swp 3 | .#* 4 | *.pyc 5 | TAGS 6 | 7 | .idea 8 | 9 | .DS_Store 10 | -------------------------------------------------------------------------------- /plt-and-algo/folding-through-a-fixed-point/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /wow-scripts/README.md: -------------------------------------------------------------------------------- 1 | The naming is confusing. This is not only about WoW -- rather anything gaming. 2 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/.gitignore: -------------------------------------------------------------------------------- 1 | /dist 2 | /node_modules 3 | 4 | .#* 5 | .*.swp 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/src/shared/types.tsx: -------------------------------------------------------------------------------- 1 | export interface Foo { 2 | value: string; 3 | } 4 | 5 | -------------------------------------------------------------------------------- /plt-and-algo/idris-tutorial/hello.idr: -------------------------------------------------------------------------------- 1 | module Main 2 | 3 | main : IO () 4 | main = putStrLn "Hello world" 5 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = pure () 7 | -------------------------------------------------------------------------------- /plt-and-algo/coq/cat-theory-for-cs/_CoqProject: -------------------------------------------------------------------------------- 1 | -R . Lib 2 | base.v 3 | base_lemma.v 4 | 5 | ch1.v 6 | ch1_ex.v 7 | -------------------------------------------------------------------------------- /plt-and-algo/datatypes-ala-carte/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/pickler-combinators/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/software-foundation/.gitignore: -------------------------------------------------------------------------------- 1 | # Idris BC 2 | *.ibc 3 | 4 | # Coq 5 | *.glob 6 | *.vo 7 | .*.aux 8 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/index.ios.js: -------------------------------------------------------------------------------- 1 | require('./output/Main').main(); 2 | //require('./output/bundle'); 3 | -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib ( 2 | module Scratch 3 | ) where 4 | 5 | import Scratch 6 | -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/README.md: -------------------------------------------------------------------------------- 1 | ### SYNOPSIS 2 | 3 | Playing with register allocation for SSA / CPS-based IRs. 4 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = return () 7 | -------------------------------------------------------------------------------- /writings/lazy-usefulness-state-monad/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/folding-through-a-fixed-point/test/Spec.hs: -------------------------------------------------------------------------------- 1 | main :: IO () 2 | main = putStrLn "Test suite not yet implemented" 3 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = someFunc 7 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/src/backend/main.tsx: -------------------------------------------------------------------------------- 1 | import * as S from '../shared'; 2 | S; 3 | 4 | console.log('backend'); 5 | -------------------------------------------------------------------------------- /plt-and-algo/datatypes-ala-carte/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = someFunc 7 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Sample 4 | 5 | main :: IO () 6 | main = return () 7 | -------------------------------------------------------------------------------- /plt-and-algo/pickler-combinators/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = someFunc 7 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/arr-store-load.ast: -------------------------------------------------------------------------------- 1 | { 2 | xs = newArray(5) 3 | xs[0] = 1 4 | ret xs[0] 5 | } 6 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/one-block.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | x = 1 3 | y = 2 4 | z = 3 5 | ret x + (y + z) 6 | } 7 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/loc-count.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | find src -name "*.scala" -exec wc {} + | sort -n 4 | -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = someFunc 7 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | 3 | resolver = "2" 4 | 5 | members = [ 6 | "lib", 7 | "driver", 8 | ] 9 | -------------------------------------------------------------------------------- /plt-and-algo/pat-werewolf/README.md: -------------------------------------------------------------------------------- 1 | # Synopsis 2 | 3 | See [PAT 1089](https://blog.csdn.net/liuchuo/article/details/82560831) 4 | 5 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/notes/main.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/writings/kotlin-compiler/notes/main.pdf -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/.gitignore: -------------------------------------------------------------------------------- 1 | output 2 | node_modules 3 | bower_components 4 | .psci* 5 | .pulp-cache 6 | /src/.webpack.js 7 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/test/Spec.hs: -------------------------------------------------------------------------------- 1 | import TestCEK 2 | 3 | import Test.Hspec 4 | 5 | main :: IO () 6 | main = hspec $ do 7 | testCek 8 | -------------------------------------------------------------------------------- /plt-and-algo/folding-through-a-fixed-point/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = return () 7 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/src/main.ts: -------------------------------------------------------------------------------- 1 | import { entryPoint } from './lib'; 2 | 3 | entryPoint(document.getElementById('mount-point')); 4 | -------------------------------------------------------------------------------- /writings/latex-usage/dot2texi/sample.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/writings/latex-usage/dot2texi/sample.pdf -------------------------------------------------------------------------------- /writings/lazy-usefulness-state-monad/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | main :: IO () 6 | main = runSample 7 | 8 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/.gitignore: -------------------------------------------------------------------------------- 1 | output 2 | node_modules 3 | bower_components 4 | .psci* 5 | .pulp-cache 6 | /src/.webpack.js 7 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/src/main/kotlin/com/om/gh/dagger/pg/App.kt: -------------------------------------------------------------------------------- 1 | package com.om.gh.dagger.pg 2 | 3 | fun main(args: Array) { 4 | } 5 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2"], 3 | "plugins": ["transform-runtime", "transform-regenerator"] 4 | } 5 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/lib.ts: -------------------------------------------------------------------------------- 1 | import { Index } from './ui'; 2 | 3 | new Index({hello: "asdf"}); 4 | 5 | export let a: number = 5; 6 | 7 | 8 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/scm_main.ml: -------------------------------------------------------------------------------- 1 | open Base 2 | open Stdio 3 | module S = Scheme 4 | 5 | let result = "HAI" 6 | 7 | let _ = printf "result = %s\n" result -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib 2 | ( someFunc 3 | ) where 4 | 5 | someFunc :: IO () 6 | someFunc = putStrLn "someFunc" 7 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib 2 | ( someFunc 3 | ) where 4 | 5 | 6 | 7 | someFunc :: IO () 8 | someFunc = putStrLn "someFunc" 9 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/driver/src/main.rs: -------------------------------------------------------------------------------- 1 | use lib; 2 | 3 | fn main() { 4 | let three = lib::add(1, 2); 5 | println!("Hello, world!, {three}"); 6 | } 7 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/while-ret.ast: -------------------------------------------------------------------------------- 1 | { 2 | x = 10 3 | y = 20 4 | while x < y do { 5 | ret x + y 6 | } 7 | ret x + y 8 | } 9 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/convert-all-tga.sh: -------------------------------------------------------------------------------- 1 | for f in $(find res -name "*.tga"); do 2 | echo "Converting $f -> $f.png" 3 | convert $f $f.png 4 | done 5 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Re-learn Normalization by Evaluation, by implementing the Pie language 4 | from `The Little Typer`. 5 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/dune: -------------------------------------------------------------------------------- 1 | (executable 2 | (name scm_main) 3 | (libraries core stdio)) 4 | 5 | (env 6 | (dev 7 | (flags (:standard -w -32 -w -33 -w -34)))) -------------------------------------------------------------------------------- /plt-and-algo/monorepo/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | .idea 8 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/Hello/PropInterlude.lean: -------------------------------------------------------------------------------- 1 | #check (by rfl : 1 = 1) 2 | 3 | -- Hmm simp doesn't make progress 4 | -- theorem lt_ok : 5 < 18 := by simp 5 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/soot-hello/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/wow-scripts/arpg-macros/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /mobile-dev/ios-playground/view-controllers/PlayWithViewControllers/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | /out 8 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/monorepo/kt/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/lake-manifest.json: -------------------------------------------------------------------------------- 1 | {"version": 7, 2 | "packagesDir": ".lake/packages", 3 | "packages": [], 4 | "name": "hello", 5 | "lakeDir": ".lake"} 6 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/wow-scripts/blizz-api-kt/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/mobile-dev/dagger-playground/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/coq/cat-theory-for-cs/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Some exercises in Coq for Barr and Wells's Category theory for computing science 4 | (ISBN:978-0-13-120486-7). 5 | -------------------------------------------------------------------------------- /plt-and-algo/idris-tutorial/Makefile: -------------------------------------------------------------------------------- 1 | IDRIS ?= idris 2 | 3 | all : Primitives.bin 4 | 5 | %.bin : %.idr 6 | $(IDRIS) $^ -o $@ 7 | 8 | clean : 9 | rm -f *.ibc *.bin 10 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/incremental-tc/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/perceptron-rs/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Rust implementation of 4 | [Neural Networks and Deep Learning](http://neuralnetworksanddeeplearning.com/chap1.html). 5 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | local.properties 8 | -------------------------------------------------------------------------------- /wow-scripts/swing-timer/README.md: -------------------------------------------------------------------------------- 1 | ### SYNOPSIS 2 | 3 | Simple swing timer for my MM hunter. 4 | 5 | The reference implementation `Quartz-Swing.lua` is taken from Quartz-3.3.1. 6 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | local.properties 8 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/ioc-free-vs-di/kt/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/sum-loop.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | i = 0 3 | s = 0 4 | while i < 10 do { 5 | i = i + 1 6 | s = s + i 7 | } 8 | ret s 9 | } 10 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/ui-layout-system/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0" 3 | } 4 | rootProject.name = "arpg-macros" 5 | 6 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Go through https://github.com/IUCompilerCourse/Essentials-of-Compilation 4 | 5 | - Potentially with sea of nodes 6 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | local.properties 8 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/partial-eval/peaapg/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | local.properties 8 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/the-little-typer-kt/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/ssa-swap.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | x = 3 3 | y = 6 4 | while x < y do { 5 | t = x 6 | x = y 7 | y = t 8 | } 9 | ret x 10 | } 11 | -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/stack.lua: -------------------------------------------------------------------------------- 1 | (function() 2 | local gStore = aura_env 3 | 4 | return function(xs, ...) 5 | return gStore.damageTakenInTheLast5Seconds 6 | end 7 | end)() 8 | -------------------------------------------------------------------------------- /hello-emacs/js/react-tern/.eslintrc: -------------------------------------------------------------------------------- 1 | // Use this file as a starting point for your project's .eslintrc. 2 | // Copy this file, and add rule overrides as needed. 3 | { 4 | "extends": "airbnb" 5 | } 6 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/simple-if.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | x = 1 3 | y = 2 4 | if x < y then { 5 | x = 999 6 | } else { 7 | y = 6 8 | } 9 | ret x + y 10 | } 11 | -------------------------------------------------------------------------------- /plt-and-algo/static-analysis/spa/README.md: -------------------------------------------------------------------------------- 1 | ### Static Program Analysis 2 | 3 | - https://cs.au.dk/~amoeller/spa/ 4 | - [(shorter) lecture notes](https://lara.epfl.ch/w/_media/sav08:schwartzbach.pdf) 5 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/writings/kotlin-compiler/dylib-runner/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/app/Main.hs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Lib 4 | 5 | expr = lambda (lambda (add here (before here))) 6 | 7 | main :: IO () 8 | main = print $ eval expr 1 2 9 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/lib/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | id 'com.github.om.ioccmp.kotlin-library-conventions' 7 | } 8 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/arr-store-load-loop.ast: -------------------------------------------------------------------------------- 1 | { 2 | i = 0 3 | xs = newArray(10) 4 | while i < 10 do { 5 | xs[i] = i 6 | i = i + 1 7 | } 8 | ret xs 9 | } 10 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/lsra-loop-liverange-hole.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | i = 0 3 | s = 0 4 | while i < 10 do { 5 | i = i + 1 6 | s = i + i 7 | } 8 | ret s 9 | } 10 | -------------------------------------------------------------------------------- /writings/wifi-router-test/glinet.ping: -------------------------------------------------------------------------------- 1 | --- 192.168.8.238 ping statistics --- 2 | 50 packets transmitted, 49 packets received, 2.0% packet loss 3 | round-trip min/avg/max/stddev = 7.162/128.349/442.566/97.461 ms -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "react": "github:DefinitelyTyped/DefinitelyTyped/react/react.d.ts#f407264835650f5f38d4bb2c515a79e7a835916b" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overminder/kitchen-sink/HEAD/plt-and-algo/iu-essentials-of-compilation/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/src/main/kotlin/com/gh/om/peaapg/Library.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.peaapg 2 | 3 | class Library { 4 | fun someLibraryMethod(): Boolean { 5 | return true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/src/test/kotlin/com/gh/om/peaapg/LibraryTest.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.peaapg 2 | 3 | import kotlin.test.Test 4 | import kotlin.test.assertTrue 5 | 6 | class LibraryTest { 7 | } 8 | -------------------------------------------------------------------------------- /writings/diy-passport-photo/README.md: -------------------------------------------------------------------------------- 1 | ### Requirements 2 | 3 | - [Chinese passport photo (48mmx33mm x4)](http://www.passportphotochicago.com/chinese-passport.php) 4 | - Common photo size: 4x6 inch 5 | 6 | 7 | -------------------------------------------------------------------------------- /writings/wifi-router-test/att-orig.ping: -------------------------------------------------------------------------------- 1 | --- 192.168.1.71 ping statistics --- 2 | 47 packets transmitted, 43 packets received, 8.5% packet loss 3 | round-trip min/avg/max/stddev = 5.609/105.199/648.774/112.718 ms -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/README.md: -------------------------------------------------------------------------------- 1 | ## Rationale 2 | 3 | Observing that programs in CPS form don't need a stack, we might be able to 4 | perform OSR in a easier way if our interpreter is written in CPS style. 5 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | How do we type check incrementally? More specifically, how do we do pull-based 4 | incremental type checking such that only what we asked is type checked? 5 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/lib/src/main/kotlin/com/github/om/ioccmp/trad/package-info.java: -------------------------------------------------------------------------------- 1 | package com.github.om.ioccmp.trad; 2 | 3 | /** 4 | * Traditional Java DI, based on constructor injection. 5 | */ 6 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/multi-ifs.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | x = 0 3 | if x < 3 then { 4 | ret 3 5 | } else if x < 2 then { 6 | ret 2 7 | } else { 8 | ret 1 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /writings/wifi-router-test/glinet-only.ping: -------------------------------------------------------------------------------- 1 | --- 192.168.8.238 ping statistics --- 2 | 51 packets transmitted, 51 packets received, 0.0% packet loss 3 | round-trip min/avg/max/stddev = 22.381/131.494/365.446/68.662 ms -------------------------------------------------------------------------------- /hello-emacs/js/typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "sourceMap": true 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "typings" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/plt/root.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.gh.om.plt 5 | 6 | // Just to mark the root package. 7 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/Makefile: -------------------------------------------------------------------------------- 1 | CPP := cpp 2 | 3 | ALL := shall-trigger.lua.gen 4 | 5 | all : $(ALL) 6 | 7 | clean : 8 | rm -f $(ALL) 9 | 10 | %.lua.gen : %.lua queue.lua 11 | $(CPP) $< -P -o $@ 12 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/swift-pipes/deps: -------------------------------------------------------------------------------- 1 | apt-get install git cmake ninja-build clang uuid-dev libicu-dev \ 2 | icu-devtools libbsd-dev libedit-dev libxml2-dev libsqlite3-dev swig \ 3 | libpython-dev libncurses5-dev pkg-config 4 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/app/src/main/kotlin/com/github/om/ioccmp/app/App.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.github.om.ioccmp.app 5 | 6 | fun main() { 7 | } 8 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "plt-and-algo/perceptron-rs/neural-networks-and-deep-learning"] 2 | path = plt-and-algo/perceptron-rs/neural-networks-and-deep-learning 3 | url = https://github.com/mnielsen/neural-networks-and-deep-learning.git 4 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/g/observer/listv1/randtest.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.g.observer.listv1 2 | 3 | // Idea: Generate a bunch of nodes, connect them, and assign id & value. 4 | // Then watch, mutate, and verify. -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/src/web/main.tsx: -------------------------------------------------------------------------------- 1 | import * as S from '../shared'; 2 | 3 | export function foo(): string { 4 | return 'bar'; 5 | } 6 | 7 | export function bar(): S.Foo { 8 | return { value: foo() }; 9 | } 10 | 11 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/README.md: -------------------------------------------------------------------------------- 1 | # cek-mach 2 | 3 | Mostly from Hayo Thielecke's [An introduction to operational semantics and abstract machines]( 4 | http://www.cs.bham.ac.uk/~hxt/2011/02552/principles-of-programming-languages-notes.pdf). 5 | 6 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/g/observer/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | g.observer: Transitively observing changes in directed graph 4 | 5 | ### Why 6 | 7 | I assume this is an integral part of any graph database. 8 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | 7 | local.properties 8 | 9 | scratch 10 | 11 | # Sqlite DB 12 | /*.db 13 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/Main.lean: -------------------------------------------------------------------------------- 1 | import «Hello» 2 | 3 | -- Do notation 4 | def main : IO Unit := do 5 | IO.println s!"Hello, {hello}!" 6 | -- ← needs a let, and can be the last statement 7 | let stdin ← IO.getStdin 8 | pure () 9 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/notes/.latexmkrc: -------------------------------------------------------------------------------- 1 | # Custom dependency and function for nomencl package 2 | add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' ); 3 | sub makenlo2nls { 4 | system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" ); 5 | } 6 | -------------------------------------------------------------------------------- /plt-and-algo/perceptron-rs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "perceptron-rs" 3 | version = "0.1.0" 4 | authors = ["Overmind Jiang "] 5 | 6 | [dependencies] 7 | num = "*" 8 | rand = "*" 9 | ndarray = "*" 10 | ndarray-rand = "*" 11 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/click-gvn-sample.ast: -------------------------------------------------------------------------------- 1 | (a) => { 2 | i = 0 3 | while 1 do { 4 | b = a + 1 5 | i = i + b 6 | if 10 < i then { 7 | ret i + i 8 | } else { 9 | } 10 | } 11 | ret 0 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/IFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public interface IFactory { 6 | @Nonnull 7 | A create(); 8 | } 9 | -------------------------------------------------------------------------------- /hello-emacs/js/react-tern/.tern-project: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaVersion": 6, 3 | "libs": [ 4 | ], 5 | "plugins": { 6 | "node": {}, 7 | "modules": {}, 8 | "es_modules": {}, 9 | "doc_comments": {}, 10 | "complete_strings": {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/README.md: -------------------------------------------------------------------------------- 1 | # SYNOPSIS 2 | 3 | Solutions to puzzles from [Codewars](http://www.codewars.com/) or from other 4 | interesting pearls. 5 | 6 | And some PL-related codes. 7 | 8 | And something else that's romantic (to programmers): graphics, OS, etc. 9 | -------------------------------------------------------------------------------- /plt-and-algo/idris-tutorial/Pi_1.idr: -------------------------------------------------------------------------------- 1 | module Pi_1 2 | 3 | isSingleton : Bool -> Type 4 | isSingleton True = Nat 5 | isSingleton False = List Nat 6 | 7 | toSingleton : (x : Bool) -> isSingleton x 8 | toSingleton True = 0 9 | toSingleton False = Nil 10 | 11 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/fibo-iter.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | x = 0 3 | y = 1 4 | iter = 0 5 | nIter = 10 6 | while iter < nIter do { 7 | t = x + y 8 | x = y 9 | y = t 10 | iter = iter + 1 11 | } 12 | ret x 13 | } 14 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/src/lib.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import * as ReactDOM from 'react-dom'; 3 | 4 | import { Form } from './ui'; 5 | 6 | export function entryPoint(mountPoint: Element) { 7 | ReactDOM.render(
, mountPoint); 8 | } 9 | -------------------------------------------------------------------------------- /plt-and-algo/perceptron-rs/src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate num; 2 | extern crate rand; 3 | #[macro_use] 4 | extern crate ndarray; 5 | extern crate ndarray_rand; 6 | 7 | mod digit_recognition; 8 | mod network; 9 | mod network_matrix; 10 | 11 | fn main() { 12 | } 13 | 14 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/static/go.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | WebRTC Demo 4 | 5 | 6 |

HAI

7 |
8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "sourceMap": true, 5 | "jsx": "preserve" 6 | }, 7 | "files": [ 8 | "lib.ts", 9 | "ui.tsx", 10 | "typings/browser.d.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/Hello.lean: -------------------------------------------------------------------------------- 1 | -- This module serves as the root of the `Hello` library. 2 | -- Import modules here that should be built as part of the library. 3 | import «Hello».Basic 4 | import «Hello».TyKls 5 | import «Hello».Ind 6 | import «Hello».PropInterlude 7 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/Foo.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | public class Foo { 4 | public final String name; 5 | 6 | public Foo(String name) { 7 | this.name = name; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/driver/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "driver" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | 10 | lib = { path = "../lib" } -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/if-in-loop.ast: -------------------------------------------------------------------------------- 1 | (n) => { 2 | x = 0 3 | while x < n do { 4 | if x < 25 then { 5 | x = x + 1 6 | } else if x < 50 then { 7 | x = x + 2 8 | } else { 9 | x = x + 3 10 | } 11 | } 12 | ret x 13 | } 14 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/java/com/gh/om/blizzapi/util.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.blizzapi 2 | 3 | object Util { 4 | fun expanduser(path: String): String { 5 | val user = System.getProperty("user.home") 6 | return path.replaceFirst("~".toRegex(), user) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/.tern-project: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaVersion": 6, 3 | "libs": [ 4 | ], 5 | "plugins": { 6 | "node": {}, 7 | "modules": {}, 8 | "es_modules": {}, 9 | "doc_comments": {}, 10 | "complete_strings": {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es5", 5 | "noImplicitAny": true, 6 | "noUnusedLocals": true, 7 | "sourceMap": false 8 | }, 9 | "exclude": [ 10 | "node_modules" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # Linux start script should use lf 5 | /gradlew text eol=lf 6 | 7 | # These are Windows script files and should use crlf 8 | *.bat text eol=crlf 9 | 10 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/test/kotlin/com/gh/om/plt/LibraryTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.gh.om.plt 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertTrue 8 | 9 | class LibraryTest { 10 | } 11 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/readings/LIST.md: -------------------------------------------------------------------------------- 1 | - http://www.cse.chalmers.se/~rjmh/PECourse/ 2 | - (From zhihu) http://pages.cs.wisc.edu/~cs701-1/ 3 | - http://people.cis.ksu.edu/~hatcliff/FPEPS/ 4 | - [Partial Evaluation and Automatic Program 5 | Generation](https://www.itu.dk/people/sestoft/pebook/) 6 | -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/test/Main.purs: -------------------------------------------------------------------------------- 1 | module Test.Main where 2 | 3 | import Prelude 4 | import Control.Monad.Eff (Eff) 5 | import Control.Monad.Eff.Console (CONSOLE, log) 6 | 7 | main :: forall e. Eff (console :: CONSOLE | e) Unit 8 | main = do 9 | log "You should add some tests." 10 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/src/test/kotlin/com/om/gh/dagger/pg/AppTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.om.gh.dagger.pg 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertNotNull 8 | 9 | class AppTest { 10 | } 11 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/test/kotlin/com/github/om/inctc/AppTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.github.om.inctc 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertNotNull 8 | 9 | class AppTest { 10 | } 11 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/README.md: -------------------------------------------------------------------------------- 1 | ### SYNOPSIS 2 | 3 | An implemention of Lennart Augustsson's `lambda-calculus cookied four ways`. 4 | 5 | ### READING 6 | 7 | - https://www.schoolofhaskell.com/user/edwardk/bound 8 | - https://www.schoolofhaskell.com/user/edwardk/phoas 9 | 10 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/YoloEndpoint.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Target; 5 | 6 | @Target(ElementType.METHOD) 7 | public @interface YoloEndpoint { 8 | } 9 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'application' 3 | } 4 | 5 | dependencies { 6 | implementation project(':lib') 7 | } 8 | 9 | application { 10 | // Define the main class for the application. 11 | mainClassName = 'yux.ktcpg.AppKt' 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 4 | networkTimeout=10000 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/test/kotlin/com/github/om/soothello/AppTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.github.om.soothello 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertNotNull 8 | 9 | class AppTest { 10 | } 11 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/test/Main.purs: -------------------------------------------------------------------------------- 1 | module Test.Main where 2 | 3 | import Prelude 4 | import Control.Monad.Eff (Eff) 5 | import Control.Monad.Eff.Console (CONSOLE, log) 6 | 7 | main :: forall e. Eff (console :: CONSOLE | e) Unit 8 | main = do 9 | log "You should add some tests." 10 | -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Aug 30 06:59:38 PDT 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /plt-and-algo/f-bounded-polymorphism/NOTES.md: -------------------------------------------------------------------------------- 1 | ### Readings 2 | 3 | - P Canning et al, [F-Bounded Polymorphism for Object-Oriented Programming](https://www.cs.utexas.edu/~wcook/papers/FBound89/CookFBound89.pdf) 4 | - [How JVM languages benefit from self types](https://discuss.kotlinlang.org/t/self-types/371/79) 5 | 6 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Oct 31 19:47:24 PDT 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Dec 19 12:39:12 PST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "plain-js-tern", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC" 12 | } 13 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Apr 04 18:10:17 PDT 2020 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/lakefile.lean: -------------------------------------------------------------------------------- 1 | import Lake 2 | open Lake DSL 3 | 4 | package «hello» where 5 | -- add package configuration options here 6 | 7 | lean_lib «Hello» where 8 | -- add library configuration options here 9 | 10 | @[default_target] 11 | lean_exe «hello» where 12 | root := `Main 13 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "lib" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [build-dependencies] 9 | cc = "*" 10 | build-target = "*" 11 | 12 | [dependencies] 13 | chrono = "*" -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/lsra-spill-simple.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | a = 1 3 | b = 2 4 | c = 3 5 | d = 4 6 | e = 5 7 | f = 6 8 | g = 7 9 | h = 8 10 | i = 9 11 | j = 10 12 | k = 11 13 | ret a + b + c + d + e + f + g + h + i + j + k 14 | + a + b + c + d + e + f + g + h + i + j + k 15 | } 16 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/YoloResource.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Target; 5 | 6 | @Target(ElementType.TYPE) 7 | public @interface YoloResource { 8 | String path = ""; 9 | } 10 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 08 07:51:57 PDT 2020 2 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip 3 | distributionBase=GRADLE_USER_HOME 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript/main.ts: -------------------------------------------------------------------------------- 1 | /// 2 | import { greeter, shout, Cat, Dog, } from "./lib"; 3 | import sourceMapSupport = require("source-map-support"); 4 | sourceMapSupport.install(); 5 | 6 | shout(new Cat); 7 | shout(new Dog); 8 | shout(null); 9 | 10 | greeter("HAI"); 11 | greeter(1); 12 | -------------------------------------------------------------------------------- /wow-scripts/priest-shield/main.lua: -------------------------------------------------------------------------------- 1 | function() 2 | function auraValue(sid) 3 | return select(17, UnitBuff("player", GetSpellInfo(sid))) or 0 4 | end 5 | function toK(v) 6 | return math.floor(v / 1000) 7 | end 8 | -- XMO + PWS + MF 9 | return toK(auraValue(207472) + auraValue(17) + auraValue(194022)) 10 | end 11 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/tools/from-tsd/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "from-tsd", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "dependencies": {} 12 | } 13 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#aee0039a2d6686ec78352125010ebb38a7a7d743", 4 | "source-map-support": "github:DefinitelyTyped/DefinitelyTyped/source-map-support/source-map-support.d.ts#0018f1f6c62f7a899c229ce7522e40b47ca43d95" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/plt/incremental/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | - afp: Adaptive Functional Programming (Umut Acar) 4 | 5 | ### See also 6 | 7 | incremental-tc, which compares HM-style type inference on large inputs. The original goal was to also implement incremental type inference, but I never got a chance for that. -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/IService.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | public interface IService
{ 7 | void put(@Nonnull A a, int id); 8 | 9 | @Nullable 10 | A get(int id); 11 | } 12 | -------------------------------------------------------------------------------- /writings/diy-passport-photo/consts.py: -------------------------------------------------------------------------------- 1 | VG_W = 101.6 2 | VG_H = 152.4 3 | 4 | V_W = 33 5 | V_H = 48 6 | 7 | DP_MM = 11.81 8 | 9 | # mm to dots (pixels) 10 | def m2d(*x): 11 | if len(x) == 2: 12 | return m2d(x[0]), m2d(x[1]) 13 | return int(x[0] * DP_MM) 14 | 15 | def test(): 16 | print('dots w/h', VG_W * DP_MM, VG_H * DP_MM) 17 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/ast-src/nested-loop.ast: -------------------------------------------------------------------------------- 1 | () => { 2 | s = 0 3 | n = 1000 4 | x = 0 5 | while x < n do { 6 | y = 0 7 | while y < n do { 8 | z = 0 9 | while z < n do { 10 | s = s + z 11 | z = z + 1 12 | } 13 | y = y + 2 14 | } 15 | x = x + 3 16 | } 17 | ret s 18 | } 19 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod interior_mut; 2 | pub mod fibo; 3 | 4 | pub fn add(left: usize, right: usize) -> usize { 5 | left + right 6 | } 7 | 8 | #[cfg(test)] 9 | mod tests { 10 | use super::*; 11 | 12 | #[test] 13 | fn it_works() { 14 | let result = add(2, 2); 15 | assert_eq!(result, 4); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.log 3 | 4 | # sbt specific 5 | .cache 6 | .history 7 | .lib/ 8 | dist/* 9 | target/ 10 | lib_managed/ 11 | src_managed/ 12 | project/boot/ 13 | project/plugins/project/ 14 | 15 | # Scala-IDE specific 16 | .scala_dependencies 17 | .worksheet 18 | .idea 19 | *.iml 20 | 21 | # Compilation output 22 | asm 23 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/java/com/gh/om/blizzapi/base/config.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.blizzapi 2 | 3 | data class AppConfig( 4 | val client: Client, 5 | val profile: Profile, 6 | ) { 7 | data class Client( 8 | val id: String, 9 | val secret: String, 10 | ) 11 | data class Profile( 12 | val gears: String, 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-typescript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "react": "^0.14.7" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Might be easier to just have a single module. Oh well I became 4 | increasingly dependent on IDEs recently... 5 | 6 | ### TOC 7 | 8 | See each directory's README for more details. 9 | 10 | - [incremental](kt/lib/src/main/kotlin/com/gh/om/plt/incremental) 11 | - [g.observer](kt/lib/src/main/kotlin/com/gh/om/g/observer) 12 | 13 | -------------------------------------------------------------------------------- /wow-scripts/simc-apl-tools/PrettyPrint.hs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env stack runghc --package pretty-simple 2 | 3 | {- SimC APL contains too many long one-liner expressions. 4 | This tool aims to pretty print them. 5 | -} 6 | 7 | module Main where 8 | 9 | import Text.Pretty.Simple (pPrint) 10 | import AplParse 11 | 12 | main = do 13 | src <- getContents 14 | pPrint (pApl src) 15 | 16 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/App.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package om.lang.pie 5 | 6 | class App { 7 | val greeting: String 8 | get() { 9 | return "Hello world." 10 | } 11 | } 12 | 13 | fun main(args: Array) { 14 | println(App().greeting) 15 | } 16 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ambientDependencies": { 3 | "react": "registry:dt/react#0.14.0+20160319053454", 4 | "react-dom": "registry:dt/react-dom#0.14.0+20160316155526", 5 | "webrtc/mediastream": "registry:dt/webrtc/mediastream#0.0.0+20160317120654", 6 | "webrtc/rtcpeerconnection": "registry:dt/webrtc/rtcpeerconnection#0.0.0+20160316155526" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /hello-emacs/js/react-typescript/ui.tsx: -------------------------------------------------------------------------------- 1 | import { 2 | Component, 3 | } from "react"; 4 | 5 | type Hello = { 6 | hello: string 7 | }; 8 | 9 | export class Index extends Component { 10 | render() { 11 | let a: string = this.props.hello; 12 | return ( 13 |
{this.props.hello}
14 | ); 15 | } 16 | } 17 | 18 | const i = ; 19 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/RuntimeChecks.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class RuntimeChecks { 6 | public static void require(boolean x, @Nonnull String message) { 7 | if (!x) { 8 | throw new RuntimeException(message); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /plt-and-algo/coq/cat-theory-for-cs/base.v: -------------------------------------------------------------------------------- 1 | (* Classical things *) 2 | 3 | Definition Excluded_middle (P: Prop) := P \/ not P. 4 | 5 | Axiom excluded_middle: forall P, Excluded_middle P. 6 | 7 | (* Decidable and refied equality *) 8 | Definition Has_eq_bool (A: Set) := exists (beq_a: A -> A -> bool), forall (a1 a2: A), 9 | (a1 = a2 <-> beq_a a1 a2 = true) /\ (a1 <> a2 <-> beq_a a1 a2 = false). 10 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/main/kotlin/com/github/om/inctc/ScratchJ.java: -------------------------------------------------------------------------------- 1 | package com.github.om.inctc; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Target; 5 | 6 | public class ScratchJ { 7 | @Target(ElementType.TYPE_PARAMETER) 8 | static @interface Foo { 9 | } 10 | 11 | static class Bar<@Foo A> { 12 | void foo() { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /writings/jit-reading/v8-pipeline.md: -------------------------------------------------------------------------------- 1 | ### pipeline.cc 2 | 3 | `PipelineImpl` documents each step. A step (e.g. OptimizeGraph) contains multiple phases (e.g. TypedLoweringPhase). Each phase contains multiple reducers (e.g. ConstantFoldingReducer). A reducer is the smallest unit that edits the graph. 4 | 5 | ### Lowering 6 | 7 | GraphAssembler provides a macro-assembler-ish interface to help with creating nodes. -------------------------------------------------------------------------------- /hello-emacs/js/react-tern/lib.jsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | export class Index extends React.Component { 4 | constructor(props) { 5 | super(props); 6 | } 7 | 8 | getNumber() { 9 | return 5; 10 | } 11 | 12 | render() { 13 | return ( 14 |
15 | {this.getNumber()} 16 |

Hello, world

17 |
18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/src/main/kotlin/com/gh/om/iueoc/App.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.gh.om.iueoc 5 | 6 | class App { 7 | val greeting: String 8 | get() { 9 | return "Hello world." 10 | } 11 | } 12 | 13 | fun main(args: Array) { 14 | println(App().greeting) 15 | } 16 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/local.properties: -------------------------------------------------------------------------------- 1 | ## This file must *NOT* be checked into Version Control Systems, 2 | # as it contains information specific to your local configuration. 3 | # 4 | # Location of the SDK. This is only used by Gradle. 5 | # For customization when using a Version Control System, please read the 6 | # header note. 7 | #Sun May 28 17:56:07 PDT 2023 8 | sdk.dir=/Users/yxjiang/Library/Android/sdk 9 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "typescript", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "main.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "devDependencies": {}, 13 | "dependencies": { 14 | "source-map-support": "^0.4.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /wow-scripts/simc-apl-tools/acls/convoke: -------------------------------------------------------------------------------- 1 | variable,name=convoke_desync,value=floor((interpolated_fight_remains-20-cooldown.convoke_the_spirits.remains)%120)>floor((interpolated_fight_remains-25-(10*talent.incarnation.enabled)-(conduit.precise_alignment.time_value)-cooldown.ca_inc.remains)%180)|cooldown.ca_inc.remains>interpolated_fight_remains|cooldown.convoke_the_spirits.remains>interpolated_fight_remains|!covenant.night_fae -------------------------------------------------------------------------------- /plt-and-algo/idris-tutorial/Primitives.idr: -------------------------------------------------------------------------------- 1 | module Primitives 2 | 3 | x : Int 4 | x = 42 5 | 6 | foo : String 7 | foo = "helloWorld" 8 | 9 | bar : Char 10 | bar = 'b' 11 | 12 | quux : Bool 13 | quux = False 14 | 15 | rev : List a -> List a 16 | rev = go [] 17 | where 18 | go : List a -> List a -> List a 19 | go outs ins = case ins of 20 | [] => outs 21 | x :: xs => go (x :: outs) xs 22 | 23 | 24 | -------------------------------------------------------------------------------- /writings/list-pattern-matching.md: -------------------------------------------------------------------------------- 1 | # Question 2 | 3 | In the follow Haskell code 4 | 5 | length' (_:xs) = 1 + length' xs 6 | 7 | How do we know what `_` is? 8 | 9 | 10 | # Answer 11 | 12 | `:` is one of the constructor for `List` type: 13 | 14 | data List a = a : List a 15 | | [] 16 | 17 | So pattern matching something with `(_:xs) :: List a` means that `_ :: a` and 18 | `xs :: List a`. 19 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/main.js: -------------------------------------------------------------------------------- 1 | import { 2 | kVersion, 3 | List, 4 | add 5 | } from './lib'; 6 | import * as objectAssign from 'object-assign'; 7 | 8 | //lib.add(1, 2); 9 | //lib.kVersion; 10 | 11 | // Some elements. 12 | const xs = new List(); 13 | xs.push(5); 14 | xs.push(true); 15 | xs.len(); 16 | 17 | const ys = Array.of(1, 2, 3); 18 | 19 | //var x = lib.add(1, 2); 20 | 21 | //console.log(lib.kVersion); 22 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webpack-ts-demo", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "ts-loader": "^0.9.4", 13 | "tslint": "^3.15.1", 14 | "typescript": "^2.0.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/test/kotlin/com/gh/om/g/observer/listv1/proptest.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.g.observer.listv1 2 | 3 | import io.kotest.core.spec.style.StringSpec 4 | import io.kotest.property.forAll 5 | 6 | class HelloWorld : StringSpec( 7 | { 8 | "foo" { 9 | forAll { a, b -> 10 | (a + b).length == a.length + b.length 11 | } 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/README.md: -------------------------------------------------------------------------------- 1 | The bads: 2 | 3 | - extensible records not so extensible. missing row constraints and 4 | type equality. ps-foreign-options and ps-react's solutions not 5 | good enough. 6 | 7 | - Eff monad too burdensome and doesn't play well with records, e.g. 8 | can't use have a record that contains a React.readState action. 9 | 10 | - compilation too slow. makes flycheck literally unusable. 11 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.1.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'soot-hello' 11 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.1.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'blizz-api' 11 | -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "react": "^15.0.1", 16 | "react-dom": "^15.0.1" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.1.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'peaapg' 11 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.1.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'dagger-playground' 11 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.1.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'iu-eoc' 11 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.2.2/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'ui-layout-system' 11 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.5.1/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'the-little-typer' 11 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/8.0.2/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = "om-plt" 11 | include("lib") 12 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/.gitignore: -------------------------------------------------------------------------------- 1 | *.annot 2 | *.cmo 3 | *.cma 4 | *.cmi 5 | *.a 6 | *.o 7 | *.cmx 8 | *.cmxs 9 | *.cmxa 10 | 11 | # ocamlbuild working directory 12 | _build/ 13 | 14 | # ocamlbuild targets 15 | *.byte 16 | *.native 17 | 18 | # oasis generated files 19 | setup.data 20 | setup.log 21 | 22 | # Merlin configuring file for Vim and Emacs 23 | .merlin 24 | 25 | # Dune generated files 26 | *.install 27 | 28 | # Local OPAM switch 29 | _opam/ 30 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/app/src/test/kotlin/yux/ktcpg/AppTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package yux.ktcpg 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertNotNull 8 | 9 | class AppTest { 10 | @Test fun testAppHasAGreeting() { 11 | val classUnderTest = App() 12 | assertNotNull(classUnderTest.greeting, "app should have a greeting") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/7.3.3/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'ioc-cmp' 11 | include('app', 'lib') 12 | -------------------------------------------------------------------------------- /writings/cross-compile-rust-for-android.sh: -------------------------------------------------------------------------------- 1 | # Use a prebuilt llvm toolchain at $LLVM_ROOT for faster compilation. 2 | # Point $NDK_STANDALONE to your Android NDK's standalone toolchains. 3 | # Enable ccache for a faster rebuild. 4 | 5 | ./configure \ 6 | --target=i686-linux-android,arm-linux-androideabi \ 7 | --llvm-root=$LLVM_ROOT \ 8 | --enable-ccache \ 9 | --i686-linux-android-ndk=$NDK_STANDALONE \ 10 | --arm-linux-androideabi-ndk=$NDK_STANDALONE 11 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | id 'com.github.om.ioccmp.kotlin-application-conventions' 7 | } 8 | 9 | dependencies { 10 | implementation 'org.apache.commons:commons-text' 11 | implementation project(':lib') 12 | } 13 | 14 | application { 15 | // Define the main class for the application. 16 | mainClass = 'com.github.om.ioccmp.app.AppKt' 17 | } 18 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/src/test/kotlin/com/om/kitsink/layoutpg/AppTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.om.kitsink.layoutpg 5 | 6 | import kotlin.test.Test 7 | import kotlin.test.assertNotNull 8 | 9 | class AppTest { 10 | @Test fun testAppHasAGreeting() { 11 | val classUnderTest = App() 12 | assertNotNull(classUnderTest.greeting, "app should have a greeting") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/java/com/gh/om/blizzapi/base/bapi.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.blizzapi.base 2 | 3 | import com.gh.om.blizzapi.AccessToken 4 | import com.gh.om.blizzapi.Item 5 | 6 | interface Bapi { 7 | suspend fun configure() 8 | suspend fun getItem(id: String): Item 9 | val token: AccessToken 10 | } 11 | 12 | interface FastBapi { 13 | fun getItem(id: Int): Item 14 | 15 | suspend fun init() 16 | suspend fun populateItem(id: Int) 17 | } 18 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.2.2/userguide/multi_project_builds.html 8 | */ 9 | 10 | rootProject.name = 'ktc-playground' 11 | include 'app', 'lib' 12 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/common.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _COMMON_HPP 2 | #define _COMMON_HPP 3 | 4 | #include 5 | 6 | #ifdef DCHECK_IS_ON 7 | # define DCHECK(x) dcheck(x, __FILE__, __LINE__, #x) 8 | static void dcheck(bool ok, const char *fileName, int line, const char *expr) { 9 | if (!ok) { 10 | fprintf(stderr, "%s:%d: DCHECK(%s)\n", fileName, line, expr); 11 | exit(1); 12 | } 13 | } 14 | #else 15 | # define DCHECK(x) 16 | #endif 17 | 18 | #endif // _COMMON_HPP 19 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/FooServiceFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class FooServiceFactory extends AbstractFactory { 6 | 7 | protected FooServiceFactory() { 8 | super(FooService.class); 9 | } 10 | 11 | @Nonnull 12 | @Override 13 | public FooService create() { 14 | return new FooService(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES6", 4 | "module": "commonjs", 5 | "noImplicitAny": true, 6 | "outDir": ".ts-build", 7 | "jsx": "react" 8 | }, 9 | "files": [ 10 | "src/main.ts", 11 | "src/lib.tsx", 12 | "src/ws.ts", 13 | "src/rtc.ts", 14 | "src/util.ts", 15 | "src/ui.tsx", 16 | 17 | "node_modules/immutable/dist/immutable.d.ts", 18 | "typings/browser.d.ts" 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /wow-scripts/poe/hello.main.kts: -------------------------------------------------------------------------------- 1 | @file:Repository("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") 2 | @file:DependsOn("org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.3") 3 | 4 | import kotlinx.html.body 5 | import kotlinx.html.h1 6 | import kotlinx.html.html 7 | import kotlinx.html.stream.createHTML 8 | 9 | val addressee = "World" 10 | 11 | print( 12 | createHTML().html { 13 | body { 14 | h1 { +"Hello, $addressee!" } 15 | } 16 | } 17 | ) -------------------------------------------------------------------------------- /mobile-dev/ndk-standalone/mk-executables: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | mkdir bin || echo 'bin/ already exists' 4 | 5 | for target in "i686-linux-android" "x86_64-linux-android" \ 6 | "arm-linux-androideabi" "aarch64-linux-android" ; do 7 | for prog in "gcc" "g++" "gdb" "ar" "ranlib" "ld" \ 8 | "readelf" "strip" "nm" "objdump" "strings" "c++filt" "addr2line" ; do 9 | ln -s ../ndk-executable-base bin/$target-$prog 10 | chmod +x bin/$target-$prog 11 | done 12 | done 13 | 14 | -------------------------------------------------------------------------------- /plt-and-algo/coq/.gitignore: -------------------------------------------------------------------------------- 1 | .*.aux 2 | .*.d 3 | *.a 4 | *.cma 5 | *.cmi 6 | *.cmo 7 | *.cmx 8 | *.cmxa 9 | *.cmxs 10 | *.glob 11 | *.ml.d 12 | *.ml4.d 13 | *.mli.d 14 | *.mllib.d 15 | *.mlpack.d 16 | *.native 17 | *.o 18 | *.v.d 19 | *.vio 20 | *.vo 21 | *.vok 22 | *.vos 23 | .coq-native/ 24 | .csdp.cache 25 | .lia.cache 26 | .nia.cache 27 | .nlia.cache 28 | .nra.cache 29 | csdp.cache 30 | lia.cache 31 | nia.cache 32 | nlia.cache 33 | nra.cache 34 | 35 | CoqMakefile.conf 36 | Makefile.coq 37 | -------------------------------------------------------------------------------- /wow-scripts/simc-apl-tools/Apl.hs: -------------------------------------------------------------------------------- 1 | module Apl where 2 | 3 | data AplStmt 4 | = SVar String Exp 5 | deriving (Show, Eq) 6 | 7 | data Exp 8 | = EVar String 9 | | EInt Int 10 | | EProp Exp String 11 | | EBOp BRator Exp Exp 12 | | EUOp URator Exp 13 | deriving (Show, Eq) 14 | 15 | data BRator 16 | = BRPlus | BRMinus | BRRem | BRMult 17 | | BRAnd | BROr 18 | | BRGt | BRLt 19 | deriving (Show, Eq) 20 | 21 | data URator = URNot | URFloor 22 | deriving (Show, Eq) 23 | 24 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/buildSrc/src/main/groovy/com.github.om.ioccmp.kotlin-library-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | // Apply the common convention plugin for shared build configuration between library and application projects. 7 | id 'com.github.om.ioccmp.kotlin-common-conventions' 8 | 9 | // Apply the java-library plugin for API and implementation separation. 10 | id 'java-library' 11 | } 12 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-hello", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.android.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "dependencies": { 10 | "react": "^0.14.0", 11 | "react-native": "^0.23.1" 12 | }, 13 | "devDependencies": {}, 14 | "scripts": { 15 | "test": "echo \"Error: no test specified\" && exit 1" 16 | }, 17 | "author": "", 18 | "license": "ISC" 19 | } 20 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 7 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 8 | Cargo.lock 9 | 10 | # These are backup files generated by rustfmt 11 | **/*.rs.bk 12 | 13 | # MSVC Windows builds of rustc generate these, which store debugging information 14 | *.pdb -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/AnalyzeeMain.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | public class AnalyzeeMain { 4 | public static void main(String[] args) { 5 | /* 6 | DepResolver resolver = new DepResolver(); 7 | resolver.addFactory(new FooResourceFactory()); 8 | resolver.addFactory(new FooServiceFactory()); 9 | resolver.resolve(FooResource.class).getFoo(5); 10 | 11 | */ 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/FooResourceFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public class FooResourceFactory extends AbstractFactory { 6 | 7 | FooResourceFactory() { 8 | super(FooResource.class); 9 | } 10 | 11 | @Nonnull 12 | @Override 13 | public FooResource create() { 14 | return new FooResource(getDep(FooService.class)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/buildSrc/src/main/groovy/com.github.om.ioccmp.kotlin-application-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | // Apply the common convention plugin for shared build configuration between library and application projects. 7 | id 'com.github.om.ioccmp.kotlin-common-conventions' 8 | 9 | // Apply the application plugin to add support for building a CLI application in Java. 10 | id 'application' 11 | } 12 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/build.sbt: -------------------------------------------------------------------------------- 1 | scalaVersion := "2.11.8" 2 | 3 | // resolvers += Resolver.sonatypeRepo("releases") 4 | 5 | // Turn on -Werror 6 | scalacOptions ++= Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings") 7 | 8 | libraryDependencies ++= Seq( 9 | // Parser combinator. 10 | "com.lihaoyi" %% "fastparse" % "0.3.7", 11 | 12 | // Macro API. 13 | "org.scala-lang" % "scala-reflect" % "2.11.8" 14 | ) 15 | 16 | mainClass := Some("com.github.overmind.seaofnodes.Main") 17 | 18 | -------------------------------------------------------------------------------- /plt-and-algo/swift-pipes/READMD.md: -------------------------------------------------------------------------------- 1 | Just a partial Swift implementation of 2 | [Tekmo](https://www.reddit.com/user/tekmo)'s 3 | [brilliant pipes library](https://hackage.haskell.org/package/pipes). 4 | 5 | The performance is quite bad as we don't have rewrite rules in Swift. 6 | 7 | XXX: this seems to be leaking sometimes. ARC is too bad... 8 | 9 | # RUN 10 | 11 | Get [Swift](https://swift.org/) and install its [deps](deps). Then run 12 | 13 | swiftc pipes.swift && ./pipes 14 | 15 | to compile and run the example. 16 | -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "purescript", 3 | "version": "1.0.0", 4 | "moduleType": [ 5 | "node" 6 | ], 7 | "ignore": [ 8 | "**/.*", 9 | "node_modules", 10 | "bower_components", 11 | "output" 12 | ], 13 | "dependencies": { 14 | "purescript-console": "^0.1.0", 15 | "purescript-prelude": "^0.1.5", 16 | "purescript-react": "^0.7.1", 17 | "purescript-react-dom": "^0.2.0" 18 | }, 19 | "resolutions": { 20 | "purescript-react": "^0.7.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/lib/src/main/kotlin/com/github/om/ioccmp/trad/hand-wired-provider.kt: -------------------------------------------------------------------------------- 1 | package com.github.om.ioccmp.trad 2 | 3 | import com.github.om.ioccmp.* 4 | 5 | fun provideRequestHandler(bank: HwBank): CoffeeRequestHandler { 6 | return TypedCoffeeRequestHandlerImpl( 7 | HwCoffeeRequestReader, 8 | HwCurrencyUtil, 9 | HwPaymentTransactor(bank), 10 | HwCoffeePackager, 11 | HwCoffeeMaker, 12 | HwCoffeeRequest::class.java, 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /hello-emacs/js/react-tern/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-tern", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "react": "^0.14.7" 14 | }, 15 | "devDependencies": { 16 | "babel-eslint": "^4.1.8", 17 | "eslint": "^1.10.3", 18 | "eslint-config-airbnb": "^5.0.0", 19 | "eslint-plugin-react": "^3.16.1" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript/lib.ts: -------------------------------------------------------------------------------- 1 | export function greeter(person: string | number) { 2 | return "Hello, " + person; 3 | } 4 | 5 | let user = "Jane"; 6 | 7 | export function test() { 8 | console.log(greeter(user)); 9 | } 10 | 11 | interface Animal { 12 | shout(); 13 | } 14 | 15 | export class Dog implements Animal { 16 | shout() { 17 | console.log("Woof"); 18 | } 19 | } 20 | 21 | export class Cat implements Animal { 22 | shout() { 23 | console.log("Meow"); 24 | } 25 | } 26 | 27 | export function shout(a: Animal) { 28 | a.shout(); 29 | } 30 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/notes/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.wordWrap": "on", 3 | "latex-workshop.latex.tools": [ 4 | { 5 | "name": "latexmk", 6 | "command": "latexmk", 7 | "args": [ 8 | "--shell-escape", 9 | "-synctex=1", 10 | "-interaction=nonstopmode", 11 | "-file-line-error", 12 | "-pdf", 13 | "-outdir=%OUTDIR%", 14 | "%DOC%" 15 | ], 16 | "env": {} 17 | }, 18 | ], 19 | } -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/lib.js: -------------------------------------------------------------------------------- 1 | /** 2 | * The version of this library. 3 | */ 4 | export const kVersion = "0.1.0"; 5 | 6 | /** 7 | * Add x and y together. 8 | */ 9 | export function add(x, y) { 10 | return x + y; 11 | } 12 | 13 | // A list. 14 | export class List { 15 | constructor() { 16 | this.xs = []; 17 | } 18 | 19 | // Push one element. 20 | push(x) { 21 | this.xs.push(x); 22 | } 23 | 24 | // Returns the length of the list. 25 | len() { 26 | return this.xs.length; 27 | } 28 | } 29 | 30 | //module.exports = { kVersion, add, List }; 31 | -------------------------------------------------------------------------------- /hello-emacs/js/plain-es6-tern/README.md: -------------------------------------------------------------------------------- 1 | ### SYNOPSIS 2 | 3 | A scratch project that shows how to use spacemacs's JavaScript layer for plain ES6. 4 | We need to add some special configuration files: 5 | 6 | - auto-completion (through `tern` - see `.tern-project` for its configurations.) 7 | - syntax-checking (through `jshint` - see `.jshintrc` for its configurations.) 8 | - formatting (through `js-beautify` - see `.jsbeautifyrc` for its configuraitons.) 9 | 10 | For more details, see [layers/+lang/javascript](https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Blang/javascript) 11 | -------------------------------------------------------------------------------- /plt-and-algo/coq/cat-theory-for-cs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile originally taken from coq-club 2 | 3 | %: Makefile.coq phony 4 | +make -f Makefile.coq $@ 5 | 6 | all: Makefile.coq 7 | +make -f Makefile.coq all 8 | 9 | clean: Makefile.coq 10 | +make -f Makefile.coq clean 11 | rm -f Makefile.coq 12 | 13 | Makefile.coq: _CoqProject Makefile 14 | coq_makefile -f _CoqProject | sed 's/$$(COQCHK) $$(COQCHKFLAGS) $$(COQLIBS)/$$(COQCHK) $$(COQCHKFLAGS) $$(subst -Q,-R,$$(COQLIBS))/' > Makefile.coq 15 | 16 | _CoqProject: ; 17 | 18 | Makefile: ; 19 | 20 | phony: ; 21 | 22 | .PHONY: all clean phony -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/examples/fibo.rs: -------------------------------------------------------------------------------- 1 | use lib::fibo; 2 | use chrono::Utc; 3 | 4 | fn main() { 5 | bench("fibo_asm", fibo::fibo_asm, 40); 6 | bench("fibo_rs", fibo::fibo_rs, 40); 7 | bench("fibo_interp_fast", fibo::fibo_interp_fast, 40); 8 | bench("fibo_interp_slow", fibo::fibo_interp_slow, 40); 9 | } 10 | 11 | fn bench(name: &str, func: fn(i64) -> i64, arg: i64) { 12 | let t0 = Utc::now(); 13 | let out = func(arg); 14 | let t1 = Utc::now(); 15 | let dt = (t1 - t0).num_milliseconds(); 16 | println!("{name}({arg}) = {out}, took {dt} ms"); 17 | } 18 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/FooResource.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | import javax.annotation.Nullable; 5 | 6 | @YoloResource 7 | public class FooResource { 8 | @Nonnull 9 | private final IService fooService; 10 | 11 | public FooResource(@Nonnull IService fooService) { 12 | this.fooService = fooService; 13 | } 14 | 15 | @YoloEndpoint 16 | @Nullable 17 | public Foo getFoo(int id) { 18 | return fooService.get(id); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/buildSrc/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | // Support convention plugins written in Groovy. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. 7 | id 'groovy-gradle-plugin' 8 | } 9 | 10 | repositories { 11 | // Use the plugin portal to apply community plugins in convention plugins. 12 | gradlePluginPortal() 13 | } 14 | 15 | dependencies { 16 | implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31' 17 | } 18 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/src/Lib.hs: -------------------------------------------------------------------------------- 1 | module Lib 2 | ( ast2Lvn 3 | , ast2Gvn 4 | , pretty 5 | , parseAst 6 | , module Opt 7 | ) where 8 | 9 | import Ast 10 | import Ast2Lir 11 | import Lir 12 | import Opt 13 | import Parser 14 | import Text.PrettyPrint.ANSI.Leijen (pretty) 15 | import Vn 16 | 17 | ast2Lvn :: Stmt -> LGraph 18 | ast2Lvn s = g' 19 | where 20 | (g, irs) = ast2Lir s 21 | g' = lvn irs g 22 | 23 | ast2Gvn :: Stmt -> LGraph 24 | ast2Gvn s = g' 25 | where 26 | (g, irs) = ast2Lir s 27 | g' = gvn irs g 28 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/src/main/scala/com/github/overmind/seaofnodes/backend/Shared.scala: -------------------------------------------------------------------------------- 1 | package com.github.overmind.seaofnodes.backend 2 | 3 | import com.github.overmind.seaofnodes.hir.nodes.{RegAllocNode, ValueNode} 4 | 5 | trait Operand 6 | trait Reg extends Operand 7 | case class PReg(id: Int) extends Reg 8 | 9 | trait MachineSpec { 10 | def scratch: PReg 11 | def gpRegs: Seq[PReg] 12 | def showReg(r: PReg): String 13 | } 14 | 15 | object MachineSpec { 16 | } 17 | 18 | trait RegProvider { 19 | def pregFor(v: ValueNode): PReg 20 | def spillRestoreInstrs: Seq[(Int, RegAllocNode)] 21 | } 22 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/src/fibo_x64.s: -------------------------------------------------------------------------------- 1 | .globl _fibo_asm_internal 2 | _fibo_asm_internal: 3 | # fibo(n: i64) -> i64 4 | .fibo_entry: 5 | cmp $2, %rdi 6 | jge .fibo_recur 7 | mov %rdi, %rax 8 | ret 9 | .fibo_recur: 10 | sub $24, %rsp 11 | mov %rbp, (%rsp) 12 | mov %rsp, %rbp 13 | mov %rdi, 8(%rsp) 14 | sub $1, %rdi 15 | call .fibo_entry 16 | mov %rax, 16(%rsp) 17 | mov 8(%rsp), %rdi 18 | sub $2, %rdi 19 | call .fibo_entry 20 | add 16(%rsp), %rax 21 | mov (%rsp), %rbp 22 | add $24, %rsp 23 | ret 24 | 25 | .globl _get1 26 | _get1: 27 | xor %eax, %eax 28 | ret 29 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/elab.kt: -------------------------------------------------------------------------------- 1 | package om.lang.pie 2 | 3 | object Elab { 4 | fun asType(e: PiExpr): PiCore { 5 | when (e) { 6 | PiExpr.Zero -> TODO() 7 | is PiExpr.Succ -> TODO() 8 | is PiExpr.NatLit -> TODO() 9 | is PiExpr.RecNat -> TODO() 10 | is PiExpr.Var -> TODO() 11 | is PiExpr.The -> TODO() 12 | is PiExpr.Lam -> TODO() 13 | is PiExpr.App -> TODO() 14 | PiExpr.Nat -> TODO() 15 | PiExpr.Set -> TODO() 16 | is PiExpr.Arr -> TODO() 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/FooService.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.Map; 5 | 6 | import javax.annotation.Nonnull; 7 | import javax.annotation.Nullable; 8 | 9 | public class FooService implements IService { 10 | private final Map storage = new LinkedHashMap<>(); 11 | 12 | @Override 13 | public void put(@Nonnull Foo foo, int id) { 14 | storage.put(id, foo); 15 | } 16 | 17 | @Nullable 18 | @Override 19 | public Foo get(int id) { 20 | return storage.get(id); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/java/com/gh/om/blizzapi/base/character_state.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.blizzapi.base 2 | 3 | import com.gh.om.blizzapi.GreatVaultOption 4 | import com.gh.om.blizzapi.PlayerActivity 5 | 6 | interface CharacterStateFactory { 7 | fun create( 8 | equipmentState: Simc.EquipmentState, 9 | lootDistribution: LootDistribution, 10 | ): CharacterState 11 | } 12 | 13 | interface CharacterState { 14 | val equipments: Simc.EquipmentState 15 | fun startWeek() 16 | fun runActivity(activity: PlayerActivity) 17 | fun finalizeWeeklyChests(): List 18 | 19 | var bonusRollCount: Int 20 | } 21 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/src/main/scala/com/github/overmind/seaofnodes/ast/Stmts.scala: -------------------------------------------------------------------------------- 1 | package com.github.overmind.seaofnodes.ast 2 | 3 | sealed trait Stmt 4 | 5 | object Stmt { 6 | def begin(ss: Stmt*) = Begin(ss) 7 | } 8 | 9 | case class Begin(ss: Seq[Stmt]) extends Stmt 10 | case class Assign(v: Loc, e: Expr) extends Stmt 11 | object Assign { 12 | def apply(v: String, e: Expr): Stmt = { 13 | Assign(LVar(v), e) 14 | } 15 | } 16 | case class If(cond: Expr, t: Stmt, f: Stmt) extends Stmt 17 | case class While(cond: Expr, body: Stmt) extends Stmt 18 | case class Ret(e: Expr) extends Stmt 19 | 20 | case class FuncDef(args: Seq[String], body: Stmt) -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [versions] 2 | kotlin = "1.9.20" 3 | kotest = "5.8.0" 4 | 5 | [libraries] 6 | kotest-property = { module = "io.kotest:kotest-property", version.ref = "kotest" } 7 | kotest-runner = { module = "io.kotest:kotest-runner-junit5", version.ref = "kotest" } 8 | kotest-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" } 9 | kotlin-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin" } 10 | kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version = "1.7.3" } 11 | 12 | [plugins] 13 | kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } 14 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/src/main/scala/com/github/overmind/seaofnodes/hir/nodes/Edge.scala: -------------------------------------------------------------------------------- 1 | package com.github.overmind.seaofnodes.hir.nodes 2 | 3 | case class Edge(from: Node, to: Node, ix: Int, isControlDep: Boolean) { 4 | // Shallow equality. 5 | override def equals(that: Any): Boolean = { 6 | that match { 7 | case e: Edge => 8 | from.eq(e.from) && to.eq(e.to) && ix == e.ix && isControlDep == e.isControlDep 9 | case _ => 10 | false 11 | } 12 | } 13 | 14 | // Shallow hash 15 | override def hashCode = { 16 | Seq(from.identityHashCode, to.identityHashCode, ix.hashCode, isControlDep.hashCode) 17 | .foldRight(0)(_ + _ * 41) 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * The settings file is used to specify which projects to include in your build. 5 | * 6 | * Detailed information about configuring a multi-project build in Gradle can be found 7 | * in the user manual at https://docs.gradle.org/6.2.2/userguide/multi_project_builds.html 8 | */ 9 | 10 | pluginManagement { 11 | repositories { 12 | // Grab bleeding edge versions of Kotlin gradle plugin. 13 | maven { 14 | url = "https://dl.bintray.com/kotlin/kotlin-eap/" 15 | } 16 | gradlePluginPortal() 17 | } 18 | } 19 | 20 | rootProject.name = 'inc-tc-pg' 21 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/kotlin/com/github/om/soothello/ow2main.kt: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello 2 | 3 | import org.objectweb.asm.ClassReader 4 | import org.objectweb.asm.tree.ClassNode 5 | 6 | object OwMain { 7 | fun main() { 8 | val cpRoot = Chrysaor.rootDir / "build" / "data" / "classes" / "java" / "main" 9 | val className = "com.linkedin.data.lite.DataTemplate" 10 | val cp = cpRoot / (className.replace(".", "/") + ".class") 11 | val c = ClassNode() 12 | cp.inputStream().use { 13 | val cr = ClassReader(it) 14 | cr.accept(c, 0) 15 | } 16 | println(c.methods) 17 | } 18 | } 19 | 20 | fun main() { 21 | OwMain.main() 22 | } -------------------------------------------------------------------------------- /plt-and-algo/final-tagless-interpreter/src/Tagful0.hs: -------------------------------------------------------------------------------- 1 | module Tagful0 2 | ( here 3 | , before 4 | , add 5 | , lambda 6 | , eval 7 | ) where 8 | 9 | -- Initial-style tagful implementation. 10 | 11 | type Ix = Int 12 | type Val = Int 13 | 14 | data Term a where 15 | TVar :: Ix -> Term Val 16 | TAdd :: Term Val -> Term Val -> Term Val 17 | TLambda :: Term a -> Term (Ix -> a) 18 | 19 | eval :: Term a -> [Val] -> a 20 | eval (TVar ix) env = env !! ix 21 | eval (TAdd a b) env = eval a env + eval b env 22 | eval (TLambda b) env = \ a -> eval b (a:env) 23 | 24 | here = TVar 0 25 | before :: Term Val -> Term Val 26 | before (TVar v) = TVar (v + 1) 27 | add = TAdd 28 | lambda = TLambda 29 | 30 | 31 | -------------------------------------------------------------------------------- /plt-and-algo/defunctionalization/Sample.hs: -------------------------------------------------------------------------------- 1 | -- Original program 2 | 3 | myMap f = \case 4 | [] -> [] 5 | x:xs -> f x:myMap xs 6 | 7 | xs = myMap (+1) [1, 2, 3] 8 | ys = myMap (*2) [1, 2, 3] 9 | 10 | -- Defunctionalized (dispatch style) closure conversion 11 | 12 | data Closure 13 | = Add Int 14 | | Mul Int 15 | 16 | -- Note that args is a hetrogenerous list and can't be represented 17 | -- directly in a typed source language 18 | apply args = \case 19 | Add x -> let [y] = args 20 | in x + y 21 | Mul x -> let [y] = args 22 | in x * y 23 | 24 | myMap f = \case 25 | [] -> [] 26 | x:xs -> apply f [x]:myMap xs 27 | 28 | xs = myMap (Add 1) [1, 2, 3] 29 | ys = myMap (Mul 2) [1, 2, 3] 30 | 31 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/value.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _VALUE_HPP 2 | #define _VALUE_HPP 3 | 4 | #include 5 | 6 | #include "info.hpp" 7 | #include "common.hpp" 8 | 9 | class Value final { 10 | public: 11 | Value(Info *info) { 12 | info_ = info; 13 | } 14 | 15 | Value *&at(intptr_t ix) { 16 | DCHECK(ix >= 0 && ix < info_->numPtrs()); 17 | return payloads_[ix]; 18 | } 19 | 20 | intptr_t &wordAt(intptr_t ix) { 21 | DCHECK(ix >= info_->numPtrs() && ix < info_->numPayloads()); 22 | return *reinterpret_cast(payloads_)[ix]; 23 | } 24 | 25 | Info &info() { 26 | return *info_; 27 | } 28 | 29 | private: 30 | Info *info_; 31 | Value *payloads_[0]; 32 | }; 33 | 34 | #endif // _VALUE_HPP 35 | -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/varargs-fu.lua: -------------------------------------------------------------------------------- 1 | function third(...) 2 | local _, _, res = ... 3 | return res 4 | end 5 | assert(third(1, 2, 3) == 3) 6 | 7 | function third1(...) 8 | -- We can pass varargs to another function directly. 9 | return third(...) 10 | end 11 | assert(third1(1, 2, 3) == 3) 12 | 13 | function third2(...) 14 | return select(3, ...) 15 | end 16 | assert(third2(1, 2, 3) == 3) 17 | 18 | -- Can't do this as the vararg expression must be used immediately in the 19 | -- containing function. 20 | -- This is somehow expected since varargs are in the immediate callee's stack 21 | -- and could not be cheaply passed as upvals. 22 | function third3(...) 23 | return (function() 24 | return select(3, ...) 25 | end)() 26 | end 27 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/scheme.ml: -------------------------------------------------------------------------------- 1 | open Base 2 | module P = Parser_comb 3 | 4 | type s_expr = 5 | | S_atom of string 6 | | S_list of s_list 7 | 8 | and s_list = { 9 | xs: s_expr list; 10 | tail: s_expr option; 11 | } 12 | 13 | let p_ws = P.many (P.p_that Char.is_whitespace) |> P.map_p (fun _ -> ()) 14 | let p_ident = P.latter_p p_ws @@ P.many1 (P.p_that Char.is_alpha) |> P.map_p String.of_char_list 15 | 16 | let rec p_expr () = 17 | P.orElse (P.lazy p_atom) p_list 18 | 19 | and p_atom () = 20 | p_ident |> P.map_p (fun x -> S_atom x) 21 | 22 | and p_list () = 23 | let lpar = P.latter_p p_ws (P.p_char '(') in 24 | let rpar = P.latter_p p_ws (P.p_char ')') in 25 | let exprs = P.many p_expr in 26 | P.latter_p lpar (P.former_p exprs rpar) 27 | -------------------------------------------------------------------------------- /wow-scripts/legion-info: -------------------------------------------------------------------------------- 1 | ### Everything 2 | 3 | - https://docs.google.com/spreadsheets/d/1TiiI4huz4NXKfx7PGvvVTyP6xu8VaDNZ4-FEn69mOhc/pubhtml# 4 | 5 | ### Hunter 6 | 7 | - Artifact Traits vs DPS increment: http://www.mmo-champion.com/threads/2030453-Legion-Theorycrafting-All-specs 8 | - How to Epeen: http://www.mmo-champion.com/threads/2051633-Would-it-be-a-mistake-to-main-beast-master 9 | - Discord: https://discordapp.com/channels/129594743393878017/129594743393878017 10 | 11 | ### Rep 12 | 13 | - http://www.wowhead.com/guides/nightfallen-reputation 14 | - http://www.wowhead.com/guides/reputation/legion/the-wardens 15 | 16 | ### Mythic Dungeon 17 | 18 | - http://www.wowhead.com/guides/raiding/dungeons/warlords-of-draenor-dungeon-overview 19 | 20 | 21 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/src/RN.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // module RN 4 | 5 | var React = require('react-native'); 6 | 7 | exports.registerComponentF = function(name, component) { 8 | return function() { 9 | React.AppRegistry.registerComponent(name, function() { 10 | return component; 11 | }); 12 | }; 13 | }; 14 | 15 | exports.createStyleSheetF = function(name, value) { 16 | return function() { 17 | var key = 'anonymous'; 18 | var sheetObj = {}; 19 | sheetObj[key] = value; 20 | var sheet = React.StyleSheet.create(sheetObj); 21 | return sheet[key]; 22 | }; 23 | }; 24 | 25 | exports.viewClass = React.View; 26 | exports.textClass = React.Text; 27 | exports.touchableOpacityClass = React.TouchableOpacity; 28 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/main/kotlin/com/github/om/inctc/logging.kt: -------------------------------------------------------------------------------- 1 | package com.github.om.inctc 2 | 3 | object Log { 4 | private val minimalLevel = Level.Error 5 | 6 | enum class Level { Debug, Error } 7 | private val levels = Level.values() 8 | 9 | private val Level.index: Int 10 | get() = levels.indexOf(this) 11 | 12 | fun enabled(level: Level): Boolean { 13 | return level.index >= minimalLevel.index 14 | } 15 | 16 | inline fun d(crossinline msg: () -> String) { 17 | if (!enabled(Level.Debug)) return 18 | 19 | println(msg()) 20 | } 21 | 22 | inline fun e(crossinline msg: () -> String) { 23 | if (!enabled(Level.Error)) return 24 | 25 | println(msg()) 26 | } 27 | } -------------------------------------------------------------------------------- /plt-and-algo/defunctionalization/README.md: -------------------------------------------------------------------------------- 1 | ## Basic Idea 2 | 3 | Instead of representing closures as a single `(funcEntryPtr, payloads)`, we 4 | split them into two parts: 5 | 6 | - (funcTag, payloads) 7 | - `apply :: Closure -> Value` 8 | 9 | ## Issues 10 | 11 | The problem is, the apply function can get very big. Consider that compilers 12 | usually have superlinear complexity, it would be very slow to compile 13 | this function. 14 | 15 | ## Related Work 16 | 17 | Sandboxed environments such as WebAssembly make use of this approach, 18 | instead of the direct approach, for security reasons. 19 | 20 | ### Readings 21 | 22 | - Defunctionalization at Work 23 | - Polymorphic Typed Defunctionalization 24 | - Definitional Interpreters for Higher-Order Programming Languages 25 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/src/main/kotlin/com/gh/om/iueoc/util.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.iueoc 2 | 3 | sealed class Trampoline { 4 | class MoreToGo
(val call: () -> Trampoline) : Trampoline() 5 | class Done(val result: A) : Trampoline() 6 | } 7 | 8 | tailrec fun Trampoline.value(): A = when (this) { 9 | is Trampoline.Done -> result 10 | is Trampoline.MoreToGo -> call().value() 11 | } 12 | 13 | object Tr { 14 | fun pure(a: A) = Trampoline.Done(a) 15 | fun more(a: () -> Trampoline) = Trampoline.MoreToGo(a) 16 | fun once(a: () -> A) = Trampoline.MoreToGo { pure(a()) } 17 | } 18 | 19 | fun Collection.indexOfSafe(a: A): Int? { 20 | val ix = indexOf(a) 21 | return ix.takeUnless { it == -1 } 22 | } -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Kotlin ### 20 | .kotlin 21 | 22 | ### Eclipse ### 23 | .apt_generated 24 | .classpath 25 | .factorypath 26 | .project 27 | .settings 28 | .springBeans 29 | .sts4-cache 30 | bin/ 31 | !**/src/main/**/bin/ 32 | !**/src/test/**/bin/ 33 | 34 | ### NetBeans ### 35 | /nbproject/private/ 36 | /nbbuild/ 37 | /dist/ 38 | /nbdist/ 39 | /.nb-gradle/ 40 | 41 | ### VS Code ### 42 | .vscode/ 43 | 44 | ### Mac OS ### 45 | .DS_Store -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/TODO: -------------------------------------------------------------------------------- 1 | # Alias analysis 2 | 3 | - How to do that? 4 | 5 | # SCCP 6 | 7 | - Implement it. 8 | 9 | # LSRA 10 | 11 | - Implement rest of the algorithm: 12 | 13 | * Finish unimplemented spilling functions. 14 | 15 | * Add register hint. 16 | 17 | Crucial, as xchg is very slow. 18 | 19 | * Fix PhiNode resolution pass. 20 | 21 | Currently we assume all the phi inputs are in the registers. This is 22 | not always true - for example, a vreg spilled before a loop and restored in 23 | the loop body might not be in the restored-to register at the loop end. 24 | 25 | - Add rematerialization. 26 | 27 | * GCM hoist many constants to the first block and they occupy too many 28 | registers! 29 | 30 | * "Global code motion with spilling"? 31 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-hello", 3 | "version": "1.0.0", 4 | "moduleType": [ 5 | "node" 6 | ], 7 | "ignore": [ 8 | "**/.*", 9 | "node_modules", 10 | "bower_components", 11 | "output" 12 | ], 13 | "dependencies": { 14 | "purescript-react": "0.7.1", 15 | "purescript-dom": "^0.2.20", 16 | "purescript-prelude": "^0.1.5", 17 | "purescript-generics": "^0.7.2", 18 | "purescript-data-default": "^0.1.0", 19 | "purescript-foreign-options": "^0.1.1", 20 | "purescript-foldable-traversable": "^0.4.2", 21 | "purescript-sequences": "^0.6.0" 22 | }, 23 | "devDependencies": { 24 | "purescript-console": "^0.1.1" 25 | }, 26 | "resolutions": { 27 | "purescript-react": "0.7.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/core.kt: -------------------------------------------------------------------------------- 1 | package om.lang.pie 2 | 3 | // Elaborated core expressions 4 | 5 | sealed class PiCore { 6 | object Zero : PiCore() 7 | data class Succ(val pred: PiCore) : PiCore() 8 | data class NatLit(val value: Int) : PiCore() 9 | data class RecNat(val type: PiCore, val nat: PiCore, val base: PiCore, val step: PiCore) : PiCore() 10 | 11 | data class Var(val name: String) : PiCore() 12 | data class The(val type: PiCore, val body: PiCore) : PiCore() 13 | 14 | data class Lam(val arg: String, val body: PiCore) : PiCore() 15 | data class App(val f: PiCore, val args: PiCore) : PiCore() 16 | 17 | object Nat : PiCore() 18 | object Set : PiCore() 19 | data class Arr(val arg: PiCore, val res: PiCore) : PiCore() 20 | } -------------------------------------------------------------------------------- /writings/latex-usage/dot2texi/sample.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | \usepackage{dot2texi} 3 | \usepackage{tikz} 4 | \usetikzlibrary{shapes,arrows} 5 | 6 | \begin{document} 7 | 8 | % The layout program is important! 9 | \begin{dot2tex}[dot,mathmode] 10 | digraph G { 11 | 12 | subgraph cluster_0 { 13 | style=filled; 14 | color=lightgrey; 15 | node [style=filled,color=white]; 16 | a0 -> a1 -> a2 -> a3; 17 | label = "process 1"; 18 | } 19 | 20 | subgraph cluster_1 { 21 | node [style=filled]; 22 | b0 -> b1 -> b2 -> b3; 23 | label = "process 2"; 24 | color=blue 25 | } 26 | start -> a0; 27 | start -> b0; 28 | a1 -> b3; 29 | b2 -> a3; 30 | a3 -> a0; 31 | a3 -> end666; 32 | b3 -> end666; 33 | 34 | start [shape=Mdiamond]; 35 | end [shape=Msquare]; 36 | } 37 | \end{dot2tex} 38 | 39 | \end{document} 40 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/src/Lang.hs: -------------------------------------------------------------------------------- 1 | module Lang where 2 | 3 | import Data.String (IsString (..)) 4 | 5 | type Name = String 6 | 7 | data ScopedName 8 | = LocalName Name 9 | | GlobalName Name 10 | deriving (Show) 11 | 12 | data Stmt 13 | = SWhile Expr Stmt 14 | | SIf Expr Stmt Stmt 15 | | SRet Expr 16 | | SExpr Expr 17 | | SDef Name Expr 18 | | SBlock [Stmt] 19 | | SPrimPrint Expr 20 | deriving (Show) 21 | 22 | instance IsString Expr where 23 | fromString = EVar . LocalName 24 | 25 | gVar :: String -> Expr 26 | gVar = EVar . GlobalName 27 | 28 | data Expr 29 | = EVar ScopedName 30 | | ELit Int 31 | | ECall Expr [Expr] 32 | | EPrimLt Expr Expr 33 | | EPrimAdd Expr Expr 34 | deriving (Show) 35 | 36 | data Function = Function Name [Name] Stmt 37 | deriving (Show) 38 | 39 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/build.rs: -------------------------------------------------------------------------------- 1 | use build_target::Arch; 2 | 3 | const FIBO_INTERP: &str = "src/fibo_interp.c"; 4 | 5 | fn get_fibo_source() -> &'static str { 6 | let arch = build_target::target_arch().unwrap(); 7 | match arch { 8 | Arch::AARCH64 => "src/fibo_aarch64.s", 9 | Arch::X86_64 => "src/fibo_x64.s", 10 | _ => panic!("Unsupported arch: {arch}"), 11 | } 12 | } 13 | 14 | fn main() { 15 | let source = get_fibo_source(); 16 | println!("cargo:rerun-if-changed={source}"); 17 | println!("cargo:rerun-if-changed={FIBO_INTERP}"); 18 | // Use the `cc` crate to build a C file and statically link it. 19 | cc::Build::new() 20 | .file(source) 21 | .compile("fibo-asm"); 22 | cc::Build::new() 23 | .file(FIBO_INTERP) 24 | .compile("fibo-interp"); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/src/main/kotlin/com/om/gh/dagger/pg/binds/binds.kt: -------------------------------------------------------------------------------- 1 | package com.om.gh.dagger.pg.binds 2 | 3 | import dagger.Binds 4 | import dagger.Component 5 | import dagger.Module 6 | import dagger.Provides 7 | import javax.inject.Inject 8 | 9 | interface B1 10 | interface B2 11 | 12 | class B1Impl @Inject constructor() : B1 13 | class B2Impl @Inject constructor() : B2 14 | 15 | @Module 16 | abstract class BindsModule { 17 | companion object { 18 | @JvmStatic 19 | @Provides 20 | fun b1(b1: B1Impl): B1 = b1 21 | } 22 | 23 | @Binds 24 | abstract fun b2(b2: B2Impl): B2 25 | } 26 | 27 | @Component(modules = [BindsModule::class]) 28 | interface BindsComponent { 29 | val b1: B1 30 | val b2: B2 31 | } 32 | 33 | fun main() { 34 | DaggerBindsComponent 35 | .create() 36 | .b1 37 | } -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/AbstractFactory.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import javax.annotation.Nonnull; 4 | 5 | public abstract class AbstractFactory implements IFactory { 6 | 7 | final Class klass; 8 | private DepResolver resolver; 9 | 10 | protected AbstractFactory(@Nonnull Class klass) { 11 | this.klass = klass; 12 | } 13 | 14 | final void setResolver(@Nonnull DepResolver resolver) { 15 | RuntimeChecks.require(this.resolver == null, this + " already attached to resolver"); 16 | this.resolver = resolver; 17 | } 18 | 19 | final protected B getDep(@Nonnull Class kls) { 20 | RuntimeChecks.require(resolver != null, this + " not yet attached to resolver"); 21 | return resolver.resolve(kls); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Access Blizzard API to optimize my char, by planning my next dungeon to run. 4 | 5 | ### Planning 6 | 7 | 1. Use Blizzard API to get item stats from dungeons. 8 | 9 | 1.1. Problem: Bapi doesn't support bonus (e.g. scaling ilvl). 10 | All the SL dungeon items are 158 ilevel. 11 | 12 | Read simc source to see how they do ilevel scaling. 13 | 14 | ### Links 15 | 16 | - To create/manage Blizzard API clients: 17 | https://develop.battle.net/access/clients 18 | 19 | - API doc (credentials flow): 20 | https://develop.battle.net/documentation/guides/using-oauth/client-credentials-flow 21 | 22 | - API doc (WoW data): 23 | https://develop.battle.net/documentation/world-of-warcraft/game-data-apis 24 | 25 | - Another WoW API client in Java: 26 | https://github.com/chalverson/wowjavaapi 27 | -------------------------------------------------------------------------------- /plt-and-algo/pi-singletons/pi-singletons.cabal: -------------------------------------------------------------------------------- 1 | -- Initial pi-singletons.cabal generated by cabal init. For further 2 | -- documentation, see http://haskell.org/cabal/users-guide/ 3 | 4 | name: pi-singletons 5 | version: 0.1.0.0 6 | -- synopsis: 7 | -- description: 8 | license: BSD3 9 | license-file: LICENSE 10 | author: Overmind JIANG 11 | maintainer: p90eri@gmail.com 12 | -- copyright: 13 | -- category: 14 | build-type: Simple 15 | -- extra-source-files: 16 | cabal-version: >=1.10 17 | 18 | library 19 | -- exposed-modules: 20 | -- other-modules: 21 | -- other-extensions: 22 | build-depends: base >=4.8 && <4.9 23 | hs-source-dirs: src 24 | default-language: Haskell2010 25 | exposed-modules: Lib 26 | -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/src/main/kotlin/com/gh/om/gamemacros/Main.kt: -------------------------------------------------------------------------------- 1 | package org.example.com.gh.om.gamemacros 2 | 3 | import com.gh.om.gamemacros.GameSpecific 4 | import com.github.kwhat.jnativehook.GlobalScreen 5 | import kotlinx.coroutines.async 6 | import kotlinx.coroutines.joinAll 7 | import kotlinx.coroutines.runBlocking 8 | 9 | private fun innerMain() { 10 | runBlocking { 11 | val tasks = GameSpecific.ALL.map { mkTask -> 12 | async { mkTask() } 13 | } 14 | tasks.joinAll() 15 | } 16 | } 17 | 18 | fun main() { 19 | GlobalScreen.registerNativeHook() 20 | try { 21 | innerMain() 22 | } finally { 23 | // NativeHook will create non-daemon thread when key listeners are added. 24 | // Stop the thread by unregistering the hook. 25 | GlobalScreen.unregisterNativeHook() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /mobile-dev/rtl-pg/hello.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

English text

6 |

ويكيبيديا العربية

7 | 8 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /plt-and-algo/pat-werewolf/ww.curry: -------------------------------------------------------------------------------- 1 | data Race = Werewolf | Human 2 | 3 | flipRace Werewolf = Human 4 | flipRace Human = Werewolf 5 | 6 | -- Nth player is what race 7 | type Assertion = (Int, Race) 8 | 9 | -- #, race 10 | type Players = [Race] 11 | 12 | raceAt :: Int -> Players -> Race 13 | raceAt i rs = rs !! (i - 1) 14 | 15 | flipAssertion :: Assertion -> Assertion 16 | flipAssertion (i, r) = (i, flipRace r) 17 | 18 | flipAssertions :: [Assertion] -> [Race] -> [Assertion] 19 | 20 | genPlayers :: Int -> [Race] 21 | genPlayers n = genPlayers' n 2 22 | 23 | genPlayers' :: Int -> Int -> [Race] 24 | genPlayers' n ww = if n == 0 25 | then if ww == 0 26 | then [] 27 | else failed 28 | else if ww > 0 29 | then addWw ? addHuman 30 | else addHuman 31 | where 32 | addWw = Werewolf : genPlayers' (n - 1) (ww - 1) 33 | addHuman = Human : genPlayers' (n - 1) ww 34 | 35 | 36 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/test/TestCEK.hs: -------------------------------------------------------------------------------- 1 | module TestCEK where 2 | 3 | import Test.Hspec 4 | 5 | import CEK 6 | 7 | testCek = describe "CEK" $ do 8 | it "halts on empty kont" $ do 9 | let w = VInt 0 10 | evalSteps (EValue w, emptyEnv, emptyKont) `shouldBe` Just w 11 | 12 | it "captures lambda env" $ do 13 | let 14 | lam = Lam "x" (EVar "x") 15 | clo = VClo lam emptyEnv 16 | evalSteps (ELam lam, emptyEnv, emptyKont) `shouldBe` Just clo 17 | 18 | it "id x = x" $ do 19 | let 20 | lam = Lam "x" (EVar "x") 21 | w = VInt 0 22 | evalSteps (EAp (ELam lam) (EValue w), emptyEnv, emptyKont) `shouldBe` Just w 23 | 24 | it "k x y = x" $ do 25 | let 26 | lam = Lam "x" (ELam (Lam "y" (EVar "x"))) 27 | w0 = VInt 0 28 | w1 = VInt 1 29 | evalSteps (ELam lam `EAp` EValue w0 `EAp` EValue w1, emptyEnv, emptyKont) `shouldBe` Just w0 30 | 31 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/src/main/kotlin/com/gh/om/plt/incremental/afp/adaptive.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.plt.incremental.afp 2 | 3 | // Unfortunately there's no hkt in Kotlin. We'll have to make mod and dest separate interfaces that 4 | // are not tied to Adaptive instead. 5 | interface AdaptiveModule { 6 | fun
mod( 7 | /** 8 | * Returns true if the arguments are the same value. 9 | */ 10 | cmp: (A, A) -> Boolean, 11 | f: (Dest) -> C 12 | ): Mod 13 | 14 | fun read( 15 | mod: Mod, 16 | f: (A) -> C 17 | ): C 18 | 19 | fun write( 20 | dest: Dest, 21 | value: A 22 | ): C 23 | 24 | fun init() 25 | fun change( 26 | mod: Mod, 27 | value: A 28 | ) 29 | 30 | fun propagate() 31 | } 32 | 33 | interface Mod 34 | 35 | interface Dest 36 | -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/src/main/kotlin/com/gh/om/gamemacros/PlatformSpecific.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.gamemacros 2 | 3 | enum class OS { 4 | Mac, 5 | Windows, 6 | Linux; 7 | 8 | companion object { 9 | val CURRENT = PlatformInferrer.getOs() 10 | } 11 | } 12 | 13 | private object PlatformInferrer { 14 | 15 | fun getOs(): OS? { 16 | // 17 | val osName = System.getProperty("os.name", "generic").lowercase() 18 | return when { 19 | osName.indexOf("mac") >= 0 || osName.indexOf("darwin") >= 0 -> { 20 | OS.Mac 21 | } 22 | osName.indexOf("win") >= 0 -> { 23 | OS.Windows 24 | } 25 | osName.indexOf("nux") >= 0 -> { 26 | OS.Linux 27 | } 28 | else -> { 29 | null 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /plt-and-algo/sea-of-nodes/scala-src/src/main/scala/com/github/overmind/seaofnodes/ast/Exprs.scala: -------------------------------------------------------------------------------- 1 | package com.github.overmind.seaofnodes.ast 2 | 3 | 4 | sealed trait Expr 5 | 6 | case class Lit(lval: Long) extends Expr 7 | case class Binary(op: BinaryOp, lhs: Expr, rhs: Expr) extends Expr 8 | case class AllocArray(n: Int) extends Expr 9 | 10 | sealed trait Loc extends Expr 11 | case class LVar(v: String) extends Loc 12 | case class LIndex(base: Expr, index: Expr) extends Loc 13 | 14 | object Expr { 15 | def add(lhs: Expr, rhs: Expr) = Binary(BinaryOp.Add, lhs, rhs) 16 | def sub(lhs: Expr, rhs: Expr) = Binary(BinaryOp.Sub, lhs, rhs) 17 | def lessThan(lhs: Expr, rhs: Expr) = Binary(BinaryOp.LessThan, lhs, rhs) 18 | } 19 | 20 | sealed trait BinaryOp 21 | 22 | object BinaryOp { 23 | case object Add extends BinaryOp 24 | case object Sub extends BinaryOp 25 | case object LessThan extends BinaryOp 26 | } 27 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/app/src/main/kotlin/yux/ktcpg/App.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package yux.ktcpg 5 | 6 | import org.jetbrains.kotlin.psi.KtNamedFunction 7 | 8 | object Sources { 9 | val hello = """ 10 | fun foo(b: Int) { 11 | val a = 5 12 | a = 8 13 | } 14 | """.trimIndent() 15 | } 16 | 17 | object SourceLookers { 18 | fun hello() { 19 | val f = parseToKtFile(Sources.hello) 20 | val fst = f.declarations.first() as KtNamedFunction 21 | println("valP: " + fst.valueParameters.map { it.text }) 22 | println("children: " + fst.children.map { it.text }) 23 | println("body: " + fst.bodyExpression?.text) 24 | println("bodyBlock: " + fst.bodyBlockExpression?.text) 25 | } 26 | } 27 | 28 | fun main() { 29 | SourceLookers.hello() 30 | } 31 | -------------------------------------------------------------------------------- /plt-and-algo/ll-comp-with-cps/src/Sample.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | 3 | module Sample where 4 | 5 | import Lang 6 | 7 | idFunc :: Function 8 | idFunc = Function "id" ["x"] (SRet "x") 9 | 10 | sFunc :: Function 11 | sFunc = Function "s" ["f", "g", "x"] 12 | (SRet (ECall "f" ["x", ECall "g" ["x"]])) 13 | 14 | loopSum :: Function 15 | loopSum = Function "loopSum" ["N"] 16 | (SBlock [ SDef "i" (ELit 0) 17 | , SDef "s" (ELit 0) 18 | , SWhile (EPrimLt "i" "N") 19 | (SBlock [ SDef "s" (EPrimAdd "s" "i") 20 | , SDef "i" (EPrimAdd "i" (ELit 1)) 21 | ]) 22 | , SRet "s" 23 | ]) 24 | 25 | recLoopSum :: Function 26 | recLoopSum = Function "loopSum" ["N", "i", "s"] 27 | (SIf (EPrimLt "i" "N") 28 | (SRet (ECall (gVar "loopSum") ["N", EPrimAdd "i" (ELit 1), EPrimAdd "s" "i"])) 29 | (SRet "s")) 30 | -------------------------------------------------------------------------------- /plt-and-algo/pickler-combinators/src/Lib.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE TupleSections #-} 2 | 3 | -- From http://research.microsoft.com/pubs/64036/picklercombinators.pdf 4 | 5 | module Lib 6 | ( someFunc 7 | ) where 8 | 9 | import Data.Char (isDigit) 10 | import Data.Word (Word8) 11 | 12 | newtype PU a = PU (String -> (String, a), a -> String -> String) 13 | 14 | (<+>) :: PU a -> PU b -> PU (a, b) 15 | PU (toA, fromA) <+> PU (toB, fromB) = PU (toAB, fromAB) 16 | where 17 | toAB s = let (s', a) = toA s 18 | in fmap (a,) (toB s') 19 | fromAB (a, b) = fromA a . fromB b 20 | 21 | bimap :: PU a -> (a -> b) -> (b -> a) -> PU b 22 | bimap (PU (toA, fromA)) a2b b2a = PU (fmap (fmap a2b) toA, fromA . b2a) 23 | 24 | word8 :: PU Word8 25 | word8 = PU (toB, fromB) 26 | where 27 | toB (b:bs) = (bs, fromIntegral $ fromEnum b) 28 | fromB b s = toEnum (fromIntegral b) : s 29 | 30 | someFunc :: IO () 31 | someFunc = putStrLn "someFunc" 32 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/info.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _INFO_HPP 2 | #define _INFO_HPP 3 | 4 | #include "common.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | class Info final { 11 | public: 12 | Info(int16_t numPayloads, int16_t numPtrs, int16_t arity) { 13 | DCHECK(numPayloads >= 0 && numPayloads >= numPtrs); 14 | DCHECK(numPtrs >= 0); 15 | DCHECK(arity >= 0); 16 | 17 | numPayloads_ = numPayloads; 18 | numPtrs_ = numPtrs; 19 | arity_ = arity; 20 | callCount_ = 0; 21 | } 22 | 23 | int16_t numPtrs() { 24 | return numPtrs_; 25 | } 26 | 27 | int16_t numPayloads() { 28 | return numPayloads_; 29 | } 30 | 31 | std::vector &bytecodes() { 32 | return bytecodes_; 33 | } 34 | 35 | private: 36 | int16_t numPayloads_; 37 | int16_t numPtrs_; 38 | int16_t arity_; 39 | int16_t callCount_; 40 | std::vector bytecodes_; 41 | }; 42 | 43 | #endif // _INFO_HPP 44 | -------------------------------------------------------------------------------- /plt-and-algo/perceptron-rs/src/digit_recognition.rs: -------------------------------------------------------------------------------- 1 | use num::Float; 2 | // use num::cast::NumCast; 3 | 4 | fn output_kinds() -> Vec { 5 | (0..10).collect() 6 | } 7 | 8 | fn desired_output(nth: usize) -> Vec { 9 | let mut res = vec![A::zero(); 10]; 10 | res[nth] = A::one(); 11 | res 12 | } 13 | 14 | fn distance_pow2(xs: &[A], ys: &[A]) -> A { 15 | let mut sum = A::zero(); 16 | for (x, y) in xs.iter().zip(ys) { 17 | sum = sum + (*x - *y).powi(2); 18 | } 19 | sum 20 | } 21 | 22 | fn cost(num_inputs: usize, outputs: &[A]) -> A { 23 | let mut sum = A::zero(); 24 | for output in output_kinds() { 25 | sum = sum + distance_pow2(&desired_output(output), outputs); 26 | } 27 | let over = A::from(2 * num_inputs).unwrap(); // XXX avoid this? 28 | sum / over 29 | } 30 | 31 | #[test] 32 | fn test_cost() { 33 | assert_eq!(9., cost(1, &desired_output(0))); 34 | } 35 | 36 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/lib/src/main/kotlin/com/github/om/ioccmp/reader/reader-monad.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * This Kotlin source file was generated by the Gradle 'init' task. 3 | */ 4 | package com.github.om.ioccmp 5 | 6 | @JvmInline 7 | value class Reader internal constructor(internal val f: (A) -> R) 8 | 9 | class ReaderModule { 10 | fun run(m: Reader, a: A): R = m.f(a) 11 | 12 | fun ret(r: A): Reader = Reader { it } 13 | 14 | fun reader(f: (A) -> R): Reader = Reader(f) 15 | 16 | fun join(m: Reader>): Reader { 17 | return Reader { a -> 18 | run(run(m, a), a) 19 | } 20 | } 21 | 22 | fun bind(m: Reader, f: (B) -> Reader): Reader { 23 | return Reader { a -> run(f(run(m, a)), a) } 24 | } 25 | 26 | fun fmap(f: (B) -> C, m: Reader): Reader { 27 | return Reader { a -> f(run(m, a)) } 28 | } 29 | } -------------------------------------------------------------------------------- /writings/jit-reading/v8-node.md: -------------------------------------------------------------------------------- 1 | # Node 2 | 3 | (Also see node-operator) 4 | 5 | A sea-of-nodes SSA PDG node. 6 | 7 | ### Implementation details 8 | 9 | - Node inputs/outputs are stored in an optimized extensible smallvec, where some storage are inline while others require one more indirection. 10 | - Nodes are mutable. 11 | + use.addInput(def) will also call def.addUse(use), but not vice versa. Also for {remove,update}Input. 12 | + Externally, node's input and outputs are always consistent with its operator. But internally during modifications there can be inconsistencies. 13 | + To ensure consistency, verify nodes often. 14 | 15 | ### Typing 16 | 17 | Nodes have a bitvec that describes their types: 18 | - Int ranges (e.g. for bounds check elimination) 19 | - OO types (struct, union of structs) 20 | - Graal also has this as in Stamps. But stamps are likely more type-safe, since the nodes and the stamps are all typed. 21 | 22 | types.h defines a long list of types, and their bitvec representations. -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/app/src/main/kotlin/yux/ktcpg/ktsyntax.kt: -------------------------------------------------------------------------------- 1 | package yux.ktcpg 2 | 3 | interface A { 4 | fun a() 5 | } 6 | 7 | interface AB: A { 8 | fun b() 9 | } 10 | 11 | // Can't write AB by a -- has to delegate on the exact type. 12 | class ExtraB(a: A): A by a, AB { 13 | override fun b() { 14 | } 15 | } 16 | 17 | // Doesn't need to be in the constructor -- anything that's accessible from the ctor will do. 18 | // The `this` is not yet an AB. 19 | class ExtraB2(): A by a(), AB { 20 | companion object { 21 | fun a() = object: A { 22 | override fun a() { 23 | } 24 | } 25 | } 26 | override fun b() { 27 | } 28 | } 29 | 30 | fun everyA(xs: List): A { 31 | return object: A { 32 | override fun a() { 33 | xs.forEach(A::a) 34 | } 35 | } 36 | } 37 | 38 | class AppendableA(val xs: MutableList): A by everyA(xs) { 39 | fun addA(a: A) { 40 | xs.add(a) 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/ast.kt: -------------------------------------------------------------------------------- 1 | package om.lang.pie 2 | 3 | sealed class TopLevel 4 | data class Claim(val name: String, val type: PiExpr) : TopLevel() 5 | data class Define(val name: String, val value: PiExpr) : TopLevel() 6 | data class Output(val value: PiExpr) : TopLevel() 7 | 8 | sealed class PiExpr { 9 | object Zero : PiExpr() 10 | data class Succ(val pred: PiExpr) : PiExpr() 11 | data class NatLit(val value: Int) : PiExpr() 12 | data class RecNat(val type: PiExpr, val nat: PiExpr, val base: PiExpr, val step: PiExpr) : PiExpr() 13 | 14 | data class Var(val name: String) : PiExpr() 15 | data class The(val type: PiExpr, val body: PiExpr) : PiExpr() 16 | 17 | data class Lam(val args: List, val body: PiExpr) : PiExpr() 18 | data class App(val f: PiExpr, val args: List) : PiExpr() 19 | 20 | object Nat : PiExpr() 21 | object Set : PiExpr() 22 | data class Arr(val args: List, val res: PiExpr) : PiExpr() 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/src/test/kotlin/com/gh/om/iueoc/test_both_interp.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.iueoc 2 | 3 | import org.junit.jupiter.api.Assertions.assertEquals 4 | import org.junit.jupiter.api.DynamicTest 5 | import org.junit.jupiter.api.TestFactory 6 | 7 | class TestBothInterp { 8 | @TestFactory 9 | fun testCases(): List { 10 | return AllPlaygroundTests.ALL.flatMap { suite -> 11 | val suiteName = suite.name.lowercase() 12 | suite.get().map { 13 | val testName = "$suiteName.${it.name.lowercase()}" 14 | val source = it.get() 15 | DynamicTest.dynamicTest(testName) { 16 | val ir = RunBothInterp.parse(source) 17 | RunBothInterp.opt(ir) 18 | val (exprResult, graphResult) = RunBothInterp.run(ir) 19 | assertEquals(exprResult, graphResult, "Interp and graph result mismatch") 20 | } 21 | } 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/value.kt: -------------------------------------------------------------------------------- 1 | package om.lang.pie 2 | 3 | sealed class PiValue { 4 | object Zero : PiValue() 5 | data class Succ(val pred: PiValue) : PiValue() 6 | data class Lam(val arg: String, val env: Env, val body: PiExpr) : PiValue() 7 | data class Neu(val neu: PiNeu) : PiValue() 8 | 9 | companion object { 10 | fun fromInt(i: Int): PiValue { 11 | var res: PiValue = Zero 12 | repeat(i) { 13 | res = Succ(res) 14 | } 15 | return res 16 | } 17 | } 18 | } 19 | 20 | sealed class PiType : PiValue() { 21 | object Nat : PiType() 22 | object Set : PiType() 23 | data class Arr(val arg: PiType, val res: PiType) : PiType() 24 | } 25 | 26 | sealed class PiNeu { 27 | data class Var(val name: String, val id: Int, val type: PiType): PiNeu() 28 | data class Ap(val rator: PiNeu, val rand: PiValue) : PiNeu() 29 | } 30 | 31 | val PiValue.asType: PiType 32 | get() = this as PiType 33 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/src/fibo_aarch64.s: -------------------------------------------------------------------------------- 1 | .globl _fibo_asm_internal 2 | _fibo_asm_internal: 3 | ; fibo(n: i64) -> i64 4 | .fibo_entry: 5 | ; if n < 2: return n 6 | cmp x0, #2 7 | b.ge .fibo_recur 8 | ret 9 | .fibo_recur: 10 | ; Store n to stack 11 | ; Note that sp needs to be 16-byte aligned, so we allocate 32 bytes to 12 | ; to store [saved fp, saved lr, n, fibo(n - 1)] 13 | sub sp, sp, #32 14 | str fp, [sp] 15 | str lr, [sp, #8] 16 | str x0, [sp, #16] 17 | mov fp, sp 18 | 19 | ; Call fibo(n - 1) 20 | sub x0, x0, #1 21 | bl .fibo_entry 22 | 23 | ; Store ret val of fibo(n - 1) to stack 24 | str x0, [sp, #24] 25 | 26 | ; Call fibo(n - 2) 27 | ldr x0, [sp, #16] 28 | sub x0, x0, #2 29 | bl .fibo_entry 30 | 31 | ; Add ret vals and restore lr, fp, sp 32 | ldr x1, [sp, #24] 33 | add x0, x0, x1 34 | ldr lr, [sp, #8] 35 | ldr fp, [sp] 36 | add sp, sp, #32 37 | ret 38 | 39 | .globl _get1 40 | _get1: 41 | mov x0, #1 42 | ret 43 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | function here(relpath) { 4 | return path.join(__dirname, relpath); 5 | } 6 | 7 | // See https://webpack.github.io/docs/tutorials/getting-started/ 8 | // , https://www.typescriptlang.org/docs/handbook/integrating-with-build-tools.html 9 | // and https://webpack.github.io/docs/multiple-entry-points.html 10 | 11 | module.exports = { 12 | entry: { 13 | web: here('src/web/main.tsx'), 14 | backend: here('src/backend/main.tsx'), 15 | }, 16 | output: { 17 | path: here('dist'), 18 | filename: '[name].bundle.js', 19 | }, 20 | resolve: { 21 | // Add '.ts' and '.tsx' as a resolvable extension. 22 | extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js'], 23 | }, 24 | module: { 25 | loaders: [ 26 | // all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader' 27 | { test: /\.tsx?$/, loader: 'ts-loader' }, 28 | ], 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/README.md: -------------------------------------------------------------------------------- 1 | ### Synopsis 2 | 3 | Notes taken when I was reading the [Kotlin 4 | compiler](https://github.com/JetBrains/kotlin/tree/master/compiler). 5 | 6 | ### reading notes 7 | 8 | `notes/` contains the notes that I took while reading the source. 9 | Note that Github's PDF viewer doesn't support links, so please [use google doc 10 | viewer to view the generated PDF file](https://docs.google.com/viewer?url=https://github.com/overminder/kitchen-sink/raw/master/writings/kotlin-compiler/notes/main.pdf). 11 | 12 | ### out-of-tree sources 13 | 14 | `runner/` contains a kotlinn runner function that need to be injected to the 15 | kotlin repo to run. These are useful because we can run arbitrary kotlin 16 | sources and set breakpoints on the compiler to learn about the compilation 17 | pipelines. 18 | 19 | ### Faster Compiler Playground 20 | 21 | `dylib-runner/` uses the compiler as a library. This would makes compilation 22 | a lot faster but we lose code navigation inside the compiler (source jar 23 | would be useful?) 24 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/test/kotlin/com/github/om/inctc/PrettyPrinterTest.kt: -------------------------------------------------------------------------------- 1 | package com.github.om.inctc 2 | 3 | import com.github.om.inctc.lang.poly.ModuleName 4 | import com.github.om.inctc.lang.poly.PprState 5 | import com.github.om.inctc.lang.poly.PolyLangParser 6 | import com.github.om.inctc.lang.poly.ppr 7 | import org.junit.Test 8 | import kotlin.test.assertEquals 9 | import kotlin.test.assertNotNull 10 | 11 | class PrettyPrinterTest { 12 | @Test 13 | fun testSome() { 14 | assertPpr("def foo = fun x in if 5 then 1 else 2 end end") 15 | assertPpr(""" 16 | def foo = 5 17 | def bar = fun x in x < 5 end 18 | def baz = fun y in if baz(3, 6) then foo else 8 end end 19 | """.trimIndent()) 20 | } 21 | 22 | private fun assertPpr(source: String) { 23 | val m = assertNotNull(PolyLangParser.file(ModuleName("test")).run(source)) 24 | val st = PprState() 25 | m.ppr(st) 26 | val printed = st.output 27 | assertEquals(source, printed) 28 | } 29 | } -------------------------------------------------------------------------------- /wow-scripts/wa2-damage-taken-5/queue-test.lua: -------------------------------------------------------------------------------- 1 | local queue = require 'queue' 2 | 3 | local q = queue.create() 4 | assert(q:isEmpty()) 5 | assert(q:peek() == nil) 6 | assert(q:pop() == nil) 7 | assert(q:storageUsage() == 0) 8 | 9 | q:appendLeft(1) 10 | assert(not q:isEmpty()) 11 | assert(q:peek() == 1) 12 | assert(q:pop() == 1) 13 | assert(q:isEmpty()) 14 | assert(q:storageUsage() == 0) 15 | 16 | q:appendLeft(2) 17 | q:appendLeft(3) 18 | q:appendLeft(4) 19 | assert(q:storageUsage() == 3) 20 | assert(not q:isEmpty()) 21 | assert(q:peek() == 2) 22 | assert(q:pop() == 2) 23 | assert(q:pop() == 3) 24 | assert(q:pop() == 4) 25 | assert(q:isEmpty()) 26 | assert(q:storageUsage() == 0) 27 | 28 | q:appendLeft(5) 29 | q:appendLeft(6) 30 | q:appendLeft(7) 31 | local xs = q:popWhile(function(x) return true end) 32 | assert(xs[1] == 5) 33 | assert(xs[2] == 6) 34 | assert(xs[3] == 7) 35 | assert(#xs == 3) 36 | assert(q:storageUsage() == 0) 37 | 38 | q:appendLeft(8) 39 | q:appendLeft(9) 40 | q:appendLeft(10) 41 | assert(q:foldr(function(x, acc) return x + acc end, 0) == 27) 42 | -------------------------------------------------------------------------------- /writings/jit-reading/v8-node-reducer.md: -------------------------------------------------------------------------------- 1 | ### Graph Reducer 2 | 3 | Edits the SSA graph by updating/adding/removing nodes. 4 | 5 | - Reduction(node): represents the result of a reduction. 6 | - Reducer: can reduce one node 7 | - AdvancedReducer: can reduce multiple nodes 8 | - AdvancedReducer.Editor: helper that performs the actual edit operations on the graph. This does most of the heavy lifting, and hides the details. 9 | 10 | # Reading some of the analyses 11 | 12 | ## escape-analysis 13 | 14 | Seems to be similar to Graal's PEA. Tracks the alloc/read/write in a tracker. 15 | 16 | The analysis is path sensitive, but LoadElement may be handled in a more precise way: when there are only 2 elements, it's data-sensitve in that the index is used to select one of the elements! When there's only 1, the access is even assumed to always success so the only element is chosen (i.e. array out of bound access is UB). 17 | 18 | There's a special case for uninhabited types -- constant-folding a node that has a uninhabited type with a constant (i.e. boolean true) is wrong! -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webrtc-p2pframe", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "babel-plugin-transform-regenerator": "^6.6.5", 13 | "babel-plugin-transform-runtime": "^6.6.0", 14 | "babel-preset-es2015": "^6.6.0", 15 | "babel-preset-stage-2": "^6.5.0", 16 | "babelify": "^7.2.0", 17 | "gulp": "^3.9.1", 18 | "gulp-babel": "^6.1.2", 19 | "gulp-rename": "^1.2.2", 20 | "gulp-sourcemaps": "^1.6.0", 21 | "gulp-typescript": "^2.12.1", 22 | "gulp-uglify": "^1.5.3", 23 | "gulp-util": "^3.0.7", 24 | "vinyl-buffer": "^1.0.0", 25 | "vinyl-source-stream": "^1.1.0", 26 | "watchify": "^3.7.0" 27 | }, 28 | "dependencies": { 29 | "immutable": "^3.7.6", 30 | "react": "^0.14.8", 31 | "react-dom": "^0.14.8", 32 | "webrtc-adapter": "^1.0.6", 33 | "whatwg-fetch": "^0.11.0" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /wow-scripts/blizz-api-kt/src/main/java/com/gh/om/blizzapi/auth_bearer.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.blizzapi 2 | 3 | import io.ktor.client.features.auth.Auth 4 | import io.ktor.client.features.auth.AuthProvider 5 | import io.ktor.client.request.HttpRequestBuilder 6 | import io.ktor.http.HttpHeaders 7 | import io.ktor.http.auth.HttpAuthHeader 8 | 9 | fun Auth.bearer(token: String) { 10 | providers.add(BearerAuthProvider(token)) 11 | } 12 | 13 | /** 14 | * Client basic authentication provider. 15 | */ 16 | class BearerAuthProvider( 17 | private val token: String, 18 | ) : AuthProvider { 19 | override val sendWithoutRequest: Boolean = true 20 | private val defaultCharset = Charsets.UTF_8 21 | 22 | override fun isApplicable(auth: HttpAuthHeader): Boolean { 23 | return true 24 | } 25 | 26 | override suspend fun addRequestHeaders(request: HttpRequestBuilder) { 27 | request.headers[HttpHeaders.Authorization] = createHeaderValue() 28 | } 29 | 30 | private fun createHeaderValue(): String { 31 | return "Bearer $token" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /mobile-dev/ndk-standalone/ndk-executable-base: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | HOST_ARCH=darwin-x86_64 4 | BASENAME=$(basename $0) 5 | 6 | case "$BASENAME" in 7 | i686-linux-android-*) 8 | TARGET_ARCH=x86 9 | TOOLCHAIN_NAME=x86 10 | API_LEVEL=android-9 11 | ;; 12 | x86_64-linux-android-*) 13 | TARGET_ARCH=x86_64 14 | TOOLCHAIN_NAME=x86_64 15 | API_LEVEL=android-21 16 | ;; 17 | arm-linux-androideabi-*) 18 | TARGET_ARCH=arm 19 | TOOLCHAIN_NAME=arm-linux-androideabi 20 | API_LEVEL=android-9 21 | ;; 22 | aarch64-linux-android-*) 23 | TARGET_ARCH=arm64 24 | TOOLCHAIN_NAME=aarch64-linux-android 25 | API_LEVEL=android-21 26 | ;; 27 | *) 28 | echo "Unknown arch: $BASENAME" 29 | exit 30 | ;; 31 | esac 32 | 33 | # Only set sysroot for {gcc,g++} 34 | case "$BASENAME" in 35 | *-gcc|*-g++) 36 | EXTRA_SYSROOT=--sysroot=$ANDROID_NDK/platforms/$API_LEVEL/arch-$TARGET_ARCH 37 | ;; 38 | esac 39 | 40 | $ANDROID_NDK/toolchains/$TOOLCHAIN_NAME-4.9/prebuilt/$HOST_ARCH/bin/$BASENAME \ 41 | $EXTRA_SYSROOT \ 42 | $@ 43 | 44 | -------------------------------------------------------------------------------- /wow-scripts/arpg-macros/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("jvm") version "2.0.10" 3 | } 4 | 5 | group = "org.example" 6 | version = "1.0-SNAPSHOT" 7 | 8 | repositories { 9 | mavenCentral() 10 | } 11 | 12 | dependencies { 13 | testImplementation(kotlin("test")) 14 | testImplementation("org.junit.jupiter:junit-jupiter:5.8.1") 15 | // https://mvnrepository.com/artifact/org.assertj/assertj-core 16 | testImplementation("org.assertj:assertj-core:3.26.3") 17 | 18 | implementation("com.github.kwhat:jnativehook:2.2.2") 19 | 20 | // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core-jvm 21 | implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0-RC.2") 22 | 23 | // https://mvnrepository.com/artifact/net.java.dev.jna/jna 24 | implementation("net.java.dev.jna:jna-platform:5.14.0") 25 | 26 | // mac JNA stuff 27 | implementation("com.github.oshi:oshi-core:6.6.5") 28 | 29 | // OCR 30 | implementation("net.sourceforge.tess4j:tess4j:5.16.0") 31 | } 32 | 33 | tasks.test { 34 | useJUnitPlatform() 35 | } 36 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/src/test/kotlin/com/gh/om/iueoc/test_sexpr_parser.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.iueoc 2 | 3 | import com.github.h0tk3y.betterParse.parser.Parser 4 | import com.github.h0tk3y.betterParse.parser.parseToEnd 5 | import org.junit.jupiter.api.Assertions.assertEquals 6 | import org.junit.jupiter.api.Test 7 | 8 | class TestSexpr { 9 | @Test 10 | fun readAndPpr() { 11 | val cases = listOf( 12 | "abc", 13 | "123", 14 | "()", 15 | "(abc 123 . def)", 16 | "(abc 123)", 17 | "(abc def [123 456] {} ())", 18 | "`(,@abc 'def)", 19 | ) 20 | cases.forEach(::assertReadAndPpr) 21 | } 22 | 23 | private fun assertReadAndPpr(input: String) { 24 | val sexpr = parseA(SexprGrammar.P.sexpr, input) 25 | val ppr = sexpr.unwrap.ppr() 26 | assertEquals(input, ppr) 27 | } 28 | 29 | private fun parseA(p: Parser, input: String): A { 30 | val toks = SexprGrammar.tokenizer.tokenize(input) 31 | return p.parseToEnd(toks) 32 | } 33 | } -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/src/IdInt.hs: -------------------------------------------------------------------------------- 1 | module IdInt where 2 | 3 | import qualified Data.Map as M 4 | import Control.Monad.State 5 | 6 | import Lambda 7 | 8 | newtype IdInt = IdInt Int 9 | deriving (Eq, Ord, Enum) 10 | 11 | firstBoundId = IdInt 0 12 | 13 | instance Show IdInt where 14 | show (IdInt i) = if i < 0 15 | then "f" ++ show (-i) 16 | else "x" ++ show i 17 | 18 | 19 | toIdInt :: Ord v => LC v -> LC IdInt 20 | toIdInt e = evalState (conv e) (0, fvmap) 21 | where 22 | fvmap = foldr (\(v, i) m -> M.insert v (IdInt (-i)) m) M.empty 23 | (zip (freeVars e) [1..]) 24 | 25 | type M v a = State (Int, M.Map v IdInt) a 26 | 27 | convVar :: Ord v => v -> M v IdInt 28 | convVar v = do 29 | (i, m) <- get 30 | case M.lookup v m of 31 | Nothing -> do 32 | let ii = IdInt i 33 | put (i + 1, M.insert v ii m) 34 | pure ii 35 | Just ii -> pure ii 36 | 37 | conv :: Ord v => LC v -> M v (LC IdInt) 38 | conv = \case 39 | Var v -> Var <$> convVar v 40 | Lam v e -> Lam <$> convVar v <*> conv e 41 | App f a -> App <$> conv f <*> conv a 42 | -------------------------------------------------------------------------------- /plt-and-algo/software-foundation/idris/basics.idr: -------------------------------------------------------------------------------- 1 | plus_0_l : (n:Nat) -> 0 + n = n 2 | plus_0_l _ = Refl 3 | 4 | plus_s_l : (n:Nat) -> (m:Nat) -> (S n) + m = S (n + m) 5 | plus_s_l Z m = Refl 6 | plus_s_l (S n) m = cong (plus_s_l n m) 7 | 8 | plus_0_l_rev : (n:Nat) -> n = 0 + n 9 | plus_0_l_rev Z = Refl 10 | plus_0_l_rev (S k) = cong (plus_0_l_rev k) 11 | 12 | -- cong : {f : u -> v} -> a = b -> f a = f b 13 | plus_id_example : {n, m : Nat} -> n = m -> n + n = m + m 14 | plus_id_example prf = cong {f=twice} prf 15 | where 16 | twice : (n:Nat) -> Nat 17 | twice n = n + n 18 | -- plus_id_example n m h = rewrite h in Refl 19 | -- ^ From idris-hackers/software-foundations:src/Basics.lidr 20 | 21 | -- cong : {f : u -> v} -> a = b -> f a = f b 22 | -- plus : Nat -> Nat -> Nat 23 | -- nm : n = m 24 | -- cong {f=plus} nm = plus n = plus m : Nat -> Nat 25 | plus_id_exercise : {n, m, o : Nat} -> n = m -> m = o -> n + m = m + o 26 | -- plus_id_exercise n m o nm mo = cong {f=(cong {f=plus} nm)} mo 27 | -- plus_id_exercise n m o nm mo = rewrite (plus_id_example n m nm) in Refl 28 | plus_id_exercise {n} {m} {o} nm mo = ?wtf 29 | 30 | 31 | -------------------------------------------------------------------------------- /hello-emacs/js/react-native-purescript/src/Main.purs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Prelude 4 | import Control.Monad.Eff (runPure, Eff) 5 | import Control.Monad.Eff.Console (CONSOLE, log) 6 | import Data.Maybe (Maybe(Nothing, Just)) 7 | import RN (touchableOpacity, createStyleSheet, baseStyle, addStyle, view, registerComponent, text) 8 | import React (writeState, readState, createClass, createClassStateless, spec, createFactory, spec') 9 | import Unsafe.Coerce (unsafeCoerce) 10 | 11 | counter = createClass $ spec 0 render 12 | where 13 | render thiz = do 14 | i <- readState thiz 15 | let 16 | mkOnPress ps = ps { 17 | onPress = unsafeCoerce $ writeState thiz (i + 1) 18 | } 19 | pure $ view [baseStyle viewStyle] 20 | [touchableOpacity [mkOnPress] $ 21 | [text [baseStyle textStyle] $ "Hello " ++ show i]] 22 | 23 | textStyle = createStyleSheet "text" { 24 | color: "green" 25 | } 26 | 27 | viewStyle = createStyleSheet "view" { 28 | flex: 1, 29 | alignItems: "center", 30 | justifyContent: "center" 31 | } 32 | 33 | main = do 34 | registerComponent "TFLandingPage" counter 35 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/src/main/kotlin/com/gh/om/peaapg/ch3/fc/ast.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.peaapg.ch3.fc 2 | 3 | data class Program(val args: List, val bbs: List) 4 | 5 | inline class Label(val name: String) 6 | 7 | data class BB(val label: Label, val body: List, val last: Jump) 8 | 9 | data class Assign(val name: String, val expr: Expr) 10 | 11 | sealed class Jump { 12 | data class Goto(val label: Label) : Jump() 13 | data class Return(val expr: Expr) : Jump() 14 | data class If(val cond: Expr, val ifTrue: Label, val ifFalse: Label) : Jump() 15 | } 16 | 17 | sealed class Expr { 18 | data class I(val value: Int) : Expr() 19 | data class Var(val name: String) : Expr() 20 | data class Symbol(val name: String) : Expr() 21 | data class BOp(val op: BinaryRator, val lhs: Expr, val rhs: Expr) : Expr() 22 | data class UOp(val op: UnaryRator, val arg: Expr) : Expr() 23 | data class MkList(val args: List) : Expr() 24 | } 25 | 26 | enum class BinaryRator { 27 | Add, 28 | Sub, 29 | Mul, 30 | Eqv, 31 | Cons; 32 | } 33 | 34 | enum class UnaryRator { 35 | Head, 36 | Tail; 37 | } -------------------------------------------------------------------------------- /writings/lazy-usefulness-state-monad/lazy-usefulness.cabal: -------------------------------------------------------------------------------- 1 | name: lazy-usefulness 2 | version: 0.1.0.0 3 | synopsis: Initial project template from stack 4 | description: Please see README.md 5 | homepage: http://github.com/githubuser/lazy-usefulness#readme 6 | license: BSD3 7 | license-file: LICENSE 8 | author: Author name here 9 | maintainer: example@example.com 10 | copyright: 2016 Author Here 11 | category: Web 12 | build-type: Simple 13 | -- extra-source-files: 14 | cabal-version: >=1.10 15 | 16 | library 17 | hs-source-dirs: src 18 | exposed-modules: Lib 19 | build-depends: base >= 4.7 && < 5 20 | , mtl >= 2.2 21 | , containers >= 0.5 22 | default-language: Haskell2010 23 | 24 | executable lazy-usefulness-exe 25 | hs-source-dirs: app 26 | main-is: Main.hs 27 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 28 | build-depends: base 29 | , lazy-usefulness 30 | default-language: Haskell2010 31 | -------------------------------------------------------------------------------- /writings/multiple-ssh-keys-github.md: -------------------------------------------------------------------------------- 1 | ### Option 1: Add all SSH keys to ssh_config 2 | 3 | See https://stackoverflow.com/a/33228296 4 | 5 | This is a brute force way of using multiple SSH keys. ssh-client will 6 | try each key until it succeeds. 7 | - pros: Easy to setup 8 | - cons: 9 | + Doesn't work with github, since [github uses a 2-step authentication](https://stackoverflow.com/questions/2419566/best-way-to-use-multiple-ssh-private-keys-on-one-client#comment79297973_33228296). 10 | + Repeated failed tries may [result in ban](https://stackoverflow.com/questions/2419566/best-way-to-use-multiple-ssh-private-keys-on-one-client#comment98162745_33228296) 11 | 12 | ### Option 2: Use per-host key config 13 | 14 | See https://stackoverflow.com/a/23751734 15 | 16 | - pros: Works with github 17 | - cons: Doesn't work by default if any of the key is added to ssh-agent. 18 | Setting IdentityAgent=none works around this. 19 | 20 | ### Option 3: Use a script to manually switch key and user 21 | 22 | [See this gist](https://gist.github.com/jexchan/2351996?permalink_comment_id=4629226#gistcomment-4629226) 23 | 24 | - pros: fully customizable 25 | - cons: this is a bit too manual 26 | 27 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/src/main/kotlin/com/github/om/inctc/graph/traversal.kt: -------------------------------------------------------------------------------- 1 | package com.github.om.inctc.graph 2 | 3 | object GraphTraversal { 4 | enum class Order { 5 | Pre, 6 | Post, 7 | } 8 | 9 | enum class Direction { 10 | Fwd, 11 | Bwd, 12 | } 13 | } 14 | 15 | fun GraphTraversal.dfs( 16 | start: NodeId, 17 | g: DAG, 18 | order: GraphTraversal.Order, 19 | direction: GraphTraversal.Direction = GraphTraversal.Direction.Fwd, 20 | cb: (NodeId) -> Unit 21 | ) { 22 | fun next(n: NodeId) = if (direction == GraphTraversal.Direction.Fwd) { 23 | g.succs(n) 24 | } else { 25 | g.preds(n) 26 | } 27 | 28 | val visited = mutableSetOf>() 29 | 30 | fun go(n: NodeId) { 31 | visited += n 32 | if (order == GraphTraversal.Order.Pre) { 33 | cb(n) 34 | } 35 | next(n)?.forEach { 36 | if (!visited.contains(it)) { 37 | go(it) 38 | } 39 | } 40 | if (order == GraphTraversal.Order.Post) { 41 | cb(n) 42 | } 43 | } 44 | 45 | go(start) 46 | } 47 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/rs/lib/src/fibo.rs: -------------------------------------------------------------------------------- 1 | use std::ffi::{c_char, CString}; 2 | 3 | extern { 4 | fn fibo_asm_internal(n: i64) -> i64; 5 | fn get1() -> i64; 6 | fn fiboInterp(n: i64, which: *const c_char) -> i64; 7 | } 8 | 9 | pub fn fibo_asm(n: i64) -> i64 { 10 | unsafe { 11 | fibo_asm_internal(n) 12 | } 13 | } 14 | 15 | pub fn fibo_interp_fast(n: i64) -> i64 { 16 | unsafe { 17 | let cstr = CString::new("fast").unwrap(); 18 | fiboInterp(n, cstr.as_ptr()) 19 | } 20 | } 21 | 22 | pub fn fibo_interp_slow(n: i64) -> i64 { 23 | unsafe { 24 | let cstr = CString::new("slow").unwrap(); 25 | fiboInterp(n, cstr.as_ptr()) 26 | } 27 | } 28 | 29 | pub fn fibo_rs(n: i64) -> i64 { 30 | if n < 2 { 31 | n 32 | } else { 33 | fibo_rs(n - 1) + fibo_rs(n - 2) 34 | } 35 | } 36 | 37 | #[cfg(test)] 38 | mod tests { 39 | use super::*; 40 | 41 | #[test] 42 | fn get1_works() { 43 | let result = unsafe { get1() }; 44 | assert_eq!(result, 1); 45 | } 46 | 47 | #[test] 48 | fn fibo_asm_works() { 49 | let result = fibo_asm(10); 50 | assert_eq!(result, 55); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /hello-emacs/js/react-purescript/src/Main.purs: -------------------------------------------------------------------------------- 1 | module Main where 2 | 3 | import Prelude 4 | import Data.Nullable as N 5 | import Data.Maybe (Maybe(..)) 6 | import Control.Monad.Eff (Eff) 7 | import Control.Monad.Eff.Console (log, CONSOLE) 8 | 9 | import React as R 10 | import React.DOM as R 11 | import React.DOM.Props as P 12 | import ReactDOM as RDOM 13 | import DOM as DOM 14 | import DOM.HTML as DOM 15 | import DOM.HTML.Types as DOM 16 | import DOM.HTML.Window as DOM 17 | import DOM.Node.ParentNode as DOM 18 | 19 | counter = R.createClass (R.spec' mkS render) 20 | where 21 | mkS _ = pure 0 22 | render this = do 23 | i <- R.readState this 24 | let incr unit = R.writeState this (i + 1) 25 | pure $ 26 | R.div' [ R.div' [R.text $ "value = " ++ show i] 27 | , R.button [P.onClick incr] [R.text "Incr"] 28 | ] 29 | 30 | component = R.createFactory counter 31 | 32 | main = void do 33 | document <- DOM.window >>= DOM.document 34 | let 35 | getMountPoint = DOM.querySelector "#mount-point" 36 | docAsParent = DOM.htmlDocumentToParentNode document 37 | Just mountPoint <- N.toMaybe <$> getMountPoint docAsParent 38 | RDOM.render (component {}) mountPoint 39 | log "Hello from PureScript!" 40 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin application project to get you started. 5 | */ 6 | 7 | plugins { 8 | // Apply the Kotlin JVM plugin to add support for Kotlin. 9 | id 'org.jetbrains.kotlin.jvm' version '1.4.0' 10 | 11 | // Apply the application plugin to add support for building a CLI application. 12 | id 'application' 13 | } 14 | 15 | repositories { 16 | // Use jcenter for resolving dependencies. 17 | // You can declare any Maven/Ivy/file repository here. 18 | jcenter() 19 | } 20 | 21 | dependencies { 22 | // Align versions of all Kotlin components 23 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 24 | 25 | // Use the Kotlin JDK 8 standard library. 26 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 27 | 28 | // Use the Kotlin test library. 29 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 30 | 31 | // Use the Kotlin JUnit integration. 32 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' 33 | } 34 | 35 | application { 36 | // Define the main class for the application. 37 | mainClassName = 'om.lang.pie.AppKt' 38 | } 39 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/src/Expr.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE OverloadedStrings #-} 2 | 3 | module Expr where 4 | 5 | import Data.String (IsString(..)) 6 | 7 | type Name = String 8 | 9 | data Expr 10 | -- | Core forms 11 | = Lit Int 12 | | Var Name 13 | | Lam [Name] Expr 14 | | LetRec [(Name, Expr)] Expr 15 | 16 | -- | Typed ops 17 | | IntAdd Expr Expr -- Unchecked. 18 | | IntLt Expr Expr -- Unchecked 19 | | Ap Expr [Expr] -- Unchecked 20 | | If Expr Expr Expr -- Unchecked 21 | 22 | -- | Guards 23 | | IsInt Expr 24 | | IsFn Expr Int 25 | 26 | -- | XXX 27 | | Abort 28 | deriving (Show) 29 | 30 | instance IsString Expr where fromString = Var 31 | 32 | -- A sample Expr. 33 | fiboMain :: Expr 34 | fiboMain = LetRec [("fibo", fibo), ("+", intAdd), ("<", intLt)] main 35 | where 36 | fibo = Lam ["n"] $ If (Ap "<" ["n", Lit 2]) 37 | "n" 38 | (Ap "+" 39 | [Ap "fibo" [Ap "+" ["n", Lit (-1)]], 40 | Ap "fibo" [Ap "+" ["n", Lit (-2)]]]) 41 | main = Ap "fibo" [Lit 10] 42 | 43 | mkSafeOp bop = Lam ["x", "y"] $ intsOrFail ["x", "y"] (bop "x" "y") 44 | intAdd = mkSafeOp IntAdd 45 | intLt = mkSafeOp IntLt 46 | 47 | intOrFail p b = If (IsInt p) b Abort 48 | intsOrFail = flip (foldr intOrFail) 49 | -------------------------------------------------------------------------------- /writings/lazy-usefulness-state-monad/stack.yaml: -------------------------------------------------------------------------------- 1 | # For more information, see: http://docs.haskellstack.org/en/stable/yaml_configuration.html 2 | 3 | # Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2) 4 | resolver: lts-5.1 5 | 6 | # Local packages, usually specified by relative directory name 7 | packages: 8 | - '.' 9 | 10 | # Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3) 11 | extra-deps: [] 12 | 13 | # Override default flag values for local packages and extra-deps 14 | flags: {} 15 | 16 | # Extra package databases containing global packages 17 | extra-package-dbs: [] 18 | 19 | # Control whether we use the GHC we find on the path 20 | # system-ghc: true 21 | 22 | # Require a specific version of stack, using version ranges 23 | # require-stack-version: -any # Default 24 | # require-stack-version: >= 1.0.0 25 | 26 | # Override the architecture used by stack, especially useful on Windows 27 | # arch: i386 28 | # arch: x86_64 29 | 30 | # Extra directories used by stack for building 31 | # extra-include-dirs: [/path/to/dir] 32 | # extra-lib-dirs: [/path/to/dir] 33 | 34 | # Allow a newer minor version of GHC than the snapshot specifies 35 | # compiler-check: newer-minor 36 | -------------------------------------------------------------------------------- /plt-and-algo/ui-layout-system/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin application project to get you started. 5 | */ 6 | 7 | plugins { 8 | // Apply the Kotlin JVM plugin to add support for Kotlin. 9 | id 'org.jetbrains.kotlin.jvm' version '1.3.61' 10 | 11 | // Apply the application plugin to add support for building a CLI application. 12 | id 'application' 13 | } 14 | 15 | repositories { 16 | // Use jcenter for resolving dependencies. 17 | // You can declare any Maven/Ivy/file repository here. 18 | jcenter() 19 | } 20 | 21 | dependencies { 22 | // Align versions of all Kotlin components 23 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 24 | 25 | // Use the Kotlin JDK 8 standard library. 26 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 27 | 28 | // Use the Kotlin test library. 29 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 30 | 31 | // Use the Kotlin JUnit integration. 32 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' 33 | } 34 | 35 | application { 36 | // Define the main class for the application. 37 | mainClassName = 'com.om.kitsink.layoutpg.AppKt' 38 | } 39 | -------------------------------------------------------------------------------- /plt-and-algo/cps-interp-osr/interp.cpp: -------------------------------------------------------------------------------- 1 | #include "value.hpp" 2 | #include "bytecode.hpp" 3 | 4 | void interpret(Value *func, Value **stackBase, Value **globals) { 5 | auto stack = stackBase; 6 | intptr_t oparg; 7 | auto codePtr = &func->info().bytecodes()[0]; 8 | 9 | #define DECODE_OPARG_I8() \ 10 | oparg = (int8_t) *codePtr++ 11 | 12 | #define DECODE_OPARG_I16() \ 13 | oparg = *(int16_t *) codePtr; \ 14 | codePtr += 2 15 | 16 | #define PUSH(x) \ 17 | --stack; \ 18 | *stack = (x) 19 | 20 | #define POP() \ 21 | *stack++ 22 | 23 | static void *dispatchTable[] = { 24 | #define MK_DISPATCH_ENTRY(x) \ 25 | [x] = &&Label ## x, 26 | BYTECODE_OP_NAMES(MK_DISPATCH_ENTRY) 27 | #undef MK_DISPATCH_ENTRY 28 | }; 29 | 30 | #define CASE(x) Label ## x: 31 | 32 | CASE(LoadLocal) { 33 | DECODE_OPARG_I8(); 34 | PUSH(stackBase[oparg]); 35 | } 36 | 37 | CASE(LoadPayload) { 38 | DECODE_OPARG_I8(); 39 | Value *top = POP(); 40 | PUSH(stackBase[oparg]); 41 | } 42 | 43 | CASE(LoadGlobal) { 44 | DECODE_OPARG_I8(); 45 | PUSH(globals[oparg]); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /plt-and-algo/ioc-free-vs-di/kt/buildSrc/src/main/groovy/com.github.om.ioccmp.kotlin-common-conventions.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | */ 4 | 5 | plugins { 6 | // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. 7 | id 'org.jetbrains.kotlin.jvm' 8 | } 9 | 10 | repositories { 11 | // Use Maven Central for resolving dependencies. 12 | mavenCentral() 13 | } 14 | 15 | dependencies { 16 | constraints { 17 | // Define dependency versions as constraints 18 | implementation 'org.apache.commons:commons-text:1.9' 19 | 20 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 21 | } 22 | 23 | // Align versions of all Kotlin components 24 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 25 | 26 | // Use the Kotlin JDK 8 standard library. 27 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 28 | 29 | // Align versions of all Kotlin components 30 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 31 | 32 | // Use JUnit Jupiter for testing. 33 | testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2' 34 | } 35 | 36 | tasks.named('test') { 37 | // Use JUnit Platform for unit tests. 38 | useJUnitPlatform() 39 | } 40 | -------------------------------------------------------------------------------- /plt-and-algo/tapl/SystemF.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE RankNTypes #-} 2 | {-# LANGUAGE ScopedTypeVariables #-} 3 | 4 | module SystemF where 5 | 6 | -- Chapter 23: System F 7 | 8 | -- Defns 9 | 10 | newtype FBool = FBool { unFBool :: forall a. a -> a -> a } 11 | newtype FList a = FList { unFList :: forall r. (a -> r -> r) -> r -> r } 12 | 13 | fromFBool :: FBool -> Bool 14 | fromFBool b = unFBool b True False 15 | 16 | toFBool :: Bool -> FBool 17 | toFBool b = FBool $ \t f -> if b then t else f 18 | 19 | fromFList :: FList a -> [a] 20 | fromFList xs = unFList xs (:) [] 21 | 22 | nilFList :: FList a 23 | nilFList = FList $ \_ nil -> nil 24 | 25 | consFList :: a -> FList a -> FList a 26 | consFList x (FList xs) = FList $ \cons nil -> cons x (xs cons nil) 27 | 28 | toFList :: [a] -> FList a 29 | toFList = foldr consFList nilFList 30 | 31 | test1 = fromFList . toFList $ [1, 2, 3] 32 | 33 | -- 23.4.12 insert and sort in pure System F 34 | 35 | fInsert :: forall a. (a -> a -> FBool) -> FList a -> a -> FList a 36 | fInsert cmp xs x = snd $ unFList xs combine (Just x, nilFList) 37 | where 38 | combine y (mbX, xs) = case mbX of 39 | Nothing -> (mbX, consFList y xs) 40 | Just x -> unFBool (cmp x y) (Nothing, consFList x (consFList y xs)) 41 | (mbX, consFList y xs) 42 | 43 | -------------------------------------------------------------------------------- /plt-and-algo/the-little-typer-kt/src/main/kotlin/om/lang/pie/util.kt: -------------------------------------------------------------------------------- 1 | package om.lang.pie 2 | 3 | sealed class ConsList { 4 | object Nil : ConsList() 5 | data class Cons(val head: A, val tail: ConsList) : ConsList() 6 | 7 | companion object { 8 | @Suppress("UNCHECKED_CAST") 9 | fun nil(): ConsList = Nil as ConsList 10 | } 11 | 12 | fun cons(a: A) : ConsList { 13 | return Cons(a, this) 14 | } 15 | 16 | fun mapNotNull(f: (A) -> B?): ConsList { 17 | var iter = this 18 | val out = mutableListOf() 19 | while (iter is Cons) { 20 | f(iter.head)?.let(out::add) 21 | iter = iter.tail 22 | } 23 | return out.foldRight(nil()) { item, acc -> 24 | acc.cons(item) 25 | } 26 | } 27 | } 28 | 29 | fun ConsList>.assoc(k: K): ConsList.Cons>? { 30 | var iter = this 31 | while (iter is ConsList.Cons) { 32 | if (iter.head.first == k) { 33 | return iter 34 | } 35 | iter = iter.tail 36 | } 37 | return null 38 | } 39 | 40 | fun ConsList>.assocv(k: K): V? { 41 | return assoc(k)?.head?.second 42 | } 43 | 44 | -------------------------------------------------------------------------------- /plt-and-algo/lambda-cookied-four-ways/src/HOAS.hs: -------------------------------------------------------------------------------- 1 | module HOAS where 2 | 3 | import qualified Data.Map as M 4 | import Data.Maybe (fromMaybe) 5 | import IdInt 6 | import Lambda 7 | 8 | data HOAS 9 | = HVar IdInt 10 | | HLam (HOAS -> HOAS) 11 | | HApp HOAS HOAS 12 | 13 | -- How to define a show instance for this? 14 | -- We might just use (show . toLC) ... 15 | 16 | nf :: LC IdInt -> LC IdInt 17 | nf = toLC . nfh . fromLC 18 | 19 | nfh :: HOAS -> HOAS 20 | nfh = \case 21 | e@(HVar _) -> e 22 | HLam b -> HLam (nfh . b) 23 | HApp f a -> 24 | case whnf f of 25 | HLam b -> nfh (b a) 26 | f' -> HApp f' (nfh a) 27 | 28 | whnf :: HOAS -> HOAS 29 | whnf = \case 30 | e@(HVar _) -> e 31 | HLam b -> HLam b 32 | HApp f a -> 33 | case whnf f of 34 | HLam b -> whnf (b a) 35 | f' -> HApp f' a 36 | 37 | fromLC :: LC IdInt -> HOAS 38 | fromLC = from M.empty 39 | where 40 | from m = \case 41 | Var v -> fromMaybe (HVar v) (M.lookup v m) 42 | Lam v e -> HLam $ \x -> from (M.insert v x m) e 43 | App f a -> HApp (from m f) (from m a) 44 | 45 | toLC :: HOAS -> LC IdInt 46 | toLC = to firstBoundId 47 | where 48 | to n = \case 49 | HVar v -> Var v 50 | HLam b -> Lam n (to (succ n) (b (HVar n))) 51 | HApp f a -> App (to n f) (to n a) 52 | -------------------------------------------------------------------------------- /hello-emacs/js/typescript-webpack/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "class-name": true, 4 | "comment-format": [ 5 | true, 6 | "check-space" 7 | ], 8 | "indent": [ 9 | true, 10 | "spaces" 11 | ], 12 | "no-duplicate-variable": true, 13 | "no-eval": true, 14 | "no-internal-module": true, 15 | "no-trailing-whitespace": true, 16 | "no-var-keyword": true, 17 | "one-line": [ 18 | true, 19 | "check-open-brace", 20 | "check-whitespace" 21 | ], 22 | "quotemark": [ 23 | true, 24 | "single" 25 | ], 26 | "semicolon": [ 27 | true, 28 | "always" 29 | ], 30 | "triple-equals": [ 31 | true, 32 | "allow-null-check" 33 | ], 34 | "typedef-whitespace": [ 35 | true, { 36 | "call-signature": "nospace", 37 | "index-signature": "nospace", 38 | "parameter": "nospace", 39 | "property-declaration": "nospace", 40 | "variable-declaration": "nospace" 41 | } 42 | ], 43 | "variable-name": [ 44 | true, 45 | "ban-keywords" 46 | ], 47 | "whitespace": [ 48 | true, 49 | "check-branch", 50 | "check-decl", 51 | "check-operator", 52 | "check-separator", 53 | "check-type" 54 | ] 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /plt-and-algo/webrtc-p2pframe/src/ws.ts: -------------------------------------------------------------------------------- 1 | import { Channel, logWith } from './util'; 2 | 3 | export type WsPayload = string | Blob | ArrayBuffer; 4 | 5 | export class WsChannel { 6 | private ws: WebSocket; 7 | private reader: Channel = new Channel(); 8 | 9 | constructor(ws: WebSocket) { 10 | this.ws = ws; 11 | ws.onclose = (e) => this.onClose_(e); 12 | ws.onmessage = (e) => this.onMessage_(e); 13 | ws.onerror = (e) => { 14 | this.reader.close(); 15 | logWith('WsChannel.read')(e); 16 | }; 17 | } 18 | 19 | static async open(uri: string): Promise> { 20 | const ws = new WebSocket(uri); 21 | await new Promise((resolve, reject) => { 22 | ws.onopen = (e) => { 23 | resolve(); 24 | }; 25 | ws.onerror = (e) => { 26 | reject(); 27 | logWith('OfferChannel.onError')(e); 28 | }; 29 | }); 30 | return new WsChannel(ws); 31 | } 32 | 33 | onClose_(e: CloseEvent) { 34 | this.reader.close(); 35 | } 36 | 37 | onMessage_(e: MessageEvent) { 38 | const data = e.data as A; 39 | this.reader.write(data); 40 | } 41 | 42 | read(): Promise { 43 | return this.reader.read(); 44 | } 45 | 46 | write(a: A) { 47 | this.ws.send(a); 48 | } 49 | } 50 | 51 | -------------------------------------------------------------------------------- /plt-and-algo/iu-essentials-of-compilation/src/main/kotlin/com/gh/om/iueoc/son/phases/phase.kt: -------------------------------------------------------------------------------- 1 | package com.gh.om.iueoc.son.phases 2 | 3 | import com.gh.om.iueoc.son.MutGraphRef 4 | 5 | interface Phase { 6 | // Returns true if [g] was changed. 7 | fun run(g: MutGraphRef): Boolean 8 | } 9 | 10 | class RepPhase(private val n: Int, private val phase: Phase) : Phase { 11 | init { 12 | require(n >= 1) 13 | } 14 | 15 | override fun run(g: MutGraphRef): Boolean { 16 | var changed = false 17 | repeat(n) { 18 | val changedThisTime = phase.run(g) 19 | if (!changedThisTime) { 20 | return@repeat 21 | } 22 | changed = true 23 | } 24 | return changed 25 | } 26 | } 27 | 28 | object Phases { 29 | val SIMPLE = listOf( 30 | InlinePhase.rep(4), 31 | ConstantPropagationPhase.rep(1), 32 | // ConstantPropagationPhase, 33 | // ConstantPropagationPhase, 34 | TrimPhase, 35 | ) 36 | 37 | val SIMPLE_REP = SIMPLE.rep(2) 38 | } 39 | 40 | private fun Phase.rep(n: Int): Phase { 41 | return if (n == 1) { 42 | this 43 | } else { 44 | RepPhase(n, this) 45 | } 46 | } 47 | 48 | private fun List.rep(n: Int): List { 49 | return (0..n).flatMap { this } 50 | } -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/peaapg/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin library project to get you started. 5 | */ 6 | 7 | plugins { 8 | // Apply the Kotlin JVM plugin to add support for Kotlin. 9 | id 'org.jetbrains.kotlin.jvm' version '1.5.0' 10 | 11 | // Apply the java-library plugin for API and implementation separation. 12 | id 'java-library' 13 | } 14 | 15 | repositories { 16 | // Use jcenter for resolving dependencies. 17 | // You can declare any Maven/Ivy/file repository here. 18 | mavenCentral() 19 | } 20 | 21 | dependencies { 22 | // Align versions of all Kotlin components 23 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 24 | 25 | // Use the Kotlin JDK 8 standard library. 26 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 27 | 28 | // Use the Kotlin test library. 29 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 30 | 31 | // Use the Kotlin JUnit integration. 32 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' 33 | 34 | // parser combinator 35 | implementation("com.github.h0tk3y.betterParse:better-parse:0.4.2") 36 | } 37 | 38 | compileKotlin { 39 | kotlinOptions { 40 | freeCompilerArgs = ["-Xinline-classes"] 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /plt-and-algo/hello-ocaml/hello.ml: -------------------------------------------------------------------------------- 1 | let foo x = 2 | match x with 3 | | 1 -> 5 4 | | _ -> 6 5 | ;; 6 | 7 | (* function (lambda case in Hs), 8 | ~:f for named param, 9 | as (@ in Hs) *) 10 | let rec mapL ~f = function 11 | | [] as l -> l 12 | | x :: xs -> f x :: mapL xs ~f:f 13 | ;; 14 | 15 | (* record: named product types *) 16 | type p2d = { 17 | x: int; 18 | y: int; 19 | } 20 | 21 | type p3d = { 22 | x: int; 23 | y: int; 24 | z: int; 25 | } 26 | 27 | (* record field punning 28 | 29 | Also without the `: p2d` annotation, the arg type will be inferred as p3d. *) 30 | let sum2d ({x; y}: p2d): int = x + y;; 31 | 32 | let _ = sum2d { x = 5; y = 6 };; 33 | 34 | (* sum types 35 | 36 | Also recursive type defs: `type ... and ...` *) 37 | type 'a my_cons = { 38 | head: 'a; 39 | tail: 'a my_list 40 | } and 'a my_list = 41 | | My_cons of 'a my_cons 42 | | My_nil 43 | ;; 44 | 45 | let rec to_my_cons xs = 46 | match xs with 47 | | [] -> My_nil 48 | | x :: xs -> My_cons { head = x; tail = to_my_cons xs } 49 | ;; 50 | 51 | let arr = [|1;2;3|];; 52 | arr.(0) <- 5;; 53 | let _ = arr.(0) + 1;; 54 | 55 | type id_gen = { 56 | mutable next_id: int; 57 | } 58 | 59 | let make_id_gen (): id_gen = { next_id = 0 };; 60 | 61 | let get_next_id (g: id_gen): int = 62 | let res = g.next_id in 63 | g.next_id <- res + 1; 64 | res 65 | ;; 66 | -------------------------------------------------------------------------------- /mobile-dev/dagger-playground/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin application project to get you started. 5 | */ 6 | 7 | plugins { 8 | // Apply the Kotlin JVM plugin to add support for Kotlin. 9 | id 'org.jetbrains.kotlin.jvm' version '1.4.30' 10 | 11 | // Apply the application plugin to add support for building a CLI application. 12 | id 'application' 13 | 14 | id "org.jetbrains.kotlin.kapt" version "1.4.30" 15 | } 16 | 17 | repositories { 18 | // Use jcenter for resolving dependencies. 19 | // You can declare any Maven/Ivy/file repository here. 20 | jcenter() 21 | } 22 | 23 | dependencies { 24 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 25 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 26 | 27 | implementation group: 'com.google.dagger', name: 'dagger', version: '2.32' 28 | kapt group: 'com.google.dagger', name: 'dagger-compiler', version: '2.32' 29 | 30 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 31 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' 32 | } 33 | 34 | application { 35 | // Define the main class for the application. 36 | mainClassName = 'com.om.gh.dagger.pg.AppKt' 37 | } 38 | 39 | sourceSets.main.java { 40 | srcDir "${buildDir}/generated/source/kapt/main" 41 | } 42 | -------------------------------------------------------------------------------- /plt-and-algo/incremental-tc/notes/README.md: -------------------------------------------------------------------------------- 1 | ### Goal 2 | 3 | How to balance: 4 | - Language expressiveness (polymorphism, HKT, first class modules, 5 | type inference etc) 6 | - Featureful IDE (code navigation, auto-completion, auto-fix etc) 7 | - Performance of the compiler, IDE, and build system (incremental type 8 | checking / resolution / codegen etc) 9 | 10 | ### Relationship with Kt compiler 11 | 12 | JetBrains (IntelliJ Idea) seems to be doing the IDE part really well. 13 | Kotlin compiler does contain a lot of machinery for incremental analysis. 14 | I should read more about it (see this-repo/readings/kt-compiler) 15 | 16 | ### Other readings 17 | 18 | - [Self Adjusting Computation](http://www.umut-acar.org/self-adjusting-computation) 19 | - [MIT Id language (book by Shail Aditya Gupta)](https://dl.acm.org/doi/book/10.5555/888484) 20 | - [Also a shorter version of above: Incremental polymorphism, by Shail Aditya Gupta](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.26.5066&rep=rep1&type=pdf) 21 | - Incremental On-Line Type Inference (Thomas L. Robinson) 22 | 23 | So looks that at least for typing this is a solved problem? 24 | 25 | - [Ekmett's papers](https://www.reddit.com/r/haskell/comments/3u9wak/incremental_unification_and_program_manipulation/) 26 | 27 | - [Haskell-code-explorer](https://github.com/alexwl/haskell-code-explorer/issues/2): 28 | Compares the output of two Haskell code indexers. 29 | 30 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/lean/hello/Hello/Monad.lean: -------------------------------------------------------------------------------- 1 | -- Contract 2 | 3 | structure MonadContract (m : Type → Type) [Monad m] where 4 | pure_left_id : ∀(v : α) (f : α → m β), bind (pure v) f = f v 5 | pure_right_id : ∀(v : m α), bind v pure = v 6 | bind_assoc : ∀(v : m α) (f : α → m β) (g : β → m χ), 7 | bind (bind v f) g = bind v (fun x => bind (f x) g) 8 | 9 | -- Should probably be somewhat easier... 10 | def optionMonadContract : MonadContract Option where 11 | pure_left_id := by 12 | intro α β v f 13 | rfl 14 | pure_right_id := by 15 | intro α v 16 | cases v 17 | · rfl 18 | · rfl 19 | bind_assoc := by 20 | intro α β χ v f g 21 | cases v 22 | · rfl 23 | · rfl 24 | 25 | #print optionMonadContract.proof_3 26 | 27 | def stateMonadContract : MonadContract (StateM σ) where 28 | pure_left_id := by 29 | intro α β v f 30 | rfl 31 | pure_right_id := by 32 | intro α v 33 | rfl 34 | bind_assoc := by 35 | intro α β χ v f g 36 | rfl 37 | 38 | -- Hmm 39 | def stateTMonadContract [inst: Monad m] (mc : MonadContract m): MonadContract (StateT σ m) where 40 | pure_left_id := by 41 | intro α β v f 42 | simp [bind, pure, StateT.pure] 43 | unfold StateT.pure StateT.bind 44 | simp 45 | unfold pure Applicative.toPure Monad.toApplicative 46 | sorry 47 | pure_right_id := by 48 | intro α v 49 | sorry 50 | bind_assoc := by 51 | intro α β χ v f g 52 | sorry 53 | -------------------------------------------------------------------------------- /plt-and-algo/partial-eval/attic/src/PEval.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE LambdaCase #-} 2 | {-# LANGUAGE TemplateHaskell #-} 3 | 4 | module PEval where 5 | 6 | import Expr 7 | 8 | import Control.Lens 9 | import Control.Monad.Trans.RWS 10 | import qualified Data.Map as M 11 | 12 | -- Like Eval.Node, but is instead more concerned about the abstract value information. 13 | data PNode 14 | = PInt { _iValue :: Maybe Int 15 | } 16 | | PClosure { _cArity :: Maybe Int 17 | , _cExpr :: Maybe ([Name], Expr) 18 | , _cEnv :: Maybe PEnv 19 | } 20 | | PUnknown 21 | deriving (Show) 22 | 23 | newtype PNodeId 24 | = PNodeId Int 25 | deriving (Show, Eq, Ord) 26 | 27 | type PEnv = M.Map Name PNodeId 28 | 29 | mkInt :: Int -> PEvalM PNodeId 30 | mkInt i = undefined 31 | 32 | peval :: Expr -> PEvalM Expr 33 | peval (Lit e) = undefined 34 | peval (Var e) = undefined 35 | peval (Lam e1 e2) = undefined 36 | peval (LetRec e1 e2) = undefined 37 | peval (IntAdd e1 e2) = undefined 38 | peval (IntLt e1 e2) = undefined 39 | peval (Ap e1 e2) = undefined 40 | peval (If e1 e2 e3) = undefined 41 | peval (IsInt e) = undefined 42 | peval (IsFn e1 e2) = undefined 43 | peval Abort = undefined 44 | 45 | data PHeap = PHeap { 46 | _hSpace :: M.Map PNodeId PNode, 47 | _hNextId :: Int 48 | } 49 | 50 | type PEvalM = RWST PEnv () PHeap Maybe 51 | 52 | makeLenses ''PNode 53 | makeLenses ''PHeap 54 | 55 | -------------------------------------------------------------------------------- /plt-and-algo/cek-mach/package.yaml: -------------------------------------------------------------------------------- 1 | name: cek-mach 2 | version: 0.1.0.0 3 | github: "overminder/cek-mach" 4 | license: BSD3 5 | author: "Overmind JIANG" 6 | maintainer: "p90eri@gmail.com" 7 | copyright: "2018 Overmind JIANG" 8 | 9 | extra-source-files: 10 | - README.md 11 | - ChangeLog.md 12 | 13 | # Metadata used when publishing your package 14 | # synopsis: Short description of your package 15 | # category: Web 16 | 17 | # To avoid duplicated efforts in documentation and dealing with the 18 | # complications of embedding Haddock markup inside cabal files, it is 19 | # common to point users to the README.md file. 20 | description: Please see the README on GitHub at 21 | 22 | dependencies: 23 | - base >= 4.7 && < 5 24 | - containers 25 | 26 | default-extensions: 27 | - LambdaCase 28 | 29 | library: 30 | source-dirs: src 31 | 32 | executables: 33 | cek-mach-exe: 34 | main: Main.hs 35 | source-dirs: app 36 | ghc-options: 37 | - -threaded 38 | - -rtsopts 39 | - -with-rtsopts=-N 40 | dependencies: 41 | - cek-mach 42 | 43 | tests: 44 | cek-mach-test: 45 | main: Spec.hs 46 | source-dirs: test 47 | ghc-options: 48 | - -threaded 49 | - -rtsopts 50 | - -with-rtsopts=-N 51 | dependencies: 52 | - cek-mach 53 | - hspec 54 | -------------------------------------------------------------------------------- /plt-and-algo/monorepo/kt/lib/build.gradle.kts: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin library project to get you started. 5 | * For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle 6 | * User Manual available at https://docs.gradle.org/8.0.2/userguide/building_java_projects.html 7 | */ 8 | 9 | plugins { 10 | // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. 11 | alias(libs.plugins.kotlin.jvm) 12 | 13 | // Apply the java-library plugin for API and implementation separation. 14 | `java-library` 15 | } 16 | 17 | repositories { 18 | // Use Maven Central for resolving dependencies. 19 | mavenCentral() 20 | } 21 | 22 | dependencies { 23 | implementation(libs.kotlinx.coroutines.core) 24 | 25 | // Use the Kotlin JUnit 5 integration. 26 | testImplementation(libs.kotlin.junit5) 27 | 28 | // Use the JUnit 5 integration. 29 | testImplementation("org.junit.jupiter:junit-jupiter-engine:5.9.1") 30 | 31 | // assertThat().isEqualTo() 32 | testImplementation("org.assertj:assertj-core:3.24.2") 33 | 34 | // Property test (a la QuickCheck) 35 | testImplementation(libs.kotest.property) 36 | testImplementation(libs.kotest.core) 37 | testImplementation(libs.kotest.runner) 38 | } 39 | 40 | tasks.withType().forEach { 41 | // Use JUnit Platform for unit tests. 42 | it.useJUnitPlatform() 43 | } 44 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/src/main/java/com/github/om/soothello/analyzee/DepResolver.java: -------------------------------------------------------------------------------- 1 | package com.github.om.soothello.analyzee; 2 | 3 | import java.util.LinkedHashMap; 4 | import java.util.LinkedHashSet; 5 | import java.util.Map; 6 | import java.util.Set; 7 | 8 | import javax.annotation.Nonnull; 9 | 10 | public class DepResolver { 11 | private final Map, Object> resolved = new LinkedHashMap<>(); 12 | private final Map, AbstractFactory> factories = new LinkedHashMap<>(); 13 | private final Set> beingResolved = new LinkedHashSet<>(); 14 | 15 | @Nonnull 16 | A resolve(@Nonnull Class kls) { 17 | A a = (A) resolved.get(kls); 18 | if (a != null) { 19 | return a; 20 | } 21 | 22 | RuntimeChecks.require(beingResolved.add(kls), "Recursive resolve for " + kls); 23 | try { 24 | AbstractFactory af = (AbstractFactory) factories.get(kls); 25 | RuntimeChecks.require(af != null, "No factory for " + kls); 26 | a = af.create(); 27 | resolved.put(kls, a); 28 | return a; 29 | } finally { 30 | RuntimeChecks.require(beingResolved.remove(kls), "Someone else removed " + kls); 31 | } 32 | } 33 | 34 | public void addFactory(@Nonnull AbstractFactory f) { 35 | RuntimeChecks.require(factories.put(f.klass, f) == null, "Already has factory for " + f.klass); 36 | f.setResolver(this); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/dylib-runner/lib/src/main/java/yux/ktcpg/lib/Lib.kt: -------------------------------------------------------------------------------- 1 | package yux.ktcpg.lib 2 | 3 | /** 4 | * A bunch of examples showing what kind of code triggers detekt's LibraryCodeMustSpecifyReturnType rule. 5 | */ 6 | 7 | fun doSomething() { 8 | println("HAI") 9 | } 10 | 11 | fun doAnotherThing(): Unit = doSomething() 12 | 13 | /* 14 | 15 | // This does trigger and indeed should trigger. 16 | val a = listOf("a") 17 | 18 | private object Foo { 19 | 20 | // This shouldn't trigger (parent is a private object so I wouldn't say this is a public API) but does trigger. 21 | // A workaround is to add `internal` modifier to it. A real fix is to make the lint rule consider fooVal's 22 | // *effective* visibility, rather than the *declared* visibility. 23 | val fooVal = listOf("foo") 24 | } 25 | 26 | interface Bar { 27 | fun doBar(): List 28 | } 29 | 30 | private val aBar = object: Bar { 31 | 32 | // This doesn't trigger. The reason is that because doBar's parent is an object literal and therefore 33 | // KtModifierListOwner.isPublic consider doBar as a non-Public declaration. 34 | override fun doBar() = listOf("bar") 35 | } 36 | 37 | private object ABar: Bar { 38 | 39 | // This does trigger. Whether we should trigger in this case is debatable -- The interface already specifies 40 | // the return type of doBar() so if ABar is used as a Bar, I would say such return type declaration is not needed. 41 | override fun doBar() = listOf("bar") 42 | } 43 | 44 | */ 45 | -------------------------------------------------------------------------------- /plt-and-algo/soot-hello/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * This file was generated by the Gradle 'init' task. 3 | * 4 | * This generated file contains a sample Kotlin application project to get you started. 5 | */ 6 | 7 | plugins { 8 | // Apply the Kotlin JVM plugin to add support for Kotlin. 9 | id 'org.jetbrains.kotlin.jvm' version '1.4.10' 10 | 11 | // Apply the application plugin to add support for building a CLI application. 12 | id 'application' 13 | } 14 | 15 | repositories { 16 | // Use jcenter for resolving dependencies. 17 | // You can declare any Maven/Ivy/file repository here. 18 | jcenter() 19 | } 20 | 21 | dependencies { 22 | // Align versions of all Kotlin components 23 | implementation platform('org.jetbrains.kotlin:kotlin-bom') 24 | 25 | // Use the Kotlin JDK 8 standard library. 26 | implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8' 27 | 28 | // Soot static analysis: https://github.com/soot-oss/soot 29 | compile group: 'org.soot-oss', name: 'soot', version: '4.2.1' 30 | 31 | // https://mvnrepository.com/artifact/org.ow2.asm/asm 32 | compile group: 'org.ow2.asm', name: 'asm', version: '9.0' 33 | 34 | // Use the Kotlin test library. 35 | testImplementation 'org.jetbrains.kotlin:kotlin-test' 36 | 37 | // Use the Kotlin JUnit integration. 38 | testImplementation 'org.jetbrains.kotlin:kotlin-test-junit' 39 | } 40 | 41 | application { 42 | // Define the main class for the application. 43 | mainClassName = 'com.github.om.soothello.AppKt' 44 | } 45 | -------------------------------------------------------------------------------- /plt-and-algo/pickler-combinators/pickler-combinators.cabal: -------------------------------------------------------------------------------- 1 | name: pickler-combinators 2 | version: 0.1.0.0 3 | synopsis: Initial project template from stack 4 | description: Please see README.md 5 | homepage: http://github.com/githubuser/pickler-combinators#readme 6 | license: BSD3 7 | license-file: LICENSE 8 | author: Author name here 9 | maintainer: example@example.com 10 | copyright: 2016 Author Here 11 | category: Web 12 | build-type: Simple 13 | -- extra-source-files: 14 | cabal-version: >=1.10 15 | 16 | library 17 | hs-source-dirs: src 18 | exposed-modules: Lib 19 | build-depends: base >= 4.7 && < 5 20 | default-language: Haskell2010 21 | 22 | executable pickler-combinators-exe 23 | hs-source-dirs: app 24 | main-is: Main.hs 25 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 26 | build-depends: base 27 | , pickler-combinators 28 | default-language: Haskell2010 29 | 30 | test-suite pickler-combinators-test 31 | type: exitcode-stdio-1.0 32 | hs-source-dirs: test 33 | main-is: Spec.hs 34 | build-depends: base 35 | , pickler-combinators 36 | ghc-options: -threaded -rtsopts -with-rtsopts=-N 37 | default-language: Haskell2010 38 | 39 | source-repository head 40 | type: git 41 | location: https://github.com/githubuser/pickler-combinators 42 | -------------------------------------------------------------------------------- /wow-scripts/time-to-die-improved/ttd.lua: -------------------------------------------------------------------------------- 1 | function() 2 | local N = 80 3 | 4 | WA_healthrate_time = WA_healthrate_time or 0 5 | WA_healthrate_index = WA_healthrate_index or 0 6 | WA_healthrate_pct = WA_healthrate_pct or {} 7 | WA_healthrate_n = WA_healthrate_n or 0 8 | 9 | local tar = UnitGUID("target") 10 | 11 | -- Reset. 12 | if (not tar) or tar ~= WA_healthrate_lasttar then 13 | WA_healthrate_time = GetTime() 14 | WA_healthrate_index = 0 15 | WA_healthrate_n = 0 16 | end 17 | 18 | if tar and GetTime() >= WA_healthrate_time then 19 | local pct = UnitHealth("target")/UnitHealthMax("target")*100 20 | 21 | WA_healthrate_index = (WA_healthrate_index+1)%N 22 | WA_healthrate_n = min(WA_healthrate_n+1, N) 23 | WA_healthrate_pct[WA_healthrate_index] = pct 24 | 25 | if WA_healthrate_lasttar == tar then 26 | local sumxy = 0 27 | local sumxx = 0 28 | local sumx = 0 29 | local sumy = 0 30 | for i=1,WA_healthrate_n do 31 | sumx = sumx + i 32 | sumxx = sumxx + i*i 33 | local y = WA_healthrate_pct[(WA_healthrate_index-WA_healthrate_n+i)%N] 34 | sumy = sumy + y 35 | sumxy = sumxy + i*y 36 | end 37 | WA_healthrate = (sumxy-(1/WA_healthrate_n)*sumx*sumy)/(sumxx-(1/WA_healthrate_n)*sumx*sumx) 38 | WA_healthrate_ttd = -pct/WA_healthrate 39 | else 40 | WA_healthrate = nil 41 | end 42 | 43 | WA_healthrate_time = GetTime() + 1 44 | WA_healthrate_lasttar = tar 45 | end 46 | 47 | if tar == WA_healthrate_lasttar and UnitCanAttack("player","target") then 48 | return true 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /writings/kotlin-compiler/runner/yux/main.kt: -------------------------------------------------------------------------------- 1 | package org.jetbrains.kotlin.runner.yux 2 | 3 | import org.jetbrains.kotlin.runner.ExpressionRunner 4 | import java.io.File 5 | import java.net.URL 6 | 7 | // XXX 8 | private val KOTLIN_HOME = File("/Users/yxjiang/ref/jb-kotlin/dist/kotlinc") 9 | 10 | object Exprs { 11 | private fun String.moar(ss: String): String { 12 | return this + "\n" + ss 13 | } 14 | 15 | val SIMPLE = """ 16 | val x = 1 17 | """.trimIndent() 18 | 19 | val ASSIGN_TO_VAL = """ 20 | val x = 1 21 | x = 5 22 | """.trimIndent() 23 | 24 | val RECURSIVE_GENERIC_BASE = """ 25 | interface Rec> 26 | fun > mk(): A? = null 27 | """.trimIndent() 28 | 29 | val RECURSIVE_GENERIC_CANT_INFER = RECURSIVE_GENERIC_BASE.moar(""" 30 | val x = mk() 31 | """.trimIndent()) 32 | 33 | val RECURSIVE_GENERIC_BAD_BOUND = RECURSIVE_GENERIC_BASE.moar(""" 34 | val x = mk>() 35 | """.trimIndent()) 36 | } 37 | 38 | fun main() { 39 | val cp = listOf( 40 | "lib/kotlin-stdlib.jar", 41 | "lib/kotlin-reflect.jar" 42 | ).map(::resolveKt) 43 | 44 | val compilerCp = listOf( 45 | "lib/kotlin-compiler.jar" 46 | ).map(::resolveKt) 47 | 48 | val runner = ExpressionRunner(Exprs.RECURSIVE_GENERIC_BAD_BOUND) 49 | runner.run(cp, listOf(), compilerCp) 50 | } 51 | 52 | private fun File.toURL2(): URL { 53 | return absoluteFile.toURI().toURL() 54 | } 55 | 56 | private fun resolveKt(s: String): URL { 57 | return KOTLIN_HOME.resolve(s).toURL2() 58 | } 59 | --------------------------------------------------------------------------------