commit 886b2ed5be451085e10adaf536d95d2e2dcfec95
parent 69ef858fc95c05afd2d2e7bec4e57b30e46f164f
Author: mjkloeckner <martin.cachari@gmail.com>
Date: Fri, 25 Nov 2022 16:55:33 -0300
generating scripts and Makefile updates, Helvetica deprecated
Besides updating the files mentioned in the title, style.css was
modified to make padding on the header smaller and to remove Helvetica
from the body font
The footer was also modified by decreasing opacity on the creative
commons image and increased when hovered with the mouse
Diffstat:
13 files changed, 289 insertions(+), 131 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,3 +1,6 @@
+KEY = ${HOME}/.ssh/key-mini
+DOMAIN = kloeckner.com.ar
+
all: sync
build:
@@ -8,6 +11,10 @@ sync: build
sudo ./scripts/deploy_local.sh
deploy:
- rsync -e "ssh -i ~/.ssh/key-x441" -orahvPt --delete --exclude=.git --delete-excluded . root@192.168.1.72:/var/www/html
+ rsync -e "ssh -i $(KEY)" -orahvPt \
+ --delete --exclude=.git --exclude=scripts --delete-excluded \
+ ./ root@$(DOMAIN):/var/www/html/
+
+ ssh -i $(KEY) root@$(DOMAIN) -t 'systemctl restart nginx'
.PHONY: build sync deploy
diff --git a/common/footer.shtml b/common/footer.shtml
@@ -2,5 +2,5 @@
<div class="footer-div">
The content of this webpage is licensed under <a style="white-space: nowrap;" rel="license" href="http://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>
</div>
- <a href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="padding: 0; margin: 0; border-width:0; width: 88px;" src="https://mirrors.creativecommons.org/presskit/buttons/80x15/png/by.png"/></a>
+ <a href="http://creativecommons.org/licenses/by/4.0/"><img id="cc-logo" alt="Creative Commons License" src="https://mirrors.creativecommons.org/presskit/buttons/80x15/png/by.png"/></a>
</footer>
diff --git a/common/latest_uploads.shtml b/common/latest_uploads.shtml
@@ -3,3 +3,4 @@
<li><time>23-Sep-2022</time> <a href="/blog/nerdearla-2022/nerdearla-2022.html">I'm going to Nerdearla 2022</a></li>
<li><time>18-Sep-2022</time> <a href="/blog/sav/sav.html">Sorting Algorithms Visualized</a></li>
<li><time>23-Oct-2021</time> <a href="/blog/dwm-config/dwm-config.html">dwm - The dynamic window manager</a></li>
+<li><time>04-Mar-2021</time> <a href="/blog/vim-config/vim-config.html">vim - The keyboard driven text editor</a></li>
diff --git a/css/article_style.css b/css/article_style.css
@@ -1,7 +1,7 @@
#article-title {
/* text-decoration: underline; */
text-align: left;
- padding-top: 1em;
+ padding-top: .5em;
padding-bottom: .75em;
}
@@ -93,8 +93,8 @@ ul {
margin-top: 1em;
}
#article-title {
- padding-top: .5em;
- padding-bottom: .75em;
+ padding-top: .25em;
+ padding-bottom: .5em;
}
#article-title-with-icon {
padding-bottom: .75em;
diff --git a/css/style.css b/css/style.css
@@ -59,7 +59,7 @@ body {
margin-left: .5em;
margin-right: .5em;
font-size: 16px;
- font-family: "Helvetica", "DejaVu Sans", sans, "Verdana", sans-serif, "Georgia", serif;
+ font-family: "DejaVu Sans", sans, "Verdana", sans-serif, "Georgia", serif;
}
header {
@@ -171,6 +171,18 @@ footer {
font-family: monospace;
}
+#cc-logo {
+ padding: 0;
+ margin: 0;
+ border-width: 0;
+ width: 88px;
+ opacity: 35%;
+}
+
+#cc-logo:hover {
+ opacity: 100%;
+}
+
.footer-div {
padding: 0em 2em 2.5em 2em;
margin-left: auto;
@@ -224,6 +236,7 @@ ul {
.header_buttons {
margin: 0;
+ padding-bottom: 0.5em;
font-size: 1.5em;
display: flex;
list-style-type: none;
@@ -394,8 +407,8 @@ time {
padding-bottom: .10em;
}
#index-title {
- padding-top: .5em;
- padding-bottom: .75em;
+ padding-top: .25em;
+ padding-bottom: .5em;
}
#latest-uploads {
padding-bottom: .25em;
diff --git a/md/bought-a-thinkpad/bought-a-thinkpad.md b/md/bought-a-thinkpad/bought-a-thinkpad.md
@@ -5,54 +5,137 @@ date: "26-Oct-2022"
# I bought a ThinkPad x200 for $27
-A couple of week ago I was scrolling through Facebook marketplace when I saw what It looked like a ThinkPad published for exactly ARS$ 8000 (around USD $27). When I enter the publication it was effectively a ThinkPad, precisely an x200, but it was very dirty, this was the picture attached to the publication:
-[![Thinkpad picture of the publication](owner-pic.jpeg)](owner-pic.png "Thinkpad picture of the publication")
-The owner stated that the machine was working but it had no charger, that was a little bit suspicious ngl but, for the price, I couldn't be picky, I was looking for a cheap old ThinkPad like this for a while and this was the perfect oportunity.
-
-So I contacted the owner, and we agree to meet the next day so I could pick it up. Fortunately the owner was about 30 minutes in public transport from my place so this was also a plus point for the publication.
-
-When the owner give it to me obviously it was very dirty but also I felt like something inside was a little bit loose; the transaction was very quick, in a corner of a known intersection so, I didn't look at it very carefully.
-
-When I arrived home and I started to look at it with more caution, the first thing that I noticed was that the loose part was the battery, so I didn't care much, but, before opening the lid I noticed that the lenovo branding was missing on the left bottom of the lid, and I panic a little since the day before going to pick up the x200 I saw a post which stated that cheap chinese clones of this machines where made, this cheap clones camed with an atom processor (trash compared to x200's processor) and they where smaller in size, and since they were clones, no lenovo branding was present on the clones. When I opened the lid I saw the "Intel Centrino" branding on the left bottom of the palm rest, and that was it, I thought that it was the cheap clone, so I leave on the desk and started to think about the trash that I thought I bought.
-This a picture of the cheap clone, it looks identical but without the lenovo brandong
+A couple of week ago I was scrolling through Facebook marketplace when I saw
+what It looked like a ThinkPad published for exactly ARS$ 8000 (around USD $27).
+When I enter the publication it was effectively a ThinkPad, precisely an x200,
+but it was very dirty, this was the picture attached to the publication:
+[![Thinkpad picture of the publication](owner-pic.jpeg)](owner-pic.png "Thinkpad
+picture of the publication") The owner stated that the machine was working but
+it had no charger, that was a little bit suspicious ngl but, for the price, I
+couldn't be picky, I was looking for a cheap old ThinkPad like this for a while
+and this was the perfect oportunity.
+
+So I contacted the owner, and we agree to meet the next day so I could pick it
+up. Fortunately the owner was about 30 minutes in public transport from my place
+so this was also a plus point for the publication.
+
+When the owner give it to me obviously it was very dirty but also I felt like
+something inside was a little bit loose; the transaction was very quick, in a
+corner of a known intersection so, I didn't look at it very carefully.
+
+When I arrived home and I started to look at it with more caution, the first
+thing that I noticed was that the loose part was the battery, so I didn't care
+much, but, before opening the lid I noticed that the lenovo branding was missing
+on the left bottom of the lid, and I panic a little since the day before going
+to pick up the x200 I saw a post which stated that cheap chinese clones of this
+machines where made, this cheap clones camed with an atom processor (trash
+compared to x200's processor) and they where smaller in size, and since they
+were clones, no lenovo branding was present on the clones. When I opened the lid
+I saw the "Intel Centrino" branding on the left bottom of the palm rest, and
+that was it, I thought that it was the cheap clone, so I leave on the desk and
+started to think about the trash that I thought I bought. This a picture of the
+cheap clone, it looks identical but without the lenovo brandong
[![x200 chinese clone](x200_clone.jpeg)](x200_clone.png "x200 chinese clone")
-After thinking (lasted 5 min max.) I started to look carefully at the machine again, and noticed that there was a lenovo branding on the bottom, so it couldn't be a copy, after searching for Intel Centrino on internet I found that it wasn't a processor but a network card, which the genuine x200 came with, so it actually was a *genunine ThinkPad*.
+After thinking (lasted 5 min max.) I started to look carefully at the machine
+again, and noticed that there was a lenovo branding on the bottom, so it
+couldn't be a copy, after searching for Intel Centrino on internet I found that
+it wasn't a processor but a network card, which the genuine x200 came with, so
+it actually was a *genunine ThinkPad*.
-Since I hadn't the charger I couldn't try if it worked, so I started to deep clean it, at least all the exterior dirt, and the keyboard, which was disgusting.
+Since I hadn't the charger I couldn't try if it worked, so I started to deep
+clean it, at least all the exterior dirt, and the keyboard, which was
+disgusting.
-[![Cleaning thinkpad dirty keyboard](cleaning-kb.jpeg)](cleaning-kb.png "Cleaning thinkpad dirty keyboard")
+[![Cleaning thinkpad dirty keyboard](cleaning-kb.jpeg)](cleaning-kb.png
+"Cleaning thinkpad dirty keyboard")
-A couple of days later I picked up a used charger from a T430 (90w), and the TrackPoint cap which was also missing. When I connected the x200 to the grid the outter lid leds lit up, meaning the ThinkPad was receiving power and the battery so I tried to turn it on, and for my surprise the computer booted to the BIOS *without a problem*.
+A couple of days later I picked up a used charger from a T430 (90w), and the
+TrackPoint cap which was also missing. When I connected the x200 to the grid the
+outter lid leds lit up, meaning the ThinkPad was receiving power and the battery
+so I tried to turn it on, and for my surprise the computer booted to the BIOS
+*without a problem*.
## Updating the BIOS
-After I plugged the computer in and it booted into the bios, I checked for the bios version and it was `3.11`. A quick check on lenovo's x200 webpage revealed that there were BIOS updates up until version `3.16`.
-[![Old bios version](old-bios-version.jpeg)](old-bios-version.png "Old bios version")
-I searched on Google on how to update the bios but I couldn't find a way without using Windows, there was [one way using Linux](https://www.thinkwiki.org/wiki/BIOS_update_without_optical_disk) but honestly in comparison with the Windows way was much more complicated. The most simple way for me was installing Windows, since Lenovo provides a Windows only BIOS updater tool. So I quickly installed Windows 7 on an 240GB kingston SSD which I had lying around and updated the BIOS, it was as simple as running the BIOS updater tool, clicking update and done.
+After I plugged the computer in and it booted into the bios, I checked for the
+bios version and it was `3.11`. A quick check on lenovo's x200 webpage revealed
+that there were BIOS updates up until version `3.16`. [![Old bios
+version](old-bios-version.jpeg)](old-bios-version.png "Old bios version") I
+searched on Google on how to update the bios but I couldn't find a way without
+using Windows, there was [one way using
+Linux](https://www.thinkwiki.org/wiki/BIOS_update_without_optical_disk) but
+honestly in comparison with the Windows way was much more complicated. The most
+simple way for me was installing Windows, since Lenovo provides a Windows only
+BIOS updater tool. So I quickly installed Windows 7 on an 240GB kingston SSD
+which I had lying around and updated the BIOS, it was as simple as running the
+BIOS updater tool, clicking update and done.
## Installing an Operating System
-After adding the SSD, installing Windows 7 and updating the BIOS, I was decided to install linux, I wanted to try void or artix (w/ runit), I had a previous machine with artix ([yt video showing how fast it booted](https://www.youtube.com/watch?v=dBdNQdocrVc)) for almost a year and it worked pretty well, I even gamed CS GO on it.
-So I made a void linux bootable drive following the [void linux docs](https://docs.voidlinux.org/installation/live-images/prep.html), but, when I tried to boot into it, nothing. The BIOS wouldn't recognized the USB drive, I also tried making a bootable USB with [balenaEtcher](https://www.balena.io/etcher/) but again, nothing. The weird thing was that if I made an arch linux bootable USB using the previous both methods the BIOS would boot instantly. Because it was late, I ended up installing arch linux.
-During the installation I noticed that the BIOS was not UEFI compatible, and that was the cause of all the trouble.
-After I finished the installation and configuration of arch linux, I searched for a tool that would allow me to make legacy BIOS compatible boot mediums, I stumbled with [WoeUSB](https://github.com/WoeUSB), I made a void linux bootable usb drive with that tool and it booted instantly, so maybe in a future I will install void linux like I intended in the first place.
-
-Anyway do you like my arch linux rice?
-[![x200 arch linux rice](rice.jpeg)](rice.png "x200 arch linux rice")
-I'm using suckless's [dwm](https://dwm.suckless.org/) and [st terminal](https://st.suckless.org/), firefox for the web browser and dolphin for the graphical file manager.
-You can check out my [dotfiles](https://github.com/mjkloeckner/dotfiles) on github, although I didn't update them yet, but maybe at the time when you are reading this I already did.
+After adding the SSD, installing Windows 7 and updating the BIOS, I was decided
+to install linux, I wanted to try void or artix (w/ runit), I had a previous
+machine with artix ([yt video showing how fast it
+booted](https://www.youtube.com/watch?v=dBdNQdocrVc)) for almost a year and it
+worked pretty well, I even gamed CS GO on it. So I made a void linux bootable
+drive following the [void linux
+docs](https://docs.voidlinux.org/installation/live-images/prep.html), but, when
+I tried to boot into it, nothing. The BIOS wouldn't recognized the USB drive, I
+also tried making a bootable USB with
+[balenaEtcher](https://www.balena.io/etcher/) but again, nothing. The weird
+thing was that if I made an arch linux bootable USB using the previous both
+methods the BIOS would boot instantly. Because it was late, I ended up
+installing arch linux. During the installation I noticed that the BIOS was not
+UEFI compatible, and that was the cause of all the trouble. After I finished the
+installation and configuration of arch linux, I searched for a tool that would
+allow me to make legacy BIOS compatible boot mediums, I stumbled with
+[WoeUSB](https://github.com/WoeUSB), I made a void linux bootable usb drive with
+that tool and it booted instantly, so maybe in a future I will install void
+linux like I intended in the first place.
+
+Anyway do you like my arch linux rice? [![x200 arch linux
+rice](rice.jpeg)](rice.png "x200 arch linux rice") I'm using suckless's
+[dwm](https://dwm.suckless.org/) and [st terminal](https://st.suckless.org/),
+firefox for the web browser and dolphin for the graphical file manager. You can
+check out my [dotfiles](https://github.com/mjkloeckner/dotfiles) on github,
+although I didn't update them yet, but maybe at the time when you are reading
+this I already did.
## Using an x200 in 2022
-The computer works perfectly, the only thing missing is OpenGL version 3.X support, because the integrated graphics card is old the last version supported is 2.1, so I couldn't make kitty nor alacritty terminals work. I ended up installing suckless's simple terminal (st), and it works like a charm, and it's very lightweight too.
-
-The Core 2 Duo althought it has almost 15 years, it is still very usable for surfing the web and writing code, and general daily lightweight task. I'm planning to take the x200 to the University to write notes and check pdfs in the library, since the x200 only weight at around 1.6kg with the 90w charger, its more lightweight than my 2.0kg dell, it is also very small in dimension, the x200 is like a [netbook](https://en.wikipedia.org/wiki/Netbook) with steroids. The most impressive thing is how usable it is with only 2gb of RAM, when I saw in the BIOS that it only had 2gb of RAM I thought that it would be unusable tbh, but no, using dwm the idle ram usage is 200mb aprox. and with a couple of tabs opened in firefox and some terminals the RAM usage sits at around 1.3gb, of course I set a swap partition and when I open more tabs in firefox htop reports some swap usage, so the swap helps a bit.
-
-This is the x200 compiling [translate shell](https://github.com/soimort/translate-shell) from source.
-[![Compiling translate shell](compiling.jpeg)](compiling.png "Compiling translate shell")
-
-Another picture of the x200, recording [MIDI](https://en.wikipedia.org/wiki/MIDI?wprov=sfla1) using [qtractor](https://qtractor.org/). I've also used the x200 for live MIDI processing, and it worked without a problem.
-[![Recording midi on the x200](recording-midi.jpeg)](recording-midi.png "Recording midi on the x200")
+The computer works perfectly, the only thing missing is OpenGL version 3.X
+support, because the integrated graphics card is old the last version supported
+is 2.1, so I couldn't make kitty nor alacritty terminals work. I ended up
+installing suckless's simple terminal (st), and it works like a charm, and it's
+very lightweight too.
+
+The Core 2 Duo althought it has almost 15 years, it is still very usable for
+surfing the web and writing code, and general daily lightweight task. I'm
+planning to take the x200 to the University to write notes and check pdfs in the
+library, since the x200 only weight at around 1.6kg with the 90w charger, its
+more lightweight than my 2.0kg dell, it is also very small in dimension, the
+x200 is like a [netbook](https://en.wikipedia.org/wiki/Netbook) with steroids.
+The most impressive thing is how usable it is with only 2gb of RAM, when I saw
+in the BIOS that it only had 2gb of RAM I thought that it would be unusable tbh,
+but no, using dwm the idle ram usage is 200mb aprox. and with a couple of tabs
+opened in firefox and some terminals the RAM usage sits at around 1.3gb, of
+course I set a swap partition and when I open more tabs in firefox htop reports
+some swap usage, so the swap helps a bit.
+
+This is the x200 compiling [translate
+shell](https://github.com/soimort/translate-shell) from source. [![Compiling
+translate shell](compiling.jpeg)](compiling.png "Compiling translate shell")
+
+Another picture of the x200, recording
+[MIDI](https://en.wikipedia.org/wiki/MIDI?wprov=sfla1) using
+[qtractor](https://qtractor.org/). I've also used the x200 for live MIDI
+processing, and it worked without a problem. [![Recording midi on the
+x200](recording-midi.jpeg)](recording-midi.png "Recording midi on the x200")
## Things to do next
-
-There is a ton of things that I want to try with this computer, like libreboot, swapping motherboards, running void linux, etc. But first I would like to disassemble it entirely to remove all the dust from the motherboard and replace the thermal paste. Also buy a 9-cell battery. The one that came with the computer only lasted around 10 minutes the first charge, after calibration I made it last an hour and a half. I saw a used 9-cell genuine lenovo near my place on MercadoLibre for the same price that I bought the x200 lol (around USD $27). So stay tuned to the blog post to read all the updates on the x200.
+There is a ton of things that I want to try with this computer, like libreboot,
+swapping motherboards, running void linux, etc. But first I would like to
+disassemble it entirely to remove all the dust from the motherboard and replace
+the thermal paste. Also buy a 9-cell battery. The one that came with the
+computer only lasted around 10 minutes the first charge, after calibration I
+made it last an hour and a half. I saw a used 9-cell genuine lenovo near my
+place on MercadoLibre for the same price that I bought the x200 lol (around USD
+$27). So stay tuned to the blog post to read all the updates on the x200.
diff --git a/md/nerdearla-2022/nerdearla-2022.md b/md/nerdearla-2022/nerdearla-2022.md
@@ -7,10 +7,20 @@ date: "23-Sep-2022"
As the title says I'm going to be present at [Nerdearla](https://nerdear.la/).
-This will be my second time that I attend to this event since I've been there for the first time in 2019. I remember that [John 'Maddog' Hall](https://en.wikipedia.org/wiki/Jon_Hall_(programmer)) was making a presentation called "50 years of UNIX and the landing on the Moon", and it was very enjoyable, you can find a record of the presentation [here](https://www.youtube.com/watch?v=9O_FnKZI6_M).
+This will be my second time that I attend to this event since I've been there
+for the first time in 2019. I remember that [John 'Maddog'
+Hall](https://en.wikipedia.org/wiki/Jon_Hall_(programmer)) was making a
+presentation called "50 years of UNIX and the landing on the Moon", and it was
+very enjoyable, you can find a record of the presentation
+[here](https://www.youtube.com/watch?v=9O_FnKZI6_M).
[![Nerdearla 2019](nerdearla-2019.jpeg)](nerdearla-2019.png "Nerdearla 2019")
-That time was my first talk ever, and I loved it, sadly, because of the pandemic, the event could only be remote the past two years.
+That time was my first talk ever, and I loved it, sadly, because of the
+pandemic, the event could only be remote the past two years.
-This time the event is hibrid, meaning half remote half presential, as always the entrance is free, you can get your free tickets at [registro.nerdear.la](https://registro.nerdear.la/). The presential part takes place at Centro cultural Konex at Once, Buenos Aires, on Oct 19 to Oct 22 of 2022.
+This time the event is hibrid, meaning half remote half presential, as always
+the entrance is free, you can get your free tickets at
+[registro.nerdear.la](https://registro.nerdear.la/). The presential part takes
+place at Centro cultural Konex at Once, Buenos Aires, on Oct 19 to Oct 22 of
+2022.
diff --git a/md/sav/sav.md b/md/sav/sav.md
@@ -5,13 +5,18 @@ date: "18-Sep-2022"
# Sorting Algorithms Visualized
-SAV, short for Sorting Algorithms Visualized, is a desktop app that shows how an array is being sorted using different algorithms.
+SAV, short for Sorting Algorithms Visualized, is a desktop app that shows how an
+array is being sorted using different algorithms.
![](sav.gif "Gif showing SAV working")
-I made it using pure C and SDL2 for graphics, you can take a look at it's source code on [Github](https://github.com/mjkloeckner/sav).
+I made it using pure C and SDL2 for graphics, you can take a look at it's source
+code on [Github](https://github.com/mjkloeckner/sav).
-The main purpose of this app was to put in practice the knowledge I gained in C as well with algorithms, and it was like a challenge since I have never used SDL2 graphics before. In the end it was a very enjoyable project since SDL2 per se is a very simple and easy to use library.
+The main purpose of this app was to put in practice the knowledge I gained in C
+as well with algorithms, and it was like a challenge since I have never used
+SDL2 graphics before. In the end it was a very enjoyable project since SDL2 per
+se is a very simple and easy to use library.
Currently the following sorting algorithms can be displayed:
diff --git a/md/testing-syntax-highlight/testing-syntax-highlight.md b/md/testing-syntax-highlight/testing-syntax-highlight.md
@@ -5,13 +5,13 @@ date: "21-Oct-2022"
# Testing code syntax highlight
-This is a testing page for a script that I'm using to highlight
-code blocks within an html file.
+This is a testing page for a script that I'm using to highlight code blocks
+within an html file.
-The script is a heavily modified version of [markdown-code-highlight-go](https://github.com/zupzup/markdown-code-highlight-go)
-that accepts an html file name as command line argument, and prints
-to stdout the html content but with all text inside code tags surrounded
-by css selectors.
+The script is a heavily modified version of
+[markdown-code-highlight-go](https://github.com/zupzup/markdown-code-highlight-go)
+that accepts an html file name as command line argument, and prints to stdout
+the html content but with all text inside code tags surrounded by css selectors.
For example, this is some C code:
@@ -36,8 +36,8 @@ sed -e "s/\$article-title\\$/$title/" -e "s/\$article-date\\$/$date/" \
-e '/\$body\$/d' $template > "$dest_dir"/"$filename".html
```
-This is an old JavaScript script that I was using to add the last modified date to a blog
-post:
+This is an old JavaScript script that I was using to add the last modified date
+to a blog post:
```js
// How do I format a date in javascript?
@@ -57,12 +57,15 @@ let dts = join(dt, format, '-');
document.querySelector('.article-date').innerHTML += " (last updated " + dts + ")";
```
-I removed it from the webpage because it was not working properly, the \`document.lastModified\`
-was always returning the current date. In stead, I added a new part to the shell script that
-builds the pages, the new content parses the output of \`stat\` command and appends it to the article date.
+I removed it from the webpage because it was not working properly, the
+\`document.lastModified\` was always returning the current date. In stead, I
+added a new part to the shell script that builds the pages, the new content
+parses the output of \`stat\` command and appends it to the article date.
-This code is part of the script that I'm using for highlighting code blocks. It's written in
-golang, a language that I didn't knew until I needed to modify [markdown-code-highlight-go](https://github.com/zupzup/markdown-code-highlight-go) to make it work on my use case.
+This code is part of the script that I'm using for highlighting code blocks.
+It's written in golang, a language that I didn't knew until I needed to modify
+[markdown-code-highlight-go](https://github.com/zupzup/markdown-code-highlight-go)
+to make it work on my use case.
```go
rp := strings.NewReplacer("<code class=\"language-", "",
@@ -79,4 +82,6 @@ if formatter == nil {
}
```
-This part is using the [chroma](https://github.com/alecthomas/chroma) syntax highlighter, at the moment I couldn't make it work, but I would like to, since it's much richer in languages support and themes than the previous method.
+This part is using the [chroma](https://github.com/alecthomas/chroma) syntax
+highlighter, at the moment I couldn't make it work, but I would like to, since
+it's much richer in languages support and themes than the previous method.
diff --git a/md/vim-config/vim-config.md b/md/vim-config/vim-config.md
@@ -16,30 +16,31 @@ The way we tell computers what to do is with text, so in order to
write that text we need a set of basic tools, one of which is a text editor,
and this is were Vim is known for.
-Vim is just a console text editor, \`console\` because vim can only be executed from
-the commandline (altough you can find distributions like gvim, which has it's own window),
-a benefit of this is that, it's very lightweight in terms of system resources.
-The term Vim stands for Vi IMproved, Vim is a rewrite and improved version of Vi, a
-console text editor that dates from 1978, it's very similar to vim but with less
-features.
-
-If you installed Vim and you don't know how to move around or insert
-text, I'm only going to tell two things, first, how to exit, press esc
-a couple of times and also Ctrl+C, just to make sure that you are on normal mode,
-then type \`:wq!\` and press enter. I'm also going to tell you how to
-run vim tutor, just execute \`vimtutor\` from the commandline. Vim tutor is a
-very good tutorial included with vim, it teaches you how to use vim in an interactive way.
+Vim is just a console text editor, "console" because vim can only be executed
+from the commandline (altough you can find distributions like gvim, which has
+it's own window), a benefit of this is that, it's very lightweight in terms of
+system resources. The term Vim stands for Vi IMproved, Vim is a rewrite and
+improved version of Vi, a console text editor that dates from 1978, it's very
+similar to vim but with less features.
+
+If you installed Vim and you don't know how to move around or insert text, I'm
+only going to tell two things, first, how to exit, press esc a couple of times
+and also Ctrl+C, just to make sure that you are on normal mode, then type
+\`:wq!\` and press enter. I'm also going to tell you how to run vim tutor, just
+execute \`vimtutor\` from the commandline. Vim tutor is a very good tutorial
+included with vim, it teaches you how to use vim in an interactive way.
## Vim configuration
-Vim is also highly configurable, you can do configure vim by editing the *.vimrc*
-text file, which should be in you home directory in Linux or BSD based OSs,
-if not, you can *create* a new blank one and start from zero.
+Vim is also highly configurable, you can do configure vim by editing the
+*.vimrc* text file, which should be in you home directory in Linux or BSD based
+OSs, if not, you can *create* a new blank one and start from zero.
-You can search for vim settings or copy from other's config files, you can also check
-out my [vim config file](https://github.com/mjkloeckner/dotfiles/blob/master/.vimrc)
-and take out the parts that would fit your needs. The basic settings are almost present
-in every config file like:
+You can search for vim settings or copy from other's config files, you can also
+check out my [vim config
+file](https://github.com/mjkloeckner/dotfiles/blob/master/.vimrc) and take out
+the parts that would fit your needs. The basic settings are almost present in
+every config file like:
```vim
set syntax=on
@@ -52,23 +53,22 @@ set mouse+=a
## Vim plugins
-By default Vim comes with a lot of features missing, for example, a key
-binding to comment a line, or auto close brackets, parenthesis, etc, this
-features you can enable them by installing *plugins*. Vim plugins are
-like strips of other's config files that you can include in yours.
+By default Vim comes with a lot of features missing, for example, a key binding
+to comment a line, or auto close brackets, parenthesis, etc, this features can
+be enabled by installing *plugins*.
-The simpler way of managing plugins is with a plugin manager, I use
+Vim plugins are like pieces of other's config files that you can include in
+yours. The simpler way of managing plugins is with a plugin manager, I use
[vim-plug](https://github.com/junegunn/vim-plug).
### Installing a plugin
-First install vim-plug or any other vim plugin manager, for vim-plug enter
-the link I left you above, and follow the instructions. For any other plugin manger
-I think would be similar.
-
-After you got a plugin manager installed simply call the plugins that you want from
-you .vimrc file, for example I'm using vim-plug and the section
-where I call the plugins in my .vimrc file looks like this:
+First install vim-plug or any other vim plugin manager, for vim-plug enter the
+link I left you above, and follow the instructions. For any other plugin manger
+I think it would be pretty similar. After you got a plugin manager installed
+simply call the plugins that you want from you .vimrc file, for example I'm
+using vim-plug and the section where I call the plugins in my .vimrc file looks
+like this:
```vim
Plug 'christoomey/vim-tmux-navigator'
@@ -82,5 +82,5 @@ Plug 'alvan/vim-closetag'
Plug 'hankchiutw/nerdtree-ranger.vim'
```
-then, in the case of vim-plug, you need to run `:PlugInstall` to install all the new
-plugins added.
+then, in the case of vim-plug, you need to run `:PlugInstall` to install all the
+new plugins added.
diff --git a/scripts/build.sh b/scripts/build.sh
@@ -2,14 +2,14 @@
# Builds a page for all the folders contained in md.
# Copies entire folder to blog folder, generates an html file
-# converting the markdown file *named the same as the subfolder*,
-# then removes the md file conbtained in the dest folder.
+# converting the markdown file *named the same as the subfolder*
-# TODO: leave markdown file to generate a description for the rss feed
+root_folder="$HOME/soydev/webp/kloeckner.com.ar"
-root_folder="/home/mk/soydev/webp/kloeckner.com.ar"
-
-for i in $(ls /home/mk/soydev/webp/kloeckner.com.ar/md); do
- cp -r "$root_folder"/md/$i "$root_folder"/blog &>/dev/null;
- "$root_folder"/scripts/build_page.sh -i "$root_folder"/md/$i/$i.md -t "$root_folder"/scripts/template.html -d "$root_folder"/blog/$i;
+for i in $(ls $root_folder/md); do
+ cp -ur "$root_folder"/md/$i "$root_folder"/blog/ >/dev/null 2>&1
+ "$root_folder"/scripts/build_page.sh \
+ -i "$root_folder"/md/$i/$i.md \
+ -t "$root_folder"/scripts/template.html \
+ -d "$root_folder"/blog/$i;
done
diff --git a/scripts/build_page.sh b/scripts/build_page.sh
@@ -16,7 +16,8 @@ div_article_title_w_logo() {
logo_src=$(echo $1 | grep -zoP '(?<=src=\")(.*?)(?=\")' | tr -d '\0')
logo_alt=$(echo $1 | grep -zoP '(?<=alt=\")(.*?)(?=\")' | tr -d '\0')
logo_title=$(echo $1 | grep -zoP '(?<=title=\")(.*?)(?=\")' | tr -d '\0')
- h1_title=$(echo $2 | grep -zoP '(?<=<h1 id=article-title>)(.*?)(?=</h1>)' | tr -d '\0')
+ h1_title=$(echo $2 | grep -zoP '(?<=<h1 id=article-title>)(.*?)(?=</h1>)' |\
+ tr -d '\0')
}
usage() {
@@ -42,8 +43,10 @@ check_opt() {
[ $OPTIND -eq 1 ] && missing_operand && exit 2
shift "$((OPTIND-1))"
- [ -z "$input" ] || [ ! -e "$input" ] && echo "error: no input file" && exit 1
- [ -z "$templ" ] || [ ! -e "$templ" ] && echo "error: no template fshellile" && exit 1
+ [ -z "$input" ] || [ ! -e "$input" ] &&\
+ echo "error: no input file" && exit 1
+ [ -z "$templ" ] || [ ! -e "$templ" ] &&\
+ echo "error: no template fshellile" && exit 1
[ -z "$dest_dir" ] && dest_dir="."
}
@@ -69,20 +72,20 @@ echo "date: $date"
# echo "dest dir: $dest_dir"
# echo "template: $template"
-[ -z "$title" ] || [ -z "$date" ] && echo "error: no metadata found on file $input" && exit 1
+[ -z "$title" ] || [ -z "$date" ] \
+ && echo "error: no metadata found on file $input" && exit 1
# generate body (skips lines starting with `%`, they're considered metadata)
-# sed '/^% /d' $input | lowdown --html-no-head-ids --html-no-escapehtml --html-no-owasp > body.html
+# sed '/^% /d' $input | \
+# lowdown --html-no-head-ids --html-no-escapehtml --html-no-owasp > body.html
# sed '/^%%/,/^%%/'
-sed '/^%%/,/^%%/d' $input | lowdown --html-no-head-ids --html-no-escapehtml --html-no-owasp > body.html
+sed '/^%%/,/^%%/d' $input |\
+ lowdown --html-no-head-ids --html-no-escapehtml --html-no-owasp > body.html
-# puts ids to <h1> tag and adds paragraph next to it with the article-date
+# puts id to <h1> tag and adds paragraph next to it with the article-date
sed -i -e 's/<h1>/<h1 id=article-title>/g' \
- -e "s/<\/h1>/<\/h1><p class=\"article-date\">$date (last update $last_update)<\/p>/" body.html
-
-# indent: sed + `-e 's/^/\t\t\t/'`
-# (applying indent makes final html more pleasant to view, but causes code
-# block to not be displayed properly)
+ -e "s/<\/h1>/<\/h1><p class=\"article-date\">$date (last update $last_update)<\/p>/"\
+ body.html
sed -e "s/\$article-title\\$/$title/" -e "s/\$article-date\\$/$date/" \
-e "s/\$pagetitle\\$/$pagetitle/" -e '/\$body\$/r./body.html' \
@@ -98,15 +101,21 @@ insert_div_article_title_w_logo() {
div_article_title_w_logo "$logo_line" "$title_line"
- sed -i -e "s^$title_line^<div id=\"article-title-with-icon\">\
- <div id=\"article-icon\"> <img src=\"$logo_src\" title=\"$logo_title\" alt=\"$logo_alt\">\
- <\/div> <h1 id=\"article-title\">$h1_title<\/h1><\/div><p class=\"article-date\">$date (last update $last_update)</p>^"\
- "$dest_dir"/"$filename".html
+ sed -i -e "s^$title_line^\
+\ <div id=\"article-title-with-icon\">\
+\ <div id=\"article-icon\">\
+\ <img src=\"$logo_src\" title=\"$logo_title\" alt=\"$logo_alt\">\
+\ <\/div>\
+\ <h1 id=\"article-title\">$h1_title<\/h1>\
+\ <\/div>\
+\ <p class=\"article-date\">$date (last update $last_update)</p>^"\
+ "$dest_dir"/"$filename".html
sed -i -E '/(^<p>).*?(article-icon).*?<\/p>/d' "$dest_dir"/"$filename".html
}
-[ ! -z "$logo_line" ] && insert_div_article_title_w_logo "$logo_line" "$title_line"
+[ ! -z "$logo_line" ] && \
+ insert_div_article_title_w_logo "$logo_line" "$title_line"
rm body.html &> /dev/null
@@ -116,3 +125,4 @@ mv tmp.html "$dest_dir"/"$filename".html
echo "==> "$filename".html generated succesfully"
echo ""
+
diff --git a/scripts/sync.sh b/scripts/sync.sh
@@ -7,10 +7,28 @@ blog_index_file="common/blog_index.shtml"
latest_uploads_file="common/latest_uploads.shtml"
rss_feed_file=$root_folder/"rss.xml" # RSS feed file
blog_folders=$("$root_folder"/scripts/sort_blog_index.py "$blog_folder")
-
-# set -xe
+index_latest_uploads_count=6
generate_blog_index() {
+ update=false
+ for i in $(ls $root_folder/$blog_folder); do
+ # if exists and it's a directory
+ if [ -d $root_folder/$blog_folder/$i ]; then
+ last_modified=$(stat $root_folder/$blog_folder/$i/$i.md --format "%Y")
+ blog_index_file_date=$(stat $blog_index_file --format "%Y")
+
+ if [ $last_modified -gt $blog_index_file_date ]
+ then
+ echo " └─ $i.html is newer than $blog_index_file"
+ echo "+ Regenerating blog index file"
+ update=true
+ break
+ fi
+ fi
+ done
+
+ $update || echo " └─ Blog index file up to date" && return 1
+
rm -rf $root_folder/$blog_index_file ||:
touch $root_folder/$blog_index_file
@@ -33,7 +51,7 @@ generate_blog_index() {
generate_latest_uploads() {
rm -rf $root_folder/$latest_uploads_file ||:
- head -n 5 $root_folder/$blog_index_file > $root_folder/$latest_uploads_file
+ head -n $index_latest_uploads_count $root_folder/$blog_index_file > $root_folder/$latest_uploads_file
}
generate_rss_feed() {
@@ -101,7 +119,8 @@ check_rss_feed_last_build() {
$updated || echo " └─ Rss feed file up to date" && echo ""
}
-[ ! -d $root_folder ] && echo "error: root_folder: $root_folder not found" && exit 1
+[ ! -d $root_folder ] && \
+ echo "error: root_folder: $root_folder not found" && exit 1
echo "* root_folder: $root_folder"
echo "* blog_folder: $blog_folder"
@@ -112,10 +131,15 @@ echo ""
echo "+ generate_blog_index"
generate_blog_index
-echo "+ generate_latest_uploads"
-generate_latest_uploads
+if [ $? -eq 1 ]; then
+ echo "+ generate_latest_uploads"
+ generate_latest_uploads
+else
+ echo "+ generate_latest_uploads"
+ echo " └─ Index file up to date"
+fi
case "$1" in
--force-rss) echo "+ generate_rss_feed"; generate_rss_feed;;
- *) echo "==> Checking if rss feed needs to be rebuild"; check_rss_feed_last_build;;
+ *) echo "+ check_rss_feed_last_build"; check_rss_feed_last_build;;
esac