Thursday 23 November 2017

RoboCopy for maximum throughput

Another one of those notes to self:

Below command is very useful to achieve high throughput on a copy process on Microsoft platforms (do play around with MT )

As the MT[:N] argument creates  multi-threaded copies with N threads and will depend on your machines processor and memory configuration.

Example to keep to a local folder in sync with a remote source:

robocopy \\source\Calibre\eBooks\ F:\Calibre\eBooks /MT:64 /MIR /Z

Technet artice on RoboCopy here.

Sunday 1 October 2017

3D Printer Software - Linux

After many years I eventually made the jump and acquired a entry level 3D printer (Anet A8). This series will be use for lessons learned and application stack I find most useful for me.

Summary:

  1. FreeCAD 0.17 for design and exported as .stl file
  2. Repetier-Host as Slicer (Slicer Prusa Edition) and 3d printer host (open .stl and convert to .gcode and print)

Detail:

FreeCAD 0.17

As I am not in a production environment and FreeCAD development seem to be very active at the moment I am using the Daily PPA to update my system.

https://launchpad.net/~freecad-maintainers/+archive/ubuntu/freecad-daily
For Slicing (that is the most important part according to me as it will tell the printer how to print the model)

Slic3r

http://slic3r.org
It is working and I can't find any fault with it currently , however I still need to tweak the settings (e.g. slicing in Slic3r vs Cura vs Repetier-Host) give me 3 different results ito. amount of filament to be used when selecting the same density etc.

Cura 2.6.1

https://ultimaker.com/en/products/cura-software
https://launchpad.net/~thopiekar/+archive/ubuntu/cura 
the software worked but once I tried Repetier-Host I don't use this anymore.
For some reason currently the relation between design and print is out of proportion. I still need to investigate further.

Repetier-Host 2.0.5

The Repetier-Host AppImage is a single executable file that contains all required libraries and also includes CuraEngine, Slic3r and Slic3r Pruse Edition.

https://www.repetier.com/download-now/ 
I found this to be great and user friendly and the progress display and log file is very good.

As most 3d-ers I printed a few small projects and ran into what I assume is the most common "how do I do this ..." scenarios e.g.
  • What is the best way to change filament
  • What is the correct temperatures for my rig 
  • How do i get this print of the heatbed ....

Changes / additions:

Borosilicate Glass Plate

After a few prints I decided the builders tape type is not working for me and added a "Signstek 3D Printer MK2 MK3 Heated Bed Borosilicate Glass Plate Panel 213*200*3m" secured by "Heat Resistant Kaptop tape"

I am extremely happy with this upgrade; prints are sticking well and taking it off is a matter of waiting 2 minutes for the bed to cool a bit and then it just pops off.


Spool holder

I have printed the following spool holders to make sure the feeding of filament is resistance free.



Lessons learned:

As stated in many forums and guides - leveling is the most important of all!!!






Sunday 3 September 2017

U/Kubuntu Network Monitoring from CLI

I had to do some traffic monitoring per process and found nethogs to be perfect for the job.
Another application that helped a lot was tcptrack


Friday 14 April 2017

rsync with remove source files and directory

Command line to copy files and then remove the source (iow. simulate the mv command with rsync)


Terminal command for hard-restart
rsync -aP --remove-source-files /source/aa/bb/subfolder /destination/subfolder/ && rm -R /source/aa/bb/subfolder

Command line options used:

rsync:

-a  = archive
P   = progress
--remove-source-files  = remove the source files that were transferred successfully (not the source directory)

bash:

&& = will only execute if previous command successful

rm:

-R  = recursive (remove files and directories) that way both the files and directory are removed.

 
 


Monday 13 March 2017

Terminal commands for hard- reboot & shutdown

So i had the unfortunate scenario where I could not reboot or shutdown a Ubuntu server via the command line and no "out of band" access methods were available.

Luckily the following saved me:

Terminal command for hard-shutdown
sudo sh -c "echo o > /proc/sysrq-trigger"
Terminal command for hard-restart
sudo sh -c "echo b > /proc/sysrq-trigger"





Monday 16 January 2017

Minecraft Python development environment to live server via Git, ssh and hooks

So I was starting up a Minecraft server for the kids using a Python interface on Github for them to learn and code some of the repetative tasks they complained about.

But as they will make alot of mistakes in the beginning and I don't want to give my 6 year old terminal access with permission to changes files to the server yet ... (as he will most probably keep on messing with his sisters' files) I decided to create a repository on the local pc where they can play/learn then "activate" as I called it or more technical term "commit" the changes and by magic the file they created will be available from within Minecraft.

So I thought I will quickly describe the process as I suspect there might me some more parents out there wanting to do this.

Please note it is a all Linux environment (client and server side).

Server side:

For this spesific use case Minecraft server was loaded on a VPS as well as Forge and mcpipy.

For the automated deployment a repository folder was created on the server
~/repo/mcpipy.git/
With the actual files located at (Production instance):
~/minecraft/mcpipy/
In other words the directory tree would be:
|
|-- minecraft
|           |-- mcpipy
|-- repo
       |-- mcpipy.git
                    |--

