Modelling arithmetic calculator in Fallout 4 game: Four bit adder

On the past weekend a friend of mine has asked if I really understand how all those bits are running inside computers. I answered positively for sure, but nevertheless decided to build a bicycle electronic device that require binary logic and operation. Having no Arduino, Raspberry or even soldering iron at my place I put my eyes on emulator … Fallout 4 game. Guys, really, who needs some boring emulator if we can have lots of fun, playing a game with amazing 3D graphic?

See my short video about switching tumblers on a huge concrete structure of CalcWall version 0.1:

I was planning to build at least Adder and Subtractor parts along with some kind of display and keyboard, but unfortunately my vacation is now over, so I have lost a chance to construct something more than a simple Adder implementation in a nearest future.

Current CalcWall schematic, not fully compliant to standards, is shown below:

Advertisements
Posted in My projects, Offtop | Tagged , , , , , , , | Leave a comment

Simple snake/wormlike creatures mod for Minetest game

Slugs. Find them on grass and dirt. A simple snake/wormlike creatures mod for Minetest to please my son who loves crafting 🙂

This is the very first, initial release. Don’t expect much, it’s very buggy and ugly. Slugs are brainless, they just move.

Download it from https://github.com/mezantrop/slugs

Installation: copy into Minetest mods directory, unpack, enable in the game.

Any ideas, suggestions and fixes are strongly welcome!

Short video is here: http://www.youtube.com/watch?v=3vZAIGXMFHY

Posted in My projects | Tagged , , , , , , , , | Leave a comment

svcstats.py – Report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface

My *stat-like utility to report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface.

Report IBM SVC/Storwize storage system performance statistics in CLI using SMI-S interface

  • Requires Python 3 with ‘pywbem’ module
  • Before running svcstats.py, enable statistic on SVC/Storwize system:
    svctask startstats -interval <1-60 minutes>

Download svcstats.py from GitHub

Usage:
svcstats.py -n|-v|-m|-d -a address -u user -p password [-f minutes] [-ht]

Options:
-n, -v, -m or -d
option -q not recognized
Show nodes, vdisks, mdisks or drives performance statistics.

-a address -u user -p password
Valid IP/DNS address, username and passwors to connect with IBM SVC/Storwize storage system
[-f minutes]
Optional report frequency interval. Must not be less then default "StatisticsFrequency" value.
[-h]
Disable column headers.
[-t]
Show report date/time creation timestamp on the storage system

IBM SVC/Storwize CIM agent documentation

Project page: svcstats.py

Posted in My projects, Storage, Storage Automation | Tagged , , , , , , , , , , , , | Leave a comment

Extracting Performance Data from IBM Storwize

Vadim Zaigrin

Universal Storage Collector could extract performance data not only from EMC Storage Systems 🙂

New Extractor extracts data from IBM Storwize storage family.

View original post 116 more words

Posted in Copy-paste, Storage | Tagged , , , | 1 Comment

Executing a batch of commands on multiple IBM SVC/Storwize storage systems

Sometimes you have to change several configuration parameters or run multiple commands over a list of IBM SVC storage systems. Here is my small Python 3 script to do the stuff quickly. It requires Paramiko module to handle SSH interactions.

Edit svcrun_conf.py to set targets, logins, passwords and all other parameters.

Usage: ./svcrun.py

#!/usr/bin/python3

# svcrun.py - using SSH, execute a batch of commands on multiple IBM SVC/Storwize storage systems
# 
# Python 3 and paramiko module are required
# Edit svcrun_conf.py to set targets, logins, passwords and all other parameters
#
# Usage:
#  ./svcrun.py
#
# 2017.09.14  v 1.0   Mikhail Zakharov <zmey20000@yahoo.com>

import sys
import datetime
import paramiko

# Configurable values are in svcrun_conf.py
import svcrun_conf


def ssh_exec(command, target, port=22):
    """Execute a command via SSH and read results"""

    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

    try:
        client.connect(target[0], username=target[1], password=target[2], port=port)
    except:
        return 'Error: {user}@{target}: is inaccessible: {error}'.format(user=target[1], target=target[0],
                                                                         error=sys.exc_info()[1])

    stdin, stdout, stderr = client.exec_command(command)

    error = stderr.read()
    if error:
        error = error.decode('US-ASCII')
        client.close()
        return 'Error: {user}@{target}: "{command}" has failed: {error}'.format(target=target[0], user=target[1],
                                                                                command=command, error=error)

    data = stdout.read()
    client.close()

    try:
        data = data.decode('UTF-8')
    except UnicodeDecodeError:
        data = data.decode('US-ASCII')

    return data


def runcommand(target, command):
    dt = '{0:%Y-%m-%d-%H-%M-%S}'.format(datetime.datetime.now())

    print(dt, 'Run command: "{cmd}"'.format(cmd=command), file=sys.stderr)
    print(ssh_exec(command, target), file=open(dt + '_' + target[0] + '_' + command.split()[0] + '.out', 'a'))


