Ubuntu shortcuts and tricks…

•2018/04/26 • Comments Off on Ubuntu shortcuts and tricks…

Need the path in text in the file manager?

gsettings set org.gnome.nautilus.preferences always-use-location-entry true
nautilus -q

MQTT:

mosquitto_pub -h 192.168.1.13 -t TxNamib/servo.0073/05 -r -m "0"
mosquitto_sub -h 192.168.1.13 -v -t '#'

 

Advertisements

future python, older pip

•2017/10/30 • Comments Off on future python, older pip

python3.6 -m pip install vpython

Game of Life, in Python

•2017/09/08 • Comments Off on Game of Life, in Python
# playground has an extra row and column on each edge. 
#  this will remove the need to check for neighbors out of bounds.

MAXX = 11
MAXY = 11

import numpy

def neighborsAlive( x, y ):
  return playground[x-1][y-1]+playground[x][y-1]+playground[x+1][y-

1]+playground[x-1][y]+playground[x+1][y]+playground[x-1][y+1]+playground[x][y

+1]+playground[x+1][y+1]

playground = numpy.zeros(( MAXX+2, MAXY+2 ))

playground[3][3] = 0
playground[3][4] = 1
playground[3][5] = 1

playground[4][3] = 0
playground[4][4] = 0
playground[4][5] = 1

playground[5][3] = 1
playground[5][4] = 1
playground[5][5] = 1 	

playground[10][3] = 1
playground[10][4] = 1
playground[10][5] = 1 	

print( playground )

newlife = numpy.zeros(( MAXX+2, MAXY+2 ))

# only do 10 cylces
for i in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]:
  print( "" )
  newlife = numpy.zeros(( MAXX+2, MAXY+2 ))
  for x in range( 1, MAXX+1 ):
    for y in range( 1, MAXY+1 ):
      myNeighbors = neighborsAlive(x,y)
      #print( playground[x][y], myNeighbors )

      # rules
      if playground[x][y] == 1:   # alive 
        #print( x, y, playground[x][y], myNeighbors )
        if myNeighbors < 2: newlife[x][y] = 0 else: if myNeighbors > 3:
            newlife[x][y] = 0
          else:
            newlife[x][y] = 1     # stay alive
      else:                       # dead
        if myNeighbors == 3:
          newlife[x][y] = 1

  print( newlife )
  # make the new one the current one for the next step
  playground = newlife

RRRduino without crystal

•2017/06/06 • Comments Off on RRRduino without crystal

https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard

Arduino as ISP (after the Arduino UNO has been loaded with Examples->11.ArduioISP

Make sure the target has a why to run by itself with power and all ICSP pins are soldered.

Burn Bootloader on the correct COM.

Then use Uno without chip to Tx the real code in.

 

MQTT…

•2017/05/24 • Comments Off on MQTT…
sudo apt-get install mosquitto mosquitto-clients

mosquitto_pub -h 192.168.16.152 -t mast.0002 -r -m "Approach"     // -r for retain, -p 1883

mosquitto_sub -v -h 192.168.16.152 -t '#'          // -p 1883, subscribe to all
mast.0002 Approach

Upper to lowercase…in filenames…

•2017/02/25 • Comments Off on Upper to lowercase…in filenames…

Yes, I just don’t like external gadgets and very expensive drone cameras to save files as DJI_0717.MP4 … .mp4 is much easier on the eyes.

me@myPuter:~/myFolder$ rename 'y/A-Z/a-z/' *

OpenCV 3.1.0 installed in Ubuntu in 16.04.1 LTS

•2016/12/29 • Comments Off on OpenCV 3.1.0 installed in Ubuntu in 16.04.1 LTS

Could not do the same with OpenCV 3.2.0, but here is and excellent how to install 3.1.0, using python 3.5 in Ubuntu 16.04.1 LTS:

http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/

The compile part takes same time, so turn a movie on when you enter “make -j2”.

A note later why it is marked “trains”…