diff options
| author | Miguel <m.i@gmx.at> | 2019-02-17 13:08:16 +0100 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2019-02-17 13:08:16 +0100 |
| commit | 00447070772d74c33d099eb3d1097fa9a549cd57 (patch) | |
| tree | 77034c5587a0558945948b57a022247de6d50272 | |
first draft
43 files changed, 3290 insertions, 0 deletions
diff --git a/00_404/index.md b/00_404/index.md new file mode 100644 index 0000000..6e50e7d --- /dev/null +++ b/00_404/index.md @@ -0,0 +1,16 @@ +Page Request resulted in 404 +============================= + +We are sorry, but the requested page could not be found. +If you think something went wrong feel free to [contact](/contact) me. + +Move along +---------- + +Just use one of the Links below to continue browsing this Website: + +* [Go Home](/) +* [Read the Blog](/blog) +* [Browse my projects](/projects) +* [Check my Portfolio](/work) +* [Contact me](/contact) diff --git a/010_contact/Michal_Idziorek_CV.pdf b/010_contact/Michal_Idziorek_CV.pdf Binary files differnew file mode 100644 index 0000000..f73fe30 --- /dev/null +++ b/010_contact/Michal_Idziorek_CV.pdf diff --git a/010_contact/index.md b/010_contact/index.md new file mode 100644 index 0000000..acf7491 --- /dev/null +++ b/010_contact/index.md @@ -0,0 +1,35 @@ +<h1>Contact and other useless Data</h1> + +Contact +------- + +You can Contact me in English, German, Polish or Klingon via any of the following channels: + +* email: [m.i@gmx.at](mailto:m.i@gmx.at) +* xmpp: miguel (on the softwarefools.com xmpp server) +* irc: oo\_miguel (on freenode) + +CV +-- + +Here you can download a PDF version of my Curriculum Vitae, which is very likely out of date: + +[Michal\_Idziorek\_CV.pdf](/DATA/Michal_Idziorek_CV.pdf) +<!-- recommendations --> + +Social Media and similar +------------------------ + +Generally trying to avoid it, occasionally I use/participate in some of these: + +* github: [miguelclean](https://github.com/miguelclean) +* dockerhub: [migueldirty](https://hub.docker.com/u/migueldirty/) +* stackoverflow: [oo\_miguel](https://stackoverflow.com/users/2430189/oo-miguel) +* topcoder: miguel\_clean +<!-- * codility/linkedin/xing/goldenline/twitter/google+ --> + +Donate +------ + +Feel free to buy me a beer, the next time we meet. + diff --git a/015_about/Michal-Idziorek.jpg b/015_about/Michal-Idziorek.jpg Binary files differnew file mode 100644 index 0000000..ddb3640 --- /dev/null +++ b/015_about/Michal-Idziorek.jpg diff --git a/015_about/index.md b/015_about/index.md new file mode 100644 index 0000000..7a7558e --- /dev/null +++ b/015_about/index.md @@ -0,0 +1,37 @@ +Michal Idziorek +=============== + +<div itemscope itemtype="http://schema.org/Person"> +Hello and Welcome to the virtual home of <span itemprop="name">Michal Idziorek</span>, +known as <em itemprop='alternateName'>Miguel the Red Scorpio</em>, a +<span itemprop="description">developer, software engineer, scientist, philosopher, +as well as self-proclaimed artist and culinarian</span>. +Michal Idziorek graduated from the _Vienna University of Technology_ +and holds a _Master of Science_ degree in _Media and Computer Science_. + +Over the years Michal succesfully engaged professionally in multidisciplinary +academic, corporate and freelance activites, acquiring a broad toolset of +specialised and universal skills he is continuously extending. + +<div itemprop="image" itemscope itemtype="http://schema.org/ImageObject"> +<figure> +{itemprop="contentUrl" .img-fluid alt="Michal Idziorek smiling in front of green grass" title="~~ But youth smiles without any reason. It is one of its chiefest charms. ~~"} +<figcaption itemprop="name">_Michal Idziorek smiling_</figcaption> +</figure> +</div> + +## What is this Website About? + +This website serves as shelter for some of my [notes](/blog) on a variety +of subjects and hosts a somehow random selection of my [projects](/projects) +& [works](/work) as well. Feel free to contact me with questions or suggestions, +via email (<a href="mailto:m.i@gmx.at" itemprop="email">m.i@gmx.at</a>) +or through any other channel provided on the [contact](/contact) page. + +Please keep in mind, that this website is essentially under sustained construction +and more content is scheduled to follow. + +Sincerely Yours,<br /> +_Michal Idziorek_ + +</div> diff --git a/020_work/index.md b/020_work/index.md new file mode 100644 index 0000000..7264d62 --- /dev/null +++ b/020_work/index.md @@ -0,0 +1,536 @@ +Portfolio +========= + +A random selection of Web-sites, Web-shops, Web-portals and Mobile Apps. + +<!--TODO: backlinks/contact +team: julka + matjas + niki +(+koko projects) +vienna-warsaw-berlin +form/tel/contact + +copterwerk +kradwerk +architekturawnetrz +krzysztofidziorek + +todo-app screenshot +--> + +<div class="row"> + +{BEGIN:CARD} +/DATA/GEN/www/casamila.png +Casamila - Architects +casamila.pl +2018 +-badge-secondary online soon +-badge-primary new +-badge-info wordpress + +Complete redesign of the Casamila Architects Website. +Extensive Template customization according to client requirements. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/shop/bunzlauer.png +Web Shop - Bunzlauer +bunzlauer.shop +2018 +-badge-success online +-badge-primary new +-badge-info OpenCart + +Customized and Optimized OpenCart Webshop specializing in international +shipping of beautiful handcrafted polish pottery. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/aquarelle.jpg +G. Mueller Watercolors +gerhard-mueller-aquarelle.de +2018 +-badge-success online +-badge-primary new +-badge-info wordpress + +Website of Gerhard Müller hosting his watarcolour paintings. Relaunched 2018. Former TYPO3. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/mmtour.png +Mille Miglia - Blog +mmtour.krzysztofidziorek.pl +2017 +-badge-success online +-badge-primary new +-badge-info wordpress + +Krzysztof's Blog about his adventures, traveling the Italian +roads of the historic Mille Miglia race in Fall 2017. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/apps/atenefunds.png +AteneKOM Funds +GooglePlay / AppStore +2018 +-badge-success online +-badge-primary new +-badge-info iOS +-badge-info Android +-badge-info Symfony + +Overview of the funding possibilities on EU-, national and regional levels. +Entries are continually updated and expanded and can be filtered by topics. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/mazury.png +Ratuj Mazury +ratuj-mazury.pl +2016 +-badge-success online +-badge-info wordpress + +This Website was launched 2016 and promotes ecological acitivites in the +Masurian area. Template was designed from scratch. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/wekkaprojekt.png +Wekka Projekt - Architects +wekka-projekt.pl +2016 +-badge-success online +-badge-info wordpress + +Launched 2016 for an Architectural Office operating in Warsaw, Poland. +Template was designed from scratch. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/norti.png +Norton Motorcycles Fan Club +nortonmotorcycles.co.uk +2018 +-badge-success online +-badge-primary new +-badge-info wordpress + +Relaunched 2018 on Wordpress. Fomer TYPO3. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/bunzlauer.png +Bunzlauer Keramik +bunzlauerkeramik.at +2018 +-badge-success online +-badge-primary new +-badge-info wordpress + +Austrian Website about Polish Pottery. +Relaunched 2018 on Wordpress. Fomer TYPO3. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/apps/cornea.png +Cornea Franz +GooglePlay / AppStore +2013 +-badge-secondary offline +-badge-info iOS +-badge-info Android +-badge-info PHP + +Mobile App with a simple Backend porviding legal News. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/shop/link-all.png +Link-All Software +link-all.eu +2013 +-badge-success online +-badge-info OsCommerce + +Webshop offering custom Alfresco hosting in vairous tiers. +Customized OsCommerce. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/shop/bildershopping.png +Bilder Shop - Art Prints +bildershopping.at +2010 +-badge-secondary offline +-badge-info OsCommerce + +Custom OsCommerce Webshop selling various Art Prints +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/shop/nadler.png +Nadler - Wine Shop +nadler-hanny.at +2007 +-badge-success online +-badge-info PHP + +In 2007 coded the super-light custom PHP Shop for the Website of this Austrian Winemaker. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/shop/panner.jpg +Panner - Stamp Shop +panner.net +2006 +-badge-secondary offline +-badge-info PHP + +Custom PHP shop specializing in Postal Stamps. Featuring a very extensive +backend for user management and analysis. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/shop/panner-admin.png +Stamp Shop Backend +panner.net/admin +2006 +-badge-secondary offline +-badge-info PHP + +Custom extensiv backend for the panner.net stamps webshop with complex user management and analytic possibilites. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/maiden.jpg +Maiden Entertainment +maidenentertainment.com +2005 +-badge-secondary offline +-badge-info PHP + +Website of an independent Music and Video Producer. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/flipper2.jpg +Flipper Grafik +flipper-grafik.at +2004 +-badge-secondary offline +-badge-info PHP + +Advertising Agency in Vienna, Austria. +{END:CARD} + + + +{BEGIN:CARD} +/DATA/GEN/www/cqs.jpg +Complex Quantum Systems +coqus.at +2006 +-badge-secondary offline +-badge-info PHP + +Website of the Doctoral Program on Complex Quantum Systems of the University Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/ikm.jpg +Institut fuer Kulturmanagement +mdw.ac.at/ikm/ +2003 +-badge-secondary offline +-badge-info Perl + +Website of the IKM Insistute of the University of Music and Performing Arts, Vienna. +Advanced book-browsing tools for the Insitutes library. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/preschl.jpg +Claudia Preschl +personal.mdw.ac.at/preschl/ +2004 +-badge-success online + +Website of Prof. Claudia Preschl of the University of Music and Performing Arts, Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/textlabor.jpg +Textlabor +textlabor.at +2006 +-badge-success online +-badge-info PHP + +Website of Jolande Peck-Himmel, PR Consultant specializing in Print and Online Media. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/lev.jpg +LEV Wien +levwien.at +2006 +-badge-secondary offline +-badge-info PHP + +Website of the Parents Council of Music Shools of Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/meersalzgrotte.png +Saliseum +meersalzgrotte.at +2008 +-badge-secondary offline +-badge-info PHP + +Very light custom PHP Website of the Sea-Salt-Cave Saliseum in Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/telenetprofi.png +Telenet Profi +telenetprofi.at +2011 +-badge-success online + +Website of a Cell Phone Store in Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/breitbandausschreibungen1.png +Broadband Tenders Germany +breitbandausschreibungen.de +2014 +-badge-success online +-badge-info Symfony + +Platform for Coorindation of German Broadband Tender Programmes. +(_involved until 2014_) + +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/maiden2.png +Maiden Reloaded +maidenenterteinmanet.com +2010 +-badge-secondary offline +-badge-info TYPO3 + +Reloaded version of the Website of the indy Video and Music producer Maiden Enterteinmant +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/brlr1.png +BRLR Monitoring +breitbandbuero.de/monitoring/ +2011 +-badge-success online +-badge-info PHP + +Monitoring of Broadband projects according to the "Bundesrahmenregeleung Leerrorhre" + +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/atenekom.jpg +AteneKOM Website +atenekom.eu +2012 +-badge-secondary offline +-badge-info TYPO3 + +Former Website of the atene KOM Agency. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/todoapp.png +Online Task Management +Intranet +2013 +-badge-info Symfony + +Browser-based tool for Assignment and Monitoring of Tasks within the Company. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/sensor.png +Sensor for GIS +Intranet +2013 +-badge-info GeoServer +-badge-info PostGIS +-badge-info OpenLayers + +Tool for spatial Analysis of Broadband related Customer Data. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/ringy.png +ZT Ringsmuth +zt-ringsmuth.at +2015 +-badge-secondary offline +-badge-info Joomla + +Website of Civil Engineer Ernst Ringsmuth. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/platin.png +Platin - Billard & Darts +platin-billard.at +2009 +-badge-secondary offline +-badge-info PHP + +Platin Bar. Works included taking Photographs for this Website as well. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/balbuza.png +Broetchenstube +broetchenstube-baden.at +2007 +-badge-secondary offline +-badge-info Joomla + +Website of a Catering Company located in Baden, Austria. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/aufbau.jpg +Cultural Administration Studies +mdw.ac.at/ikm/kulturmanagement/ +2007 +-badge-secondary offline +-badge-info PHP + +Lightweight Website of postgradual studies at the University of Music and Performing Arts, Vienna. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/kunst-stuecke.png +Kunst-Stuecke Art Gallery +kunst-stuecke.at +2007 +-badge-secondary offline +-badge-info Redaxo + +Light CMS driven Website for an art gallery in Vienna. +{END:CARD} + + +{BEGIN:CARD} +/DATA/GEN/www/cuadro.png +Cuadro Architects +cuadro.com.pl +2006 +-badge-secondary offline +-badge-info PHP + +Architecture Website for Cuadro +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/foto-pschill.png +Gallery for Fotografie Pschill +fotografie-pschill.at +2006 +-badge-secondary offline +-badge-info PHP + +Create a PHP Gallery for this Photographers website. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/werbereich.png +Werbereich Creative Agency +werbereich.at +2006 +-badge-secondary offline +-badge-info PHP + +Technical implementation of the Website of this Creative Agency +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/immoconnect.png +Immoconnect Real Estate +immoconnect.net +2006 +-badge-secondary offline + +Light single-page Website for an Austrian Real Estate Agency. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/austria-org-pl.png +Austrian Cultural Forum +austria.org.pl +2007 +-badge-secondary offline +-badge-info PHP + +Impleneted the news archive for the Austrian Cultural Forum located in Warsaw. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/condition-red.png +Condition Red - Band +condition-red.com +2005 +-badge-secondary offline +-badge-info Flash + +Flash driven Website of the Rock and Metal Band: Condition RED. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/austrian-wine.png +Austrian Wine +austrian-wine.at +2005 +-badge-secondary offline + +Website for an exporter of Austrian Wines. +{END:CARD} + +{BEGIN:CARD} +/DATA/GEN/www/copterwerk.png +Copterwerk - Drone Services +copterwerk.com +2011 +-badge-secondary offline + +Web presence of a company offering Aerial photography and photogrammetry services. +{END:CARD} + +</div> + 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. diff --git a/080_blog/00010_Old-And-Outdated/00010_Monospace-Font-Bitmap-Generator/index.md b/080_blog/00010_Old-And-Outdated/00010_Monospace-Font-Bitmap-Generator/index.md new file mode 100644 index 0000000..3df7719 --- /dev/null +++ b/080_blog/00010_Old-And-Outdated/00010_Monospace-Font-Bitmap-Generator/index.md @@ -0,0 +1,64 @@ +monospaced font bitmaps +======================= + July 4, 2017 + +Since once in a while I have the need to generate my own simple bitmap fonts, which I might embed directly in my code (as in this little class, for example), today I publish this simple python script that will convert a textfile filled with ‘X’es and spaces into an array of integers + +* space = bit off +* ‘X’ = bit on + +{.img-fluid} + + +The script has some severe limitations but easily can be extended: + +* works for 5×5 bitmaps only +* every 6th lines is skipped (used for commenting) +* reads a file called “fonts.txt” from same directory + +~~~~~~~~~~~~~~~~~~~~~ {.bash .numberLines} +# filename: convert.py +f = open('fonts.txt','r'); + +i=0; +value=(2**25)-1; + +for line in f: + if (i % 6 ==0): + c=0; + if(i>0): + print(str(value)+","); + value=0 + else: + for j in range(0,5): + if j<len(line): + bit=24-(c*5+j); + if(line[j]=='X'): + value+=2**bit; + + c+=1; + i+=1; +~~~~~~~~~~~~~~~~~~~~~ + +Example input file (fonts.txt) with 2 letters only: + +~~~~~~~~~~~~~~~~~~~~~ {.bash} +// A (this is a comment line) +XXXXX +X X +XXXXX +X X +X X +// B (this is a comment line) +XXXX +X X +XXXX +X X +XXXX +~~~~~~~~~~~~~~~~~~~~~ + +Run ‘python convert.py’ in the same directory to get an array of integers you can easily embed in C/C++/Java etc. + +~~~~~~~~~~~~~~~~~~~~~ {.bash} +python convert.py +~~~~~~~~~~~~~~~~~~~~~ diff --git a/080_blog/00010_Old-And-Outdated/00020_Notes-on-Mail-Clients/index.md b/080_blog/00010_Old-And-Outdated/00020_Notes-on-Mail-Clients/index.md new file mode 100644 index 0000000..68a7be8 --- /dev/null +++ b/080_blog/00010_Old-And-Outdated/00020_Notes-on-Mail-Clients/index.md @@ -0,0 +1,144 @@ +## Mail Clients + +### Overview + +The Softwarefools Mailserver (SFMS) handles various domains and users. The +communication between the clients and the server is encrypted by TLS (better +known as SSL3.1+) to guarantee maximum security. Even though all common +major mailservices (GMX,Yahoo!, etc.) function the same way and through the +same technology, connecting to an encrypted server can be somehow tricky. This +is a result of various encryption standards that are often used simultaneously +by client programmers. To make this process as short and effective as possible, +we have summed up the working connection settings for all Mail User Agents +(MUAs) / Mail Retrieval Agents (MRAs) / Mail Transport Agent (MTAs) we have +tested so far. A good explanation on the differences between MUAs, MRAs and +MTAs can be found here: http://dev.mutt.org/trac/wiki/MailConcept + +The SFMS supports the IMAP protocol to remotely handle all incoming mail. This +allows you to keep your mailfolder in order on all devices and interfaces you +plan to access the server with. Outoging mail is pushed on the SFMS via the +SMTPD protocol. + +### Fingerprints + +To ensure highest possible security you should check the server keys fingeprints (see below), before accepting them through your favourite client. Note that you should also access this wiki over TLS/SSL to avoid the possibility of a man-in-the-middle attack. + + IMAP on port 993: + + MD5: 02:B0:72:78:F7:F1:28:40:C4:DB:37:3F:18:BB:E1:AF + SHA1: 36:6E:E3:8A:FD:C2:AF:F9:70:4F:B2:F3:E1:D1:03:AB:B7:7E:31:9B + + SMTPD on port 25: + + MD5: 49:D9:B8:49:44:73:B6:74:C0:BE:7A:5D:7D:46:44:C0 + SHA1: 9F:2C:40:51:AA:17:CF:2B:F1:EA:B9:E4:20:57:76:84:38:CC:33:5C + +### General Settings + +The general settings to access your mail account are your username (the full +main mail address on SFMS, e.g. name@domain) and your password. We +emphasize using IMAP as method to receive mail because it much more complys +with todays multi device accessibility. If you prefer using POP3 you have to +think about setting the “Keep mail on server” settings in your client so you +won’t come to a point of loosing important mails on the server. SFMS can +operate in both methods. In general there is only one address that is important +both as incoming and outgoing mailserver address: mail.softwarefools.com But to +be ready for future expansion of the Software Fools Universe we recommend to +use imap.softwarefools.com or pop.softwarefools.com (depending on your prefered +Inbox method) and smtp.softwarefools.com. + +Alternatively you can always use the corresponding subdomains with your domain +(e.g. imap.gotsche.at, smtp.copterwerk.com) + +The security method used is SSL/TSL on both servers. Our SMTP server requires +authentification with the same username and password as the incoming +mailserver. For specific adresses of all supported domains see Domains managed +by SF. + +### Agents + +#### Squirrel Webmail + +The easiest way of connecting to the SFMS is directly visiting Squirrel Webmail interface. The Squirrelmail interface allowes you to send emails and access your recived mails with an IMAP connection. You can customize your personal Squirrelmail interface as much as you like in the Options. We recommend the Theme Classic Blue with Font Verdana 12 + +To access the Squirrelmail interface visit the following link and enter your login data: https://secure.softwarefools.com/squirrelmail/ + +For some domains we created some easy-to-remember shortcuts to this page (e.g. http://webmail.gotsche.at). + +It is important to note that the webaccess to the mails should always happen encrypted through https. The certificate for https://secure.softwarefools.com is registered so all major Browsers should accept it immediately. If not, it might be important to accept the certificate specifically to access the https page. + +#### Microsoft Outlook + +One of the most common mailclients in use is Microsoft Outlook of the MS-Office bundle. As all major mail clients it offers to access multiple mail accounts as well as managing schedules and contacts. To connect to SFMS with outlook you have to enter the Account management …. (tbc) + +Link: http://support.microsoft.com/kb/829918 + +#### Mozilla Thunderbird + +A free and increasingly popular mailclient is Thunderbird of the Mozilla community. As MS-O it offers access to multiple eMail accounts. Also the usability of Schedules and Contact management have been cloned. This makes Thunderbird a client of choice for everybody not owning MS-Office. To configure a new email account follow these steps: + +* Enter Edit > Account Settings +* In the Account-Actions Dropdown select New eMail Account +* Enter your full Name, your email address (also aliases work) and your password and click Continue +* Thunderbird will now try out typical mailserver settings, if this processis not succesfull or if you want to configure yourself click Manual Setting +* For the Incoming mailserver select IMAP. As server address Thunderbird will use the domain of the Mail adress entered above, complete it to imap.softwarefools.com (alternativly imap.yourdomain will also work). As Security Method select SSL/TSL at the Standard Port: 993. The Authentification Method should be set to: Password,normal. +* The Outgoing mailserver is of course an SMTP server, just complete the server address to smtp.softwarefools.com (alternativly smtp.yourdomain). As Security Method select STARTTSL at Port: 587. Authentification Method again should be set to: Password,normal +* The Usernames used for both servers are the full email address (e.g. name@domain), aliases will not work. + +#### Android Mail Client + +To add a new mail account to your Android mail client open settings and click on Add Account. Enter your mail-address and password and click Continue. The client will now ask what type of Mail account you would like to set up. Again we emphasize using IMAP.This choice is final in Android Mail Client, if you want to change the method you have to delete the mail account and create a new one. Android will now propose some settings for the Incoming Mailserver (the serveraddress will be composed of your method and the mails domain, the username will be the mailname,etc.), yet these are not yet correct. Complete the usernameto your full email address and select Securitytype SSL (accept all certificates) (on port 993). When clicking Continue the client will try out the settings and if correct continue to the outgoing mailserver settings. Again the client will propose some settings such as using the same username and password and again precompose the serveraddress. The only thing left to do is selecting the securitymethod: TLS (accept all certificates) (Port should be 587). On some newer Android Systems (5+) its possible to get repeated “Server not responding” messages if you try SSL (accept all certificates) on the incoming server directly. This can be fixed by using strict SSL once to get a “Certificate not valid” note and Then select SSL (accept all certificates). Same applies for TSL on the outgoing server. + +As accessing your mails with your mobile can be data intensive android mail client offers some additional settings on the next page of the configurator. You can select in what frame of time the mails should be synced with your phone and how often this synchronisation take place (ordinarily and in rush hours). The starting and ending time of your rush hours can be set for all your accounts in the clent properties. On the last page of the configurator you can name the mail account on your phone to better recognize it, and you have to enter the name displayed to an recipient of your mails. + +#### iPhone Mail Client + +Setting up a new Mail account on your iPhone works pretty much like on android device. Visit [1] for more information. + +#### Claws Mail + +The following was tested on my debian-wheezy system with Claws Mail version 3.8.1. + +* Configuration -> Create new account +* Basic: Name of Account: whatever +* Basic: Full name: whatever +* Basic: Mail address: user@domain.com +* Basic: Protocol: IMAP4 +* Basic: Server for receiving: mail.softwarefools.com +* Basic: SMTP server (send): mail.softwarefools.com +* Basic: User ID: user@domain.com +* Basic: Password: secret_password +* Receive: Authentication method: LOGIN +* Send: SMTP Authentication (SMTP AUTH): LOGIN +* SSL: IMAP4: Use SSL for IMAP4 connection +* SSL: Send (SMTP): Use STARTTLS command to start SSL session + +It might be necessery to rebuild your folder-tree: proceed as follows: + +* Right mouse-click on account main-folder -> +* Rebuild folder tree -> +* YES + +#### Mutt + +Ideally mutt will serve only the purpose of a MUA, outsourcing the retrieval of emails to a MRA (e.g. fechmail) and the relaying of emails to a MTA (e.g. postfix). Configuration is trivial in that case. Adapt your .muttrc as follows: + + set spoolfile=/var/mai/username + +You can also access your imap mails directly from within mutt: + + set imap_user=user@domain.com + set imap_pass=secret_password + set spoolfile=imaps://mail.softwarefools.com/INBOX + +#### Fetchmail + +For the simplest configuration of fetchmail as your MRA, add the following line to your .fetchmailrc (adapt user@domain.com, secret_password and local_username): + + poll mail.softwarefools.com protocol IMAP user "user@domain.com" there with password "secret_password" is local_username here ssl sslfingerprint '02:B0:72:78:F7:F1:28:40:C4:DB:37:3F:18:BB:E1:AF' fetchall + +#### Postfix + +In many scenarios it is recommended to use a seperate MTA (e.g. postfix) to relay your outgoing emails to remote hosts. If you decide to use postfix read on here: http://www.postfix.org/ + + diff --git a/080_blog/00010_Old-And-Outdated/index.md b/080_blog/00010_Old-And-Outdated/index.md new file mode 100644 index 0000000..3055918 --- /dev/null +++ b/080_blog/00010_Old-And-Outdated/index.md @@ -0,0 +1,5 @@ +Old and Outdated +================ + +Here you can find some some old and outdtdated articles, please do not read them. +They are kept here only for historical reference reasons. diff --git a/080_blog/00013_Old-Software-Fools-Mediawiki-Content/index.md b/080_blog/00013_Old-Software-Fools-Mediawiki-Content/index.md new file mode 100644 index 0000000..cb6581f --- /dev/null +++ b/080_blog/00013_Old-Software-Fools-Mediawiki-Content/index.md @@ -0,0 +1,391 @@ +Fool’s Wiki Knowledge +===================== + + February 24, 2016 + +Migrated from our former Mediawiki: + +Welcome to the Foolo-Pedia! Foolo-Pedia is a growing collection of interesting, important, ridiculous or useless information gathered and refined by the SoftwareFools team for all Friends of Fools. We decided to mainly keep this Wiki in english to be compatible with all our costumers and friends. Some destinct pages maybe in polish, german or klingon. + +Articles which might be of universal interest, divided by area and topic. + +## Minilinux + + software fools minimal linux + + 1. usb stick + 2. create one big partition (2gb) + 3. mkefs.ext4 /dev/sdx1 + 4. mount /dev/sdx1 /mnt + 5. compile kernel + 6. cp bzImage /mnt + 7. boot + + 8. + grub> search /bzImage + grub> linux /bzImage root=?? + + PROBLEMS WITH kernel config! + +## Kernel Building + + cd linux-source-[xxx] + make mrproper + cp someconfig .config -i + make oldconfig + make menuconfig + make localmodconfig + make localyesconfig + make + (OPT) make modules + su + make install + (OPT) make modules_install + (OPT) update-intiramfs -c -k [kernel-postfix] + + (REMOVE UNWANTED FILES FROM BOOT!) + update-grub + grub-install /dev/sda + reboot + +## GDB + + http://www.cprogramming.com/debuggers.html + + use gcc or clang with : -ggdb -O0 + + h - help + + r - run + c - continue + n - next + s - step + + b - break <line> + p - print <var> + + wa - watch <var> + + bt + frame <number> + list + info locals + + set <var> = <value> + set substitute-path FROM TO + + call <func> + +## clang + + http://llvm.org/releases/3.7.0/docs/CMake.html + http://clang.llvm.org/get_started.html + put MAKEFLAGS="-j8" or similar in front of your CMake invocations. + + extracted llvm to ~/temp/clang/llvm-3.7.0.src/ + extracted clang to ~/temp/clang/llvm-3.7.0.src/tools/clang/ + extracted compiler-rt to ~/temp/clang/llvm-3.7.0.src/projects/compiler-rt + extracted libcxx to ~/temp/clang/llvm-3.7.0.src/projects/libcxx + + $ cd ~/temp/clang/llvm-3.7.0-build + $ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/miguel/opt/llvm-3.7.0 ../llvm-3.7.0.src + $ cmake --build . + $ cmake --build . --target install + +## XMPP + +### Idea + +Today I figured out, once again, that there are many open-source and free (as in freedom) alternatives to all those chat clients and their proprietary protocols, which we dislike and want to avoid. Taking it seriously I decided to set up a XMPP Server on our Softwarefools Server (http://www.softwarefools.com) to finally enable secure and comfortable communication between me, myself and my fellow peers. + +### Starting Point + +* We have a Debian Virtual Private Server (VPS) Running wheezy (stable) +* I just found that tutorial: http://wiki.linuxwall.info/doku.php/en:ressources:articles:ejabberd + +### I. get package + + # apt-get install ejabberd + +### II. adapt config + +In /etc/ejabberd/ejabberd.cfg adapt the hosts line as that: (if you wonder this is Erlang) + + %% Hostname + {hosts, ["softwarefools.com"]}. + +### III. setup certificate + + # mkdir /etc/ejabberd/certs + +For now we skip the rest of that step and proceed with the self-signed certificate provided by Debian. (/etc/ejabberd/ejabberd.pem) + +### IV. restart server + + # /etc/init.d/ejabberd restart + +### V. create user + + # ejabberdctl register miguel softwarefools.com 'pass123' + # ejabberdctl register niki softwarefools.com 'pass321' + +### VI. open ports + + # iptables -I INPUT -p tcp --dport 5222 -j ACCEPT + # iptables -I INPUT -p tcp --dport 5269 -j ACCEPT + +TODO: in fact we need more here! + +### VII. connect with client + +* Get Pidgin http://www.pidgin.im/ +* Connect & Enjoy  + +### Further Work +* certificate +* dns configuration – should provide xmpp info (? + + +## Benchmark + +### Tools for Stress Testing your RIG + + May 12, 2017 + + Some nice tools to stress-test your computer: + + CPU: Prime95 + GPU: FurMark + RAM: MemTest86+ + HDD/SSD: S.M.A.R.T + + Ref: http://www.pcworld.com/article/2028882/keep-it-stable-stupid-how-to-stress-test-your-pc-hardware.html + +### Networking + + 1. Connected my [laptop] and [desktop] via 5meter cat5e cable -> 1000mbit full duplex link + 2. created ~1.5G ramdisks with tmpfs on each. + 3. created a 1 giga file with data from /dev/urandom on [desktop] + 4. copied file with scp from [desktop] to [laptop] + 5. copied file with scp from [laptop] to [desktop] + 6. repeated 4 & 5 10 times : average speed ~70+MB/s from desk & 80+MB/s to desk, link stays up all the time. ping around 0.2-0.3ms + 7. repeated 1-6 with my other 3meter ethernet cable. + 8. tried both direction simultanously which gave a total data throughput even over 100MB/s + +### Hard Disk + +To get some information about the disk run: + +Request identification info directly from the drive, which is displayed in a new expanded format with considerably more detail than with the older -i option. + + $ hdparm -I /dev/sda + +Timings + + $ hdparm -tT /dev/sda + +Clear Cache + + $ echo 3 > /proc/sys/vm/drop_caches + +I am using this block-size and count which results in ~2GB: + + $ dd [...] bs=1048576 count=2048 + +READ: + + $ dd if=test of=/dev/null + $ dd if=/dev/sdX of=/dev/null + +WRTIE: + + $ dd if=/dev/zero of=test + $ dd if=/dev/zero of=/dev/sdX + +smartmontools: + + seatage: + Raw_Read_Error_Rate + Seek_Error_Rate + + example: + % python + >>> 200009354607 & 0xFFFFFFFF + 2440858991 <---- total number + >>> (200009354607 & 0xFFFF00000000) >> 32 + 46 <--- number of errors + +## Fixing HDD after Free Falling + +So you also dropped your hard-disk and some of your secotrs got damaged, +probably by the head hitting the platter? The following short text outlines, +how I approached fixing my disk after it hit the floor. Of course I would +not rely on this disk for mission critical data anymore, but it +might serve as a scratch/temporarily/redundant space. + +Backup all your data in advance because the disk will almost certainly +require reformatting and repartitoning after follwing this procedure! + +Some Tools/Programms I used: + +* smartctl +* hdparm +* grep + +### smartctl + +Try from fastest to slowest to find faulty sector: replace LBAi\_START,LBA\_END with meaningful values. + + smartctl -t [long|conveyence|short|select,LBA_START-LBA_END] -C /dev/sda + +The following did not work for me. Resulted in ‘interrupted by host’ for some reason. +Probably the disks goes to sleep or something. Issueing some read operations every minute might fix this(?) + + -C to run test in foreground mode! + +### hdparm + +You can bi-search via –read-sector if complete ranges are affected (As in my case) and then fix them in one step: + + for i in {36312851..36312886}; do hdparm --write-sector $i /dev/sda; done + +### Example + +Exemplary session fixing one sector: + +**WARNING: this will destroy your data !** + + 1) # smartctl -a /dev/sda | egrep 'Pend|Real|Offline_Unc' + + 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 4 + 197 Current_Pending_Sector 0x0012 098 098 000 Old_age Always - 47 + 198 Offline_Uncorrectable 0x0010 098 098 000 Old_age Offline - 47 + + 2) # smartctl -t short /dev/sda + + 3) # smartctl -l selftest /dev/sda + + [...] 1 Short offline Completed: read failure 90% 10632 152076520 + + 4) # hdparm --read-sector 152076520 /dev/sda # verification + + [...] reading sector 152076520: FAILED: Input/output error + + 5) # hdparm --write-sector 152076520 /dev/sda + + 6) # smartctl -a /dev/sda | egrep 'Pend|Real|Offline_Unc' + + 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 4 + 197 Current_Pending_Sector 0x0012 098 098 000 Old_age Always - 46 + 198 Offline_Uncorrectable 0x0010 098 098 000 Old_age Offline - 46 + +## Raid and LVM + + + Also refer to: http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/foreward.html + + Here I will write down some of my considarations about setting up a RAID + and LVM. + + We want to get a performance boost and minimize the ssd wear-out. + Also we will not put there any mission-critical files, because the content + of the ssd will not be mirrored. beside regular backups of course. + We also need to take the limited diskspace into account. + while our hdd’s are 2*2TB we only have a single 250MB sdd. + + So we will be looking at files that are: + + * not updated very often + * read often + * not critical if they get lost. + * not too huge + + So I consider for my usecase + * /bin + * /sbin + * /boot + * /lib{,32,64} + + * /usr (without /usr/local) + + That directories will reside on our raid1 since they contain important files: + * /home/miguel + * /root + * /opt + * /usr/local + + Finally we will mount the following things in ram for superfast and temporary space: + + * /tmp + * /var/log (unless you care about logs) + + What about that directories? + consider speed vs. security vs. drive wear-out + + * /etc + * /var + + Never mount swap on your ssd! + + == extending logical volume and fs == + * https://wiki.archlinux.org/index.php/LVM + + # lvextend -L +20G VolGroup00/lvolhome + + resize fs (ext2, ext3 or ext4) + for ext4 this can be done even without unmounting the device + + # resize2fs /dev// + +## Some RAID Problems on my old Desktop + + https://www.thomas-krenn.com/en/wiki/Mdadm_checkarray + https://plone.lucidsolutions.co.nz/linux/io/ssd-on-nvidia-sata-port-generates-error-eh-in-swncq-mode-and-failed-command-read-fpdma-queued/view + https://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array + + Kernel options: sata_nv.swncq=0 + + [ 8625.896029] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen + [ 8625.896035] ata5.00: failed command: WRITE DMA EXT + [ 8625.896040] ata5.00: cmd 35/00:08:50:06:b0/00:00:13:00:00/e0 tag 0 dma 4096 out + res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout) + [ 8625.896043] ata5.00: status: { DRDY } + [ 8625.896048] ata5: hard resetting link + [ 8625.896050] ata5: nv: skipping hardreset on occupied port + [ 8626.364038] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) + [ 8631.372026] ata5.00: qc timeout (cmd 0x27) + [ 8631.372031] ata5.00: failed to read native max address (err_mask=0x4) + [ 8631.372033] ata5.00: HPA support seems broken, skipping HPA handling + [ 8631.372035] ata5.00: revalidation failed (errno=-5) + [ 8631.372042] ata5: hard resetting link + [ 8631.372044] ata5: nv: skipping hardreset on occupied port + [ 8631.840045] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) + [ 8631.864140] ata5.00: configured for UDMA/133 + [ 8631.864146] ata5.00: device reported invalid CHS sector 0 + [ 8631.864154] ata5: EH complete + [ 8662.888029] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen + [ 8662.888036] ata5.00: failed command: WRITE DMA EXT + [ 8662.888041] ata5.00: cmd 35/00:08:50:06:b0/00:00:13:00:00/e0 tag 0 dma 4096 out + res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout) + [ 8662.888043] ata5.00: status: { DRDY } + [ 8662.888049] ata5: hard resetting link + [ 8662.888051] ata5: nv: skipping hardreset on occupied port + [ 8663.356038] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) + [ 8663.396135] ata5.00: configured for UDMA/133 + [ 8663.396141] ata5.00: device reported invalid CHS sector 0 + [ 8663.396151] ata5: EH complete + [ 8693.864031] ata5.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen + [ 8693.864038] ata5.00: failed command: WRITE DMA EXT + [ 8693.864043] ata5.00: cmd 35/00:08:50:06:b0/00:00:13:00:00/e0 tag 0 dma 4096 out + res 40/00:00:00:4f:c2/00:00:00:00:00/40 Emask 0x4 (timeout) + [ 8693.864045] ata5.00: status: { DRDY } + [ 8693.864051] ata5: hard resetting link + [ 8693.864052] ata5: nv: skipping hardreset on occupied port + [ 8694.332036] ata5: SATA link up 3.0 Gbps (SStatus 123 SControl 300) + [ 8694.356134] ata5.00: configured for UDMA/133 + [ 8694.356141] ata5.00: device reported invalid CHS sector 0 + [ 8694.356150] ata5: EH complete + [ 8724.840030] ata5: limiting SATA link speed to 1.5 Gbps + + + diff --git a/080_blog/00015_Miscellanous/index.md b/080_blog/00015_Miscellanous/index.md new file mode 100644 index 0000000..eaaba3a --- /dev/null +++ b/080_blog/00015_Miscellanous/index.md @@ -0,0 +1,475 @@ +Miscellanous Notes +================== + +A collection of short notes on things I wish to remember. Many topics are heavily outdated. + +Backing up and Restoring Docker Volumes +--------------------------------------- + + July 3, 2017 + +One of my first questions, when starting my docker experience was +how to backup and restore docker volumes. + +### On the source host + +First of all identify your volumes: + + $ docker ps + $ docker inspect my_container_name | grep -C 1 -i Source + +Now you can backup the directory to a tar on your host machine: + + $ docker run –rm –volumes-from my_container_name -v $(pwd):/backup ubuntu tar cvf /backup/backup_db.tar /var/lib/mysql + +### On the target host + +In order to securely copy and restore the volume on the target host one can run: + + $ scp source_host:~/backup_db.tar . + $ docker run –rm –volumes-frommy_container_name -v $(pwd):/backup ubuntu bash -c “cd /var/lib/mysql && tar xvf /backup/backup_db.tar –strip 1″ + +A Growing Collection of Linux Command Line One-Liners +------------------------------------------------------ + +Please believe me... this collection was really supposed to grow over time... + +inside a direcotry show disk usage of all hidden files and directories and sort by size: + + $ du $(ls .* -d | tail -n +3) -hs |sort -h + +inside a direcotry show disk usage of all files and directories (also hidden) and sort by size. +Exclude ./DATA file. + + $ du . -a -d 1 -h –exclude=’./DATA’ | sort -h + +Tar all files in current directory, excluding ./DATA and ./.cache + + $ tar –exclude=’./.cache’ –exclude=’./DATA’ -cvf home_miguel_20180216.tar . + +Find files in ./ARCHIVE NOT belonging to a specific user: miguel + + $ find ARCHIVE/ \! -user miguel + +set folder/ permissions to Read/Browse only for owner recursively + + $ sudo chmod -R u=r,g=,o= folder/ + $ chmod -R u=rX,g=,o= folder/ + +find all mails from Boban when in the maildir full of mailboxes and print only short headers without bodies: + + $ grepmail -H -B -Y ‘(^TO:|^From:)’ Boban * + +not really a one-lier but will print 256 colors in a bash: + + for i in {0..255} ; do + printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i" + if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then + printf "\n"; + fi + done + +Some Tools of Choice +-------------------- + +### Systems + +* joomla +* redaxo +* typo3 +* wordpress +* mediawiki + +* oscommerce +* opencart + +* owncloud +* alfresco +* mantis + +* piwik / matomo +* loganalyzer +* goaccess +* nagios / icinga + +### Servers + +* apache +* nginx + +* mariadb / mysql +* postfix +* postgis + +* geoserver + +<!-- +## Tools / Servers + openlayers + git / gitweb / stagit / gitolite + xmpp + mumble + docker / registry + kvm + kubernetes + postfix/dovecot / rouncube/postfixadmin + symfony + bootstrap + webGL + websockets + ajax + node/angular + jmeter + ceph +--> + +Compilation Notes +----------------- + +### build your own webkit + + March 14, 2018 + +Let’s compile a release with debug info and install to /usr/local + +~~~~~~ {.bash} +wget https://webkitgtk.org/releases/webkitgtk-2.20.0.tar.xz +tar -xvf webkitgtk-2.20.0.tar.xz +cd webkitgtk-2.20.0 +# install all the libs that will be reported missing in the next step. +# I could not find the woff2 stuff in debian so skipped it... +cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_WOFF2=NO -GNinja +# this takes about 30minutes on my i7-4790K .. zzzzz..zzz +ninja +sudo ninja install +~~~~~~~~~~~ + + pkg-config + + pkg-config uses our new build now: + + [1] https://trac.webkit.org/wiki/BuildingGtk + [2] https://webkitgtk.org/ + +### Build and Install GCC + + April 27, 2015 + +#### Preparations +Read the prequisites at +[https://gcc.gnu.org/install/prerequisites.html](https://gcc.gnu.org/install/prerequisites.html) +and get (most recent versions at time of this writing) the following: + +* gcc (5.2.0) +* binutils (2.25.1) + +#### Configure and Build + +* unpack binutils-x.y.z +* create a new directory binutils-x.y.z-build and inside it run the following commands: + +~~~~~~ {.bash} + $ ../binutils-x.y.z/configure --disable-nls --with-sysroot --enable-targets=all + $ make -j4 + $ make install +~~~~~~~~~~~~ + +* unpack gcc-x.y.z and run the contrib/download_prerequisites script inside. +* create a new directory: gcc-x.y.z-build and inside it run: + +~~~~~~ {.bash} + $ ../gcc-x.y.z/configure --disable-nls --enable-languages=c,c++ --enable-threads + $ make -j4 + $ make install +~~~~~~~~~~~~ + +#### Reference + [1] binutils and gcc README files. + [2] https://gcc.gnu.org/install/ + [3] http://wiki.osdev.org/Building_GCC + [4] http://stackoverflow.com/questions/1726042/recipe-for-compiling-binutils-gcc-together + +monad transformers in action +---------------------------- + January 1,2018 + + *Main Control.Monad.Writer Control.Monad.State> runState (runWriterT (get >>= \a -> tell ["foo"] >> put (a*a) >> tell ["bar"] >> tell [show a])) 5 + +emscripten +---------- + October 1,2017 + + sdl2 port + https://github.com/juj/emsdk + android-ndk-r15c + + * accomplish build sys with: sdl2+input+audio+opengl+SDL_net+SDL_thread @ linux, win, osx, ios, android, win-phone, steam, rasp + +LUKS container over sshfs +------------------------- + July 5, 2017 + +* enable user\_allow\_other in /etc/fuse.conf +* sshfs -o allow\_root user@server:/BACKUPS/ ~/mnt/ +* dd if=/dev/urandom of=~/mnt/megaloman bs=1M count=512 +* sudo cryptsetup -y luksFormat ~/mnt/megaloman +* sudo cryptsetup luksOpen ~/mnt/megaloman vol1 +* sudo mkfs.ext4 /dev/mapper/vol1 +* sudo mount /dev/mapper/vol1 /mnt +* df -h | grep vol1 +* sudo umount /mnt +* sudo cryptsetup luksClose vol1 +* fusermount -u ~/mnt + +NOTE: backup your data example use : rsync -a –info=progress2 source dist + +some areas of interest +---------------------- + December 20, 2014 + +Some General Topics I am reasearching right now (or plan to do it). Or used to reasearch... + +* Neuronal Networks +* Deep Learning +* Random Forrests (and other techniques based on Decision Trees) +* Simmulated Annealing +* (Linear) Integer Programming + + +Inter Process Communication +--------------------------- + March 14, 2018 + +We can attach nicely to same memory segment from 2 different processes: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c .numberLines} +// ipc via shared mem +// attach to shared memory; +key_t my_ftok = ftok("~/surf-webext-dom-shared-mem",'a'); + +int mem_seg=shmget(my_ftok,1024*1024,IPC_CREAT|0660); +if(mem_seg==-1) +{ +g_print("shmget failed: %s\n",strerror(errno)); +} + +shared_buf=shmat(mem_seg,NULL,0); +if(shared_buf==(void*)-1) +{ +g_print("shmat failed: %s\n",strerror(errno)); +} +g_print("attached to shared memory.\n"); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +SSL Certificate CSR +------------------- + + February 20, 2015 + + for apache ssl mod + + first check your old csr if you like: + $ openssl req -text -noout -verify -in CSR.csr + + 1. generate key + $ openssl genrsa -des3 -out www.yourdomain-example.com.key 2048 + + 2. create CSR + $ openssl req -new -key www.yourdomain-example.com.key -out www.yourdomain-example.com.csr + + refs: + [1] https://search.thawte.com/support/ssl-digital-certificates/index?page=content&id=AR1108&actp=LIST + +Competitive Coding +------------------ + March 17, 2015 + +A small selection of websites, which I visit from time to time, addressing competitive coding. + +* topcoder.com +* codeforces.com +* codility.com +* codersclan.ne +* projecteuler.net +* www.codingame.com (need to check this) +* www.codechef.com (need to check this) +* http://psyho.gg/overview-of-programming-contests/ (and read here) +* https://www.hackerrank.com/ +* http://code.google.com/codejam +* https://www.kaggle.com/ – predicitve modelling +* odesk.com / elance + +Comp Science Literature +----------------------- + March 17, 2015 +This is a list of some books, focusing on topics around computer science, which I recently read or am currently reading or want to read :P + +* Meyers, Effective C++ (Addison-Wesley) C++98 only? +* Meyers, More Effective C++ (Addison-Wesley) C++98 only? +* Meyers, Effective STL. C++98 only? +* Sutter, Exceptional C++ +* Sutter, More Exceptional C++ +* Karlson, Beyond the C++ Standard Library: An Introduction to Boost 1st Edition +* Maybe Something on Multiprocessing (?) +* Donald Knuth. The Art Of Computer Programming +* Algorithms 3rd Edition (by Cormen, Leiserson, Rivest, Stein) +* Jonathan Bartlett. Programming from the Ground Up +* C++ in a Nutshell (O’REILLEY, by Lischner) +* C++ Primer (5th Edition) by Lippman, Lajoie, Moo +* The C++ Programming Language 4th Edition +* Anthony Williams, C++ Concurrency in Action: Practical Multihreading +* Dive into Python (2 and 3) by Mark Pilgrim +* Learn You a Haskell for Great Good by Marian Lipovaca +* Real World Haskell +* Version Control with Git (O’REILLEY, by Loeliger & McCullough) (next: 9(10) ?) +* The Linux Command Line, by William Shotts (http://linuxcommand.org/tlcl.php) +* Debian, The Administrators Handbook (by Hertzog and Mas) +* Absolute FreeBSD by Michael W. Lucas +* Modern Operating Systems, Third Edition (by Andrew S. Tannebaum) +* Linux Device Drivers (O’REILLEY, by Corbert, Rubini, Kroah-Hartman) +* Linux Kernel in a Nutshell (O’REILLEY, Greg Kroah-Hartman) + +* Concrete Math (2nd) +* UPENN cis194 + +* STOC '83 Proceedings of the fifteenth annual ACM symposium on Theory of computing / Primitives for the manipulation of general subdivisions and the computation of Voronoi diagrams + +* http://haskellbook.com/ +* Wadler paper "Monads for Functional Programming" +* simon marlow - book (parallel) +* data 6 - course (Github) +* sedgewick & waynes algorithms +* books from appendix, from programming from ground up? + +VNC +--- + April 2, 2015 + +### Server: + $ apt-get install tightvncserver + $ xtightvncserver -geometry 1900×1100 + $ netstat -tap | grep vnc # remember port (e.g.5901) + +### Client: + $ ssh -L 5901:localhost:5901 you@remote # tunnel + $ xtightvncviewer localhost::5901 # in new terminal + +### Kill Server: + $ vncserver -kill :1 # (or :2 etc..) + +Owncloud Notes +-------------- + +### Mounting Ownclouds DavFS + + April 15, 2015 + + $ apt-get install davfs2 + + * since owncloud seems to have problems with locks, edit /etc/davfs2/davfs2.conf and set use_locks to 0 in order to allow creating files (as well as probably writing) + + $ mount -t davfs https://secure.sf.com/owncloud/remote.php/webdav /mnt/ + +### rescan/rebuild ownlocud files database + + June 22, 2016 + + inside ownlcoud directory run: + sudo -u www-owncloud php console.php files:scan –all + + +LXC +--- + April 28, 2015 + + maybe worth a try: + + apt-get install lxc; lxc create ctname -t download — -d debian -r jessie + -a amd64; lxc-start -d -n ctname, lxc-attach ctname + + similar tools: chroot/ debootsrap + +Add vim Lang +------------ + May 14, 2015 + + $ sudo apt-get install myspell-pl + $ cd /ush/share/hunspell + $ vim + :mkspell pl pl_PL + +What every programmer should know about +--------------------------------------- + November 7, 2015 + + Undefined behaviour: http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html + Memory: http://lwn.net/Articles/250967/ + Floating point arithmetic: https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html + +IDE Comparison +-------------- + + December 7, 2015 + +While I love working with vim (ctags, taglist, etc..) and the command line, it might be worth to have a look at the following IDE’s for Java and/or C++: + +* IntelliJ IDEA +* Eclipse +* Eclipse CDT +* Codeblocks +* Netbeans +* Codelite +* KDevelop + +Setup Postfix +------------- + +We want to handle different domains on a single postfix server and have virtual users along real unix users. For the virtual users we use uid/gid 5000. + +Relevant config files are: + + /etc/postfix/master.cf + /etc/postfix/main.cf + /etc/postfix/smtpd_sender_login_maps (tells which emails belong to which login) + /etc/postfix/vmailbox (sepcifies our VIRTUAL mailboxes and the names of the spoolfiles) + /etc/postfix/virtual (aliases for our local unix users) + /etc/dovecot/users (specifies the logins, passwords, home directories,..) + /etc/dovecot/conf.d/10-mail (set inbox and mailbox dirs) + +Be careful about the permissions of the different folders, so uid/gid 5000, postfix and dovecot can access as relevant. + +A very nice tutorial on setting up postfixadmin can be found here: + + https://lelutin.ca/posts/installing_postfix_-_clamav_-_spamassassin_-_dovecot_-_postfixadmin_on_debian_squeeze/ + +Windows Specific Notes +---------------------- + +### disable hiberfile.sys + + September 7, 2017 + + run cmd.exe as administrator: + powercfg.exe -h off + +### GTA4 on NVIDIA-GTX 980 + + April 17, 2016 + + Add following flags : -nomemrestrict -norestriction + Otherwise video memory is not identified correctly. + +### Civilization 4 BTS Autosaves + + September 23, 2016 + + In the file: C:\Users\miguel\Documents\My Games\Beyond the Sword\CivilizationIV + + Adjust: + + ; The maximum number of autosaves kept in the directory before being deleted. + MaxAutoSaves = 100 + + ; Specify the number of turns between autoSaves. 0 means no autosave. + AutoSaveInterval = 1 + diff --git a/080_blog/00020_About-Software-Fools/index.md b/080_blog/00020_About-Software-Fools/index.md new file mode 100644 index 0000000..394b67e --- /dev/null +++ b/080_blog/00020_About-Software-Fools/index.md @@ -0,0 +1,54 @@ +The Software Fools +================== + +A highly creative team consisting of software & hardware engineers, quantum physicians, data scientists, +cooks, painters, programmers, writers, philosophers, full stack developers, photographers, heavy drinkers, game designers and musicians,... among many others. + +It was formed in 1994 and consist, in it's very core and from the very +beginnings, by it's fouding fathers: Miguel & Nick. + +Most notable part-time members of the SoftwareFools include: Matjas & Juls. + +Some of the old SoftwareFools logos emerged around the turn of the millenium, +probably in the early 2000s: + +{.img-fluid} + +{.img-fluid} + +{.img-fluid} + +{.img-fluid} + +{.img-fluid} + +{.img-fluid} + +The Logo of the glorious Software Fools Tangible Tabletop Division, engaging +successfully in bleeding edge hardware designs: + +{.img-fluid} + +And here antoher one: + +{.img-fluid} + +Interestingly the Division suddenly ceased to exist, on the very verge of its success. + +The logo of the famous Software Fools Mediawiki, base of universal knowledge covering a broad range of topics: + +{.img-fluid} + +The software fools 2bit logo: + +{.img-fluid style="width:380px;'"} + +and some webdesign logos used mainly by nick for branding: + +{.img-fluid} + +{.img-fluid} + + + + diff --git a/080_blog/00025_Open-Source-Gaming-on-Linux/index.md b/080_blog/00025_Open-Source-Gaming-on-Linux/index.md new file mode 100644 index 0000000..38a6311 --- /dev/null +++ b/080_blog/00025_Open-Source-Gaming-on-Linux/index.md @@ -0,0 +1,33 @@ +Open Source Linux Games +======================= + +May 22, 2015 + +Some of my favourite games from the 90ies are reimplemented as open-source software and work natively on Linux. + +## OpenTTD (Transport Tycoon Deluxe) +My beloved Transport Tycoon with many extra features and high resolution graphics. + +{style="width:50%"} + + +## Jagged Alliance 2 (ja2-straciatella) +“No cops, no courts, no jails, no law. You can count me in!” + +{style="width:50%"} + +## ScummVM +Script Creation Utility for Maniac Mansion! This supports a multitude of Lucas Arts (and not only) games. + +{style="width:50%"} + +## OpenRA +Supports a variety of the classical Westwood real-time strategy games. + +{style="width:50%"} + +## More +Check out this external pages for even more games: + + [1] https://wiki.debian.org/Games/ + [2] http://osgameclones.com/ diff --git a/080_blog/00030_The-Hell-of-Autotools/index.md b/080_blog/00030_The-Hell-of-Autotools/index.md new file mode 100644 index 0000000..746bd82 --- /dev/null +++ b/080_blog/00030_The-Hell-of-Autotools/index.md @@ -0,0 +1,74 @@ +The Hell of Autotools +===================== + March 19, 2018 +In this trivial example we compile a custom **webkit2gtk+ extension** with +**autotools**. For a start we need to provide two files, `Makefile.am` +and `configure.ac`, beside our actual `ext.c` source file, which contains +the extension code itself. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c .numberLines} +// File: ext.c // + +#include <webkit2/webkit-web-extension.h> + +G_MODULE_EXPORT void +webkit_web_extension_initialize_with_user_data (WebKitWebExtension *extension, + GVariant *user_data) +{ + g_print("Hello Extension!\n"); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: Makefile.am # + +webextension_LTLIBRARIES = libmyappwebextension.la +webextensiondir = /home/miguel/temp + +WEB_EXTENSION_CFLAGS = `pkg-config --cflags webkit2gtk-web-extension-4.0` +WEB_EXTENSION_LIBS2 = `pkg-config --libs webkit2gtk-web-extension-4.0` + +libmyappwebextension_la_SOURCES = ext.c +libmyappwebextension_la_CFLAGS = $(WEB_EXTENSION_CFLAGS) +libmyappwebextension_la_LIBADD = $(WEB_EXTENSION_LIBS) +libmyappwebextension_la_LDFLAGS = -module -avoid-version -no-undefined $(WEB_EXTENSION_LIBS2) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.makefile .numberLines} +# File: configure.ac # + +AC_PREREQ([2.69]) +AC_INIT(ext,0.1,test@example.com) +AM_INIT_AUTOMAKE +AC_CONFIG_SRCDIR([ext.c]) +AC_PROG_CC +LT_INIT +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Put the above files in a new fresh directory and you are ready to see the +powers of autotools in action. + +Run the following commands on your pash prompt: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +touch NEWS README AUTHORS ChangeLog +aclocal +autoconf +automake --add-missing +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +After this steps, we end up with 18 files in our directory. Finally we +can _configure_, _build_ and _install_ our extension. The following +commands will probably look familiar. Note that the _configure_ step +generates 6 additional files, totaling in **24 files** before the actual +_make_ command is run. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +./configure +make +make install +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +... just to compile one **single C file**. diff --git a/080_blog/00035_Trumpet-in-Blender/index.md b/080_blog/00035_Trumpet-in-Blender/index.md new file mode 100644 index 0000000..e1a9953 --- /dev/null +++ b/080_blog/00035_Trumpet-in-Blender/index.md @@ -0,0 +1,25 @@ +hear the trumpets hear the pipers +================================= + November 9, 2017 +Today morning I was playing with blender’s cycles “material nodes”, the “sub-surf modifier” and the “depth of field” camera setting. + +I modeled a simple trumpet by extruding some cylinders and used the Diffuse and Glossy shaders for the trumpet, as well as a Wave texture for the marble surface. + +**Extruded** and scaled some basic **cylinders** to get a simple (yet unfinished) trumpet: + +{.img-fluid} + +Added **materials**: + +{.img-fluid} + +Added the **subsurf** modifier: + +{.img-fluid} + +Configured **depth of field**: + +{.img-fluid} + +Voila, ... it's alpha and omega's kingdom come. + diff --git a/080_blog/00040_Graham-Scan-(Haskell)/index.md b/080_blog/00040_Graham-Scan-(Haskell)/index.md new file mode 100644 index 0000000..195dbe1 --- /dev/null +++ b/080_blog/00040_Graham-Scan-(Haskell)/index.md @@ -0,0 +1,128 @@ +Haskell – Convex Hull – Graham Scan +=================================== + +December 16, 2017 + +Playing with Convex Hulls (via Graham Scan) and SVG Export in Haskell: + +This is an embedded SVG generated by the Haskell programm below: + +<svg style="background-color:black;border:3px solid green;margin:2px;" width="330" height="330"><circle cx="250.04284841107818" cy="201.75346959836142" r="5" fill="rgb(30,150,112)"></circle> <circle cx="168.06592772450588" cy="111.843758303498" r="5" fill="rgb(30,150,47)"></circle> <circle cx="189.1691117845287" cy="250.13932743386943" r="5" fill="rgb(30,150,107)"></circle> <circle cx="130.9047490592456" cy="253.98605115515113" r="5" fill="rgb(30,150,108)"></circle> <circle cx="133.43531697969132" cy="255.82160214659208" r="5" fill="rgb(30,150,109)"></circle> <circle cx="182.304020607504" cy="105.5457583516454" r="5" fill="rgb(30,150,60)"></circle> <circle cx="251.5850563588106" cy="65.40572671380644" r="5" fill="rgb(30,150,139)"></circle> <circle cx="171.80987991027797" cy="186.35194010383304" r="5" fill="rgb(30,150,37)"></circle> <circle cx="207.80255687618114" cy="132.29096928312123" r="5" fill="rgb(30,150,61)"></circle> <circle cx="195.49409554478555" cy="83.18625335312012" r="5" fill="rgb(30,150,87)"></circle> <circle cx="92.72787404887227" cy="119.1126315578156" r="5" fill="rgb(30,150,76)"></circle> <circle cx="132.01826662198954" cy="259.3032349925243" r="5" fill="rgb(30,150,113)"></circle> <circle cx="254.30961953454" cy="228.57029782885428" r="5" fill="rgb(30,150,131)"></circle> <circle cx="119.4923496517701" cy="224.99714968272923" r="5" fill="rgb(30,150,83)"></circle> <circle cx="104.9029796235115" cy="248.66327951701538" r="5" fill="rgb(30,150,112)"></circle> <circle cx="177.91310266020778" cy="126.62370162491455" r="5" fill="rgb(30,150,38)"></circle> <circle cx="266.34722960770284" cy="187.10030895652505" r="5" fill="rgb(30,150,123)"></circle> <circle cx="198.64979304554535" cy="188.53978156044514" r="5" fill="rgb(30,150,58)"></circle> <circle cx="153.9541873486683" cy="57.38878027501561" r="5" fill="rgb(30,150,103)"></circle> <circle cx="170.63539358861877" cy="176.00651132793615" r="5" fill="rgb(30,150,27)"></circle> <circle cx="28.36356558991553" cy="95.4663889254756" r="5" fill="rgb(30,150,148)"></circle> <circle cx="144.84264545840333" cy="98.7746298856041" r="5" fill="rgb(30,150,60)"></circle> <circle cx="190.22210041855752" cy="135.09803947887505" r="5" fill="rgb(30,150,42)"></circle> <circle cx="182.77513675509647" cy="226.9525049033775" r="5" fill="rgb(30,150,81)"></circle> <circle cx="91.5545715639725" cy="181.77301165017755" r="5" fill="rgb(30,150,73)"></circle> <circle cx="260.52976404909987" cy="126.7650903973776" r="5" fill="rgb(30,150,116)"></circle> <circle cx="199.24706728106065" cy="85.8145677264196" r="5" fill="rgb(30,150,87)"></circle> <circle cx="140.1028394863066" cy="228.94903207761297" r="5" fill="rgb(30,150,80)"></circle> <circle cx="86.45512221013155" cy="142.21354112994936" r="5" fill="rgb(30,150,74)"></circle> <circle cx="104.7684570753781" cy="95.55777241192189" r="5" fill="rgb(30,150,82)"></circle> <circle cx="109.8116912935771" cy="201.82250066393837" r="5" fill="rgb(30,150,69)"></circle> <circle cx="226.2427629753817" cy="260.4928511647599" r="5" fill="rgb(30,150,135)"></circle> <circle cx="207.52854584882476" cy="98.23832427848856" r="5" fill="rgb(30,150,82)"></circle> <circle cx="137.34727138289463" cy="248.54598831387364" r="5" fill="rgb(30,150,101)"></circle> <circle cx="67.6437518548912" cy="235.9987917257608" r="5" fill="rgb(30,150,126)"></circle> <circle cx="146.63935287123562" cy="199.14394352970618" r="5" fill="rgb(30,150,47)"></circle> <circle cx="166.09256427911302" cy="242.83302095042907" r="5" fill="rgb(30,150,94)"></circle> <circle cx="184.35531117256224" cy="161.9097796435418" r="5" fill="rgb(30,150,32)"></circle> <circle cx="135.0509917491549" cy="104.7711158701602" r="5" fill="rgb(30,150,57)"></circle> <circle cx="219.20921008912157" cy="115.18635102633722" r="5" fill="rgb(30,150,80)"></circle> <circle cx="163.3590840337916" cy="68.94091343798308" r="5" fill="rgb(30,150,91)"></circle> <circle cx="106.80531573718335" cy="199.21285711361014" r="5" fill="rgb(30,150,69)"></circle> <circle cx="91.69394054319545" cy="249.00283065566003" r="5" fill="rgb(30,150,120)"></circle> <circle cx="42.69884845673566" cy="208.11969850342197" r="5" fill="rgb(30,150,131)"></circle> <circle cx="150.6236743485051" cy="188.8620474963915" r="5" fill="rgb(30,150,36)"></circle> <circle cx="158.90382633613356" cy="274.07594874616575" r="5" fill="rgb(30,150,126)"></circle> <circle cx="203.43810936607744" cy="240.5130006472947" r="5" fill="rgb(30,150,104)"></circle> <circle cx="90.52909317079552" cy="217.88023089739372" r="5" fill="rgb(30,150,95)"></circle> <circle cx="142.0940864941062" cy="129.52923503909" r="5" fill="rgb(30,150,30)"></circle> <circle cx="183.3037554100898" cy="163.4224683254946" r="5" fill="rgb(30,150,31)"></circle> <circle cx="254.59761377280722" cy="194.8355635900217" r="5" fill="rgb(30,150,113)"></circle> <circle cx="70.01341642229187" cy="145.07162677904222" r="5" fill="rgb(30,150,90)"></circle> <circle cx="245.95274031933198" cy="105.6150023686217" r="5" fill="rgb(30,150,109)"></circle> <circle cx="179.3874489883276" cy="161.3271491454406" r="5" fill="rgb(30,150,26)"></circle> <circle cx="174.8322909478738" cy="98.24413130742855" r="5" fill="rgb(30,150,63)"></circle> <circle cx="76.57661314940059" cy="232.5620695235213" r="5" fill="rgb(30,150,117)"></circle> <circle cx="110.20050744456465" cy="131.53437983901722" r="5" fill="rgb(30,150,53)"></circle> <circle cx="101.02068320616426" cy="147.86628733061426" r="5" fill="rgb(30,150,57)"></circle> <circle cx="165.8572064460344" cy="278.14694842092365" r="5" fill="rgb(30,150,131)"></circle> <circle cx="100.51994290684408" cy="135.00585528086626" r="5" fill="rgb(30,150,61)"></circle> <circle cx="93.82764097353034" cy="129.06320594160917" r="5" fill="rgb(30,150,70)"></circle> <circle cx="253.87187416210415" cy="154.5167254215345" r="5" fill="rgb(30,150,105)"></circle> <circle cx="139.60104049751217" cy="105.10237893042421" r="5" fill="rgb(30,150,55)"></circle> <circle cx="217.63333767494922" cy="82.01911898999408" r="5" fill="rgb(30,150,102)"></circle> <circle cx="155.07651713848244" cy="202.01229698806958" r="5" fill="rgb(30,150,49)"></circle> <circle cx="38.84571396023169" cy="211.71370049299298" r="5" fill="rgb(30,150,137)"></circle> <circle cx="131.35457460373755" cy="229.43649756282707" r="5" fill="rgb(30,150,82)"></circle> <circle cx="101.8811149603446" cy="60.806865650812135" r="5" fill="rgb(30,150,114)"></circle> <circle cx="108.91357375361146" cy="183.38328826229434" r="5" fill="rgb(30,150,57)"></circle> <circle cx="98.29711330271346" cy="109.47482179229984" r="5" fill="rgb(30,150,77)"></circle> <circle cx="172.28688779196867" cy="181.46233752550535" r="5" fill="rgb(30,150,33)"></circle> <circle cx="93.77188129034651" cy="152.09728921642983" r="5" fill="rgb(30,150,65)"></circle> <circle cx="39.16221208499168" cy="220.08715706943792" r="5" fill="rgb(30,150,141)"></circle> <circle cx="82.90283027529738" cy="187.23987823799342" r="5" fill="rgb(30,150,83)"></circle> <circle cx="36.83140136457256" cy="237.10836498299798" r="5" fill="rgb(30,150,152)"></circle> <circle cx="159.04913429058357" cy="193.6137496983329" r="5" fill="rgb(30,150,41)"></circle> <circle cx="149.8458394746179" cy="243.69722670699878" r="5" fill="rgb(30,150,94)"></circle> <circle cx="139.0710264338086" cy="147.9219518871481" r="5" fill="rgb(30,150,18)"></circle> <circle cx="156.87676351678834" cy="196.31621769543472" r="5" fill="rgb(30,150,43)"></circle> <circle cx="76.22813867551673" cy="58.065254250002404" r="5" fill="rgb(30,150,132)"></circle> <circle cx="114.74404579519961" cy="250.4087840946835" r="5" fill="rgb(30,150,110)"></circle> <circle cx="87.15900106326063" cy="148.70527298969148" r="5" fill="rgb(30,150,72)"></circle> <circle cx="26.847893428897535" cy="218.50461482065617" r="5" fill="rgb(30,150,151)"></circle> <circle cx="167.86224317149043" cy="217.21693364547622" r="5" fill="rgb(30,150,67)"></circle> <circle cx="282.75471021838604" cy="222.40422121056434" r="5" fill="rgb(30,150,153)"></circle> <circle cx="113.65929983185622" cy="172.1380647926459" r="5" fill="rgb(30,150,47)"></circle> <circle cx="145.09413645816042" cy="155.25057732001034" r="5" fill="rgb(30,150,10)"></circle> <circle cx="237.53341559112823" cy="129.6627629148239" r="5" fill="rgb(30,150,91)"></circle> <circle cx="204.79599735549814" cy="127.38370156552024" r="5" fill="rgb(30,150,60)"></circle> <circle cx="67.74775493976351" cy="139.97850753416574" r="5" fill="rgb(30,150,94)"></circle> <circle cx="210.31226434244496" cy="247.09502723685614" r="5" fill="rgb(30,150,114)"></circle> <circle cx="138.5101000851674" cy="278.7105427190394" r="5" fill="rgb(30,150,132)"></circle> <circle cx="169.19801602950238" cy="114.05245580753565" r="5" fill="rgb(30,150,46)"></circle> <circle cx="248.30023598811576" cy="139.82948336104496" r="5" fill="rgb(30,150,100)"></circle> <circle cx="84.30932668117279" cy="219.93833030785126" r="5" fill="rgb(30,150,101)"></circle> <circle cx="132.24331417077946" cy="291.2609993001805" r="5" fill="rgb(30,150,146)"></circle> <circle cx="160.94658587409114" cy="77.98657154244181" r="5" fill="rgb(30,150,82)"></circle> <circle cx="189.89599533144758" cy="214.5141658021252" r="5" fill="rgb(30,150,73)"></circle> <circle cx="274.07238032907736" cy="114.61040292334776" r="5" fill="rgb(30,150,133)"></circle> <circle cx="173.4334175877005" cy="142.41875279561097" r="5" fill="rgb(30,150,23)"></circle> <circle cx="81.59666952240286" cy="157.09683628233245" r="5" fill="rgb(30,150,78)"></circle> <circle cx="113.74263460749069" cy="245.6984634962466" r="5" fill="rgb(30,150,105)"></circle> <circle cx="128.62844736870682" cy="89.1045872570648" r="5" fill="rgb(30,150,75)"></circle> <circle cx="117.09080103183433" cy="256.3606817576775" r="5" fill="rgb(30,150,114)"></circle> <circle cx="107.0510464556047" cy="63.6364881544602" r="5" fill="rgb(30,150,109)"></circle> <circle cx="146.06063748335822" cy="155.5476601817892" r="5" fill="rgb(30,150,9)"></circle> <circle cx="19.797156728201166" cy="208.00327375672293" r="5" fill="rgb(30,150,154)"></circle> <circle cx="224.6871261564196" cy="59.32941538253692" r="5" fill="rgb(30,150,125)"></circle> <circle cx="18.330634507062157" cy="169.68512490920642" r="5" fill="rgb(30,150,146)"></circle> <circle cx="117.71877593737015" cy="157.71566996945785" r="5" fill="rgb(30,150,39)"></circle> <circle cx="150.90744004872494" cy="125.69996651911103" r="5" fill="rgb(30,150,31)"></circle> <circle cx="172.0555296451493" cy="147.95967101995438" r="5" fill="rgb(30,150,19)"></circle> <circle cx="211.71510600782037" cy="168.6836805807738" r="5" fill="rgb(30,150,61)"></circle> <circle cx="60.24756518573737" cy="246.71025625213787" r="5" fill="rgb(30,150,140)"></circle> <circle cx="103.23366497661333" cy="219.01237316076927" r="5" fill="rgb(30,150,87)"></circle> <circle cx="273.7017283881007" cy="172.2120764305319" r="5" fill="rgb(30,150,127)"></circle> <circle cx="97.80303649638779" cy="204.85716575700624" r="5" fill="rgb(30,150,80)"></circle> <circle cx="221.46148887605563" cy="164.77249284618293" r="5" fill="rgb(30,150,71)"></circle> <circle cx="50.524491137739275" cy="89.6937642622213" r="5" fill="rgb(30,150,130)"></circle> <circle cx="204.0380699117014" cy="37.35498291700646" r="5" fill="rgb(30,150,135)"></circle> <circle cx="143.40838746301495" cy="259.3899906185589" r="5" fill="rgb(30,150,111)"></circle> <circle cx="266.77265013944714" cy="123.56187324575204" r="5" fill="rgb(30,150,123)"></circle> <circle cx="121.09007007148857" cy="87.19247610877495" r="5" fill="rgb(30,150,80)"></circle> <circle cx="80.22930186274945" cy="70.1701303865456" r="5" fill="rgb(30,150,120)"></circle> <circle cx="180.45553719901778" cy="175.95293706048568" r="5" fill="rgb(30,150,35)"></circle> <circle cx="222.7506070445607" cy="80.61735797855984" r="5" fill="rgb(30,150,106)"></circle> <circle cx="158.2801305209321" cy="168.2844490594726" r="5" fill="rgb(30,150,14)"></circle> <circle cx="209.07427850176043" cy="146.00598552038022" r="5" fill="rgb(30,150,58)"></circle> <circle cx="181.8649175345449" cy="96.87537796898624" r="5" fill="rgb(30,150,68)"></circle> <circle cx="57.818033309206335" cy="94.70613646665379" r="5" fill="rgb(30,150,121)"></circle> <circle cx="120.75849455577627" cy="136.86343872502906" r="5" fill="rgb(30,150,41)"></circle> <circle cx="238.4042177525126" cy="214.12837089906836" r="5" fill="rgb(30,150,108)"></circle> <circle cx="134.82175169469224" cy="282.8625044224542" r="5" fill="rgb(30,150,137)"></circle> <circle cx="124.37897828966902" cy="141.19895073915285" r="5" fill="rgb(30,150,35)"></circle> <circle cx="71.30829640124736" cy="228.6244751809119" r="5" fill="rgb(30,150,118)"></circle> <circle cx="202.8966932024821" cy="175.5553271682116" r="5" fill="rgb(30,150,55)"></circle> <circle cx="112.28137080688083" cy="198.61669563281163" r="5" fill="rgb(30,150,64)"></circle> <circle cx="230.79728693422757" cy="72.90445718027976" r="5" fill="rgb(30,150,118)"></circle> <circle cx="158.79949910260785" cy="182.82233984968175" r="5" fill="rgb(30,150,29)"></circle> <circle cx="58.56877652829822" cy="147.81482668362486" r="5" fill="rgb(30,150,102)"></circle> <circle cx="188.43313680897649" cy="169.0946893542551" r="5" fill="rgb(30,150,38)"></circle> <circle cx="183.18362562517675" cy="146.11507672367435" r="5" fill="rgb(30,150,31)"></circle> <circle cx="256.71894488922624" cy="172.26799561066733" r="5" fill="rgb(30,150,109)"></circle> <circle cx="245.03698870042268" cy="103.65831068003733" r="5" fill="rgb(30,150,110)"></circle> <circle cx="50.70099080152846" cy="87.39565736040664" r="5" fill="rgb(30,150,132)"></circle> <circle cx="130.64433518067872" cy="28.1630727673696" r="5" fill="rgb(30,150,137)"></circle> <circle cx="94.56724747823085" cy="150.4574267806313" r="5" fill="rgb(30,150,64)"></circle> <circle cx="67.04524904809107" cy="53.02953597638252" r="5" fill="rgb(30,150,143)"></circle> <circle cx="78.62648151898244" cy="81.82623533931174" r="5" fill="rgb(30,150,112)"></circle> <circle cx="161.15153490662175" cy="96.99587052613042" r="5" fill="rgb(30,150,61)"></circle> <circle cx="245.67175110458567" cy="217.1949486286303" r="5" fill="rgb(30,150,116)"></circle> <circle cx="157.1543105644771" cy="197.82600606935443" r="5" fill="rgb(30,150,45)"></circle> <circle cx="277.47686405127035" cy="159.7874794173272" r="5" fill="rgb(30,150,130)"></circle> <circle cx="233.345787687867" cy="166.3550830285023" r="5" fill="rgb(30,150,84)"></circle> <circle cx="117.83415920099087" cy="164.15103726228338" r="5" fill="rgb(30,150,40)"></circle> <circle cx="120.13909214312396" cy="172.46043638719644" r="5" fill="rgb(30,150,41)"></circle> <circle cx="205.5110421762653" cy="72.98191491764617" r="5" fill="rgb(30,150,102)"></circle> <circle cx="96.80163765991092" cy="62.92764545891779" r="5" fill="rgb(30,150,115)"></circle> <circle cx="124.88959943706861" cy="225.15044973370053" r="5" fill="rgb(30,150,81)"></circle> <circle cx="164.15746228129717" cy="208.86982033897232" r="5" fill="rgb(30,150,58)"></circle> <circle cx="61.99262838338286" cy="146.89828049656404" r="5" fill="rgb(30,150,99)"></circle> <circle cx="172.85767813829926" cy="78.87359339217413" r="5" fill="rgb(30,150,83)"></circle> <circle cx="253.24460591758893" cy="78.41050145160236" r="5" fill="rgb(30,150,132)"></circle> <circle cx="118.82587572803565" cy="135.954087178179" r="5" fill="rgb(30,150,43)"></circle> <circle cx="98.37373962332532" cy="154.76680314997353" r="5" fill="rgb(30,150,60)"></circle> <circle cx="122.31937398668295" cy="165.877836976854" r="5" fill="rgb(30,150,36)"></circle> <circle cx="149.9286260021866" cy="46.27747926759328" r="5" fill="rgb(30,150,115)"></circle> <circle cx="150.6188359447945" cy="196.58148153111807" r="5" fill="rgb(30,150,44)"></circle> <circle cx="96.17812624734673" cy="29.840537240648665" r="5" fill="rgb(30,150,146)"></circle> <circle cx="128.59108692837646" cy="194.72588208165476" r="5" fill="rgb(30,150,50)"></circle> <circle cx="38.82122769921369" cy="75.5662312500352" r="5" fill="rgb(30,150,149)"></circle> <circle cx="79.94903569579193" cy="186.85152375858772" r="5" fill="rgb(30,150,86)"></circle> <circle cx="204.77448960563186" cy="203.64418479165812" r="5" fill="rgb(30,150,73)"></circle> <circle cx="102.88584275265274" cy="197.78063641998918" r="5" fill="rgb(30,150,71)"></circle> <circle cx="159.65478381235536" cy="151.46210092241446" r="5" fill="rgb(30,150,6)"></circle> <circle cx="134.10239921221842" cy="161.49132008992956" r="5" fill="rgb(30,150,23)"></circle> <circle cx="139.09958643074796" cy="219.08371036054947" r="5" fill="rgb(30,150,70)"></circle> <circle cx="146.567509740401" cy="147.39910865707066" r="5" fill="rgb(30,150,12)"></circle> <circle cx="131.83426320463218" cy="162.48898240420658" r="5" fill="rgb(30,150,25)"></circle> <circle cx="173.79168328304365" cy="42.17798379123914" r="5" fill="rgb(30,150,121)"></circle> <circle cx="109.95961714856101" cy="176.03754103367197" r="5" fill="rgb(30,150,52)"></circle> <circle cx="193.05669580827944" cy="188.37810635692216" r="5" fill="rgb(30,150,53)"></circle> <circle cx="104.13084921683644" cy="251.78865585330408" r="5" fill="rgb(30,150,116)"></circle> <circle cx="151.87833723048243" cy="141.41758941633188" r="5" fill="rgb(30,150,14)"></circle> <circle cx="170.37984822769394" cy="82.74727274516178" r="5" fill="rgb(30,150,78)"></circle> <circle cx="269.0943849070194" cy="126.07704256534687" r="5" fill="rgb(30,150,125)"></circle> <circle cx="125.65122538235366" cy="91.64498546299714" r="5" fill="rgb(30,150,74)"></circle> <circle cx="197.53172426918525" cy="128.69408459081865" r="5" fill="rgb(30,150,53)"></circle> <circle cx="174.6642667835747" cy="158.9818125733492" r="5" fill="rgb(30,150,21)"></circle> <circle cx="24.442195159380894" cy="149.95618131450235" r="5" fill="rgb(30,150,138)"></circle> <circle cx="230.57251917564554" cy="160.3740796367529" r="5" fill="rgb(30,150,80)"></circle> <circle cx="116.98152224764455" cy="119.15376321927269" r="5" fill="rgb(30,150,55)"></circle> <circle cx="76.56308571870836" cy="116.27351644357717" r="5" fill="rgb(30,150,92)"></circle> <circle cx="114.18131147378502" cy="228.83119145309104" r="5" fill="rgb(30,150,89)"></circle> <circle cx="61.43526198061147" cy="189.2999144311051" r="5" fill="rgb(30,150,105)"></circle> <circle cx="47.159274262692136" cy="232.7974361297379" r="5" fill="rgb(30,150,141)"></circle> <circle cx="182.3516235175878" cy="147.2513501676052" r="5" fill="rgb(30,150,30)"></circle> <circle cx="212.65566528240188" cy="106.8365872143227" r="5" fill="rgb(30,150,79)"></circle> <circle cx="103.57241974005441" cy="244.94215489038754" r="5" fill="rgb(30,150,110)"></circle> <circle cx="118.74222089776532" cy="72.89123743199185" r="5" fill="rgb(30,150,95)"></circle> <circle cx="249.90029463264338" cy="210.31306906279752" r="5" fill="rgb(30,150,116)"></circle> <circle cx="138.08211482254237" cy="201.93298825621986" r="5" fill="rgb(30,150,53)"></circle> <circle cx="99.45732504409123" cy="125.68120399343496" r="5" fill="rgb(30,150,66)"></circle> <circle cx="95.25417908245312" cy="199.8722971385956" r="5" fill="rgb(30,150,79)"></circle> <circle cx="173.5225523778074" cy="183.25325411366197" r="5" fill="rgb(30,150,35)"></circle> <circle cx="161.10556608174647" cy="287.6615940190875" r="5" fill="rgb(30,150,141)"></circle> <circle cx="99.12828988863924" cy="192.5533080036565" r="5" fill="rgb(30,150,71)"></circle> <circle cx="138.3352868758438" cy="198.47497165114282" r="5" fill="rgb(30,150,49)"></circle> <circle cx="193.78642259086737" cy="131.00758347474238" r="5" fill="rgb(30,150,48)"></circle> <circle cx="232.588767217581" cy="166.3351798078713" r="5" fill="rgb(30,150,83)"></circle> <circle cx="39.31251655429242" cy="177.08833200695184" r="5" fill="rgb(30,150,125)"></circle> <circle cx="185.95704286695798" cy="177.33472005753862" r="5" fill="rgb(30,150,40)"></circle> <circle cx="147.90048340005285" cy="71.10204540244274" r="5" fill="rgb(30,150,89)"></circle> <circle cx="166.8845546562491" cy="172.74666158680589" r="5" fill="rgb(30,150,22)"></circle> <circle cx="277.6246746037615" cy="90.30367358125177" r="5" fill="rgb(30,150,147)"></circle> <circle cx="163.7772455221003" cy="119.59515393163443" r="5" fill="rgb(30,150,38)"></circle> <circle cx="100.8084390756384" cy="179.4519113235002" r="5" fill="rgb(30,150,63)"></circle> <circle cx="232.797670719027" cy="208.95839448193917" r="5" fill="rgb(30,150,100)"></circle> <circle cx="116.20169369192108" cy="215.30258202242675" r="5" fill="rgb(30,150,76)"></circle> <circle cx="129.14679183749018" cy="162.7114418319233" r="5" fill="rgb(30,150,28)"></circle> <circle cx="172.21836963279975" cy="53.36276325209766" r="5" fill="rgb(30,150,109)"></circle> <circle cx="122.18074560789485" cy="31.35034324083615" r="5" fill="rgb(30,150,135)"></circle> <circle cx="234.92525075624567" cy="197.12521379760366" r="5" fill="rgb(30,150,95)"></circle> <circle cx="287.55861698920245" cy="191.54124064684203" r="5" fill="rgb(30,150,146)"></circle> <circle cx="208.95996913096113" cy="86.31885888350531" r="5" fill="rgb(30,150,92)"></circle> <circle cx="117.94515643676408" cy="125.74735207871876" r="5" fill="rgb(30,150,50)"></circle> <circle cx="97.65527429491222" cy="84.40941345270775" r="5" fill="rgb(30,150,96)"></circle> <circle cx="148.98989317857215" cy="107.68365082202222" r="5" fill="rgb(30,150,50)"></circle> <circle cx="83.80736835288073" cy="136.33946071934116" r="5" fill="rgb(30,150,78)"></circle> <circle cx="199.93779378476336" cy="138.9591143291108" r="5" fill="rgb(30,150,50)"></circle> <circle cx="158.33576748574276" cy="205.38810908810458" r="5" fill="rgb(30,150,53)"></circle> <circle cx="157.50068512278443" cy="189.02964217352948" r="5" fill="rgb(30,150,36)"></circle> <circle cx="153.9943950342934" cy="149.63839051508984" r="5" fill="rgb(30,150,5)"></circle> <circle cx="227.12941615549062" cy="152.9883523085731" r="5" fill="rgb(30,150,76)"></circle> <circle cx="206.6719685811751" cy="116.71508779989065" r="5" fill="rgb(30,150,68)"></circle> <circle cx="148.85052880252837" cy="109.67806598750374" r="5" fill="rgb(30,150,48)"></circle> <circle cx="226.66377000731163" cy="61.32427435125567" r="5" fill="rgb(30,150,125)"></circle> <circle cx="66.10772769569768" cy="110.10357863882781" r="5" fill="rgb(30,150,105)"></circle> <circle cx="152.27636978490196" cy="114.5539300162203" r="5" fill="rgb(30,150,43)"></circle> <circle cx="135.56796817958528" cy="127.40915255930368" r="5" fill="rgb(30,150,35)"></circle> <circle cx="195.72769880316034" cy="203.4027436123629" r="5" fill="rgb(30,150,67)"></circle> <circle cx="130.7530263067129" cy="244.7852266812409" r="5" fill="rgb(30,150,98)"></circle> <circle cx="36.438341384815075" cy="210.6090541896294" r="5" fill="rgb(30,150,139)"></circle> <circle cx="176.71218763469287" cy="137.54323300750582" r="5" fill="rgb(30,150,29)"></circle> <circle cx="174.45032008232968" cy="209.2316111886315" r="5" fill="rgb(30,150,61)"></circle> <circle cx="68.73068617514102" cy="52.28176780869747" r="5" fill="rgb(30,150,142)"></circle> <circle cx="162.4456402979608" cy="73.76239706732053" r="5" fill="rgb(30,150,86)"></circle> <circle cx="108.00141921697366" cy="109.55469140282139" r="5" fill="rgb(30,150,69)"></circle> <circle cx="162.96141476843476" cy="141.23102327916624" r="5" fill="rgb(30,150,16)"></circle> <circle cx="125.9345304765698" cy="238.19247603714848" r="5" fill="rgb(30,150,93)"></circle><line x1="130.64433518067872" y1="28.1630727673696" x2="96.17812624734673" y2="29.840537240648665" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="96.17812624734673" y1="29.840537240648665" x2="67.04524904809107" y2="53.02953597638252" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="67.04524904809107" y1="53.02953597638252" x2="38.82122769921369" y2="75.5662312500352" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="38.82122769921369" y1="75.5662312500352" x2="28.36356558991553" y2="95.4663889254756" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="28.36356558991553" y1="95.4663889254756" x2="18.330634507062157" y2="169.68512490920642" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="18.330634507062157" y1="169.68512490920642" x2="19.797156728201166" y2="208.00327375672293" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="19.797156728201166" y1="208.00327375672293" x2="36.83140136457256" y2="237.10836498299798" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="36.83140136457256" y1="237.10836498299798" x2="132.24331417077946" y2="291.2609993001805" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="132.24331417077946" y1="291.2609993001805" x2="161.10556608174647" y2="287.6615940190875" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="161.10556608174647" y1="287.6615940190875" x2="226.2427629753817" y2="260.4928511647599" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="226.2427629753817" y1="260.4928511647599" x2="282.75471021838604" y2="222.40422121056434" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="282.75471021838604" y1="222.40422121056434" x2="287.55861698920245" y2="191.54124064684203" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="287.55861698920245" y1="191.54124064684203" x2="277.6246746037615" y2="90.30367358125177" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="277.6246746037615" y1="90.30367358125177" x2="251.5850563588106" y2="65.40572671380644" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="251.5850563588106" y1="65.40572671380644" x2="204.0380699117014" y2="37.35498291700646" style="stroke:rgb(255,0,0);stroke-width:2"></line> <line x1="204.0380699117014" y1="37.35498291700646" x2="130.64433518067872" y2="28.1630727673696" style="stroke:rgb(255,0,0);stroke-width:2"></line></svg> + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +--------------------------------------------------------------------------------------------- +-- +-- GRAHAM SCAN IMPLEMENTATION +-- +-- This little haskell programm calulates the Convex Hull for a set of 2D points. +-- It ships wit a main function that feeds the Graham Scan algorithm with some +-- random points and generates a simple SVG of the input points and resulting envelope. +-- A simple SVG encoder is included. +-- +-- Alogrithm used: https://en.wikipedia.org/wiki/Graham_scan +-- +-- CREDITS -- +-- +-- Michal Idziorek <m.i@gmx.at> +-- 16 December 2017 +-- +--------------------------------------------------------------------------------------------- + +import Data.List +import System.Random + +--------------------------------------------------------------------------------------------- + +-- GRAHAM SCAN -- + +-- Three points are clockwise if ccw < 0. +ccw (p1x,p1y) (p2x,p2y) (p3x,p3y) = (p2x - p1x)*(p3y - p1y) - (p2y - p1y)*(p3x - p1x) + +-- Calculate the slope defined by 2 points. (return Infinity, if points are identical). +slope (ax,ay) (bx,by) | (ax,ay ) == (bx,by) = 1/0 -- Infinity + | otherwise = (bx-ax)/(by-ay) + +-- Comparison function to sort points counterclockwise (given a reference point). +slope_cmp a b c = compare (slope a c) (slope a b) + +-- Comparison function using the y and x coordinates for ordering. +graham_cmp (ax,ay) (bx,by) | ay /= by = compare ay by + | otherwise = compare ax bx + +-- Graham scan on prepared data. this will calculate the convex hull. +graham_calc [] hs = hs +graham_calc (x1:xs) hh | length(hh) < 2 = graham_calc xs (x1:hh) +graham_calc xx@(x1:xs) hh@(h1:h2:hs) | ccw x1 h1 h2 < 0 = graham_calc xs (x1:hh) + | otherwise = graham_calc xx (h2:hs) + +-- Find the starting point, sort all points counterclockwise and perform the graham scan. +graham xs = graham_calc sortedPoints [] + where minPoint = minimumBy graham_cmp xs + sortedPoints = sortBy (slope_cmp minPoint) xs + +--------------------------------------------------------------------------------------------- + +-- XML ENCODING-- + +xml_attr (x:xs) = x++"=\""++(head xs)++"\" " +xml_enc tag attrs body = "<"++tag++" "++xml_attrs++">"++body++"</"++tag++">" + where xml_attrs = unlines $ map xml_attr attrs + +-- SVG ENCODING -- + +-- hardcoded scaling and panning function +svg_transf x = x*30+5 + +line_to_svg ((x1,y1),(x2,y2)) = xml_enc "line" [["x1",show lx1],["y1",show ly1], + ["x2",show lx2],["y2",show ly2], + ["style", "stroke:rgb(255,0,0);stroke-width:2"]] "" + where lx1=svg_transf x1 + lx2=svg_transf x2 + ly1=svg_transf y1 + ly2=svg_transf y2 + +point_to_svg (x,y) = xml_enc "circle" [["cx",show cx],["cy",show cy],["r","5"], + ["fill","rgb(30,150,"++(show (floor dist))++")"]] "" + where cx=svg_transf x + cy=svg_transf y + dist= (sqrt ((x-5)*(x-5) + (y-5)*(y-5)))*255/8 + + + +-- draws SVG points and lines (in hardcoded sizes and colors) +svg_draw p l = xml_enc "svg" [style,["width","330"],["height","330"]] body + where style = ["style", + "background-color:black;border:3px solid green;margin:2px;"] + body = (unlines (map point_to_svg p )) ++ + (unlines (map line_to_svg l )) + +-- calculate convex hull and generate svg +svg_graham xs = svg_draw xs (zip hull hull_open) + where hull_open = graham xs + hull = (last hull_open) : hull_open + +-- RANDOMIZING -- + +randomPoints g cnt = take cnt (zip r10a r10b) + where r5 = randomRs (0,5) g :: [Double] + r10a =zipWith (+) r5 (drop cnt r5) + r10b =zipWith (+) (drop (2*cnt) r5) (drop (3*cnt) r5) + +--------------------------------------------------------------------------------------------- + +-- MAIN -- + +-- Note that this is the only place of impurity in this source-file. +-- Is is subject to side effects due to I/O (we are writng to stdout) +-- and the random number generator. +main = do + g <- newStdGen + putStr (svg_graham (randomPoints g 25)) + putStr (svg_graham (randomPoints g 50)) + putStr (svg_graham (randomPoints g 100)) + putStr (svg_graham (randomPoints g 250)) + putStr (svg_graham (randomPoints g 500)) + putStr (svg_graham (randomPoints g 1500)) + +--------------------------------------------------------------------------------------------- +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/080_blog/00065_Base64-Encoder-(Haskell)/index.md b/080_blog/00065_Base64-Encoder-(Haskell)/index.md new file mode 100644 index 0000000..830ed8d --- /dev/null +++ b/080_blog/00065_Base64-Encoder-(Haskell)/index.md @@ -0,0 +1,51 @@ +Miguel's Naive Base64 Encoder +============================== + February 19, 2018 + +Coded on a winter afterfnoon on 19th Feb 2018 A.D. to fully understand +base64 encoding and play with haskell, which is always an indisputable +pleasure. + +The following lines were written in full awareness that 'libraries' for +this very purpose, which perform way better, are in existence. + +Coded in big anger due to nick's stories about saving his binary format, +encrypted passwords in an ascii config file, featuring +strange letters and characters. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +-- File: base64.hs -- + +import Data.Char +import Text.Printf +import qualified Data.List as L +import qualified Data.List.Split as T + +toBase64 x = maskBase64 x . toBase64core . asciiToBin . binFill $ x +toBase64core = map base64toDigit . map binToDec . T.chunksOf 6 + +base64toDigit x = (['A'..'Z']++['a'..'z']++['0'..'9']++['+','/']) !! x +binToDec = sum . map (2^) . L.findIndices (=='1') . reverse +asciiToBin = concat . map (\y -> printf "%08b" y) . map ord +binFill x = x ++ (take (fill64length x) $ cycle "\000") + +maskBase64 o x = take (length x - l ) x ++ (take l $ cycle "=") + where l = (fill64length o) + +fill64length x | m==0 = 0 + | otherwise = 3-m + where m=mod (length x) 3 + +main = do + line <- getLine + putStrLn $ toBase64 line +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Example usage, with decoding via `base64 -d` + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} +miguel@megaloman:~$ echo -n "secret haskell" | runghc base64.hs +c2VjcmV0IGhhc2tlbGw= +miguel@megaloman:~$ echo -n "c2VjcmV0IGhhc2tlbGw=" | base64 -d # decode to check +secret haskell +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/080_blog/00070_Password-Management-on-the-Command-Line/index.md b/080_blog/00070_Password-Management-on-the-Command-Line/index.md new file mode 100644 index 0000000..1b45b02 --- /dev/null +++ b/080_blog/00070_Password-Management-on-the-Command-Line/index.md @@ -0,0 +1,89 @@ +# Passoword Managemet from the Command Line + + February 8, 2018 + +Today we will look at some simple, portable yet effective ways to manage +your passwords from the command line. You will need nothing more than +**apg** and one of **gnugpg** or **openssl** along with your favorite +text editor. + +~~~~~~~~~~ {.bash} +apt install apg gnupg openssl +~~~~~~~~~~ + +## Generate your Password + +Before you can manage your passwords, you will obviously first have to +generate them. Since your brain might be a very poor random number +generator you can use `/dev/random` here. + +A few examples for generating random passwords with **apg** follow: + +~~~~~~~~~~ {.bash} +# generate a few random passwords with default settings using /dev/random +apg -c /dev/random + +# set password length to 20-30 characters and generate 10 passwords +apg -m20 -x30 -n10 -c /dev/random + +Example output: + gootCoHuecJarItOojBouFrag + OignisholWulfisOdPearshed + fekfedsornUgbacyoimyab + ... + +# Other useful flags: +#- a0 pronouncable +# -a1 random + +# If you use -a1 you can specify the symbolset with -M +# You can combine multiple -M options as in: -MCnS + +# -MC / -Mc must/can use small leters set +# -MC / -Mc must/can use capital symbol set +# -MN / -Mn must/can use numeral symbol set +# -MS / -Ms must/can use special symbol set + + +# Finally we can exclude specific characters from the symbol set with -E +apg -a1 -m10 -MN -E 02345678 -c /dev/random + +Example output: + 9119191199 + 9919119919 + 1199999911 + ... +~~~~~~~~~~ + +## Managing your Password Safe + +Just put the passwords in a plaintext file (named mypasswords in the examples below), +along with related data and encrypt them symmetrically via **gnupg**. +Decrypt them as needed. You will be prompted for a passphrase in each case. + +Note that **gnupg** might cache your password for a few minutes, +so don’t worry if you can decrypt them without beeing prompted. + +~~~~~~~~~~ {.bash} +#encrypyt. Don't forget to delete the source file +gpg -c mypasswords + +#decrypt and write to STDOUT +gpg -d mypasswords.gpg +~~~~~~~~~~ + +You might prefer openssl, which some claim to be even more portable + +~~~~~~~~~~ {.bash} +#encrypyt. Don't forget to delete the source file +openssl aes-256-cbc -salt -in mypasswords > mypasswords.aes + +#decrypt and write to STDOUT +openssl aes-256-cbc -d -in mypasswords.aes +~~~~~~~~~~ + +Adding, Editing or Deleting a password constitutes simply of the three steps: + +* decrypt your password file and save it in a safe place +* edit the passwordfile as needed with your favorite text editor +* encrypt the password flie back again diff --git a/080_blog/00090_Miguels-KVM-Adventures/index.md b/080_blog/00090_Miguels-KVM-Adventures/index.md new file mode 100644 index 0000000..7f50c76 --- /dev/null +++ b/080_blog/00090_Miguels-KVM-Adventures/index.md @@ -0,0 +1,212 @@ +Miguel’s KVM Adventures +======================= + +February 7, 2018 + +Some notes about my explorations of the World of KVM virtualization. + +## Abstract +In my never ending pursuit of abstraction and encapsulation I recently started integrating all of my services into docker containers and deploying them inside virtual kvm guests. This article presents my continues effort to summarize the findings of this ongoing journey, which implies that the following material might be subject to change anytime without notice. This collection of notes and sentimental thoughts comes without any warranty or implication of fitness for any purpose. You have been warned! Now feel free to make use of it.  + +## Libvirt +This are the most common virsh commands I use to manage the kvm guests, where _domain_ is simply the name of the targeted guest and _FILE_ the name of a XML file. Remember that libvirt supports other virtualization infrastructure as well (Xen, VMware, QEMU). Most of the options are self-explanatory. With ‘virsh create’ starting a transient domain, that will disappear after shutdown, and the define/start combo resulting in a persistent domain that will even survive host restarts + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} + virsh create _FILE_ # create domain from xml file + virsh destroy _domain_ # forcefully remove domain + + virsh define _FILE_ # define domain from xml file + virsh undefine _domain_ # undefine domain + + virsh suspend _domain_ # stop all scheduling + virsh resume _domain_ # start scheduling + + virsh start _domain_ # power on domain + virsh shutdown _domain_ # send corresponding ACPI signal to guest + + virsh edit _domain_ # edit xml config in place + + virsh autostart _domain_ # set autostart flag + virsh autostart _domain_ --disable # unset autostart flag + virsh list [--all] [--autostart] # list defined/active/autostart domains +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## Disk Image +Most of the guest systems will require some sort of storage. Creating a fresh qcow2 image, to back our virtual disk, is as simple as running: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} + qemu-img create -f qcow2 milky.img 200G +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Do not worry, the image will only take a fraction of the declared space, and will not grow larger than necessary, due to trimming, which will be explained later. + + +## Domain Definition +Domains, this is how libvirt calls our ‘guests’, can be defined in XML formatted files. This is my minimalistic defintion of the domain ‘milkman’ carrying 8GB RAM and 4 CPUs: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.xml .numberLines} + <domain type='kvm'> + + <name>milkman</name> + <uuid>504d80ee-1427-11e8-9861-0708f4830f96</uuid> + + <memory unit='KiB'>8388608</memory> + <currentMemory unit='KiB'>8388608</currentMemory> + <vcpu>4</vcpu> + + <os> + <type>hvm</type> + <boot dev='hd'/> + </os> + + <features> + <acpi/> + </features> + + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + + <devices> + + <emulator>/usr/bin/kvm</emulator> + + <disk type='file' device='disk'> + <driver name='qemu' type='qcow2' discard='unmap' /> + <source file='/home/miguel/KVM/images/milky.img'/> + <target dev='sda' bus='scsi'/> + </disk> + + <interface type='bridge'> + <source bridge='virbr1'/> + <model type='virtio'/> + </interface> + + <controller type='scsi' index='0' model='virtio-scsi' /> + + <graphics type='vnc' port='55555' autoport='no' listen='::1' /> + + </devices> + + </domain> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Beside the obvious RAM size and CPU count w specify the underlying qcow2 image, to be used for our emulated hard disk. We also want to specify discard=’unmap’ and make use of a virtio-scsi controller, both to allow trimming. Trimming will be covered in more detail later. + +Our virtual machine relies on a virtual bridge virbr1. It is very important to use type=’virtio’ here. The defaults resulted in extremely poor network performance, at least in some of my particular use cases. The setup of the bridge with accompanying parameters is described in the next section about networking. + +At the very last we tell the vnc-server to listen on ::1 at port 5555. This values can be also adjusted during run-time as explained later on. + +In order to install an operating system we can add a virtual cd-rom along with an iso-image by augmenting the devices section in our XML defintion with the following lines: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.xml .numberLines} + <disk type='file' device='cdrom'> + <driver name='qemu' type='raw'/> + <source file='/home/miguel/KVM/isos/debian-9.3.0-amd64-netinst.iso'/> + <target dev='hdc' bus='ide'/> + <readonly/> + </disk> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Make sure to adapt the boot order in the os section by adding an appropriate line, so you end up with this: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.xml .numberLines} + <os> + <type>hvm</type> + <boot dev='cdrom'/> + <boot dev='hd'/> + </os> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## Networking +Since my primary interface to the virtual machines is SSH, reliable network connectivity is one of the primary foci. IPv4 addresses became scarse so we will not waste any for the host systems virbr1 or eth0. The following diagram illustrates my IPv4 setup of a simple arp proxy utilizing ipv4 forwarding. The guests use their public ipv4 addreses and the ips of the hosts gateway. + +{.img-fluid} + +There is no need to save address space in case of IPv6 since we have a complete /64 IPv6 subnet at our disposal. While only a few guests are accessible by their IPv4 public addresses directly, we have virtually an infinite number of IPv6 addresses. Sidenote: One single /64 IPv6 subnet consists of 2^64 different addresses, which is over four billion times more than there are IPv4 addresses in the whole world! I use just the lower /65 half of our /64 subnet for the guests while the IPv6 address of the hosts NIC lies in the upper half. + +My IPv6 setup in /etc/network/interface goes along this lines: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.numberLines} + #/etc/network/interfaces + + iface eth0 inet6 static + address2a01:6a8:122:5622:8000::88/128 + gateway fe80::1 + + iface virbr1 inet6 static + pre-up brctl addbr virbr1 + address 2a01:6a8:122:5622::3/65 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +All we need to do is activate IPv6 forwarding on the host to let our guests communicate with the world outside. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} + sysctl -w net.ipv6.conf.all.forwarding=1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +And this is how the IPv6 config of a particular guest looks like: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.numberLines} + iface ens3 inet6 static + address 2a01:6a8:122:5622::13/65 + gateway 2a01:6a8:122:5622::3 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Things could be improved further by running a DHCP server, like dnsmasq, to assign the guest addresses, but for now I want to keep it simple. + +## VNC + +While ssh is perfectly sufficient for most of the time, you sometimes might need to have a look at the frame-buffer console. You can start/stop listening on a specific port or interface with: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} + sudo virsh qemu-monitor-command <guest_name> --hmp change vnc <listen_ip>:<port> + sudo virsh qemu-monitor-command <guest_name> --hmp change vnc none +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Interestingly the port is offset by 5900 meaning that e.g. :87 will let the vnc-server listen on port 5987! +Check it with netstat -tulpn to be sure. + +## Backup Running KVM + +One of the beautiful things about using virtual machines is the level of control we have over them. We can for instance backup our running machines with almost no downtime using the following approach: + +dump config to xml file +save kvm state (RAM etc.) and stop the guest. +create an overlay on the underlying qcow2 disk image. +restore the kvm on the overlay. +backup the original disk image. +commit deltas from overlay to the image. +switch to the image with merged changes and delete deltas. + +A downtime will be experienced only between the save and restore steps, while the most time consuming part of the process, backing up the disk, can be delayed. The XML, RAM state and HDD snapshot contain all the data required to re-spawn an identical consistent copy of our virtual machine, as at the time of the backup. NOTE: the clock might cause problems if not adjusted, if some applications rely on it. Ntp can take care of that. A fast and dirty implementation of this technique, for my particular setup, can be found on our gitweb [2]. A more complete but complex solution is Daniel Berteaud’s perl script [3], which I frankly did _not_ test myself. + +## Docker Containers +A common use case is to run docker inside the virtual guests, which makes it an integral part of my ‘KVM Adventures’. I prefer to remap docker’s root user to a non-privileged user of my host, as well as utilize syslog instead of the default json-file driver. This is reflected by the following config: + +/etc/docker/daemon.json: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.json .numberLines} + { + "userns-remap": "miguel", + "log-driver": "syslog" + } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Optionally you can tell rsyslog to log deamon.* entries into a separate file and adjust logrotation as outlined here [5]. + +## Miscellaneous + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.bash} + virt-host-validate # validate host virtualization setup +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## References + + [1] https://libvirt.org/formatdomain.html + [2] https://gitweb.softwarefools.com/?p=miguel/kvm_tools.git + [3] http://repo.firewall-services.com/misc/virt/virt-backup.pl + [4] https://www.linux-kvm.org/page/Tuning_KVM + [5] https://www.wolfe.id.au/2015/05/03/syslog-logging-driver-for-docker/ + diff --git a/080_blog/00100_Monospaced-Font-and-Pixel-Display-for-Space-Engineers/index.md b/080_blog/00100_Monospaced-Font-and-Pixel-Display-for-Space-Engineers/index.md new file mode 100644 index 0000000..cb40788 --- /dev/null +++ b/080_blog/00100_Monospaced-Font-and-Pixel-Display-for-Space-Engineers/index.md @@ -0,0 +1,323 @@ +# Monospaced Font and Pixel Display for Space Engineers +<p class="text-secondary">September 23, 2016</p> +<figure class="text-center"> +{.img-fluid .rounded alt="Closeup of standard Space Engineers LCD Panel, showing pink letters. Single Pixels can be determined." title="Pink is the color of passion"} +<figcaption class="text-secondary"> +Standard LCD Panel displaying monospaced text. +</figcaption> +</figure> + +## Pixel Precise Font + +For everyone suffering from the lack of monospaced fonts and pixel-based +displays in Space Engineers here I share my simple, yet effective solution: +A simple helper class in C#, which I wrote yesterday night to solve this +particular problem. As a bonus this also enabled using the LCD Screens +for arbitrary pixel-precise output, even with animations, as you will +see later. + +Have fun and feel free to improve it! + +The class can be easily embedded in your programmable blocks and allows simulating pixel-precise displays on the LCD and Text Panels. The class also ships with a beautiful set of retro-style compile time mono-spaced fonts. + +First admire a few screenshot to get a first impression: + +<figure class="text-center"> +{.img-fluid .rounded alt="A Space Engineers Console showcasing our Font. It displays some ASCII styled bars." title="The Monospaced Font in Action."} +<figcaption class="text-secondary"> +Status bars showing normal and inverted font. +</figcaption> +</figure> + +<figure class="text-center"> +{.img-fluid .rounded alt="Two adjacent Space Engineers Consoles. One shows a sinus wave, demonstrating pixel precise output."} +<figcaption class="text-secondary"> +The Display to the right demonstrates animated pixel precise output. +</figcaption> +</figure> + +The class exposes the following public methods: + +* Screen constructor +* pixelOn +* draw_rect +* put_letter +* put_letter_inv // inverted single letter +* put_text +* put_text_inv // inverted text +* update // updates lcd or text panel + +## Pixel Display supports Animations + +<figure class="text-center"> +{.img-fluid .rounded alt="Complete setup with 3 Panels a timer block and a programmable block"} +<figcaption class="text-secondary"> +A complete Setup featuring 3 LCD Panels and supporting blocks. +</figcaption> +</figure> + +With a timer block this approach can be used for beautiful animations too! + +The solution is based on emulating pixels using very small fonts ~0.2 on regular LCD Panels. I use ‘[‘ and ‘.’ here, since they both have the same widths and work quite well to emulate on/off pixels. + + +Usage of the class is easy and straigth forward from your Main function: + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.csharp .numberLines} +// construct a new Screen class instace providing +// the label of your panel and dimensions. +Screen s = new Screen("Your_LCD_1",215,59,this); + +// put text on specified pixel coordinates +s.put_text(10,10," Welcome to the Machine "); + +// refresh the LCD Panel +s.update(); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## C Sharp Class for the Space Engineers Font + +And this is the C# class behind it. You will have to copy it into your programmable blocks. (Let me know if there is a more elegant way?) + +Sidenote: If you wonder how I generated this numbers inside the letters array, you can read it in this seperate post about bitmap fonts generation. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.csharp .numberLines} +class Screen +{ + + public int width; + public int height; + + IMyTextPanel panel; + + char mark_pixel='['; + char mark_empty='.'; + + static MyGridProgram programm; + string output; + + public Screen(string panel_name, int _width, int _height, MyGridProgram programRef) + { + width=_width; + height=_height; + programm=programRef; + panel=programm.GridTerminalSystem.GetBlockWithName(panel_name) as IMyTextPanel; + + output=new string(' ',0); + for(int y=0;y<height;y++) + { + output+=new string(mark_empty,width); + output+='\n'; + } + } + + public void pixelOn(int x,int y) + { + StringBuilder sb = new StringBuilder(output); + sb[y*(width+1)+x]=mark_pixel; + output = sb.ToString(); + } + + public void draw_rect(int x, int y, int width, int height) + { + for(int i=x;i<x+width;i++) + { + pixelOn(i,y); + pixelOn(i,y+height-1); + } + + for(int i=y;i<y+height;i++) + { + pixelOn(x,i); + pixelOn(width+x-1,i); + } + + + } + + public void put_text(int x, int y, string str) + { + int linefeed=0; + for(int i=0;i<str.Length;i++) + { + if(str[i]=='\n') + { + y+=7; + linefeed=0; + continue; + } + + linefeed+=7; + put_letter(x+linefeed,y,str[i]); + } + } + + public void put_text_inv(int x, int y, string str) + { + int linefeed=0; + for(int i=0;i<str.Length;i++) + { + if(str[i]=='\n') + { + y+=7; + linefeed=0; + continue; + } + + linefeed+=7; + put_letter_inv(x+linefeed,y,str[i]); + } + } + + public void put_letter(int x, int y, int ascii_code) + { + int letter=letters[ascii_code-0x20]; + + for(int i=0;i<5;i++) + for(int j=0;j<5;j++) + + if(0<(letter & (int)Math.Pow(2,24-(i+j*5)) )) + pixelOn(x+i,y+j); + } + + public void put_letter_inv(int x, int y, int ascii_code) + { + int letter=letters[ascii_code-0x20]; + draw_rect(x-1,y-1,7,7); // outline + for(int i=0;i<5;i++) + for(int j=0;j<5;j++) if(0>=(letter & (int)Math.Pow(2,24-(i+j*5)) )) + pixelOn(x+i,y+j); + } + + public void update() + { + panel.WritePublicText(output, false); + } + + // monospace fonts starting from 0x20 (space) + static readonly int[] letters = + { + 0,4329476,10813440,11512810,16398526,17895697,6632015,4325376,2232450,8523912, + 22483413,4357252,68,31744,4,1118480,15390382,4608142,15239320,31504446, + 1841462,33060926,33062463,32540808,33095231,33094719,131200,131208,2236546, + 1016800,8521864,32051204,15392270,33095217,32045630,33047071,32032318, + 33061407,33062416,33050175,18415153,14815374,14748236,20673235,17318431,18732593,18667121, + 15255086,32045584,15259213,32045779,33299071,32641156,18400814,18393412,18405233,18157905,18157700, + 32575775,14950670,17043521,14747726,4539392,31,6389760,33095217,32045630, + 33047071,32032318,33061407,33062416,33050175,18415153,14815374,14748236, + 20673235,17318431,18732593,18667121,15255086,32045584,15259213,32045779,33299071, + 32641156,18400814,18393412,18405233,18157905,18157700,32575775,2240642,4329604 + 8525960,14016, + }; + +}; + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## Source Code used for Example Screenshots above + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.csharp .numberLines} +static int cnt=0; // programm counter + +public void Main(string argument) +{ + // increase programm counter + cnt+=1; + if (cnt>100) cnt= 0; + + // init our screen class: new 438x59 screen + Screen s = new Screen("Miguel_LCD_1",(int)(438*1.5),(int)(59*1.5),this); + + // draw some rectangles + s.draw_rect(0,0,s.width,s.height); + s.draw_rect(2,2,s.width-4,s.height-4); + + //draw more rectangles (stress testing only) + // for(int i=4; i<35; i+=2) + // { + // s.draw_rect(i,i,s.width-2*i,s.height-2*i); + // } + + // write counter value + s.put_text(8,5,"counter: "+cnt); + + // inverted text + s.put_text_inv(8,12,"SOME INVERTED TEXT --- "); + + + // paint a sinus wave + for(int i=0;i<s.width;i++) { if(i>200)s.pixelOn(i,(int)(s.height/2+s.height/3*Math.Sin((i+cnt)/25.0))); + } + + // paint individual letters along a sinus + string txt=new string(' ',0); + txt="! software fools rules the waves!"; + + for(int i=0;i<txt.Length;i++) { s.put_letter(30+i*7,(int)(s.height/2+s.height/5*Math.Sin((30+i*6+cnt)/25.0)),txt[i]); } s.update(); // other screens Screen s2 = new Screen("Miguel_LCD_2",329,89,this); Screen s3 = new Screen("Miguel_LCD_3",215,59,this); s3.put_text_inv(10,10," Welcome to the Machine "); s3.put_text(10,17,"-= Miguel's 5x5 Fonts =-\n The quick brown fox \n jumps over the lazy dog\n0123456789><=;'~^\n"+ + " %#@!~?{}[]-+*&`.,:'"); + + s3.draw_rect(0,0,s3.width,s3.height); + s3.draw_rect(2,2,s3.width-4,s3.height-4); + + s2.put_text(10,1, +"Something......[|||||||||| ] 10%\n"+ +"Foo............[||| ] 33%\n"+ +"Bar............[||| ] 99%\n"+ +"Something else.[||||||||||I ] 05%\n" +); + +s2.put_text_inv(10,35, +"Something......[|||||||||| ] 10%\n"+ +"Foo............[||| ] 33%\n"+ +"Bar............[||| ] 99%\n"+ +"Something else.[||||||||||I ] 05%\n" +); + +s2.put_text(10,65, +"copyright by softwarefools.com" +); + + s2.update(); + s3.update(); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +## Helpful Comment on improving Performance + + JR Raynal + December 13, 2017 at 9:29 am + +Hi, I was playing with your script, and found it super slow… which is odd given the performances of other scripts out there. Turns out by switching the output from a string to a StringBuilder, you don’t need to copy them around as much. I assume this is the fix because I experienced a serious speed increase with that! + +Here is the rewritten snippet: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.csharp .numberLines} + + StringBuilder output; + + public Screen(string panel_name, int _width, int _height, MyGridProgram programRef) + { + width = _width; + height = _height; + programm = programRef; + panel = programm.GridTerminalSystem.GetBlockWithName(panel_name) as IMyTextPanel; + + output = new StringBuilder(); + for (int y = 0; y < height; y++) + { + output.Append(mark_empty, width); + output.Append('\n'); + } + } + + public void pixelOn(int x, int y) + { + output[y * (width + 1) + x] = mark_pixel; + } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +## TODOS + +cleanup and optimize code!!, move sources to git repo, use some kind of syntax highlihter on this post. allow other font-sets with other sizes and let the user adjust spacing, publish python font converter in another post. diff --git a/080_blog/00105_GNU-Screen-Multiplexer-Keyboard-Shortcuts/index.md b/080_blog/00105_GNU-Screen-Multiplexer-Keyboard-Shortcuts/index.md new file mode 100644 index 0000000..01bbb09 --- /dev/null +++ b/080_blog/00105_GNU-Screen-Multiplexer-Keyboard-Shortcuts/index.md @@ -0,0 +1,41 @@ +GNU Screen - multiplexer - Keyboard Shortcuts +----------------------------------------- + + March 12, 2015 + + Invocation + $ screen [-S session_name] # simply start new session + $ screen -ls # lists sessions + $ screen -r session_name # resume detached session + $ screen -d -R session_name # resume session (also detach or create) + $ screen -d -RR #resume first session + + Shortcuts + ctrl-a c NEW WINDOW + ctrl-a n / ctrl-a p NEXT/PREVIOUS + ctrl-a d DETACH + ctrl-a D D DETACH and LOGOUT + + ctrl-a S SPLIT HORIZ. + ctrl-a | SPLIT VERTICAL + ctrl-a tab NEXT REGION + ctrl-x REMOVE REGION + ctrl-a q REMOVE ALL OTHER REGIONS + ctrl-a F FIT WINDOW + + ctrl-a c CLEAR SCREEN + ctrl-a k KILL WINDOW + ctrl-a \ QUIT + + ctrl-a esc COPY/SCROLLBACK MODE + + Layout Commands + ctrl-a : #enter command mode + :layout new [title] + :layout remove [n|title] + :layout next + :layout prev + :layout show #list layouts + + Ref + [1] $ man screen diff --git a/080_blog/00110_Midnight-Commander-Cheatsheet/index.md b/080_blog/00110_Midnight-Commander-Cheatsheet/index.md new file mode 100644 index 0000000..0a11a9b --- /dev/null +++ b/080_blog/00110_Midnight-Commander-Cheatsheet/index.md @@ -0,0 +1,72 @@ +Midnight Commander Cheatsheet +============================= + + June 07, 2018 + +A short cheatsheet summarizing midnight commander's most useful shortcut keys. + +Basic Navigation +---------------- +<div class="row"> +<div class="col-2"><span class="px-2 bg-primary text-white">tab</span></div> +<div class="col-10">switch active panel</div> +</div> + +<div class="row"> +<div class="col-2"><span class="px-2 bg-primary text-white">up/down</span></div> +<div class="col-10">select previous/next rown</div> +</div> +<div class="row"> +<div class="col-2"><span class="px-2 bg-primary text-white">return</span></div> +<div class="col-10">open selected directory</div> +</div> +<div class="row"> +<div class="col-2"><span class="px-2 bg-primary text-white">alt-o</span></div> +<div class="col-10">open selected directory on other panel</div> +</div> +<!-- +<table class="table"> +<tbody> +<tr><td><span class="px-2 bg-primary text-white">up/down</span></td><td> select previous/next row</td></tr> +<tr><td><span class="px-2 bg-primary text-white">return</span></td><td> open selected directory</td></tr> +<tr><td><span class="px-2 bg-primary text-white">alt-o</span></td><td> open selected directory on other panel</td></tr> +</tbody> +</table> +--> + +View +---- +<div><span class="px-2 bg-primary text-white">alt-.</span> toggle hidden files</div> +<div><span class="px-2 bg-primary text-white">ctrl-o</span> toggle console</div> +<div><span class="px-2 bg-primary text-white">alt-t</span> toggle listing mode</div> +<div><span class="px-2 bg-primary text-white">alt-i</span> sync with other panel</div> +<div><span class="px-2 bg-primary text-white">ctrl-u</span> swap panels</div> + +Miscellaneous +------------- + shift-f6 rename filling in the current name + insert/ctrl-t/+/\/* - selections + esc-tab auto complete + ctrl-enter / alt-enter - copy currently selected filename to console + Ctrl + Shift + Enter - copy full path + enter/f3/f4 - ??? how to have full control over behaviour.. debian? notes./. + xdg-mime default evince.desktop application/pdf + alias mc='EDITOR=vim' + + alt-shift-h show dir history + alt-y/alt-u (navigate history?) + + alt+?/alt-s/ctrl-s search + + ctrl-space calc size + ctrl - x c chmod + ctrl - x o chown + + alias mc='. /usr/libexec/mc/mc-wrapper.sh' - will stay in dir after exit + + Ref: http://klimer.eu/2015/05/01/use-midnight-commander-like-a-pro/ + man mc + ... + +NOTE: I run mc inside tmux and the shifted function keys did not work as +expected. Use midnight commanders Learn Keys dialog to fix this diff --git a/080_blog/00120_Lambda-Calculus-(Haskell)/index.md b/080_blog/00120_Lambda-Calculus-(Haskell)/index.md new file mode 100644 index 0000000..25c6b83 --- /dev/null +++ b/080_blog/00120_Lambda-Calculus-(Haskell)/index.md @@ -0,0 +1,38 @@ +Lambda Calculus +=============== + + May 2, 2018 + +Playing with Type Quantifiers and Haskell's Rank 2 Type Polymorphsim, +implementing Boolean logic from scratch. We use the conventional +definitions for `True` an `False` also known as Church booleans, after Alonzo Church, who +intruced them along Lambda Calculus in the 1930s [1]. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +{-# LANGUAGE Rank2Types #-} + +fTrue :: forall a. a->a->a +fTrue x y = x + +fFalse :: forall a. a->a->a +fFalse x y = y + +fAnd :: (forall a. a->a->a)->(forall a. a->a->a)->(forall a. a->a->a) +fAnd p q = p q p + +fOr :: (forall a. a->a->a)->(forall a. a->a->a)->(forall a. a->a->a) +fOr p q = p p q + +fNot :: (forall a. a->a->a)->(forall a. a->a->a) +fNot p = p fFalse fTrue + +ifThenElse :: (forall a. a->a->a)->(forall a. a->a->a) + ->(forall a. a->a->a)->(forall a. a->a->a) +ifThenElse p a b = p a b + +-- Example -- + +main = print $ (ifThenElse fFalse fFalse $ fAnd fTrue $ fNot fFalse) "T" "F" +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + [1] https://en.wikipedia.org/wiki/Lambda_calculus diff --git a/080_blog/00130_Calculator-on-Parsec-and-GTK-(Haskell)/index.md b/080_blog/00130_Calculator-on-Parsec-and-GTK-(Haskell)/index.md new file mode 100644 index 0000000..9701481 --- /dev/null +++ b/080_blog/00130_Calculator-on-Parsec-and-GTK-(Haskell)/index.md @@ -0,0 +1,29 @@ +Simple Calculator on Parsec and GTK +=================================== + + May 3, 2018 + +{.img-fluid .border} + +Today I implemented this simple stupid calulator as a side effect of playing +around with parsec [1] and haskells gtk3 [2] bindings, as well as glade [3] - +an interactive user interface designer. + +Source Files +------------ + +* [calc.hs](/DATA/haskell/calc/calc.hs) +* [calc.glade](/DATA/haskell/calc/calc.glade) + +calc.hs Listing +--------------- + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +{BEGIN:SOURCE} +./DATA/haskell/calc/calc.hs +{END:SOURCE} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + [1] https://hackage.haskell.org/package/parsec + [2] https://hackage.haskell.org/package/gtk3 + [3] https://glade.gnome.org/ diff --git a/080_blog/00140_Minimalistic-SVG-Generator-(Haskell)/index.md b/080_blog/00140_Minimalistic-SVG-Generator-(Haskell)/index.md new file mode 100644 index 0000000..b03fe16 --- /dev/null +++ b/080_blog/00140_Minimalistic-SVG-Generator-(Haskell)/index.md @@ -0,0 +1,40 @@ +A Minimalistic SVG Generator +============================ + + May 11, 2018 + + +A minimalistic SVG generator for my humble requirements. +They might grow someday however... + +The SVG in the following screenshot was generated from the following code +to demonstrate a simple use case. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +svgExample1 = svgAddList (svgEmpty (svgShGray 200) 300 200) $ + [ svgRedLine (0,0) (200,200) + ,svgRedLine (300,0) (100,200) + ,svgBluePoint (33,133) + ,svgBluePoint (33,22) + ,svgBluePoint (66,25) + ,svgFilledTriangle svgBlack svgWhite (20,20) (100,100) (10,90) + ,svgFilledCircle svgWhite svgGreen (150,120) 30 + ]++ + map (svgBluePoint . (,) 250) [50,60..150] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +{.img-fluid .border} + +Source Files +------------ + +* [SimpleSvg.hs](/DATA/haskell/svg/SimpleSvg.hs) + +SimpleSvg.hs Listing +--------------- + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines} +{BEGIN:SOURCE} +./DATA/haskell/svg/SimpleSvg.hs +{END:SOURCE} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/080_blog/index.md b/080_blog/index.md new file mode 100644 index 0000000..f4aee65 --- /dev/null +++ b/080_blog/index.md @@ -0,0 +1,2 @@ +# Miguel's Blog + diff --git a/backtop.js b/backtop.js new file mode 100644 index 0000000..4bab48d --- /dev/null +++ b/backtop.js @@ -0,0 +1,17 @@ +// When the user scrolls down 20px from the top of the document, show the button +window.onscroll = function() {scrollFunction()}; +scrollFunction(); + +function scrollFunction() { + if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { + document.getElementById("myBtn").style.display = "block"; + } else { + document.getElementById("myBtn").style.display = "none"; + } +} + +// When the user clicks on the button, scroll to the top of the document +function topFunction() { + document.body.scrollTop = 0; // For Safari + document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera +} diff --git a/favicon.ico b/favicon.ico Binary files differnew file mode 100644 index 0000000..3a82451 --- /dev/null +++ b/favicon.ico diff --git a/index.md b/index.md new file mode 100644 index 0000000..875e9eb --- /dev/null +++ b/index.md @@ -0,0 +1,11 @@ +<div class="row"> +<div class="col-sm"> +<a href='#'><img src="https://lcsc.academyofmine.com/wp-content/uploads/2017/06/Test-Logo.svg.png" class="img-fluid" alt="Responsive image"></a> +</div> +<div class="col-sm"> +<img src="https://lcsc.academyofmine.com/wp-content/uploads/2017/06/Test-Logo.svg.png" class="img-fluid" alt="Responsive image"> +</div> +<div class="col-sm"> +<img src="https://lcsc.academyofmine.com/wp-content/uploads/2017/06/Test-Logo.svg.png" class="img-fluid" alt="Responsive image"> +</div> +</div> diff --git a/pandoc.css b/pandoc.css new file mode 100644 index 0000000..3f99c9d --- /dev/null +++ b/pandoc.css @@ -0,0 +1,66 @@ +/* + hack to obtain this css file: file.md needs to have some source-code for pandoc. + extract css from result: + stack exec pandoc -- -s file.md --highlight-style pygments +*/ +a.sourceLine { display: inline-block; line-height: 1.25; } +a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; } +a.sourceLine:empty { height: 1.2em; } +.sourceCode { overflow: visible; } +code.sourceCode { white-space: pre; position: relative; } +div.sourceCode { margin: 1em 0; } +pre.sourceCode { margin: 0; } +@media screen { +div.sourceCode { overflow: auto; } +} +@media print { +code.sourceCode { white-space: pre-wrap; } +a.sourceLine { text-indent: -1em; padding-left: 1em; } +} +pre.numberSource a.sourceLine + { position: relative; left: -4em; } +pre.numberSource a.sourceLine::before + { content: attr(title); + position: relative; left: -1em; text-align: right; vertical-align: baseline; + border: none; pointer-events: all; display: inline-block; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + color: #aaaaaa; + } +pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } +div.sourceCode + { } +@media screen { +a.sourceLine::before { text-decoration: underline; } +} +code span.al { color: #ff0000; font-weight: bold; } /* Alert */ +code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #7d9029; } /* Attribute */ +code span.bn { color: #40a070; } /* BaseN */ +code span.bu { } /* BuiltIn */ +code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4070a0; } /* Char */ +code span.cn { color: #880000; } /* Constant */ +code span.co { color: #60a0b0; font-style: italic; } /* Comment */ +code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #ba2121; font-style: italic; } /* Documentation */ +code span.dt { color: #902000; } /* DataType */ +code span.dv { color: #40a070; } /* DecVal */ +code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.ex { } /* Extension */ +code span.fl { color: #40a070; } /* Float */ +code span.fu { color: #06287e; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #007020; font-weight: bold; } /* Keyword */ +code span.op { color: #666666; } /* Operator */ +code span.ot { color: #007020; } /* Other */ +code span.pp { color: #bc7a00; } /* Preprocessor */ +code span.sc { color: #4070a0; } /* SpecialChar */ +code span.ss { color: #bb6688; } /* SpecialString */ +code span.st { color: #4070a0; } /* String */ +code span.va { color: #19177c; } /* Variable */ +code span.vs { color: #4070a0; } /* VerbatimString */ +code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ diff --git a/template.html b/template.html new file mode 100644 index 0000000..b042b3f --- /dev/null +++ b/template.html @@ -0,0 +1,73 @@ +<!DOCTYPE html> +<html lang="en"> + + <head> + <link rel="shortcut icon" type="image/png" href="###ROOT###/favicon.ico"/> + <title>###TITLE###</title> + <meta charset="UTF-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> + <meta name="description" content="###DESCRIPTION###"/> + <meta name="keywords" content="###KEYWORDS###" /> + <meta name="author" content="Michal Idziorek" /> + <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous"> + <link rel="stylesheet" href="###ROOT###/pandoc.css" /> + </head> + + <body> + + <div class="container" id="top"> + + <div class="row"> + + <div class="col-12 p-0"> + + <nav class="navbar navbar-expand-sm navbar-dark bg-primary"> + + <a class="navbar-brand" href="###ROOT###/index.html"> + idziorek.net + </a> + + <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> + <span class="navbar-toggler-icon"></span> + </button> + + <div class="collapse navbar-collapse" id="navbarSupportedContent"> + <ul class="navbar-nav mr-auto"> + ###MENU### + </ul> + </div> + + </nav> + + <nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + ###BREADCRUMBS### + </ol> + </nav> + + <div class="px-3"> + ###CONTENT### + <ul class="nav flex-column"> + ###SUBMENU### + </ul> + </div> + + <div id="footer" class="p-3 bg-primary text-light text-center"> + (c)1994-2019 + </div> + </div> + </div> + <div class="fixed-bottom container d-flex justify-content-end"> + <a id="myBtn" class="m-3 btn btn-dark" href="#top"> + ▲ + </a> + </div> + </div> + + <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script> + <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script> + <script src="###ROOT###/backtop.js"></script> + </body> + +</html> |
