Books I’m reading at the moment… December 2018

December 2nd, 2018

The Chronicles of Thomas Covenant part IV by Stephen R. Donaldson (https://en.wikipedia.org/wiki/The_Chronicles_of_Thomas_Covenant)

American Gods by Neil Gaiman
(https://en.wikipedia.org/wiki/American_Gods)
I picked this up in used books shop. I “know” Neil Gaiman from his collaboration on Good Omens (https://en.wikipedia.org/wiki/Good_Omens) with the late Terry Pratchett. It’s good to hold a physical book in the hand while reading because I mostly read e-books on my tablet, but it’s just not the same.

PADI Tec Deep Diver Manual
Not sure if I will ever do this… but it’s interesting to read about it, at least at the moment.

Books I’m reading at the moment… November 2018

November 3rd, 2018

攻殻機動隊 1.5 Human Error Processor by Masamune Shirow

The Last Ringbearer (https://en.wikipedia.org/wiki/The_Last_Ringbearer)

The Chronicles of Thomas Covenant part III by Stephen R. Donaldson (https://en.wikipedia.org/wiki/The_Chronicles_of_Thomas_Covenant)

The Long Walk by Stephen King / Richard Bachman
(https://en.wikipedia.org/wiki/The_Long_Walk)
I read that book in German as a teenager and I wanted to re-read it to see how it holds up and whether I would discover something new about it.

The Eyes of the Dragon by Stephen King
(https://en.wikipedia.org/wiki/The_eyes_of_the_dragon)
I read this book at around the same time as the Long Walk and it was a nice re-read.

American Gods by Neil Gaiman
(https://en.wikipedia.org/wiki/American_Gods)
I picked this up in used books shop. I “know” Neil Gaiman from his collaboration on Good Omens (https://en.wikipedia.org/wiki/Good_Omens) with the late Terry Pratchett. It’s good to hold a physical book in the hand while reading because I mostly read e-books on my tablet, but it’s just not the same.

PADI Tec Deep Diver Manual
Not sure if I will ever do this… but it’s interesting to read about it, at least at the moment.

潜水士試験:合格

October 11th, 2018

What a mess that was… everything completely in Japanese and out of more than 300 testees, I was the only non-Asian person. Well, I passed and that’s what counts.

Above: I was testee #0047

Looking at the list, most people passed but there were some who failed. Anyway, most people used more or less the same textbooks, I will post mine here later. There does not seem to be so much variety of textbooks on this subject.

Next step: Find employment as part-time scuba diving instructor?

Anyway, time for a celebratory beer…

 

Books I’m reading at the moment… October 2018

October 9th, 2018

A Short History of Nearly Everything by Bill Bryson (https://en.wikipedia.org/wiki/A_Short_History_of_Nearly_Everything) – finished

The Chronicles of Thomas Covenant part I by Stephen R. Donaldson (https://en.wikipedia.org/wiki/The_Chronicles_of_Thomas_Covenant) – finished

攻殻機動隊 1.5 Human Error Processor by Masamune Shirow

The Chronicles of Thomas Covenant part II by Stephen R. Donaldson (https://en.wikipedia.org/wiki/The_Chronicles_of_Thomas_Covenant) – finished

The Last Ringbearer (https://en.wikipedia.org/wiki/The_Last_Ringbearer)

Scientific experiments I’d be interested in (I) – coffee

October 9th, 2018

Recently, I’ve been thinking about some experiments which I can’t do by myself but would very much like to know the results… therefor, a new series on this blog.

First up the question “can you trick the body into reacting to caffeine with a non-caffeinated fluid”?

Evidently, the body reacts to the chemical caffeine when coffee is drunk. What I would like to know is if it’s possible to trigger the same reaction by drinking a non-caffeinated fluid that tastes and looks the same as coffee.

Cons that it’s not possible:
-If the fluid does not contain caffeine, there will be no reaction because it’s a physical reaction triggered by the intake of such a fluid

Pros that it’s possible:
-There is such a thing as a placebo effect
-If you can quicken your beard growth by thinking about sex, why not invoke a bodily reaction to caffeine intake?

Pending further research…

My first self-created course on memrise.com

September 28th, 2018

I’ve been posting about memrise on a couple of occasions. This time rather than bragging how many words I’ve learned and how many points I made, I created my own course:

https://www.memrise.com/course/2053021/qian-shui-shi-shi-yan-nodan-yu/

It’s a Japanese -> English course supposed to help you with vocabulary required to help passing the Japanese dive theory test called 潜水士試験

(I have no idea why the URL uses the Mandarin pinyin pronounciation for the test… I’ve inputted Japanese kanji – I also opened a help call with memrise but no reaction so far)

Creating the course was not difficult but you need to prepare the list(s) ahead and put the colums in the right order if you want to mass-import the lists.

Good luck, give it a try yourself (the course as well as creating your own course ^^)

A script to allow non-admin users to install security updates on CentOS

September 27th, 2018

At work, I needed to come up with a script that allows non-admin users to install security updates on CentOS servers.

The only real dependency is yum-utils (because it uses the binary needs-restart to check the status of things) but you should also create a folder to store the script and of course a sudo command for the users to run.

Please also note the creative accumulation of several copied scripts to create the multiple choice menus…. I patched together some code samples found on the usual websites where coding is discussed.

HTH someone out there…

#!/bin/bash

######################################
## only root can run this (or sudo) ##
######################################

# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo “This script must be run using sudo (“sudo /opt/yumcleanup/restartsetupscript”) or as root. Exiting…” 1>&2
exit 1
fi

###############
## functions ##
###############

display_help () {
echo “The script can be run without interaction using the following”
echo “command line option: –non-interactive”
echo “This will silently install security updates only and restart”
echo “affected services.”
echo ” ”
echo “Calling the script with –help will also display this help text”
echo “as does calling the script with an unknown option.”
exit
}

set_exports () {
export http_proxy=”http://my.proxy.server.local:11111″
export https_proxy=”http://my.proxy.server.local:11111″
export proxy=”http://my.proxy.server.local:11111″
}

unset_exports () {
unset http_proxy
unset https_proxy
unset proxy
}

outputs_preparation () {
`rm -f $outputs`
touch $outputs
chmod 600 $outputs
}

outputr_preparation () {
`rm -f $outputr`
touch $outputr
chmod 600 $outputr
}

outputs_filling () {
`$mybin -s >> $outputs`
}

outputr_filling () {
`$mybin -r >> $outputr`
}

services_restart () {
while read line
do
# Restarting $line
`/bin/systemctl stop $line`
`/bin/systemctl start $line`
done < $outputs
}

#################
## getopt test ##
#################

getopt –test > /dev/null
if [[ $? -ne 4 ]]; then
echo “I’m sorry, `getopt –test` failed in this environment.”
exit 1
fi

#######################
## setting variables ##
#######################

outputs=/tmp/myoutputs
outputr=/tmp/myoutputr
mybin=/bin/needs-restarting

getopt –test > /dev/null
if [[ $? -ne 4 ]]; then
echo “I’m sorry, `getopt –test` failed in this environment.”
exit 1
fi

LONGOPTIONS=non-interactive,help

PARSED=$(getopt –options=$OPTIONS –longoptions=$LONGOPTIONS –name “$0” — “$@”)
if [[ $? -ne 0 ]]; then
# e.g. $? == 1
# then getopt has complained about wrong arguments to stdout
echo “something wrong, showing help instead in one second”
display_help
exit 2
fi

# echo “$PARSED”

# read getopt’s output this way to handle the quoting right:
eval set — “$PARSED”

# now enjoy the options in order and nicely split until we see —
while true; do
case “$1” in
–non-interactive)
n=y
# echo “doing silent stuff now… TODO: disable this line”
# should do these steps: (probably better to put this in its own function)
set_exports
`yum -y -d0 –security update`
outputs_preparation
outputs_filling
services_restart
unset_exports
exit
shift
;;
–help)
h=y
# echo “displaying help in two seconds”
display_help
shift
;;
–)
#echo “instead of — showing help in three seconds”
#display_help
shift
break
;;
*)
echo “Programming error”
echo “displaying help instead in four seconds”
display_help
exit 3
;;
esac
done

set_exports
#export http_proxy=”http://my.proxy.server.local:11111″
#export https_proxy=”http://my.proxy.server.local:11111″
#export proxy=”http://my.proxy.server.local:11111″

# cleanup before we do anything
#`rm -f $outputs`
#`rm -f $outputr`

# install updates, ask user which type of updating he wants to do
echo “”
echo “Please select the type of updates you want to install: ”
echo “”
PS3=’Enter your choice: ‘
options=(“All updates (will most certainly require a reboot)” “Security updates only (reboot probably not required)” “All updates except kernel and kernel-related packages (reboot might be required)” “Quit (you will need to run the script again later)”)
select opt in “${options[@]}”
do
case $opt in
#”Option 1″)
“All updates (will most certainly require a reboot)”)
echo “Installing all updates… please wait”
`yum -y -d0 update` &
PIDD=`ps -ef|grep yum | grep -v yumclean |grep -v grep | awk ‘{print $2}’`
while sleep 8; do echo “still installing…” && kill -0 $PIDD 2>/dev/null || break; done
break
;;
#”Option 2″)
“Security updates only (reboot probably not required)”)
echo “Installing only security updates…. please wait”
`yum -y -d0 –security update` &
PIDD=`ps -ef|grep yum | grep -v yumclean |grep -v grep | awk ‘{print $2}’`
while sleep 8; do echo “still installing…” && kill -0 $PIDD 2>/dev/null || break; done
break
;;
#”Option 3″)
“All updates except kernel and kernel-related packages (reboot might be required)”)
echo “Installing all updates except kernel and kernel-related packages… please wait”
`yum –exclude=kernel* -y -d0 update` &
PIDD=`ps -ef|grep yum | grep -v yumclean |grep -v grep | awk ‘{print $2}’`
while sleep 8; do echo “still installing…” && kill -0 $PIDD 2>/dev/null || break; done
break
;;
#”Quit”)
“Quit (you will need to run the script again later)”)
echo “Quitting… bye!”
exit
;;
*) echo “invalid option $REPLY”;;
esac
done

unset_exports
#unset http_proxy
#unset https_proxy
#unset proxy

##############################
## section services restart ##
##############################

outputs_preparation
outputs_filling

# `$mybin -s >> $outputs`
# chmod 600 $outputs

if [ `wc -l $outputs | awk ‘{ print $1 }’` -ge 1 ]; then
echo “”
echo “The following services should be restarted:”
echo “******************************”
cat $outputs
echo “******************************”

while true
do
read -p “Do you want to restart the above services? (y/N)” answer

case $answer in
[yY]* ) #
echo “restarting services….”

while read line
do
echo Restarting $line
`/bin/systemctl stop $line`
`/bin/systemctl start $line`
done < $outputs

break;;

[nN]* )echo “exiting…” && break ;;

* ) echo “Please enter Y or N”;;
esac
done
else
echo “******************************”
echo “No services need to be restarted.”
echo “******************************”
fi

# section reboot

outputr_preparation
outputr_filling

# `$mybin -r >> $outputr`
# chmod 600 $outputr

echo “”
echo “Please check the following output and decide whether a reboot is required:”
echo “***************”
cat $outputr
echo “***************”

while true
do
echo “If you need to disable some kind of monitoring before rebooting the server,”
echo “please cancel this script (Ctrl+c) and disable the monitoring now,”
echo “then re-run this script again.”
read -p “Do you want to reboot the server in 60 seconds? (y/N)” answer

case $answer in
[yY]* ) #
echo “Scheduling reboot….”

