Initial commit with the conversion

This commit is contained in:
Thomas Schwery 2017-02-09 07:33:35 +01:00
commit 9cd5799384
19 changed files with 525 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
public

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "themes/hugo-zen"]
path = themes/hugo-zen
url = https://github.com/rakuishi/hugo-zen.git

View file

@ -0,0 +1,14 @@
---
title: First Post
date: 2010-04-08 19:48:35
---
I really hope nobody ever saw the previous blogs ! Hum ... ;-)
Okay, so once again I wanted to start a blog to share / store every small things I have lost in my bookmarks.
In my bookmarks are links to virtually everything that has been useful in my system, with notes on how to apply these configurations stored everywhere. Now I want to have someplace where I can order all that and share with anyone interested.
I hope that this time, I won't post three small things and let this blog die ...

View file

@ -0,0 +1,91 @@
---
title: Pretty boot output
date: 2010-04-13 01:07:15
---
I've always asked myself how some Linux distributions have pretty lines along the :
```
Starting ACPI services... [ OK ]
Starting anac(h)ronistic cron: anacron deferred while on battery power. [ OK ]
Starting deferred execution scheduler: atd [ OK ]
```
It appears this is managed by the LSB and there is only one file to edit to have anything you want for your boot output :
```
/etc/lsb-base-logging.sh
```
```
log_end_msg () {
# If no arguments were passed, return
if [ -z "${1:-}" ]; then
return 1
fi
retval=$1
log_end_msg_pre "$@"
# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
if log_use_fancy_output; then
RED=`$TPUT setaf 1`
GREEN=`$TPUT setaf 2`
YELLOW=`$TPUT setaf 3`
NORMAL=`$TPUT sgr0`
$TPUT hpa $((`$TPUT cols` - 12))
else
RED=''
GREEN=''
YELLOW=''
NORMAL=''
fi
if [ $1 -eq 0 ]; then
/bin/echo -e " [ ${GREEN}OK${NORMAL} ]"
elif [ $1 -eq 255 ]; then
/bin/echo -e " [${YELLOW}WARNING!${NORMAL}]"
else
/bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
fi
log_end_msg_post "$@"
return $retval
}
log_action_end_msg () {
log_action_end_msg_pre "$@"
if [ -z "${2:-}" ]; then
end=""
else
end=" ($2)"
fi
/bin/echo -n "${end}"
# Only do the fancy stuff if we have an appropriate terminal
# and if /usr is already mounted
if log_use_fancy_output; then
RED=`$TPUT setaf 1`
BLUE=`$TPUT setaf 4`
NORMAL=`$TPUT sgr0`
$TPUT hpa $((`$TPUT cols` - 12))
else
RED=''
BLUE=''
NORMAL=''
fi
if [ $1 -eq 0 ]; then
/bin/echo -e " [ ${BLUE}DONE${NORMAL} ]"
else
/bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
fi
log_action_end_msg_post "$@"
}
```
Thanks to Google and [Jonathan McDowell](http://www.earth.li/~noodles/blog/2010/01/prettifying-debian-boot-output.html)

26
articles/2010-04-blog.md Normal file
View file

@ -0,0 +1,26 @@
---
title: What's this blog ?
date: 2010-04-12 23:33:54
---
Okay, I already see the questions coming :
* a. What's this blog ?
* b. Why not using Wordpress like everyone else ?
* c. What more does it have ?
* d. Obi-Wan Kenobi ?
So :
* a. I'm using <a href='http://www.steve.org.uk/Software/chronicle/'>Chronicle</a> to power this blog.
* b. Because I was looking for something clean, simple and efficient, because I want to be able to edit every entry by hand, using either a simple nano by ssh or a subversion repository.
* c. No database.
* d. Yup !
To post articles to this blog, I rely on two systems : A text editor and Subversion. Simple, efficient, flexible.
The only thing I have to do is type in any text editor and then commit the file. The script will compile the blog just after the commit and *Magic involved* publish it.
Anything else ?

View file

@ -0,0 +1,57 @@
---
title: xRandr and dual screen
date: 2010-06-09 18:28:23
---
As always when you have to study an exam, you notice something on your computer that doesn't work ... Today was the easy way to connect an external display and use it to ... hum ... work.
As I don't use fancy desktop environment, no gui tools are available. That's not a problem, you just have to do it the easy way: Some obscure key bindings that will launch a script that will do what you wanted.
The program used for display "manipulations" is xrandr. Very useful, simple, does what it claims to do ... and command line ! Perfect, let's do our little script :
```
#!/bin/bash
RESOLUTION="800x600"
INTERNAL="LVDS1"
EXTERNAL="VGA1"
touch /tmp/xrandr
loop=`cat /tmp/xrandr`
case "$loop" in
vga_right)
xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --left-of $INTERNAL
echo "vga_left" > /tmp/xrandr
;;
vga_left)
xrandr --output $INTERNAL --mode $RESOLUTION --output $EXTERNAL --mode $RESOLUTION --same-as $INTERNAL
echo "vga_double" > /tmp/xrandr
;;
vga_double)
xrandr --output $INTERNAL --auto --output $EXTERNAL --off
echo "vga_off" > /tmp/xrandr
;;
*)
xrandr --output $INTERNAL --auto --output $EXTERNAL --auto --right-of $INTERNAL
echo "vga_right" > /tmp/xrandr
;;
esac
```
To be able to use it, just modify the internal and external display name. You can find them just by typing:
```
$ xrandx -q
</pre>
The output should tell you the names:
<pre>
Screen 0: minimum 320 x 200, current 2880 x 1200, maximum 8192 x 8192
VGA1 connected 1600x1200+1280+0 (normal left inverted right x axis y axis) 408mm x 306mm
1600x1200 60.0*+
1280x1024 75.0 60.0
[...]
LVDS1 connected 1280x800+0+0 (normal left inverted right x axis y axis) 286mm x 179mm
1280x800 59.9*+
1024x768 85.0 75.0 70.1 60.0
[...]
TV1 disconnected (normal left inverted right x axis y axis)
```

View file

@ -0,0 +1,42 @@
---
title: How to modify the CPU voltage
date: 2010-06-07 23:08:51
---
Hi !
Today I just experimented with an old tool: *Linux-PHC*. This is a kernel module that replaces the default apci module and allows more control over the cpu. The main function of this module is to allow the user to modify the CPU voltage, usually lower it.
Why would you lower the CPU voltage ? The answer is simple: On a laptop, it means less heat and more battery.
I tried the experiment a long time ago, we still needed to patch and recompile the kernel ... Long procedure, boring when the updates come ... Now it is possible to just compile a module and insert it, so I decided to try again.
You can get the archive from the official website: [http://www.linux-phc.org](http://www.linux-phc.org/forum/viewtopic.php?f=13&t=2).
We need to have the kernel headers to compile a module, so let's install them:
```
$ sudo aptitude install linux-headers-2.6-686
```
After a simple
```
$ ./prepare.sh 2.6.32
$ make
$ sudo make install
```
I was good to go !
First, get the default voltage values:
```
$ cat cpu0/cpufreq/phc_controls
75:39 74:34 8:28 6:23 136:19
```
And then, try some new one ... There is no risk involved, except a beautiful system freeze if you set the voltage too low. Even then, the voltages are reset on reboot ...
```
for i in `seq 0 1`; do echo "75:25 74:20 8:8 6:8 136:8" | sudo tee /sys/devices/system/cpu/cpu$i/cpufreq/phc_controls; done;
```
Have fun !

View file

@ -0,0 +1,14 @@
---
title: Mercurial Repositories
date: 2010-08-14 22:05:53
---
I finally found a way to share the code snipplets that I wrote for a reason or an another with anyone who would have any use for them.
I decided to drop my usual SVN repositories and try another versioning tool : Mercurial. The main reason was that the name sounded cool and that it was really easy to setup some web repository view ... I know it's not really a plus since all VCS provide this feature through a plugin or an another ...
So, if you want to browse some code I wrote in the last months or some configuration files I use on my laptop, just go to <a href='http://hg.schwery.me/'>http://hg.schwery.me/</a>
UPDATE :
After some crash of the server used for this repository, I changed for a repository at BitBucket.

View file

@ -0,0 +1,26 @@
---
title: How to disable Num_Lock
date: 2010-08-16 14:14:08
---
A small note about the most useless key on my keyboard : *Num_Lock*
I don't know about you, but when I have numbers to type, I use the line on top of the keyboard and not the numeric pad that, once activated, replaces some keys of my keyboard - Yes, I'm on a laptop.
So, about disabling that key and rendering it useful :
```
xmodmap -e 'keycode 77 = ISO_Level3_Shift'
```
Replace the keycode with what corresponds to your numlock key. If you don't know the keycode, use xev.
If you use that numlock key sometimes, you can map the Shift+NumLock to NumLock:
```
xmodmap -e 'keycode 77 = ISO_Level3_Shift Num_Lock'
```
Now you have a numlock key that can be used for anything you want ...
PS: The mapping disappear at reboot, you'll have to add it to the startup or login, I'll let you play !

View file

@ -0,0 +1,19 @@
---
title: My blog now supports Gopher
date: 2010-08-18 13:56:34
---
As always during holidays, I have too much time on my hands.
Relevant XKCD: [#554](http://xkcd.com/554/)
My blog now supports Gopher !
You can visit it on ~~gopher://schwery.me~~ __This link is no longer valid,
this server has been torn down__
If you are interested in the script that is responsible for serving the
pages, it is written in Perl5, is some 170 lines long and is bad code
that needs to be rewritten in Haiku.

View file

@ -0,0 +1,28 @@
---
title: Now with OwnCloud
date: 2012-02-07 18:43:05
---
After a long pause in this blog, I just updated the broken edition method. Before, the only method to add new notes
in this blog was using SVN, which was broken when I migrated to Mercurial.
Now, I shared a folder with WebDAV, using ownCloud so that I can access these notes from anywhere using either a mounted
folder in my home directory or the online interface.
As soon as an entry is added or modified, a small watch script launch a blog recompilation :
```
#!/bin/bash
SHARED_FOLDER=""
BUILD_FOLDER=""
while inotifywait -e modify $SHARED_FOLDER; do
cp $SHARED_FOLDER/* $BUILD_FOLDER
chronicle
echo "Recompiled blog"
done
```
Easy !

View file

@ -0,0 +1,62 @@
---
title: Anlyea Quadcopter - Design phase
date: 2016-04-18 00:00:00
---
I started working on a custom Quadcopter for fun. I started from the
[Crossfire by MickeyB](https://www.thingiverse.com/thing:234867) from which
I redesigned large portions to better fit my needs.
![Crossfire 2 Original](crossfire_original.jpg "Original Crossfire 2")
I wanted a somewhat smaller design so that it fits inside a Rako box for
transport. I started using the original arms but then, the original center
piece was too large for the Quad to fit inside the 600mm x 400mm x 120mm
Rako box I had on hand. As the difference was not that large, I decided
to design a new replacement part using [OpenSCAD](http://www.openscad.org)
because, hey, why not ?
If you don't know OpenSCAD, it's a program and a language to describe and
design 3D objects. Instead of drawing like you would usually, you program
what the object looks like using operations and primitive objects. In my
case, in this object, the hole for the existing arm can be described as
four 3mm holes for the screws that will go through the arms.
I decided to create a module that will take the angle of the arm as a parameter
so that the module can be instanciated four times with the different angles.
module arm_hole(angle) {
rotate([0, 0, angle]) {
translate([-12.5, -14, 1.9])
cylinder(d = 3, center = true, h = 4);
translate([ 13 , -14, 1.9])
cylinder(d = 3, center = true, h = 4);
translate([-12.5, 11.5, 1.9])
cylinder(d = 3, center = true, h = 4);
translate([ 13 , 11.5, 1.9])
cylinder(d = 3, center = true, h = 4);
}
}
I continued to redesign the central parts as needed: One top plate, one
bottom plate, a new battery holder that can be mounted on the bottom, an
adapter for the flight controller on top, ... This continued until I only
kept the arms.
The first flight was ... chaotic to say the least. As it was my first design,
I was thinking about a lot of details that would prove to be useless or
wrong. For example, I wanted to put the battery on the bottom because it
was the only place where there was some room left. And for some reason I
wanted to reduce the vibrations to the battery. If you already designed
or even tried a Quadcopter, you will see the missing part in my reasoning:
The battery is the heaviest part of the copter and it was moving as a
pendulum below the copter as the flightcontroller was frantically trying
to correct the level of the craft. Not enough to crash it downright, but
enough to get really rough rides with autolevel and sluggish ones with
manual control of the level.
The Anlyea copter is still in the design phase as I try more designs that
are readily available, print them and study how they fly. I will post a
new article with the full designs once it can fly for longer than 10 seconds
and it doesn't repeatedly crash into the nearest pool, but for now, it
sits confortably into its Rako case.

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

View file

@ -0,0 +1,83 @@
---
title: Debian Preseeded install medium
date: 2016-08-02 09:00:00
---
After the configuration of my servers through Saltstack, I decided to
go furter and to also store the configuration to my laptops and home computed
into Saltstack and thus allow an easy way to format and get a fully configured
system back in place really easily and quickly.
First step was to get a quick way of formatting my computers without or
with only minimal human intervention. As I'm using Debian, it means preparing
a preseeded installation file so that everything is taken care of.
I tried some approaches to build manually an install image but as I went
along, I decided to scratch all that and script the build of this medium.
I looked around and found existing work by [acatton on GitHub](https://github.com/acatton/debian-preseeded-iso).
There were a number of problems I wanted to fix :
1. The hostname should be provided by the user on build
2. A default user account should be created
2. Or perhaps not and the user would have to input something during the install
3. I wanted an encrypted root partition by default
4. I wanted to install a Saltstack minion by default
5. I needed to copy default configuration files
The encryption and installation of a minion were easy tasks and only need
edition of the preseed file. The other points introduced the need for a
templating script that could generate different files as needed and using
user input during the generation of the medium.
As I already knew the Mustache syntax, I decided to use Mustache as a
templating engine to generate the needed preseed files. Instead of
copying the preseed file from the folder into the generated medium image,
I sent it through `mo` with various variables to get 4 different install
seeds.
cat "$PRESEED" | SUITE="jessie" TARGETNAME=$HOSTNAME CREATEUSER=1 ./mo > "$TMP/preseed-jessie-autouser.cfg"
cat "$PRESEED" | SUITE="stretch" TARGETNAME=$HOSTNAME CREATEUSER=1 ./mo > "$TMP/preseed-stretch-autouser.cfg"
unset CREATEUSER
cat "$PRESEED" | SUITE="jessie" TARGETNAME=$HOSTNAME ./mo > "$TMP/preseed-jessie-manualuser.cfg"
cat "$PRESEED" | SUITE="stretch" TARGETNAME=$HOSTNAME ./mo > "$TMP/preseed-stretch-manualuser.cfg"
And then, I changed the `isolinux/txt.cfg` configuration file to get an
entry for each configuration file.
cat >> isolinux/txt.cfg <<EOE
label install-jessie-manualuser
menu label ^Install Jessie $HOSTNAME (manual user)
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz auto=true file=/cdrom/preseed-jessie-manualuser.cfg
EOE
cat >> isolinux/txt.cfg <<EOE
label install-jessie-autouser
menu label ^Install Jessie $HOSTNAME (auto Valdor user)
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz auto=true file=/cdrom/preseed-jessie-autouser.cfg
EOE
cat >> isolinux/txt.cfg <<EOE
label install-stretch-autouser
menu label ^Install Stretch $HOSTNAME (manual user)
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz auto=true file=/cdrom/preseed-stretch-manualuser.cfg
EOE
cat >> isolinux/txt.cfg <<EOE
label install-stretch-autouser
menu label ^Install Stretch $HOSTNAME (auto Valdor user)
kernel /install.amd/vmlinuz
append vga=788 initrd=/install.amd/initrd.gz auto=true file=/cdrom/preseed-stretch-autouser.cfg
EOE
The Saltstack minion is installed by the preseed
`d-i pkgsel/include string salt-minion plymouth plymouth-themes` directive
and with the configuration file also copied at the end of the install
with `d-i preseed/late_command string cp -a /cdrom/preseed/minion /target/etc/salt/`.
The only manual interaction needed is to accept the minion key after the
reboot and let Saltstack up the newly installed computer.

View file

@ -0,0 +1,17 @@
---
title: Migration to Hugo
date: 2017-02-08 22:00:00
---
After an another long pause on this blog, I piled up a number of notes in
my notebook that I have to write down. But first, like with any other
reboot, I have to refresh my tools.
This time, I migrated my blog from Chronicle to [Hugo](http://www.gohugo.io/).
I put my existing articles through a simple converter to get them in markdown.
The articles are written in Markdown, converted and processed through Hugo.
So now, I just have to organize the contents of my notebook, write it down
and I will finally be able to erase it to give some more room for new
projects !

17
config.toml Normal file
View file

@ -0,0 +1,17 @@
contentDir = "articles"
layoutDir = "layouts"
publishDir = "public"
buildDrafts = false
baseURL = "http://thomas.inf3.ch"
canonifyURLs = true
theme = "hugo-zen"
languageCode = "en"
title = "Thomas Schwery"
author = "Thomas Schwery"
copyright = "Thomas Schwery, All rights reserved."
[params]
logo = "/images/logo.png"
subtitle = "A Glog ... Plog ... Blog ..."

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en-US{{ end }}">
<head>
<meta charset="utf-8">
{{ .Hugo.Generator }}
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//fonts.googleapis.com/css?family=Roboto:400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/github.min.css">
<link rel="stylesheet" href="/css/normalize.css">
<link rel="stylesheet" href="/css/skeleton.css">
<link rel="stylesheet" href="/css/custom.css">
<link rel="alternate" href="/index.xml" type="application/rss+xml" title="{{ .Site.Title }}">
<title>{{ $isHomePage := eq .Title .Site.Title }}{{ .Title }}{{ if eq $isHomePage false }} - {{ .Site.Title }}{{ end }}</title>
</head>
<body>
<div class="container">
<header role="banner">
<div class="header-logo">
<a href="/"><img src="{{ .Site.Params.logo }}" width="60" height="60" alt="{{ .Site.Title }}"></a>
</div>
{{ if eq $isHomePage true }}<h1 class="site-title">{{ .Site.Title }}</h1><h2>{{ .Site.Params.subtitle }}</h2>{{ end }}
</header>

BIN
static/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

1
themes/hugo-zen Submodule

@ -0,0 +1 @@
Subproject commit 924fcebb10a39fc7d8a29fd202f4a993feb2c6e2