Then change into the repository and intitialize it as a git version controlled repository:

cd ~/repo/mcpipy.git/
git init --bare 
--bare does not have a working directory (just the version control) more can be found here and here. Think of --bare as a way to mark a repository as a storage facility, opposed to a development environment.

Git Hooks:

The Git repository you just created will have a folder called hooks and contain files with actions that you can hook and perform as set by you (e.g. 'pre-receive', 'post-receive' and 'update') more to be found in the Git documentation.

Change into the hooks directory and create a post-receive hook (iow. what will be done once we pushed files to the repoitory on the server from the PC and the server received all the files)

 ~/repo/mcpipy.git/hooks/post-receive

#!/bin/sh
git --work-tree=~/minecraft/mcpipy --git-dir=~/repo/mcpipy.git checkout -f
and make it executable

chmod +x post-receive
Then over to the local machine (where the kids will do the coding and push it from to the server)

Client side:

Create a folder for the development and git init it.
cd /kids/mcpipy
git init

Then we need to configure the remote path of our repository.

git remote add live ssh://user@minecraftserver/root/repo/mcpipy.git
Then create your first python file in the repository
And add & commit the files / changes.

git add .
git commit -m "Minecraft Python projects ready" 

then to make it "active" or basically deploy the files to the production environment you need to push to the 'live' 

git push live master
From within Minecraft just type /py and the file name to build/test it e.g.


Sunday 8 January 2017

Google Chromecast and Mikrotik Wireless

So i recently upgraded my wifi at home from a TP-Link to a Mikrotik hAP ac device/s, although the installation of CAPsMAN and provisioning of Configurations were rather quick and easy .. that was not the end.

This post will focus on the wireless connections between the Chromecast and Mikrotik AP.

As in most households these days multiple media devices, wireless speakers/assistants and tablets etc. need the ability to connect ot the wifi.

Below so far my tests and findings with the Google ChromeCast.



Mikrotik Version 6.37.3
Mikrotik Firmware (hAP ac) 3.34
Mikrotik Model RouterBOARD 962UiGS-5HacT2HnT
ChromeCast Firmware 1.22.78337
ChromeCast Model Chromecast 2



I have decided to simplify my SSID's and only have 2 available on the network: Private and Guest and have both bands (2ghz & 5ghz) / radios assigned to the same SSID's. The previous wireless installation had seperate SSID's for 2 ghz and 5 ghz.
 
Connecting the Chromecast to the network was a breeze, just launch the Google Home application, select devices > settings > Wi-Fi and enter the new credentials.

and then the fun started, family members start complaining they can't "see" the Chromecasr device to cast to, and constant reboot / power cycles started and I started to keep an eye on the Mikrotik log and wireless registration table (and funnily enough all seemed ok, but the user experience were correct the devices were no longer discoverable)

Initial setup:


I then decided to pidgeon hole the Chromecast onto it's own SSID and assign it only to one spesific radio, that way I can control & troubleshoot. I did so and created a Media SSID and assigned it to a radio. This is done by creating a new  CAP's provisioning with the target Radio MAC.


Provisioned the new configurations and learned lesson 1, for no money would the Chromecast want to join the new SSID, various other devices could connect to it though.

Lesson learned: I performed a factory reset (FDR) on the Chromecast and it seemlessly connected to the new newly created SSID.

I changed the configuration in the following order with all configurations experiencing the same result:

  1. Started with  band=2ghz-b/g/n with same behaviour
  2. Changed to band=2ghz-b/g as some people / forums suggested issues with n band, with same behaviour
  3. Changed to the 5ghz radios with band=5ghz-onlyac, FDR the Chromecast and registered it to the Media SSID.

Current working configuration:


So currently it seem very stable and working without issues.


Media band = 5ghz-onlyac
radio = only the closest 5ghz Radio to the Chromecast




It is running for 3 days without any issues so far.

Inconsistencies and possible Chromecast bugs:

  • I have one other Chromecast connected to the "Private" SSID without any issues at the moment, still to investigate further.
  • On the Google Splash screen the Wireless SSID disappear sometimes with a "backdrop" change (As I told the kids to look for that to determine if the Chromecast is connected or not it causes false negatives at the moment :-)   )

Next steps:

  • Let it run for a while and monitor.
  • Change the Media SSID to hidden.





Sunday 1 January 2017

Winbox on OS X

Joshaven have complied “Winbox” by MikroTik with Wine in order to make it usable on Mac.
It can be downloaded from his website here

Below script can be used to manually update to the latest (3.7) Version.

rsync -avloz /Applications/Winbox4Mac.app/ /Applications/Winbox4Mac-3.7.app/

cd /Applications/Winbox4Mac-3.7.app/Contents/Resources/drive_c/Program\ Files/MikroTik
curl http://download2.mikrotik.com/routeros/winbox/3.7/winbox.exe --output winbox.exe
The manual way will keep the router list in tact.