CBKADAL
GitHub Page Configuration Files
C. BinKadal --- Sendirian, Berhad.


_config.yml

title: System Programing - Pemerograman Sistem
version:     "081---24-Mar-2024"
copyright:   "2021-2024"
description: This is the System Programing course site,
      a GitHub Page, hosted at GitHub.com (thank you!).
      This site contains links to lecture materials, exam questions, and laboratory materials.
      It is based on "Google Here, Google There, Try This, Try That, and then Ask Anybody (GHGTT4A2)".
disc: You are free to share, copy and redistribute the material of this site 
      in any medium or format for any purpose, even commercially. 
      Please give appropriate credit, provide a link to the page, 
      and indicate if changes were made. You may do so in any reasonable manner. 
      You should not apply legal terms or technological measures, 
      that legally restrict others from doing anything that is permitted here.
author: C. BinKadal
google_analytics: G-BL9D1PZCHY
address: "Sendirian, Berhad."
sitemap: true
plugins:
  - jekyll-sitemap
  - jekyll-seo-tag
urlweb:           "https://sp.vlsm.org/"
urlscele:         "https://scele.cs.ui.ac.id/course/view.php?id=3742"
urllogcode:       "https://doit.vlsm.org/ETC/logCodes.txt"
urlcontact:       "TBA"
urlgithub:        "https://github.com/os2xx/sysprog/"
urlghpage:        "https://sp.vlsm.org/"
keywords:         "jekyll, testing"
github:           [metadata]


Gemfile

source 'https://rubygems.org'

gem 'jekyll-sitemap'
gem 'github-pages', group: :jekyll_plugins
gem "addressable"
gem "nokogiri"
gem "faraday-retry"
gem 'webrick'


_layouts/layout.html


<!DOCTYPE html>
<html lang="en">
<!-- File _layouts/layout.html           -->
<!-- (c) 2021 - 2021 VauLSMorg           -->
<!-- REV00: Sun 04 Jul 2021 10:48:43 WIB -->
<!-- START: Wed 17 Feb 2021 19:44:53 WIB -->
<!-- This is a free HTML file            -->
{% include head.html %}
<body class="plainclass1">
<!-- body class="backclass" -->
<div class="container">
  <header>
  <div class="row">
    <div class="column left">
      <img src="{{ site.baseurl }}/assets/images/cbk.jpg" alt="CBKADAL" style="width:130px; border-radius:50%">
    </div>
    <div class="column right1">
      {% if page.title %}{{ page.title | escape }}
      {% else %}{{ site.title | escape }}{% endif %}
    </div>
    <div class="column right2">
      {% if page.author %}{{ page.author | escape }}
      {% else %}{{ site.author | escape }}{% endif %}
      ---
      {% if page.address %}{{ page.address | escape }}
      {% else %}{{ site.address | escape }}{% endif %}
    </div>
  </div>
  </header>
  {% include navbar.html %}
  <section>
     {{ content }}
  </section>
  {% include footer.html %}
  {% include google-analytics.html %}
  {% include scripts.html %}
</div>
</body>
</html>




Makefile

# REV06: Tue 31 Jan 2023 17:00
# REV05: Tue 06 Jul 2021 10:00
# REV02: Tue 15 Jun 2021 11:00
# REV01: Fri 12 Mar 2021 13:00
# START: Mon 15 Feb 2021 09:00

ALL: 000.md

000.md: 000.pmd _config.yml Gemfile _layouts/layout.html Makefile \
	_includes/navbar.html \
	_includes/footer.html _includes/head.html _includes/google-analytics.html \
	assets/css/style.css assets/scripts/includeScript.py
	python assets/scripts/includeScript.py < 000.pmd > 000.md

.phony: ALL


_includes/head.html


<!-- File _includes/head.html             -->       
<!-- (c) 2021 - 2021 VauLSMorg            -->
<!-- REV01: Thu 29 Jul 2021 12:06:40 WIB  -->
<!-- START: Wed 17 Feb 2021 19:48:31 WIB  -->
<!-- This is a free HTML file             -->
<head>
  <title>
    {% if page.title %}{{ page.title | escape }} - {{ site.title | escape }}
    {% else %}{{ site.title | escape }}{% endif %}
  </title>
  <meta charset="utf-8">
  <meta name="viewport"    content="width=device-width, initial-scale=1">
  <meta name="description" content="{{ page.excerpt | default: site.description }}">
  <link href="{{ site.baseurl }}/assets/css/style.css" rel="stylesheet" type="text/css" title="Style">
