Wednesday, November 27, 2019

Raspberry Pi NTP Time...

Some versions of the Raspberry Pi/ Raspbian have NTP disabled

# to check status
timedatectl status

# to enable NTP...
sudo timedatectl set-ntp True

Saturday, November 02, 2019

Formatting Code on Blogs...

Finally found at how to do this using prism.js from the excellent blog post here.

This is done by adding a link to the CSS in <head>, and a link to the JS before closing the <body> tag. The theme is specified with the css name, e.g. prism.min.css or prism-tomrrow.min.css. For Blogger, this has to be done by updating the Blog Theme.

<head>
  ...
  <link
    href='https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism-tomorrow.min.css' 
    rel='stylesheet'/>
</head>
<body>
  ...
  <script
    src='https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/prism.min.js'/>
  <script
    src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js"/>
</body>

There is a full list of the CDN files here, and a full list of supported languages here.

Code is enclosed within the <pre> tag to preserve formatting; and within the <code> tags, also specifying the language for highlighting:

<pre><code class="language-java">   class App {
      public static void main(String[] args) {
         System.out.println("Hello World!");
      }
   }
</code></pre>

Formatting can also be done inline.

Note that to display HTML or PHP some of the symbols will need to be escaped so the browser doesn't try to parse the code. An online converter like Free Online HTML Escape Tool can do this.

Wednesday, October 09, 2019

Installing MicroPython on the ESP8266

Check the port it is attached to in Device Manager. Download the firmware from the MicroPython downloads page.
Open a Command Prompt and do the following:
pip install esptool

# erase the flash

esptool.py --chip esp8266 erase_flash

# For the HUZZAH ESP8266 breakout buttons for GPIO0 and RESET are built in to the board
# Hold GPIO0 down, then press and release RESET (while still holding GPIO0),
# and finally release GPIO0

# install the firmware
esptool.py --chip esp8266 --port COM3 write_flash --flash_mode dio \
   --flash_size detect 0x0 esp8266-20190529-v1.11.bin
Full info on the Adafruit HUZZAH ESP8266 breakout on the Adafruit website.
Full info on MicroPython here.
Connection to the REPL over the serial prompt is at baudrate 115200 using Putty.
Note that the USB to UART serial console cable is connected as follows:
  • n/a
  • White - Tx
  • Green - Rx
  • Red - V+
  • n/a
  • Black - GND

Sunday, January 06, 2019

VirtualBox: Creating a Centos VM...

Create the VM from the DVD ISO, including GNOME.

Make sure on Settings -> System -> Pointing Device is set to USB Tablet.

Then...

'visudo' and add the following: 'paul ALL=(ALL) NOPASSWD: ALL'

sudo yum install VBoxAdditions, gcc kernel-devel dkms perl, make
cd /run/media/****/VBOXADDITIONS*
sudo ./VBoxLiuxAdditions

sudo yum install java java-1.8-openjdk-devel git

in /etc/sysconfig/network-scripts/ifcfg-enp0s3 (or the appropriate network adaptor) set 'ONBOOT=yes'

mkdir ~/git
cd ~/git
git clone -u 'sh gup.sh' paulp@*****:d:/Users/****/Documents/git-server/miscellany.git

ln -sf ~/git/miscellany/vimrc ~/.vimrc
ln -sf ~/git/miscellany/bash_aliases ~/.bash_aliases
ln -sf ~/git/miscellany/gitconfig ~/.gitconfig

Set Terminal Custom Font to DejaVu Sans Mono Book (10 or 9)