Skip to content

Instantly share code, notes, and snippets.

View mt-caret's full-sized avatar
😇

mt_caret mt-caret

😇
View GitHub Profile
let
resolve = nixPath: defaultUrl:
let
resolvedNixPath = builtins.tryEval nixPath;
in
if resolvedNixPath.success then
import resolvedNixPath.value
else
builtins.fetchTarball defaultUrl
;
{ lib
, fetchFromGitHub
, buildGoModule
, go-md2man
, podman
}:
buildGoModule rec {
pname = "toolbox";
version = "0.0.92";
{ stdenv, fetchFromGitHub, cmake, pkg-config, git, bzip2, libusb1, libzip, openssl }:
stdenv.mkDerivation rec {
pname = "uuu";
version = "1.3.191";
src = fetchFromGitHub {
owner = "NXPMicro";
repo = "mfgtools";
rev = "uuu_${version}";
sha256 = "196blmd7nf5kamvay22rvnkds2v6h7ab8lyl10dknxgy8i8siqq9";
};
@mt-caret
mt-caret / satysfi-steamer.diff
Last active August 22, 2019 04:46
run steamer on SATySFi HEAD (b1349fae80e43ac454bbcd9a7101c9988fe6aaa2)
diff --git a/hilite.satyh b/hilite.satyh
index 4a7c33b..69179bc 100644
--- a/hilite.satyh
+++ b/hilite.satyh
@@ -1,4 +1,5 @@
% Syntax Highlighting, Lite Edition.
+@require: pervasives
@require: list
@require: color
@require: gr
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad ((<=<))
import Control.Monad.Trans (liftIO)
import Control.Monad.Trans.Maybe
import System.Taffybar
import System.Taffybar.SimpleConfig
import qualified System.Taffybar.Information.CPU as C
import qualified System.Taffybar.Widget.SimpleClock as S
import qualified System.Taffybar.Widget.Windows as Win
import qualified System.Taffybar.Widget.Workspaces as Work
import "u256"
let popcount (n: u32): i32 =
loop ret = 0 for i in 0..<32 do
ret + u32.get_bit i n
let main: []u256.t =
map (\x ->
map (\y -> popcount (x ^ y) >= 4) (0..<2**10)
|> u256.pack
import numpy as np
from u256 import u256
max_value = 2**256 - 1
min_value = 0
mask = 2**32 - 1
o = u256()
def encode(n):
$ futhark pyopencl --library --safe u256.fut && python reproduce.py
/nix/store/zfnva27rkm8lb9b793qqw48yzbp7v7qn-python3.7-pyopencl-2018.2.3/lib/python3.7/site-packages/pyopencl/__init__.py:232: CompilerWarning: Non-empty compiler output encountered. Set the environment variable PYOPENCL_COMPILER_OUTPUT=1 to see more.
"to see more.", CompilerWarning)
input [1, 0, 0, 0, 0, 0, 0, 0] 1
output [1, 1, 0, 0, 0, 0, 0, 0] 4294967297
Traceback (most recent call last):
File "reproduce.py", line 44, in <module>
test_pack_unpack_roundtrip(1)
File "reproduce.py", line 41, in test_pack_unpack_roundtrip
assert call1(o.pack_unpack_roundtrip, a) == a
$ futhark python --library --safe u256.fut && python reproduce.py
input [1, 0, 0, 0, 0, 0, 0, 0] 1
output [257, 0, 0, 0, 0, 0, 0, 0] 257
Traceback (most recent call last):
File "reproduce.py", line 44, in <module>
test_pack_unpack_roundtrip(1)
File "reproduce.py", line 41, in test_pack_unpack_roundtrip
assert call1(o.pack_unpack_roundtrip, a) == a
AssertionError
from hypothesis import given, reproduce_failure, settings
from hypothesis.strategies import integers
import numpy as np
from u256 import u256
import unittest
max_value = 2**256 - 1
min_value = 0
mask = 2**32 - 1