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
{-# OPTIONS_GHC -Wall #-} | |
----------------------------------------------------------------------------- | |
-- | | |
-- Module : FairLock | |
-- Copyright : (c) Masahiro Sakai 2023 | |
-- License : BSD-3-Clause | |
-- | |
-- Simple Lock implemented using STM. | |
-- When multiple threads are blocked on a Lock, they are woken up in FIFO order. |
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
module Main (main) where | |
import Control.Concurrent.Async | |
import Control.Concurrent | |
import Control.Exception | |
import Control.Monad | |
import Data.IORef | |
import Foreign.C | |
import System.Random.MWC |
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 sys | |
for mname, m in sys.modules.items(): | |
fname = getattr(m, '__file__', None) | |
if fname is not None and fname.endswith('.so'): | |
print(f"{mname}: {fname}") |
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
module FermatsFactorizationMethod where | |
import Control.Monad | |
import Data.List (sort) | |
import Math.NumberTheory.Roots -- https://hackage.haskell.org/package/integer-roots | |
factor :: Integer -> [Integer] | |
factor = sort . g | |
where | |
g 1 = [] |
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
# coding: utf-8 | |
def answer1(n) | |
n + 1 | |
end | |
def answer2(str) | |
str.upcase | |
end | |
def answer3(n) |
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
-- | | |
-- | |
-- * [Secant method](https://en.wikipedia.org/wiki/Secant_method) | |
-- | |
-- * [割線法](https://ja.wikipedia.org/wiki/%E5%89%B2%E7%B7%9A%E6%B3%95) | |
module SecantMethod where | |
secantMethod :: (Eq a, Fractional a) => (a -> a) -> a -> a -> [a] | |
secantMethod f x0 x1 = map fst xs | |
where |
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
/* | |
NY Times の記事 "Dead Lay Out in Bucha for Weeks, Refuting Russian Claim, Satellite Images Show - The New York Times" | |
https://www.nytimes.com/2022/04/04/world/europe/bucha-ukraine-bodies.html | |
での「ロシア占領中の3月19日時点の衛星画像で死体が確認できる」と言う主張に対して、 | |
「OSINT/GEOINTによって撮影時刻は4月1日11:57(UTC)である」と言う反論がなされている。 | |
- ロシア語: https://t.me/rybar/30599 | |
- 英訳: https://t.me/realCRP/4200 | |
- 日本語訳: https://t.me/wakeupjapancomeon/1605 |
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
-- Fisher–Yates shuffle algorithm | |
-- https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modern_method | |
-- | |
-- Note that mwc-random provides functions for permuting vectors. | |
-- https://hackage.haskell.org/package/mwc-random-0.14.0.0/docs/System-Random-MWC-Distributions.html#g:5 | |
-- | |
{-# OPTIONS_GHC -Wall #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Shufle | |
( shuffleVector |
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 FlexibleContexts, GADTs, TypeFamilies #-} | |
class T a where | |
type Config a | |
getConfig :: a -> Config a | |
data D where | |
T :: T a => a -> D |
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
aminoacid | codon | |
---|---|---|
A | GCA | |
A | GCC | |
A | GCG | |
A | GCT | |
C | TGC | |
C | TGT | |
D | GAC | |
D | GAT | |
E | GAA |