for target in svcrun_conf.svc_targets:
    for command in svcrun_conf.svc_commands:
        runcommand(target, command)

print('Done', file=sys.stderr)

Configuration file is required:

# Configuration file for svcsrun.py

# Default SVC/Storwize credentials
svc_username = 'username'
svc_password = 'password'

# SVC/Storwize systems to run commands on
svc_targets = {
    # 'Hostname/IP', 'Login', 'Password'),
    ('192.168.1.11', svc_username, svc_password),
    ('192.168.1.12', 'anotheruser', 'secret')
}

# Commands to run one by one on each SVC/Storwize system
svc_commands = [
    'lssystem -delim \,',
    'lsvdisk -nohdr -bytes -delim \,'
]

Download it from GitHub

Posted in Storage Automation, Tips & tricks | Tagged , , , , , , , , , | Leave a comment

Scan IBM SVC/Storwize system for “SCSI ID Mismatches”

A small addition to the SAN/Storage CLI Toolbox which shows so called SCSI ID (LUN) mismatches on IBM SVC/Storwize systems. This Bourne shell/awk script shows the list of the same vdisks that are mapped with different SCSI IDs. Should be useful for clusters, especially VMware.

#!/bin/sh

# -----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# zmey20000@yahoo.com wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Mikhail Zakharov
# -----------------------------------------------------------------------------

# simmatch.sh - Scan IBM SVC/Storwize system for "SCSI ID Mismatches"
# 2017.08.31    v1.0

delim=","			# Main delimiter
delim2=";"			# Second layer delimiter
fashion="../fashion/fashion"	# fashion SSH wrapper. Comment/uncomment the
				# appropriate lines below if you want pure SSH

lshostvdiskmap="lshostvdiskmap -nohdr -delim $delim"

# ----------------------------------------------------------------------------- 
usage() {
    echo "Usage:"
    echo " simmatch.sh <target> <user> <password>"
    exit 1
}
  
# ----------------------------------------------------------------------------- 
[ "$#" -ne 3 ] && usage

target="$1"
user="$2"
password="$3"

awk="gawk"				# We need gawk to do the stuff

# Uncomment ssh and comment fashion if you like
#ssh "$user"@"$target" "$lshostvdiskmap" | $awk -F "$delim" -v d2=$delim2 '
$fashion "$target" "$user" "$password" "$lshostvdiskmap" | 
	$awk -F "$delim" -v d2=$delim2 '
{ 
	# Put all records into an array
	for (f = 1; f <= NF; f++)
		dm[NR, f] = $f
	dm[NR, NF + 1] = 0		# Mapping count
	dm[NR, NF + 2] = ""		# SCSI ID List
}
END {
	OFS = FS
	for (l = 1; l <= NR; l++)
		for (l1 = 1; l1 <= NR; l1++)
			if (dm[l, 4] == dm[l1, 4]) {
				dm[l, NF + 1] += 1
				dm[l, NF + 2] = dm[l, NF + 2] dm[l1, 3] OFS
			}
	# Pack SCSI ID List
	for (l = 1; l <= NR; l++) if (dm[l, 9] > 1) {
			len_sidlst = split(dm[l, NF + 2], sidlst)
			# get unique SCSI IDs only
			delete usidlst
			for (le = 1; le <= len_sidlst; le++)
				usidlst[sidlst[le]]++
			# Save unique SCSI IDs back to the list
			delete dm[l, NF + 2]
			for (sid in usidlst)
				if (sid != "")
					dm[l, NF + 2] = dm[l, NF + 2] sid d2
		}
	# Print out report
	print "Host ID", "Host Name", "SCSI ID", "Vdisk ID",\
		"Vdisk Name", "Vdisk UID", "IO Group ID",\
		"IO Group Name", "Mapping count", "SCSI ID List"
	for (l = 1; l <= NR; l++) if (split(dm[l, NF + 2], sidlst, d2) > 2) {
			for (f = 1; f < NF + 2; f++)
				printf dm[l, f] OFS
			# Ugly strip of the last "d2" occurrence
			printf substr(dm[l, NF + 2], 1, length(dm[l, NF + 2]) - 1)"\n"
		}
} 
'

Download it from GitHub.

Posted in Storage Automation, Tips & tricks | Tagged , , , , , , , , , , , , | Leave a comment

Accessing HP/3PAR storage systems using Python and SSH

I have just found a small script on Python 3 which I wrote for D81S to test a connection with HP/3PAR 7xxx arrays. It still looks like a good example of the subject, so I decided to store it for the future reference.

Posted in Storage Automation, Tips & tricks | Tagged , , , , , | Leave a comment