shutdown -r -t 1

break;;

[nN]* )echo “exiting…” && exit;;

* ) echo “Please enter Y or N”;;
esac
done

Kabutomushi are awesome

August 18th, 2018

In Japan, there is a famous and well-loved beetle called カブト虫 (kabutomushi), which goes by the common name of Japanese rhinoceros beetle.

Anyway, here’s the wikipedia link to it:
https://en.wikipedia.org/wiki/Japanese_rhinoceros_beetle

You might have seen pictures and if you watch anime, you will probably have heard of them. However, these things are huge. Check this out:

(No banana for scale but an adult’s hand)

They’re completely harmless but it scratches slightly when they hold on tight due to the slightly hooked ends of their legs.

They can be kept as pets although they don’t live very long. Since they’re mostly active at night they will sleep during the day. They eat jelly and fruits e.g. pieces of apples and watermelons.

For some reasons, they will invariably fight an other species of beetle called クワガタ (kuwagata) when their paths cross.

The above picture was taken at a exhibition on beetles in Shinjuku.

Replacement pen for the Casio EX-word Dataplus 6 XD-D10000

August 18th, 2018

Nowadays, everything breaks… somehow I even managed to break the pen for my Casio EX-word 電子辞書… somehow. Don’t ask me how because I don’t know either…

Anyway, finding a replacement was not easy… the Casio homepage is less than helpful. But accidentally I’ve found some replacement pens that are 98% perfect (not 100% because the replacements are slightly loose in the penholder incorporated in the main body of the device).

Here they are:

If you need replacement pens too, maybe this will help.

A memrise milestone…

July 18th, 2018

Recently surpassed a streak of 10^3 consecutive days of learning on memrise… don’t think I’m going to be able to keep this up until I hit 10^4… and guess what, no rewards or points or anything for it.

Here’s a screenshot:

Which also means that slightly more than 1000 days ago, the app and the website didn’t work and I lost a 350ish day streak. Nobody ever said sorry about that then.