This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //! Creates WGPU context that must run async. | |
| //! | |
| //! Three important parts of the WGPU API are async functions: | |
| //! - Creating a new WGPU Instance. | |
| //! - Requesting a new WGPU Adapter. | |
| //! - Creating a WGPU Device and Queue. | |
| //! | |
| //! In non-web applications, we would like to block on these functions. However, | |
| //! for WASM (web) usage, we cannot block. | |
| //! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env cabal | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE NumericUnderscores #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {- cabal: | |
| build-depends: | |
| base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env cabal | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {- cabal: | |
| ghc-options: | |
| -O2 -threaded -rtsopts "-with-rtsopts=-N -T" | |
| -Wall -Wcompat -Wincomplete-record-updates | |
| -Wincomplete-uni-patterns -Wredundant-constraints |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Crappy Utah Teapot loader script for Blender 2.90.1 | |
| import bpy | |
| from mathutils import Vector | |
| def create4x4patch(points): | |
| surface_data = bpy.data.curves.new('wook', 'SURFACE') | |
| surface_data.dimensions = '3D' | |
| # set points per segments (U * V) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # File: macos-haskell-run-vulkan-triangles.sh | |
| # | |
| # Haskell Vulkan on MacOS example: | |
| # Build and run the vulkan-triangles GLFW example. | |
| # | |
| # The purpose of this script is to automate building and running the | |
| # vulkan-triangles GLFW example. There are some half-baked instructions | |
| # for MacOS available here: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env stack | |
| {- stack | |
| script | |
| --resolver lts-12.19 | |
| --package containers | |
| --package double-conversion | |
| --package text | |
| --package text-show | |
| -} | |
| {- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE QuasiQuotes #-} | |
| module Main where | |
| import Control.Parallel.OpenCL | |
| import Data.Vector.Storable (Vector) | |
| import qualified Data.Vector.Storable as V | |
| import Data.Vector.Storable.Mutable (IOVector) | |
| import qualified Data.Vector.Storable.Mutable as MV | |
| import Foreign (castPtr, nullPtr, sizeOf) | |
| import Foreign.C.Types (CFloat) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env nix-shell | |
| #! nix-shell -i runghc -p 'ghc.withPackages (ps: [ ps.hmatrix ])' | |
| import Numeric.LinearAlgebra | |
| -- | Represents the coupled ODEs (Example (1)): | |
| -- | |
| -- y[0] = position = p | |
| -- y[1] = velocity = v | |
| -- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Intended to be run in shapeless sbt console; use :paste | |
| //--- paste this first to define the macro | |
| import scala.language.experimental.macros | |
| import scala.reflect.macros.whitebox | |
| import scala.util.control.NonFatal | |
| object WillBeTrue { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // (This is an older version of the Gist here: https://gist.github.com/lancelet/0d0713af7eb1401c9b1a) | |
| // (Only hanging around because I posted it to a Gitter group.) | |
| // Intended to be run in shapeless current master sbt console; use :paste | |
| //--- paste this first to define the macro | |
| import scala.language.experimental.macros | |
| import scala.reflect.macros.whitebox | |
| import scala.util.control.NonFatal |
NewerOlder