</head>





_includes/navbar.html


<!-- File _includes/navbar.html           -->
<!-- (c) 2021 - 2021 VauLSMorg            -->
<!-- REV02: Thu 26 Aug 2021 16:35:26 WIB  -->
<!-- START: Wed 17 Feb 2021 19:48:31 WIB  -->
<!-- This is a free HTML file             -->
<nav class="navbar">
  <ul>
    <li class='listitem'><a href='{{ site.baseurl }}/'>HOME</a></li>
    <li class='listitem'><a href='{{ site.baseurl }}/000.html'>LISTING</a></li>
    <li class='listitem'><a href='{{ site.baseurl }}/Log/'>REPORT</a></li>
    <li class='listitem'><a href='{{ site.urllogcode }}'>LOG CODES</a></li>
    <li class='listitem'><a href='{{ site.urlscele }}'>SCELE</a></li>
    <li class='listitem'><a href='{{ site.urlgithub }}'>GitHub</a></li>
    <li class='listitem'><a href='{{ site.urlweb }}'>SP.vlsm.org</a></li>
  </ul>
</nav>



assets/css/style.css

/*
 Shamelessly stolen from "Here, There, and Everywhere",
 including but not limited to "bootstrap", "stack overflow", 
 "Mike Dane", "w3schools", et al.
 */

.backclass {
  background-image:url(/assets/images/default.png)
}

.plainclass {
  color:            white;
  background-color: #101030;
}

/* See https://www.w3schools.com/colors/colors_hsl.asp              */
/* See https://www.quackit.com/css/color/charts/hsl_color_chart.cfm */
.plainclass1 {
  color:            hsl(0, 100%, 100%);
  background-color: hsl(0, 10%, 10%);
  line-height:      120%;
  font-family:      monospace,courier;
}

.plainclass1 li {
  line-height:      140%;
}

.plainclass1 h1 {
  color:            hsl(100, 50%, 50%);
}

.plainclass1 h2 {
  color:            hsl(100, 50%, 50%);
}

.plainclass1 h3 {
  color:            hsl(100, 50%, 50%);
}

.container {
  max-width:    70%;
  margin:       0 auto;
  font-size:    1em;
  text-align:   justify;
}

.container a {
  color: #a0a0a0;
}

.container a:hover {
  color: #f0f0f0;
}

.row {
}

.column {
  float:            left;
  display:          inline-block;
  background:       #808080;
  height:           130px;
  width:            100%;
  padding-top:      10px;
  padding-bottom:   10px;
  padding-left:     10px;
  padding-right:    10px;
  text-align:       left;
}

.left {
  width:            130px;
}

.right1 {
  height:           66px;
  width:            calc(100% - 200px);
  padding-top:      24px;
  padding-bottom:   0px;
  padding-left:     30px;
  font-size:        1.9em;
  font-weight:      bold;
}

.right2 {
  height:           50px;
  width:            calc(100% - 200px);
  padding-top:      5px;
  padding-bottom:   5px;
  padding-left:     30px;
  font-size:        1.3em;
  font-weight:      bold;
}
}

.youtube {
  float:            left;
  display:          inline-block;
  height:           150px;
  width:            100%;
  padding-top:      10px;
  padding-bottom:   10px;
  padding-left:     10px;
  padding-right:    10px;
}

.yvideo {
  width:            25%;
  height:           100%;
  padding-top:      0px;
  padding-bottom:   0px;
  padding-left:     0px;
  padding-right:    0px;
}

.yinfo {
  width:            calc(75%  - 30px);
  height:           calc(100% - 20px);
  padding-top:      10px;
  padding-bottom:   10px;
  padding-left:     10px;
  padding-right:    10px;
}

.row:after {
  content: "";
  display: table;
  clear: both;
}

.navbar {
  background-color: #101010;
  color:            #FFFFFF;
  font-size:        0.8em;
}

.navbar ul li {
  display:        inline-block;
  padding:        1px;
  padding-top:    10px;
  padding-bottom: 10px;
}

.navbar ul li a {
  text-decoration: none;
}

.navbar ul li a:hover {
  background:       blue;
  color:            #CCCCCC;
  font-size:        1.2em;
  font-weight:      bold;
}

pre {
  border:        3px solid rgba(255, 255, 255, 0.15);
  padding:       10px; 
  color:         #b5e853;
  border-radius: 2px;
}

table {
  width: 100%;
  margin: 0 0 20px 0;
}

