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
| local utils = require "mp.utils" | |
| function srt_time_to_seconds(time) | |
| local major, minor = time:match("(%d%d:%d%d:%d%d),(%d%d%d)") | |
| local hours, mins, secs = major:match("(%d%d):(%d%d):(%d%d)") | |
| return hours * 3600 + mins * 60 + secs + minor / 1000 | |
| end | |
| function seconds_to_srt_time(time) | |
| local hours = math.floor(time / 3600) |
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 TypeApplications #-} | |
| -- Based on https://gitlab.haskell.org/ghc/ghc/-/issues/19097#note_321796 | |
| {- | |
| action NewEventAction = do | |
| now <- getCurrentTime | |
| let event = newRecord @Event | |
| |> set #createdAt now -- THIS LINE NEEDS MORE INDENTATION | |
| render NewView { .. } | |
| -} |
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
| let | |
| # Fetch a reproducible clone of nixpkgs. | |
| # That one is a pull request to nixpkgs which includes antlr 4.8. | |
| pkgs = import (fetchTarball { | |
| url = "https://github.com/guibou/nixpkgs/archive/d4cfc8694c7536a79c9d0260b171ee7983394896.tar.gz"; | |
| }) {}; | |
| in | |
| rec { | |
| # Create an alias for "spike $(which pk)" to run-spike. |
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
| import time | |
| import contextlib | |
| N = 10000 | |
| @contextlib.contextmanager | |
| def timeit(label): | |
| t = time.time() | |
| yield | |
| t2 = time.time() |
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 QuantifiedConstraints #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE BangPatterns #-} | |
| {-# LANGUAGE PartialTypeSignatures #-} | |
| import Data.Array.MArray | |
| import Data.Array.Unboxed | |
| import Data.Array.ST | |
| import Data.Function (fix) |
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 DeriveFunctor #-} | |
| {-# LANGUAGE DerivingStrategies #-} | |
| {-# LANGUAGE DerivingVia #-} | |
| module Range where | |
| import qualified Data.List.NonEmpty as NonEmpty | |
| import Data.List.NonEmpty (NonEmpty) | |
| import Data.Functor.Compose | |
| import Data.Monoid |
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 BangPatterns #-} | |
| {-# LANGUAGE ScopedTypeVariables #-} | |
| {-# LANGUAGE TypeApplications #-} | |
| import Criterion.Main | |
| newtype SafeInt t = SafeInt t | |
| deriving (Show, Ord, Eq) | |
| instance (Bounded t, Num t, Integral t) => Num (SafeInt t) where | |
| (+) (SafeInt a) (SafeInt b) |
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
| -- Solution 0, do nothing | |
| let foo = [fmt|\ | |
| this | |
| is | |
| a | |
| |] | |
| -- Will return " this\n is\n a\n " | |
| -- Solution 1, trim common alignement |
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
| .circleci/config.yml:416:25: info: | |
| still Open: https://github.com/haskell/unix/issues/102 | |
| .gitlab-ci.yml:649:7: info: | |
| still Open: https://gitlab.com/gitlab-org/gitlab-runner/issues/3856 | |
| compiler/backpack/RnModIface.hs:155:13: error: | |
| now Closed: https://github.com/haskell/cabal/issues/3633 | |
| compiler/main/DriverPipeline.hs:355:10: info: |
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 #-} | |
| {-# LANGUAGE ViewPatterns #-} | |
| {-# LANGUAGE TemplateHaskell #-} | |
| import PyF | |
| import Data.Time.Calendar | |
| import Control.Monad (guard, mzero) | |
| -- | Format a date without dots. | |
| fmtDate :: Day -> String |