Skip to content

Instantly share code, notes, and snippets.

View dramforever's full-sized avatar
🖤
dramming

dram dramforever

🖤
dramming
  • Scarlet Devil Mansion, Gensokyo
View GitHub Profile
problemStr =
"800 000 000 003 600 000 070 090 200 050 007 000 000 045 700 000 \
100 030 001 000 068 008 500 010 090 000 400";
pr = Partition[ToExpression@Characters@StringDelete[problemStr, " "], 9];
blocks = Table[3 Quotient[i, 3] + Quotient[j, 3], {i, 0, 8}, {j, 0, 8}];
rows = Table[i, {i, 0, 8}, {j, 0, 8}];
cols = Table[j, {i, 0, 8}, {j, 0, 8}];
constrain[blk_] :=
Join @@ Table[Outer[Plus, Range[9], (Position[blk, k] - 1).{81, 9}], {k, Min[blk], Max[blk]}];
@dramforever
dramforever / total.idr
Created August 4, 2018 10:29
total test
Idris> :l total.idr
Type checking ./total.idr
total.idr:3:1-5:35:
|
3 | totalTest x with (decEq x 'a')
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
Main.totalTest is possibly not total due to: with block in Main.totalTest
@dramforever
dramforever / webapp.hs
Created July 5, 2017 08:06
Web app using Transient/Axiom
-- Build instructions: It's complicated
{-# LANGUAGE CPP #-}
module Main where
import Prelude hiding (div, id, span)
import GHCJS.HPlay.View
import Transient.Move
import Control.Monad.IO.Class
@dramforever
dramforever / Main.hs
Created September 30, 2014 15:18
qipa turing machine
{-# LANGUAGE NoMonomorphismRestriction #-}
module Main where
import Control.Monad.State
data Tape a = Tape { left :: [a]
, right :: [a]
}
@dramforever
dramforever / finder.hs
Created September 8, 2014 06:57
some qipa solver
import Data.List
import Data.Maybe
import Control.Monad
data Ans = A | B | C | D | Whatever deriving (Show, Eq, Ord)
ver ans 1 = (ans !! 1) == (ans !! 1)
ver ans 2 = Just (ans !! 5) == lookup (ans !! 2) [(A, C), (B, D), (C, A), (D, B)]
@dramforever
dramforever / linux_arch_x86_boot_ctypes.h.txt
Created September 8, 2014 03:45
linux/arch/x86/boot/ctypes.h in English
linux/arch/x86/boot/ctypes.h in English
------------------------------------------------
hash ifndef boot isdigit h
hash define boot isdigit h
static inline int isdigit int ch
return ch is greater than or equal to zero and ch is less than or equal to nine
static inline int isxdigit int ch
if isdigit ch return true
if ch is greater than or equal to A and ch is greater than or equal to F
@dramforever
dramforever / slowvector.hs
Last active August 29, 2015 14:05
slow vector stuff
module Main (main) where
import Sound.Wav
import Data.Int
import qualified Data.ByteString.Lazy as B
import Data.ByteString.Lazy.Builder
import Data.Monoid
import System.Environment
import System.Exit
import System.IO
@dramforever
dramforever / hrevoice.hs
Created August 26, 2014 14:02
hrevoice
module Main where
import Sound.Wav
import Data.Int
import qualified Data.ByteString.Lazy as B
import Data.ByteString.Lazy.Builder
import Data.Monoid
import System.Environment
import System.Exit
import System.IO
#include <cstdio>
#include <climits>
using namespace std;
const int POOL_SIZE = 10000000;
const int QUEUE_SIZE = 10000000;
const int NODES_SIZE = 10000000;
struct edge_node {
int dest;
@dramforever
dramforever / ATP_Song_早八3_王瑞康.md
Last active August 29, 2015 14:05
这就是我的生物作业歌词啊怎么了

这是最终版


更新内容

  • v5 final version
  • v4: 修复了markdown标记
  • v3: 增加了版权说明
  • v2: 增加了前面这堆