Jekyll2021-12-27T22:07:54+08:00https://www.robertmarkoski.net/feed.xmlRobert MarkoskiA website about mining, engineering, and home automation.Robert MarkoskiRaspberry Pi Bluetooth Tracker2019-05-29T00:00:00+08:002019-05-29T00:00:00+08:00https://www.robertmarkoski.net/python/home%20assistant/iot/pi/raspberrypi-bluetooth-tracker<h1 id="bluetooth-device-tracking-with-rasberry-pis">Bluetooth Device Tracking with Rasberry Pi’s</h1>
<p>Hot on the heels of my post on using <a href="https://github.com/robmarkoski/pi-motion-mqtt-sensor">a raspberry pi as a motion sensor</a> is another script that uses <a href="http://mqtt.org">MQTT</a> to integrate with <a href="https://www.home-assistant.io/">Home Assistant</a> and use it as a device tracker with bluetooth.</p>
<p>This can help with presence detection, especially if you got a bunch of bluetooth capable Raspberry Pi devices around the place.</p>
<p><a href="https://github.com/robmarkoski/bt-mqtt-tracker">Check it out here</a></p>Robert MarkoskiA short python script that turns a Raspberry Pi with Bluetooth as a device tracker.Raspberry Pi Motion Detection MQTT Device2019-05-13T00:00:00+08:002019-05-13T00:00:00+08:00https://www.robertmarkoski.net/python/home%20assistant/iot/pi/raspberrypi-pir-sensor-mqtt<h1 id="pir-motion-sensing-mqtt-device">PIR Motion Sensing MQTT Device</h1>
<p>MQTT is an <a href="http://mqtt.org">excellent protocol</a> for simple device communication. Even better is how well it integrates with <a href="https://www.home-assistant.io/">Home Assistant</a> to create useful sensors using cheap gear.</p>
<p>Here is a short python script to turn a PIR mounted on a PI as a communicating motion sensor.</p>
<p><a href="https://github.com/robmarkoski/pi-motion-mqtt-sensor">Check it out here</a></p>Robert MarkoskiA short python script to use a PIR sensor connected to a Rasberry Pi as a Motion Sensing MQTT DeviceAS4130 - HDPE Pipe Dimensions2019-03-07T00:00:00+08:002019-03-07T00:00:00+08:00https://www.robertmarkoski.net/engineering/imec/dewatering/AS4130-HDPE-Pipe-Dimensions<h1 id="asnzs-4130-hdpe-pipe-data">AS/NZS 4130 HDPE Pipe Data</h1>
<p>We have released the internal datasheets used for sizing HDPE Pipe and completing Dewatering Designs at <a href="https://www.imeconsultants.com.au">IMEC</a>.</p>
<p>It provides the sheet in PDF, CSV as well as xslx Format.</p>
<p>Find the repository <a href="https://github.com/IMEConsultants/AS4130-HDPE-PIPE">here</a></p>Robert MarkoskiA Github Repository which provides AS4130 HDPE Pipe Dimensions in Various Formats.Python Library for Using Colebrook Approximations of Darcy Friction Factor2019-03-01T00:00:00+08:002019-03-01T00:00:00+08:00https://www.robertmarkoski.net/python/module/imec/Colebrook-python-module<h1 id="colebrookpy">Colebrook.py</h1>
<p>The colebrook.py python module is one I have released which we use internally at <a href="https://www.imeconsultants.com.au">IMEC</a>.</p>
<p>It includes a bunch of functions which use various Colebrook-White approximations to calculate the Darcy Friction factor using the flows reynolds number and pipes relative roughness.</p>
<p>Find the repository <a href="https://github.com/IMEConsultants/colebrook">here</a></p>Robert MarkoskiA python library for using a bunch of different Colebrook approximations for determining the Darcy Friction Factor in full pipe flowsHow to upgrade Ubuntu WSL to 18.102019-02-17T00:00:00+08:002019-02-17T00:00:00+08:00https://www.robertmarkoski.net/wsl/nix/wsl-update-to-1810<h1 id="upgrading-to-ubuntu-1810-on-wsl">Upgrading to Ubuntu 18.10 on WSL</h1>
<p>Although not officially released you can upgrade to Ubuntu 18.10 on WSL</p>
<div class="language-console highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="go">sudo apt update && sudo apt dist-upgrade -y
</span></code></pre></div></div>
<p>Next edit <code class="language-plaintext highlighter-rouge">/etc/update-manager/release-upgrades</code> and change <code class="language-plaintext highlighter-rouge">Prompt=lts</code> to change <code class="language-plaintext highlighter-rouge">Prompt=normal</code></p>
<p>Now run:</p>
<div class="language-console highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="go">sudo do-release-upgrade
</span></code></pre></div></div>
<p>This may take a while.</p>
<p>You may get an LXD Error when upgrading. Purge it (I haven’t found any issues yet) via the following:</p>
<div class="language-console highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="gp">$</span><span class="w"> </span><span class="nb">sudo </span>dpkg <span class="nt">--force</span> depends <span class="nt">-P</span> lxd
<span class="c">...
</span><span class="gp">$</span><span class="w"> </span><span class="nb">sudo </span>dpkg <span class="nt">--force</span> depends <span class="nt">-P</span> lxd-client
<span class="c">...
</span></code></pre></div></div>
<p>Then run the upgrade again.</p>Robert MarkoskiUpgrading to Ubuntu 18.10 on WSLHow to install Xfce4 on Ubuntu 18.04 WSL2019-02-15T00:00:00+08:002019-02-15T00:00:00+08:00https://www.robertmarkoski.net/wsl/nix/xfce4-on-wsl<h1 id="installing-xfce4-on-wsl">Installing xfce4 on WSL</h1>
<p>Amazingly, you can run a Window environment with WSL. This lets you run nix based GUI applications on Windows. Not officially supported, but I personally haven’t had any issues.</p>
<p>I am running this on Ubuntu 18.04</p>
<h2 id="installation">Installation</h2>
<p>First off update your system and install xfce4</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">sudo </span>apt update <span class="o">&&</span> <span class="nb">sudo </span>apt <span class="nb">install </span>xfce4 <span class="nt">-y</span>
</code></pre></div></div>
<p>Next on Windows go ahead download and install <a href="https://sourceforge.net/projects/vcxsrv/files/latest/download">VcXsrv</a></p>
<p>Next you need to set the default display in WSL, so in your bash prompt set it as follows:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span><span class="nb">export </span><span class="nv">DISPLAY</span><span class="o">=</span>:0.0
</code></pre></div></div>
<p>If you would like to make the change permanent, add that line to the end of your <code class="language-plaintext highlighter-rouge">.bashrc</code></p>
<p>That’s it! Installation is complete.</p>
<h2 id="running">Running</h2>
<p>Now lets get VcXsrv up and running. Run VcXsrv and then select the <code class="language-plaintext highlighter-rouge">One Window without titlebar</code> option</p>
<p><img src="/images/xfcewsl/vcxsrv1.jpg" alt="Select One Window Without Titlebar" /></p>
<p>Next select <code class="language-plaintext highlighter-rouge">Start no client</code></p>
<p><img src="/images/xfcewsl/vcxsrv2.jpg" alt="Select Start no Client" /></p>
<p>Now select <code class="language-plaintext highlighter-rouge">Disable Access Control</code></p>
<p><img src="/images/xfcewsl/vcxsrv3.jpg" alt="Select Disable Access Control" /></p>
<p>Finally you can save the configuration and Finish up</p>
<p><img src="/images/xfcewsl/vcxsrv4.jpg" alt="Save Configuration" /></p>
<p>You should have a blank VcXsrv screen now open. Open up your bash prompt and type:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>xfce4-session &
</code></pre></div></div>
<p>Your Desktop should now show up on in the VcXsrv window.</p>
<h2 id="bonus-automation">Bonus: Automation</h2>
<p>To automate the entire process if you like, you can create a VBS script that will automatically run VcSrv with the correct configuration and then launch and xfce4-session as follows.</p>
<p>Create a new bash script called <code class="language-plaintext highlighter-rouge">launch.sh</code> as follows:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">#!/bin/bash</span>
<span class="c"># This script checks if another xfce4-session is running first.</span>
<span class="k">if</span> <span class="o">[</span> <span class="nt">-z</span> <span class="si">$(</span>pidof xfce4-session<span class="si">)</span> <span class="o">]</span><span class="p">;</span> <span class="k">then
</span><span class="nb">source</span> ~/.bashrc
xfce4-session
<span class="k">fi</span><span class="p">;</span>
</code></pre></div></div>
<p>Ensure the script is executable via <code class="language-plaintext highlighter-rouge">chmod +x launch.sh</code></p>
<p>Next on the windows side create a new VBS Script <code class="language-plaintext highlighter-rouge">wslgui.vbs</code> and then add the following code. Obviously update the install and script locations to wherever they are for you</p>
<pre><code class="language-vbs">' Script to Automatically Run and Xfce4 Session
' It opens a single window/no-decoration VcXsrv window
' Then runs your WSL Launch Script
' Update file locations accordingly
Set shell = CreateObject("WScript.Shell" )
shell.Run """C:\Program Files\VcXsrv\vcxsrv.exe"" :0 -screen 0 @1 -nodecoration -wgl"
shell.Run "bash -c ""~/launch.sh""", 0
</code></pre>
<p>Now Run the Script and you should automatically get a running desktop environment.</p>
<p>From here you can go ahead and try a few themes and other customisations to get working.</p>Robert MarkoskiInstalling xfce4 on WSLWelcome to RobertMarkoski.net2018-10-24T00:00:00+08:002018-10-24T00:00:00+08:00https://www.robertmarkoski.net/rob/the-first<p>Welcome to RobertMarkoski.net</p>Robert MarkoskiWelcome to RobertMarkoski.net