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 TupleSections #-} | |
import Control.Monad.State (State, evalState, get, gets, modify, put) | |
import Data.Function (on) | |
import Data.List (unionBy) | |
import Data.Map (Map) | |
import Data.Maybe (fromMaybe) | |
import qualified Data.Map as Map |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Fireworks</title> | |
<style>html,body{margin:0;height:100%;}</style> | |
</head> | |
<body> | |
<script defer> | |
const SCRW = document.body.clientWidth; | |
const SCRH = document.body.clientHeight; |
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
class Vec2(object): | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def dot(v, w): | |
return v.x * w.x + v.y * w.y | |
class Mat22(object): | |
def __init__(self, a, b, c, 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
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Ondulator</title> | |
<style>html,body{margin:0;height:100%;}</style> | |
<script> |
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 Data.SBV | |
fruits :: SInteger -> SInteger -> SInteger -> SBool | |
fruits a b c = equation &&& positive | |
where | |
x = sFromIntegral a :: SReal | |
y = sFromIntegral b :: SReal | |
z = sFromIntegral c :: SReal | |
equation = x / (y + z) + y / (x + z) + z / (x + y) .== 4 |
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 Control.Monad | |
import Math.NumberTheory.Logarithms (integerLog2) | |
simulate :: Integer -> Integer | |
simulate n = head (go [1..n]) | |
where | |
go [x] = [x] | |
go (x1:x2:xs) = go (xs ++ [x1]) | |
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
def out_of_process(func): | |
from types import GeneratorType | |
GENERATOR = b'#GENERATOR#' | |
DONE = b'#DONE#' | |
def runner(conn, *args, **kwargs): | |
return_value = func(*args, **kwargs) | |
if isinstance(return_value, GeneratorType): | |
conn.send(GENERATOR) | |
for val in return_value: |
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
#include <type_traits> | |
template <typename T> | |
struct wrap; | |
template <typename T> | |
constexpr auto is_wrap_v = false; | |
template <typename T> | |
constexpr auto is_wrap_v<wrap<T>> = true; |
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 com.sun.jna.Library; | |
import com.sun.jna.Native; | |
import com.sun.jna.Pointer; | |
import sun.misc.Unsafe; | |
import java.lang.reflect.Field; | |
public class Program { | |
private static final Unsafe UNSAFE; |
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
#include <utility> | |
#include <type_traits> | |
template<typename T> | |
struct identity { using type = T; }; | |
template<std::size_t I, typename... Ts> | |
struct nth_type; | |
template<typename T, typename... Ts> |