diff options
Diffstat (limited to '080_blog')
5 files changed, 240 insertions, 237 deletions
diff --git a/080_blog/00040_Haskell/00010_Links-and-Notes-and-Literature/index.md b/080_blog/00040_Haskell/00010_Links-and-Notes-and-Literature/index.md index 6e82b3b..2eb1215 100644 --- a/080_blog/00040_Haskell/00010_Links-and-Notes-and-Literature/index.md +++ b/080_blog/00040_Haskell/00010_Links-and-Notes-and-Literature/index.md @@ -6,29 +6,62 @@ * **Real World Haskell** by Bryan O'Sullivan, Don Stewart, and John Goerzen * **Parallel and Concurrent Programming in Haskell** by Simon Marlow -* **Haskell Wiki** https://wiki.haskell.org -* **UPENN CIS 194** https://www.seas.upenn.edu/~cis194/spring13/ -* **What I Wish I Knew When Learning Haskell** by Stephen Diehl -* **Data61 Course** https://github.com/data61/fp-course +* **Haskell Wiki** <https://wiki.haskell.org> +* **UPENN CIS 194** <https://www.seas.upenn.edu/~cis194/spring13/> +* **What I Wish I Knew When Learning Haskell** by Stephen Diehl <http://dev.stephendiehl.com/hask/> +* **Data61 Course** <https://github.com/data61/fp-course> * **Monads for functional programming (paper)** by Philip Wadler * **Functional Pearl (paper)** * **Why Functional Programming Matters (paper)** -* **Mailing Lists** https://www.haskell.org/mailing-lists/ +* **Mailing Lists** <https://www.haskell.org/mailing-lists/> * **IRC** #haskell at chat.freenode.at -* **Monadic Warsaw** +* **Monadic Warsaw** -## Xmonad +## xmonad-contrib contribution -My little contribution to xmonad-contrib: +Added a pretty printer for empty visible workspaces\ +<https://github.com/xmonad/xmonad-contrib/pull/241> -* Added pretty printer for empty visible workspaces (wrapped in Maybe) - https://github.com/xmonad/xmonad-contrib/pull/241 +## Some GHC Flags -## GHC Flags (TODO: put here all the other flags I have documentend in this Makefile somweher :P ) - -gq ? + -v verbose mode + -O2 level 2 optimizations + -rtsopts allow +RTS flags + -prof enable basic time and allocation profiling + -auto-all cost centers on all top level functions + (you can also add them via the SCC pragma) + -caf-all generate data for CAFs (constant applicative forms) + -fforce-recomp force recompilation + -threaded Use threaed runtime + -eventlog enables +RTS -l flag + + -Wall + -Werror + + Notes: you will obtain the profiling versions of dependancies via: + stack install --profile [libraryname] + + -fprof-auto replaced -auto-all + -fprof-cafs replaced -caf-all + +## Some +RTS flags + + -K set stack limit + -s statistic reporting + -p profiling + -hc extract heap profile + -hy allocation by type + -hd allocation by constructor + -ix x is sampling frequency in seconds. e.g. 0.01) + -Nx x is number of cores to utilize + -l emit log file (can be used threadscope) + -ddump-simpl generate core + + Note: render the heap profile as graph with: hp2ps -e8in -c file.hp + show eventlog with: threadscope file.eventlog ## monad transformers in action diff --git a/080_blog/00040_Haskell/00065_Base64-Encoder/base64.cast b/080_blog/00040_Haskell/00065_Base64-Encoder/base64.cast index 63fece1..54f3ab5 100644 --- a/080_blog/00040_Haskell/00065_Base64-Encoder/base64.cast +++ b/080_blog/00040_Haskell/00065_Base64-Encoder/base64.cast @@ -1,322 +1,226 @@ { - "duration": 14.820928, + "command": null, + "width": 101, "title": null, + "height": 6, "env": { "SHELL": "/bin/bash", "TERM": "screen-256color" }, - "width": 106, "stdout": [ [ - 0.019966, - "miguel@megaloman:~$ " - ], - [ - 1.524665, - "t" - ], - [ - 0.08111, - "h" - ], - [ - 0.095838, - "i" - ], - [ - 0.118019, - "s" - ], - [ - 0.086883, - " " - ], - [ - 0.089573, - "i" - ], - [ - 0.134283, - "s" - ], - [ - 0.096031, - " " - ], - [ - 0.114016, - "a" - ], - [ - 0.166151, - " " - ], - [ - 0.319094, - "l" - ], - [ - 0.195916, - "o" - ], - [ - 0.142042, - "c" + 0.020042, + "miguel@megaloman:~/git/haskell/base64$ " ], [ - 0.139961, - "a" + 0.972847, + "cat /dev/urandom | pv | ./base64 > /dev/null " ], [ - 0.07801, - "l" + 0.43902, + "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[1Pecho \"Welcome to Base64 encoding\" | ./base64" ], [ - 0.081012, - " " - ], - [ - 0.094941, - "a" - ], - [ - 0.120898, - "s" - ], - [ - 0.107959, - "c" - ], - [ - 0.115993, - "i" - ], - [ - 0.137871, - "i" + 0.83889, + "\r\n" ], [ - 0.205335, - "n" + 0.001251, + "V2VsY29tZSB0byBCYXNlNjQgZW5jb2RpbmcK\r\n" ], [ - 0.108673, - "e" + 0.000356, + "miguel@megaloman:~/git/haskell/base64$ " ], [ - 0.127436, - "m" + 1.151505, + "echo \"Welcome to Base64 encoding\" | ./base64" ], [ - 0.123916, - "a" + 0.328933, + "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[Ccat /dev/urandom | pv | ./base64 > /dev/null " ], [ - 0.244565, + 0.833, "\r\n" ], [ - 0.000482, - "bash: this: command not found\r\n" + 1.001665, + " 253MiB 0:00:01 [ 253MiB/s] [ <=> ]\r" ], [ - 0.000346, - "miguel@megaloman:~$ " + 0.999837, + " 500MiB 0:00:02 [ 247MiB/s] [ <=> ]\r" ], [ - 1.012884, - "this is a local asciinema" + 1.000048, + " 753MiB 0:00:03 [ 252MiB/s] [ <=> ]\r" ], [ - 0.230737, - "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C" + 1.000117, + "1001MiB 0:00:04 [ 247MiB/s] [ <=> ]\r" ], [ - 0.140235, - "\u001b[1@e" + 0.999649, + "1.22GiB 0:00:05 [ 251MiB/s] [ <=> ]\r" ], [ - 0.097927, - "\u001b[1@c" + 1.000026, + "1.47GiB 0:00:06 [ 250MiB/s] [ <=> ]\r" ], [ - 0.188824, - "\u001b[1@j" + 1.000236, + "1.72GiB 0:00:07 [ 253MiB/s] [ <=> ]\r" ], [ - 0.000974, - "\u001b[1@o" + 1.000056, + "1.96GiB 0:00:08 [ 252MiB/s] [ <=> ]\r" ], [ - 0.421424, - "\b\u001b[1P" + 0.999645, + " 2.2GiB 0:00:09 [ 244MiB/s] [ <=> ]\r" ], [ - 0.117902, - "\b\u001b[1P" + 1.000274, + "2.45GiB 0:00:10 [ 253MiB/s] [ <=> ]\r" ], [ - 0.208192, - "\u001b[1@h" + 0.999751, + "2.69GiB 0:00:11 [ 244MiB/s] [ <=> ]\r" ], [ - 0.115112, - "\u001b[1@ " + 1.000191, + "2.93GiB 0:00:12 [ 252MiB/s] [ <=> ]\r" ], [ - 0.012814, - "\u001b[1@o" + 0.999772, + "3.18GiB 0:00:13 [ 248MiB/s] [ <=> ]\r" ], [ - 0.295287, - "\r\n" + 1.000312, + "3.43GiB 0:00:14 [ 257MiB/s] [ <=> ]\r" ], [ - 0.000755, - "bash: ech: command not found\r\n" + 0.999856, + "3.68GiB 0:00:15 [ 254MiB/s] [ <=> ]\r" ], [ - 0.000509, - "miguel@megaloman:~$ " + 1.000239, + "3.93GiB 0:00:16 [ 253MiB/s] [ <=> ]\r" ], [ - 0.480858, - "ech othis is a local asciinema" + 0.99986, + "4.17GiB 0:00:17 [ 248MiB/s] [ <=> ]\r" ], [ - 0.192018, - "\r\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C\u001b[C" + 0.999739, + " 4.4GiB 0:00:18 [ 242MiB/s] [ <=> ]\r" ], [ - 0.237975, - "\u001b[C" + 1.000023, + "4.65GiB 0:00:19 [ 252MiB/s] [ <=> ]\r" ], [ - 0.118994, - "\u001b[C" + 1.000103, + "4.89GiB 0:00:20 [ 245MiB/s] [ <=> ]\r" ], [ - 0.146091, - "\u001b[1P" + 1.000106, + "5.14GiB 0:00:21 [ 255MiB/s] [ <=> ]\r" ], [ - 0.348015, - "\u001b[1P" + 1.000102, + "5.38GiB 0:00:22 [ 246MiB/s] [ <=> ]\r" ], [ - 0.562446, - "\u001b[1@h" + 1.000042, + "5.63GiB 0:00:23 [ 252MiB/s] [ <=> ]\r" ], [ - 0.437804, - "\u001b[C" + 0.999787, + "5.87GiB 0:00:24 [ 250MiB/s] [ <=> ]\r" ], [ - 0.219332, - "\u001b[1@ " + 1.000079, + "6.11GiB 0:00:25 [ 248MiB/s] [ <=> ]\r" ], [ - 0.220637, - "\r\n" + 1.000035, + "6.36GiB 0:00:26 [ 247MiB/s] [ <=> ]\r" ], [ - 0.000486, - "this is a local asciinema\r\n" + 0.999929, + " 6.6GiB 0:00:27 [ 250MiB/s] [ <=> ]\r" ], [ - 0.000206, - "miguel@megaloman:~$ " + 0.999966, + "6.84GiB 0:00:28 [ 244MiB/s] [ <=> ]\r" ], [ - 1.218406, - "m" + 1.000047, + "7.09GiB 0:00:29 [ 252MiB/s] [ <=> ]\r" ], [ - 0.079499, - "c" + 0.999829, + "7.33GiB 0:00:30 [ 250MiB/s] [ <=> ]\r" ], [ - 0.170894, - "\r\n" + 0.99996, + "7.57GiB 0:00:31 [ 245MiB/s] [ <=> ]\r" ], [ - 0.00735, - "\u001b[?1049h\u001b[?1h\u001b=" + 1.000063, + "7.81GiB 0:00:32 [ 248MiB/s] [ <=> ]\r" ], [ - 0.000586, - "\u001b[1;9r\u001b[4l\u001b(B\u001b)0\u001b[9;1H\u001b[m\u000f\u001b[37m\u001b[40m\u001b[m\u000f\u001b[39;49m\r \r\u001b[?1l\u001b>\u001b[?1049l\u001b[?1049h\u001b[?1h\u001b=" + 0.999947, + "8.06GiB 0:00:33 [ 251MiB/s] [ <=> ]\r" ], [ - 0.021657, - "\u001b[?1001s\u001b[?1002h\u001b[?1006h\u001b[?2004h" + 1.000249, + " 8.3GiB 0:00:34 [ 246MiB/s] [ <=> ]\r" ], [ - 0.000429, - "\u001b[1;9r\u001b[4l\u001b(B\u001b)0\u001b[?1h\u001b=\u001b[m\u000f\u001b[39m\u001b[49m\u001b[1;9r\u001b[H\u001b[J\u001b[2;105H\u001b[1K \u001b[37m\u001b[40m|\u001b[2;106H" + 1.000158, + "8.55GiB 0:00:35 [ 253MiB/s] [ <=> ]\r" ], [ - 0.000193, - "\b\u001b[39m\u001b[49m\u001b[1K \u001b[37m\u001b[40m╗\u001b[2;106H" + 0.999634, + "8.79GiB 0:00:36 [ 254MiB/s] [ <=> ]\r" ], [ - 0.000114, - "\b\u001b[39m\u001b[49m\u001b[1K \u001b[37m\u001b[40m/\u001b[2;106H" + 1.000289, + "9.04GiB 0:00:37 [ 251MiB/s] [ <=> ]\r" ], [ - 0.000129, - "\b\u001b[39m\u001b[49m\u001b[1K \u001b[37m\u001b[40m╗\u001b[2;106H" + 0.99977, + "9.29GiB 0:00:38 [ 251MiB/s] [ <=> ]\r" ], [ - 0.000156, - "\u001b]0;mc [miguel@megaloman]:~\u0007\u001b>" + 1.000013, + "9.53GiB 0:00:39 [ 248MiB/s] [ <=> ]\r" ], [ - 0.000337, - "\u001b[7;1H\u001b[39m\u001b[49mHint: Want your plain shell? Press C-o, and get back to MC with C-o again.\u001b[7;106H" + 1.000045, + "9.77GiB 0:00:40 [ 247MiB/s] [ <=> ]\r" ], [ - 0.000251, - "\u001b]0;mc [miguel@megaloman]:~\u0007\u001b>" + 0.999859, + " 10GiB 0:00:41 [ 248MiB/s] [ <=> ]\r" ], [ - 0.000102, - "\u001b[1;1H\u001b[30m\u001b[47m Left File Command Options Right \u001b[2;1H\u001b[37m\u001b[40m╔«═\u001b[97m\u001b[105m ~ \u001b[37m\u001b[40m═════════════════════════════════════════⋅[^]»╗╔«═ ~ ═════════════════════════════════════════⋅[^]»\r\n║\u001b[97m↑n Name \u001b[37m│\u001b[97m Size \u001b[37m│\u001b[97mModify time \u001b[37m║║\u001b[97m↑n Name \u001b[37m│\u001b[97m Size \u001b[37m│\u001b[97mModify time \u001b[37m║\u001b[4;1H╟───────────────────────────────────────────────────╢╟───────────────────────────────────────────────────╢\u001b[5;1H║UP--DIR ║║" + 0.760304, + "^C\r\n" ], [ - 1e-05, - "UP--DIR ║\u001b[6;1H╚═════════════════════════════════ 158G/234G (67%) ═╝╚═════════════════════════════════ 158G/234G (67%) ═╝\u001b[8;1H\u001b[39m\u001b[49mmiguel@megaloman:~$\u001b[84C\u001b[31m[^]\u001b[9;1H 1\u001b[97mHelp \u001b[31m 2\u001b[97mMenu \u001b[31m 3\u001b[97mView \u001b[31m 4\u001b[97mEdit \u001b[31m 5\u001b[97mCopy \u001b[31m 6\u001b[97mRenMov \u001b[31m 7\u001b[97mMkdir \u001b[31m 8\u001b[97mDelete \u001b[31m 9\u001b[97mPullDn \u001b[31m10\u001b[97mQuit \u001b[9;105H \b\u001b[4h \u001b[4l\u001b[8;21H" - ], - [ - 1.221371, - "\u001b[1;1H\u001b[39m \u001b[2;1H \u001b[3;1H \u001b[4;1H \u001b[5;1H \u001b[6;1H \u001b[7;1H \u001b[8;1H \u001b[9;1H \u001b[1;106H\u001b[?2" - ], - [ - 4.5e-05, - "004l\u001b[?1006l\u001b[?1002l\u001b[?1001r" - ], - [ - 0.000416, - "\u001b[?1l\u001b>\u001b[9;1H\u001b[m\u000f\u001b[39;49m\r \r\u001b[?1l\u001b>\u001b[?1049l\u001b[39;49m" - ], - [ - 0.000319, + 0.000409, "\r\n" ], [ - 0.001118, - "miguel@megaloman:~$ " - ], - [ - 0.791031, - "e" - ], - [ - 0.62602, - "\b\u001b[K" + 0.000128, + "miguel@megaloman:~/git/haskell/base64$ " ] ], - "height": 9, - "command": null, - "version": 1 + "version": 1, + "duration": 46.348438 }
\ No newline at end of file diff --git a/080_blog/00040_Haskell/00065_Base64-Encoder/index.md b/080_blog/00040_Haskell/00065_Base64-Encoder/index.md index 0ede6cf..3fd87ee 100644 --- a/080_blog/00040_Haskell/00065_Base64-Encoder/index.md +++ b/080_blog/00040_Haskell/00065_Base64-Encoder/index.md @@ -2,18 +2,22 @@ Miguel's Base64 Encoder ======================= February 19, 2018 -Coded on a winter afternoon to fully understand **base64 encoding** and play with +Initially coded on a cold winter afternoon to fully understand **base64 encoding** and play with **Haskell**, which is always an indisputable pleasure. -Coded in _big anger_, due to Nick's fairy tales about saving his encrypted binary -data in plain ASCII configuration files, featuring strange letters and -non-printable characters. :P +Coded in _big anger_, due to my friend Nick's fairy tales about saving his encrypted binary +data in plain _ASCII_ configuration files, featuring strange letters and non-printable characters. :smile: -<asciinema-player cols="106" rows="9" preload="true" theme="solarized-dark" autoplay="true" src="base64.cast"></asciinema-player> +_EDIT_: After optimizing my naive implementation, the encoder now reaches speeds +of around **240MB/s** on a single core of my _i7-4790K_. + +<asciinema-player loop="1" preload="true" theme="solarized-dark" autoplay="true" src="base64.cast"></asciinema-player> + +The source code below was auto-fetched from: +<https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=blob;f=base64/base64.hs> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} {BEGIN:EMBED} https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=blob_plain;f=base64/base64.hs {END:EMBED} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The above code was auto-fetched from: <https://gitweb.softwarefools.com/?p=miguel/haskell.git;a=blob_plain;f=base64/base64.hs> diff --git a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md index 63f9816..279c721 100644 --- a/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md +++ b/080_blog/00040_Haskell/00200_Estatico-Page-Maker/index.md @@ -14,13 +14,13 @@ I use **pandoc** et al. for most of the work anyway. ## Features * **No** Database -* Input with Simple **Markdown** Files -* Generates **Static HTML** Content -* Embedding data **fetched** via **http/https** -* Embedding self-hosted **asciinema** casts -* Embedding Latex formulas via **MathJx** -* Image Scaling with **ImageMagick** -* Syntax **Highlighting** +* Generate HTML from **Markdown** with **pandoc** +* **Highlight** source-code with **pandoc** +* Embed data **fetched** from the web with **http-conduit** +* Embed **screen-casts** with **asciinema** +* Embed Latex formulas with **MathJx** +* Scale Images with **ImageMagick** +* Generate MP4 from OGG **Videos** with **ffmpeg** ## Try It You can find the most recent version following the links below. diff --git a/080_blog/00110_Fool-Operating-System/index.md b/080_blog/00110_Fool-Operating-System/index.md index 765b33d..a8fac68 100644 --- a/080_blog/00110_Fool-Operating-System/index.md +++ b/080_blog/00110_Fool-Operating-System/index.md @@ -1,7 +1,52 @@ Fool OS ======= -My little buggy toy operating system is a never ending work in progress... +Welcome to my little buggy **x86 toy operating** system. +This is a never ending work in progress, motivated solely by my +bottomless curiosity. + +Be warned that most features are unstable and in development. + +## Features v0.2 + +* Booting with Multiboot (Spec. 0.6.96) (e.g. GRUB 2) +* Rudimentary POSIX compilance +* 32-bit protected mode +* Logging to COM1 +* Parsing ACPI (incomplete) and Multiboot Data +* Symmetrical Multiprocessing with LAPIC and IOAPIC +* CMOS Clock/ PIT Timer / APIC Timer +* Seperate GDT and IVT for each CPU +* Paging / Virtual Memory +* Ext2 RAM Disk +* Pipes +* Standard streams (stdin/stdout/stderr) +* PS2 Mouse/Keyboard support +* Multi-threading & Multitasking +* Kernel and Userspace Tasks +* CPU Private Memory +* Support for ELF binaries. +* IRQ Handling Framework +* Finegrained Spinlocks +* Superfast Task Scheduler +* PCI Bus scanning +* Ethernet E1000 PCI Driver +* VESA Framebuffer with fallback to a text-only terminal +* C-library for Userspace (Newlib) +* Simple Network Stack (ARP, IPv4, ICMP, UDP) +* Compositing Window Manager + +## Userspace Ports and Programs + +* Simple Fool-Shell +* Snake Game +* Newlib C library +* ncurses +* ncurses-examples +* vim +* zlib +* libpng +* many more to come... ## Screenshots @@ -14,7 +59,7 @@ My little buggy toy operating system is a never ending work in progress... {.img-fluid}\ [click here for full-resolution version of pic above.](foolos2.png)\ My **Compositing** Window Manager in action. As you see **Fool-OS** ships -with **vim** and some little **ncurses** programms as well as a +with **vim** and some little **ncurses-examples** as well as a **Brainfuck** interpreter. ## Videos @@ -33,11 +78,28 @@ Demonstrating the Kernel's **piping** functionality, inside the shell. Your browser does not support the video tag. </video> -Some random **ncurses** programms running in the **Window Manager**. +Some random **ncurses** programs (from ncurses-examples) running inside **Terminal Emulators**. + +## Git Repository + +* [Fool OS - Git Repository](https://gitweb.softwarefools.com/?p=miguel/fool-os.git) + +## Disclaimer + + THIS IS A NEVER ENDING WORK IN PROGRESS. -## Links + This is a simple and useless "operating system", with a very basic + set of features. It is the fruit of my fundamental explorations of + the x86 architecture and operating system design. -* [reference](https://www.idziorek.net/~miguel/fool-os-ref/) -* [git](https://gitweb.softwarefools.com/?p=miguel/fool-os.git) + Copyright 2014,2015,2018 M.Idziorek <m.i@gmx.at>, unless stated + otherwise or forgotten. -The ref and readme are of course outdated ... + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. |
