diff options
Diffstat (limited to '050_projects')
| -rw-r--r-- | 050_projects/0010_The-Old-Times/attack.png | bin | 0 -> 25834 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/attack.zip | bin | 0 -> 26160 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/high1.png | bin | 0 -> 169188 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/high2.png | bin | 0 -> 89748 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/highway.zip | bin | 0 -> 2960639 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/index.md | 54 | ||||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/naval.zip | bin | 0 -> 31425 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/naval1.png | bin | 0 -> 24910 bytes | |||
| -rw-r--r-- | 050_projects/0010_The-Old-Times/naval2.png | bin | 0 -> 43527 bytes | |||
| -rw-r--r-- | 050_projects/0100_Webkit-Keyboardless-Navigation/index.md | 30 | ||||
| -rw-r--r-- | 050_projects/100_Static-Page-Maker-in-Haskell/index.md | 121 | ||||
| -rw-r--r-- | 050_projects/index.md | 4 |
12 files changed, 209 insertions, 0 deletions
diff --git a/050_projects/0010_The-Old-Times/attack.png b/050_projects/0010_The-Old-Times/attack.png Binary files differnew file mode 100644 index 0000000..7c83d63 --- /dev/null +++ b/050_projects/0010_The-Old-Times/attack.png diff --git a/050_projects/0010_The-Old-Times/attack.zip b/050_projects/0010_The-Old-Times/attack.zip Binary files differnew file mode 100644 index 0000000..2d09784 --- /dev/null +++ b/050_projects/0010_The-Old-Times/attack.zip diff --git a/050_projects/0010_The-Old-Times/high1.png b/050_projects/0010_The-Old-Times/high1.png Binary files differnew file mode 100644 index 0000000..93ebf07 --- /dev/null +++ b/050_projects/0010_The-Old-Times/high1.png diff --git a/050_projects/0010_The-Old-Times/high2.png b/050_projects/0010_The-Old-Times/high2.png Binary files differnew file mode 100644 index 0000000..c94a5ef --- /dev/null +++ b/050_projects/0010_The-Old-Times/high2.png diff --git a/050_projects/0010_The-Old-Times/highway.zip b/050_projects/0010_The-Old-Times/highway.zip Binary files differnew file mode 100644 index 0000000..ffc7d7b --- /dev/null +++ b/050_projects/0010_The-Old-Times/highway.zip diff --git a/050_projects/0010_The-Old-Times/index.md b/050_projects/0010_The-Old-Times/index.md new file mode 100644 index 0000000..192a1c7 --- /dev/null +++ b/050_projects/0010_The-Old-Times/index.md @@ -0,0 +1,54 @@ +Games from the past +=================== + + 1990ies + +## About this games + +I recently found this simple and stupid games from times long gone. +I coded them in the 90ies as a teenager. Their source code was fortunatelly lost. + +This DOS MZ exacutables will run fine in a DOSBox. + +## Highway + + Coded: 1999 + Tech: C, DJGPP compiler, Allegro library + +A unique combination of Frogger and the original GTA, which it was probably +inspired by. Control your vehicle with the arrow keys without crashing, +as long as possible. + +Download: [highway.zip](highway.zip) + +{.img-fluid style="width:300px;"} +{.img-fluid style="width:300px;"} + +## Under Attack + + Coded: Early 90ies + Tech: QBasic + +Originally I coded this game for the TI-83 caluclator, later reimplementing +it for my PC **in colors**. As the commander of a the mighty battleship _HMS Miguel_ you need +to use the arrow keys to evade enemy missiles fired from the deepness of the ocean, +by enemy submarines. + +Download: [attack.zip](attack.zip) + +{.img-fluid style="width:300px;"} + +## Operation Naval Storm + + Coded: 1996 + Tech: QBasic + +Another naval warfare classic, based on the well known *Sea Battle* game, played on +paper grids. In this advanced version every player places only one single +ship, measuring 1x1 in size. Try to outperform the brilliant AI. + +{.img-fluid style="width:300px;"} +{.img-fluid style="width:300px;"} + +Download: [naval.zip](naval.zip) + diff --git a/050_projects/0010_The-Old-Times/naval.zip b/050_projects/0010_The-Old-Times/naval.zip Binary files differnew file mode 100644 index 0000000..6155a1e --- /dev/null +++ b/050_projects/0010_The-Old-Times/naval.zip diff --git a/050_projects/0010_The-Old-Times/naval1.png b/050_projects/0010_The-Old-Times/naval1.png Binary files differnew file mode 100644 index 0000000..d351629 --- /dev/null +++ b/050_projects/0010_The-Old-Times/naval1.png diff --git a/050_projects/0010_The-Old-Times/naval2.png b/050_projects/0010_The-Old-Times/naval2.png Binary files differnew file mode 100644 index 0000000..fb45276 --- /dev/null +++ b/050_projects/0010_The-Old-Times/naval2.png diff --git a/050_projects/0100_Webkit-Keyboardless-Navigation/index.md b/050_projects/0100_Webkit-Keyboardless-Navigation/index.md new file mode 100644 index 0000000..158c382 --- /dev/null +++ b/050_projects/0100_Webkit-Keyboardless-Navigation/index.md @@ -0,0 +1,30 @@ +Miguel's Surfing Quick Links +============================ + + April 12, 2018 + +Since I do not want to depend on JavaScript all of the time, I tried to +integrate simple keyboard-only navigation directly into the webkit2gtk+, +as a web extension. + +I use simple unix pipes for communication between the +main thread and my webextension. + +Please note that this is a work in progress! + +You can take a look at both branches at my github repo: [https://github.com/miguelclean/surf-webext-dom](https://github.com/miguelclean/surf-webext-dom). + +The DOM is manipulated on the fly by the browser without any JavaScript involved. + +A little video demonstrating what was achieved so far (inside the glorious, webkit2gtk+ based, suckless surf browser): + +<video style="width:60%;min-width:100pt;" controls> + <source src="/DATA/v1.mp4" type="video/mp4"> + <source src="/DATA/v1.ogv" type="video/ogg"> +Your browser does not support the video tag. + +</video> + +The browser itself can be found here: [https://surf.suckless.org/](https://surf.suckless.org/). + + diff --git a/050_projects/100_Static-Page-Maker-in-Haskell/index.md b/050_projects/100_Static-Page-Maker-in-Haskell/index.md new file mode 100644 index 0000000..0619078 --- /dev/null +++ b/050_projects/100_Static-Page-Maker-in-Haskell/index.md @@ -0,0 +1,121 @@ +# Static Haskell Website Creator - Miguel's Lair + + April 12, 2018 + +About two weeks ago, for personal reasons, I decided to switch my homepage +from a well known PHP driven CMS solution, to a light and static set +of html pages. + +I used this fact as a pretence to write my own simple static website +generator. And, Yes.. I know there are already hundereds of such genertors +out there, but I wanted to practice haskell and my masturbatory solution +fits in under 100 lines of code. (Including comments and type signatures) + +I use pandoc for all the heavy work, as syntax highlighting and conversion of +markdown to html, anyway. + +## Features + +* No Documentation +* No Database +* Sitemap derived from Directory Tree +* Simple Markdown Files for Content + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +-- +-- Staticus WWW - A minimalistic yet undocumented static website generator +-- coded in April 2018 by Michal Idziorek <m.i@gmx.at> +-- + +module StaticusWWW where + +import Control.Exception +import Control.Monad.Reader +import Data.List +import Data.List.Split +import Data.List.Utils +import Data.Maybe +import Data.Text(pack,unpack) +import Data.Tree +import System.Directory +import Text.Pandoc + +-- generate a HTML link from a href & title +htmlLink :: String -> String -> String +htmlLink href title="<a href='"++href++"'>"++replace "_" " " title++"</a>" + +-- generate HTML breadcrumbs from a list of page titles +genBrc :: [String] -> String +genBrc b | length b < 2 = "" + | otherwise = fst $ foldl lnk ("",0) b + where lnk (a,c) v = (a++" / "++html c v,c+1) + html c = htmlLink (concat (replicate (length b-c-1) "../")) + +-- pure function that generates a single HTML page from: +-- a html template, description, keywords, breadcrumbs, topMenue & submenue +genPage :: String->String->String->[String]->[String]->[String]->String->String +genPage tmpl dsc kw brc top chld md = + foldr rplc tmpl (replacers content (menu "/" top) (menu "./" chld) (genBrc brc) title dsc kw) + where content = either (const "error") unpack res + where res = runPure $ do doc <- readMarkdown def{readerExtensions=(enableExtension Ext_raw_html pandocExtensions )} $ pack md + writeHtml5String def doc + rplc v = replace ("##" ++ fst v ++ "##") (snd v) + title = if null brc then "Home" else replace "_" " " $ last brc + menu p = foldr (fm p) "" + fm p s a = "<li>"++htmlLink (p++s) s ++"</li>"++a + replacers c m m2 b t d k= + [("CONTENT", c) + ,("LOGO", "/DATA/logo.png") + ,("STYLESHEET", "/DATA/style.css") + ,("SITE_TITLE", "Miguel's Lair") + ,("SITE_SUBTITLE", "<br />where information sleepzzZZZzz ...") + ,("TITLE", t) + ,("DESCRIPTION", d) + ,("KEYWORDS", k) + ,("AUTHOR", "Michal Idziorek") + ,("MENU", m) + ,("SUB_MENU", m2) + ,("BREADCRUMBS", b) + ,("FOOTER", "(c) by Miguel 2018")] + +-- get list of subdirectories in given directory, with full relative path +getDirList :: FilePath -> IO [FilePath] +getDirList d = map ((d++"/")++) <$> listDirectory d + >>= filterM doesDirectoryExist + +-- sequence IO Action 'f' for each subdirectory of 'fp' recursively +trvDirTree :: FilePath -> (FilePath -> [FilePath] -> IO()) -> IO () +trvDirTree fp f = unfoldTreeM unf fp >>= sequence_ + where unf p = getDirList p >>= \s -> f p s >>= \l -> + return (return l, s) + +-- write the HTML page generated from current diectory by 'genPage' +wrtPage :: FilePath -> FilePath -> String -> [FilePath] -> FilePath -> [FilePath] -> IO () +wrtPage idx out tmpl top p chld = do + + when (not home) (createDirectory outdir) + + md <- readFile $ p ++ "/index.md" + cfg <- (map ((\(x:xs) -> (x,unwords xs)).words).lines) + <$> catch (readFile $ p++"/config") + ((\_ -> return "") :: IOException -> IO String) + + writeFile (outdir++"/index.html") + (genPage tmpl (lkp cfg "dsc") (lkp cfg "kwd") + brc (menu top) (if home then [] else menu chld) md) + + where home = outdir==out++"/" + remUnder = filter (not.null) . map (dropWhile(=='_').dropWhile(/='_')) + lkp cfg k = fromMaybe "" (lookup k cfg) + menu = remUnder . filter (not . isPrefixOf "00_") . map (last.splitOn "/") . sort + outdir = out ++ "/" ++ intercalate "/" brc + brc = remUnder $ splitOn "/" (drop (length idx) p) + +-- Main IO action: traverses index recursively and calls wrtPage in each +-- subdir, which in turn generates the output directories and html pages +main :: IO () +main = do tmpl <- readFile "./DATA/template.html" + top <- getDirList "./INDEX" + trvDirTree "./INDEX" (wrtPage "./INDEX" "./OUT" tmpl top) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + diff --git a/050_projects/index.md b/050_projects/index.md new file mode 100644 index 0000000..516f1f1 --- /dev/null +++ b/050_projects/index.md @@ -0,0 +1,4 @@ +Miguel's Projects +================= +This is a quite random selection of some of my little projects that accumulated over time. +Some are open source and available via git. |
