This file contains 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
-- docker run -i -t -v /Users/<<home>>/workspace/hask:/tmp/app debian | |
import Text.Parsec | |
import Text.Parsec.String (Parser) | |
import Data.Maybe | |
data Item = Item (String, Int) deriving Show | |
data RGB = RGB Int Int Int deriving Show | |
data Game = Game Int [RGB] deriving Show | |
puzzle :: (Int, Int, Int) -- RGB |
This file contains 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
FROM debian:bullseye-slim | |
RUN mkdir -p /usr/share/man/man1 | |
# Update packages and install dependencies | |
RUN apt-get update && apt-get -y install \ | |
git \ | |
ca-certificates \ | |
bash \ | |
vim \ | |
gawk sed grep bc coreutils wget zip \ |
This file contains 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
-- Notes https://www.cs.utoronto.ca/~trebla/CSCC24-2023-Summer/08-parsing.html#token | |
import Text.Parsec | |
import Text.Parsec.String (Parser) | |
-- Parsec parser for a single integer | |
integerParser :: Parser Int | |
integerParser = (read <$> many1 digit) <* many space |
This file contains 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 SudUtils(module SudUtils) where | |
import qualified Data.Vector as V | |
import Data.Maybe | |
import Data.List (sort, group) | |
-- sudoku | |
data Cell = Cell Int | Cells [Int] deriving Show |
This file contains 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 SudUtils | |
import qualified Data.Vector as V | |
import Data.Maybe | |
import Data.List (sort, group) | |
-- / end initialization code | |
solve :: Board -> Board | |
solve vec = V.imap (\i rw -> update i rw) vec |
This file contains 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 qualified Data.Vector as V | |
import Data.Maybe | |
data IsNew = N|O deriving (Show) | |
data Cell = Cell Int Int IsNew deriving (Show) | |
instance Eq Cell where | |
(==) (Cell x0 y0 _) (Cell x1 y1 _) = x0 == x1 && y0 == y1 | |
This file contains 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
public static final AcctProductMapGetResT util(String str) { | |
try { | |
JAXBContext jaxbContext = JAXBContext.newInstance(AcctProductMapGetResponseT.class, | |
AcctProductMapGetResT.class); | |
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); | |
JAXBElement<AcctProductMapGetResponseT> jresp = unmarshaller.unmarshal( | |
new StreamSource(new ByteArrayInputStream(str.getBytes())), AcctProductMapGetResponseT.class); | |
AcctProductMapGetResponseT resp = jresp.getValue(); | |
Assert.assertNotNull(resp); | |
return resp.getResponse(); |
This file contains 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
mvn dependency:tree | grep jar | grep INFO | awk -F"-" '{print $2}' | grep jar | awk -F":" '{gsub (/\./, "\/", $1); print $1"/"$2"/"$4"/*.jar" }' |
This file contains 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 where | |
import qualified Data.Vector as V | |
import Data.Maybe | |
import Data.Ord | |
-- manacher algorithm | |
-- $ ghci | |
-- $ :l manacher.hs | |
-- > manacher "aba" | |
manacher :: String -> String |
This file contains 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
#!/bin/bash | |
SHASUM="HELLO WORLD" | |
while true; do | |
FILENAME=`ls -ltrap *.hs | grep -v / | awk '{print $9}' | tail -1` | |
tmp_SHASUM=`shasum $FILENAME` | |
# echo "$tmp_SHASUM" | |
if [ "$SHASUM" != "$tmp_SHASUM" ]; then | |
# echo "Strings are not equal" |
NewerOlder