Interfacing an analog joystick using Forth

pin import adc import 26 constant x_pin ( GPIO pin of the X axis ) 27 constant y_pin ( GPIO pin of the Y axis ) 2 constant button_pin ( GPIO pin used for the button ) button_pin pull-up-pin ( Defining the button pin as pull-up ) : get-adc-chan pin-adc-chan ; ( Getting the ADC channel of the passed pin ) : x-pin-adc x_pin get-adc-chan...

9front in a BHYVE zone on OmniOS

We will use zadm for zone administration, installation is simple: # pkg install zadm We need a vnic for our zone, so let’s create an instance: # dladm create-vnic -l e1000g0 z_9front0 Then set up the zone with zadm: # zadm create -b bhyve 9front The zone config will open in your $EDITOR, modify it like shown below: { "acpi" : "on", "autoboot" : "true",...

Transmission in pkgsrc zone on OmniOS

We will use zadm for zone administration, installation is simple: # pkg install zadm We need a vnic for our zone, so let’s create an instance: # dladm create-vnic -l e1000g0 zone_transmission_0 Then set up the zone with zadm: # zadm create -b pkgsrc transmission The zone config will open in your $EDITOR, modify it like shown below: { "autoboot" : "true", "bootargs" : "",...

Pushover notification for Transmission

I have transmission-damemon running headlessly on my NAS server and I have set up a Pushover notification for the completed downloads: #!/bin/sh TOKEN="Secret_Token" USER="Unique_User_ID" /usr/local/bin/curl -s \ --form-string "user=$USER" \ --form-string "token=$TOKEN" \ --form-string "message=Kesz: $TR_TORRENT_NAME" \ https://api.pushover.net/1/messages.json You can enable this script adding the following line to settings.json: "script-torrent-done-enabled": true, "script-torrent-done-filename": "/usr/local/etc/transmission/home/bin/pushover.sh", I also use Pushover for the smartmontools daily checks, but instead of...

Basics of Forth, pt. 2

Write a program that takes an integer, calculates the square and prints the result on the screen also print out a newline character \n after the result. : square-calc ( n -- n*n ) depth 1 < if ." Supply an integer and call square-calc again. " else ." The square of the number you entered is " dup * . cr then ; Write...