th {
  text-align: left;
  border-bottom: 1px dashed #b5e853;
  padding: 5px 10px;
}

td {
  padding: 5px 10px;
}

/*
  ZCZC
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px; 
  color: #b5e853;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 2px;
  word-wrap: normal;
  overflow: auto;
  overflow-y: hidden;
  max-width: 65%;

 */

/*
 ************************************************************
 */

@media screen and (max-width:768px) {
  ul {
    margin: 0;
    padding: 0;
  }
  #navbar ul li {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    text-align: center;
  }
  #navbar ul li a {
    margin: 0;
    padding: 0;
  }
  #menu {
    display: none;
  }
  #maincontent {
    width: 100%;
    padding: 0;
  }
  h1 {
    font-size: 1em;
  }
}

/*
 ************************************************************
 */


_includes/google-analytics.html


<!-- File _includes/google-analytics.html         -->
<!-- REV01: Wed 31 Mar 2021 07:15:14 WIB          -->
<!-- START: Wed 17 Feb 2021 19:47:55 WIB          -->
<!-- Global site tag (gtag.js) - Google Analytics -->

<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '{{ site.google_analytics }}');
</script>



assets/scripts/includeScript.py

# (c) 2011 Brice Fernandes. This script was ripped from 
# https://fractallambda.com/2011/08/17/pincpy-including-files-and-script-output.html
# Note: This script is outdated.  
# The author uses Handlebars.js or Pystache for the same purpose.
# Usage: 
#     python .program/xx.py < in.pmd > out.md

import sys
import re
import shlex
import subprocess as sp
 
exe_pat = re.compile(r'(\s*)\(!>(.*)<\)\s*')
inc_pat = re.compile(r'(\s*)\(>(.*)<\)\s*')
 
if __name__ == "__main__":
  for line in sys.stdin:
    match_exe = re.match(exe_pat, line)
    match_inc = re.match(inc_pat, line)

    if match_exe:
      space = match_exe.group(1)
      exe = match_exe.group(2).strip()
      args = shlex.split(exe)
      sys.stdout.writelines(
        map(
          lambda x: space+x+"\n", 
          sp.check_output(args).split("\n")))

    elif match_inc:
      space = match_inc.group(1)
      inc = match_inc.group(2).strip()
      sys.stdout.writelines(
        map(
          lambda x: space+x, 
          open(inc)))

    else:
      sys.stdout.write(line)


assets/scripts/report.sh

#!/bin/bash
# Sun 26 Sep 2021 11:27:55 WIB

REPORT="usageW03.txt"
EXTRAS=60
MaxROOT=0
MaxMemory=0
MaxSwap="-1"

fecho(){
    echo "ZCZC $1" | tee -a $REPORT
}
expt() {
   local EXSTAMP=$(printf "%8.8X" $(( $(date +%s) & 16#FFFFFFFF )) )
   local EXCHSUM="XXXXXXXX"
   [ "$(hostname)" = "$USER" ] && {
       EXCHSUM=$(echo "$USER$EXSTAMP"|sha1sum|tr '[a-z]' '[A-Z]'| cut -c1-8)
   }
   fecho "expt $EXSTAMP $EXCHSUM"
   fecho "date $(date '+%y%m%d %H%M')"
   fecho "user $USER hostname $(hostname)"
}
echo "===== To EXIT,     press CONTROL-C ===== ====="
echo "===== Report File: $REPORT    ===== ====="
rm -f $REPORT
while true ; do
    expt
    LOOP=10
    while (( LOOP-- )) ; do
        TMP1=$(($(df|awk '/ \/$/ {print $3}')/1024))
        (( "$MaxROOT" < "$TMP1" )) && { MaxROOT=$TMP1; fecho "MaxRootFS ${MaxROOT}M" ; }
        TMP1=$(($(free|awk '/Mem:/ {print $3}')/1024))
        (( "$MaxMemory" < "$TMP1" )) && { MaxMemory=$TMP1; fecho "MaxMemory ${MaxMemory}M" ; }
        TMP1=$(($(free|awk '/Swap:/ {print $3}')/1024))
        (( "$MaxSwap" < "$TMP1" )) && { MaxSwap=$TMP1; fecho "MaxSwap ${MaxSwap}M" ; }
        sleep 6
    done
    sleep $((1+(++EXTRAS/60)))
    (( "$EXTRAS" > "60" )) && EXTRAS=0
done
exit


© 2021-2024 --- C. BinKadal --- Revision: 081---24-Mar-2024.