<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ahmad Bilal on Medium]]></title>
        <description><![CDATA[Stories by Ahmad Bilal on Medium]]></description>
        <link>https://medium.com/@ahmadb?source=rss-bd429c04d807------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*dIt02lYCh_4TAQg8rbRLCA.jpeg</url>
            <title>Stories by Ahmad Bilal on Medium</title>
            <link>https://medium.com/@ahmadb?source=rss-bd429c04d807------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:26:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahmadb/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using Multipass with cloud-init]]></title>
            <link>https://medium.com/@ahmadb/using-multipass-with-cloud-init-bc4b92ad27d9?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc4b92ad27d9</guid>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Tue, 24 Nov 2020 01:56:25 GMT</pubDate>
            <atom:updated>2020-11-24T01:56:25.334Z</atom:updated>
            <content:encoded><![CDATA[<p>I upgraded my MacBook Pro to macOS Big Sur last week. Even though most of the applications worked fine, I encountered a few compatibility issues, which are expected for a new OS release. One of those issues was Docker not playing nice with VirtualBox. So I uninstalled VirtualBox and updated Docker. Before reinstalling VirtualBox, I thought maybe it would be a good idea to check what else is out there for creating development VMs on macOS. And that’s how I stumbled upon Multipass, Canonical’s take on quickly creating Ubuntu VMs on macOS, Windows and Linux.</p><p>There were a couple of things that I found interesting about Multipass. First, it uses the native hypervisor in macOS, and second, it can take cloud-init YAML files to configure the VMs.</p><p>So I installed Multipass using Homebrew:</p><pre>% brew install multipass</pre><p>After the installation, I noticed that there was a UI tool also installed with it. I launched it and selected Shell from the menu. It downloaded the latest Ubuntu 20.04 LTS, created the default “primary” VM and dropped into the shell — within seconds. The whole process was lightweight and quick.</p><p>It took me some time to get familiar with the command line options of Multipass, and after playing around with creating and deleting some test VM’s (including one with X11 forwarding over SSH to launch GUI Linux applications in macOS), I started looking into the cloud-init integration to make the entire process of creating and deleting a custom development VM as simple as possible.</p><p>My key requirements for a development VM were:</p><ol><li>SSH into the VM using the SSH public key authentication</li><li>Upgrade all packages</li><li>Install avahi-daemon to enable mDNS, so that I could use vmname.local instead of IP address to connect to the VM</li><li>A minor convenience — create an alias for future manual updates</li></ol><p>These requirements translated into this cloud-config.yaml cloud-init file:</p><pre>#cloud-config<br>users:<br>  - default<br>  - name: ubuntu<br>    gecos: Ubuntu<br>    sudo: ALL=(ALL) NOPASSWD:ALL<br>    groups: users, admin<br>    shell: /bin/bash<br>    ssh_import_id: None<br>    lock_passwd: true<br>    ssh_authorized_keys:<br>      - &lt;SSH public key from macOS&gt;<br>package_update: true<br>package_upgrade: true<br>packages:<br>  - avahi-daemon<br>write_files:<br>  - content: |<br>    # custom<br>    alias update=&#39;sudo apt update &amp;&amp; sudo apt upgrade &amp;&amp; sudo apt dist-upgrade &amp;&amp; sudo apt autoremove &amp;&amp; sudo apt auto-clean&#39;<br>    path: /etc/skel/.bashrc<br>    append: true</pre><p>Then I created mkvm script to create the VM and SSH into it:</p><pre>#!/bin/zsh</pre><pre>VM_NAME=$1</pre><pre>/usr/local/bin/multipass launch -n $VM_NAME --cloud-init ./cloud-config.yaml<br>/usr/bin/ssh ubuntu@$VM_NAME.local</pre><p>And rmvm script to delete the VM and remove it from known hosts:</p><pre>#!/bin/zsh</pre><pre>VM_NAME=$1</pre><pre>/usr/local/bin/multipass delete $VM_NAME<br>/usr/local/bin/multipass purge<br>/usr/bin/ssh-keygen -R $VM_NAME.local</pre><p>And now I am all set to create and delete VMs with a single command:</p><pre>% ./mkvm bilal-dev<br>% ./rmvm bilal-dev</pre><p>It is great to have a lightweight tool to quickly create Ubuntu VMs on macOS. Multipass does the basics — it doesn’t have features like “snapshots”, and “suspend” doesn’t work with the native macOS hypervisor right now. But it is very fast, and the cloud-init integration is awesome. Multipass can also be used with VirtualBox as the hypervisor (which also enables suspend). Overall, it is a very promising tool for developer productivity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc4b92ad27d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bilal’s Home Office/Studio Tour]]></title>
            <link>https://medium.com/@ahmadb/bilals-home-office-studio-tour-5f88b5fcad2c?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f88b5fcad2c</guid>
            <category><![CDATA[creative-space]]></category>
            <category><![CDATA[guitar]]></category>
            <category><![CDATA[pro-audio]]></category>
            <category><![CDATA[home-studio]]></category>
            <category><![CDATA[home-office]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Sun, 26 Apr 2020 05:16:57 GMT</pubDate>
            <atom:updated>2020-04-26T07:40:49.515Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ygqa4FNbcPXCS-YC4kJRQ.jpeg" /><figcaption>First Look</figcaption></figure><p>With all this COVID-19 social isolation in progress, I thought it might be a good time to share my home office/studio setup. For full disclosure, this room wasn’t setup in response to the current environment. I have always had a room in the house dedicated for work. But when I started working remotely in early 2019, this room finally got the attention (including the “Dark Secret” paint on the walls) needed to transform it into the creative space that I always wanted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZemZrAvK8WrzncIU6jG6A.jpeg" /><figcaption>The Workstation</figcaption></figure><p>My personal workstation is a MacBook Pro 15 (2017) with a Core i7 processor, 16GB RAM and 1TB storage. This is a decent laptop, with enough juice to handle my usual mix of desktop software like Final Cut Pro, Logic Pro, Ableton Live, Reason, Affinity apps, Luminar, Office and Visual Studio Code.</p><p>This MacBook is docked to a <a href="https://www.caldigit.com/ts3-plus/">CalDigit TS3 Plus</a> Thunderbolt 3 Dock. With a single Apple Thunderbolt 3 cable, this dock powers the MacBook and connects it to various peripherals:</p><p><a href="https://www.logitech.com/en-us/product/mk850-wireless-keyboard-mouse-combo">Logitech MK850</a> Wireless Keyboard and Mouse — one of the few keyboard/mouse combos which work seamlessly with both Mac and PC (for the Dell XPS 15 in the house).</p><p><a href="https://www.acer.com/ac/en/US/content/professional-model/UM.JB6AA.002">Acer B326HK</a> 32&quot; 4K Monitor — a decent display with reasonably good color accuracy and latency, mounted on an AmazonBasics monitor stand to create room for organizing devices under it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HUe35VKoRgXZmu8A-dHENg.jpeg" /><figcaption>Pro Audio</figcaption></figure><p><a href="https://www.akaipro.com/mpk249">AKAI MPK249</a> Performance Keyboard Controller — with 49 semi-weighted keys, 16 drum pads, and various knobs and sliders to control any mainstream Digital Audio Workstation software, this is a very convenient keyboard controller to play and record.</p><p><a href="https://tascam.com/us/product/us-20x20/feature">TASCAM Celesonic US-20x20</a> USB 3.0 Audio MIDI Interface — the centerpiece of the music studio, with 20 inputs, 20 outputs, phantom power for condenser microphones and low latency monitoring. My guitars plug into this interface directly, with amp and effect modeling done in software plugins like <a href="https://line6.com/helix/helixnative.html">Line 6 Helix Native</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H_VvAQM7D1qJ4PaZ1o8sIg.jpeg" /><figcaption>Studio Subwoofer</figcaption></figure><p>US20x20 is connected to a pair of M-Audio BX5 studio monitors, M-Audio BX10s studio subwoofer (under the desk), and various studio microphones and headphones. MPK249 has a couple of expression pedals under the desk connected to it. One pro tip — <a href="https://www.behringer.com/Categories/Behringer/Signal-Processors/DI-Boxes/HD400/p/P0387#googtrans(en|en)">Behringer HD400</a> is a great little device to clean up hum from the audio signal with so many electronic devices around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vWVzv3hNBtrWIGYtVIXwmA.jpeg" /><figcaption>More Peripherals</figcaption></figure><p>In addition to these peripherals, there is an external optical drive and an external hard drive dock also connected to the TS3 Plus for occasional use. Next to them, a headless <a href="https://www.raspberrypi.org/products/raspberry-pi-3-model-b/">Raspberry Pi 3 Model B</a> is powered on and ready for action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DqofxQ2TLX1f48ElT__c8w.jpeg" /><figcaption>More Useful Stuff Under the Desk</figcaption></figure><p>Under the other desk is an <a href="https://epson.com/For-Home/Printers/Inkjet/Epson-Expression-Premium-XP-640-Small-in-One-All-in-One-Printer/p/C11CF50201">Epson XP-640</a> multifunction printer/scanner. I have had good experience with Epson printers in the past, and this one works pretty well too, with support for double-sided prints. Next to it, there is an <a href="https://www.amazon.com/gp/product/B07MWV1JD7/">Under Desk Elliptical</a>, to make the desk work a bit healthier. And on the other side, there is <a href="https://www.amazon.com/gp/product/B00HYI7I2Y/">Ansmann Energy 16 Plus</a> smart battery charger, which can charge 16 batteries at a time. This is a great charger to support a more sustainable lifestyle with rechargeable batteries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q3LmRR75ZCjgT8xFjuP1Yw.jpeg" /><figcaption>Guitar Wall</figcaption></figure><p>And here is my guitar wall, with a diverse collection of guitars:</p><p><a href="https://www.washburn.com/product/t24/">Washburn Taurus T24</a> electric bass guitar — a great neck through 4-string bass with good sustain.</p><p>Jackson DK2S solid body electric guitar — this one is out of production now, but remains a very cool instrument, with Sustainiac sustainer pickup in the neck position for infinite sustain and feedback. I replaced the bridge and the middle pickups with Seymour Duncan parallel axis pickups, which sound great on this guitar.</p><p>Gretsch G5435T Electromatic Pro Jet chambered electric guitar — This is my first Gretsch, with “Black Top” Filter’Tron pickups. I absolutely love the sound of this guitar.</p><p>Ovation Celebrity CC057 electric acoustic guitar — I got this one after my Fender Stratacoustic got smashed in international flights. It sounds great plugged in or unplugged, and has a fiber glass back.</p><p>Below the guitars are the bookshelves filled with books on technology, art and music. I have organized these books here, away from the rest of the collection, and closer to where they are typically most used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jEdCuU5CcM_A_oPGLGs5SQ.jpeg" /><figcaption>Practice Amp</figcaption></figure><p>There is also a <a href="https://peavey.com/products/index.cfm/item/658/118345/">Peavey VYPYR VIP 1</a> guitar amp with Sanpera 1 expression pedal (for things like Wah effects) on the side. This is a great practice amp, supporting electric, acoustic and bass guitar input.</p><p>Above the amp, on the wall is… a whiteboard! No home office/studio is complete without a whiteboard to brainstorm ideas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U2iZRMQs9OWkckQFfxIWWQ.jpeg" /><figcaption>Reading Nook</figcaption></figure><p>Speaking of what a home office/studio cannot be complete without, here is a reading nook, to take a break, grab a book and read. On the wall, there is an original piece of digital calligraphy, which I did in Inkscape on Ubuntu (very open source art!).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m6wpnYffU692kHN_9r6Ztg.jpeg" /><figcaption>Camera and Lenses</figcaption></figure><p>And on this corner of the desk, here is my <a href="https://www.usa.canon.com/internet/portal/us/home/products/details/cameras/eos-dslr-and-mirrorless-cameras/mirrorless/eos-m3-ef-m-18-55mm-is-stm-kit">Canon EOS M3</a> mirrorless camera, with a collection of EF-M lenses:</p><p><a href="https://www.usa.canon.com/internet/portal/us/home/products/details/lenses/ef/wide-angle/ef-m-11-22mm-f-4-5-6-is-stm">EF-M 22mm f/2 STM</a> — probably the first lens to get with this camera. This is a fast prime lens, equivalent of 35mm full frame.</p><p><a href="https://www.usa.canon.com/internet/portal/us/home/products/details/lenses/ef/telephoto-zoom/ef-m-55-200mm-f-4-5-6-3-is-stm">EF-M 55–200mm f/4.5–6.3 IS STM</a> — a decent zoom lens, which also takes nice full moon shots!</p><p><a href="https://www.usa.canon.com/internet/portal/us/home/products/details/lenses/ef/wide-angle/ef-m-11-22mm-f-4-5-6-is-stm">EF-M 11–22mm f/4–5.6 IS STM</a> — an ultra-wide angle lens, which is my favorite for landscape photography.</p><p><a href="https://www.usa.canon.com/internet/portal/us/home/products/details/lenses/ef/macro/ef-m-28mm-f-3-5-macro-is-stm">EF-M 28mm f/3.5 Macro IS STM</a> — and to round it off, a macro lens, which comes in handy to get super close to wildflowers.</p><p>Most of the pictures on my <a href="https://www.instagram.com/ahmadbilal/">Instagram</a> come from this camera. The workflow is quite convenient, since I can transfer pictures to iPhone from this camera over WiFi, which then get replicated to iPad and Mac through Photo Stream, and also get backed up on Google Photos and Synology NAS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_T64sifLDxbTpLvHNkxdHg.jpeg" /><figcaption>“Achievements” Wall</figcaption></figure><p>On this wall, I have some patent plaques, Microsoft “Ship It” plaques (which chronicle the products I had shipped at Microsoft) and old university degrees — thinking about replacing it all with artwork one of these days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*viZS59PEkrsowz8HWV7RGw.jpeg" /><figcaption>Trip Down the Memory Lane</figcaption></figure><p>And on the window sill, some relics from my career in technology — VMware patent blocks, a windmill replica from my work in clean tech, Microsoft patent cubes, Microsoft 10 year award, Microsoft 5 year clock, Windows Phone ship award and another Windows ship award.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S_dpaxopyCaxAgfcFLWV_g.jpeg" /><figcaption>Home Server</figcaption></figure><p>That concludes the tour of the home studio/office, but there is also some supporting infrastructure around the house which is integral to it. A key part of this infrastructure is the <a href="https://www.synology.com/en-us/products/DS418">Synology DS418</a> NAS server for shared files, parked in the hallway, connected to an APC Smart UPS for uninterrupted operation during power outages. This is a power-efficient ARM-based NAS server, with 4 hard drives (6TB storage), fault tolerance, regular snapshots and nightly backups to an external USB drive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7IjcMLkqQna7lGdXvVRWlQ.jpeg" /><figcaption>Home Network</figcaption></figure><p>And last, but not the least is the reliable wireless network throughout the house, powered by <a href="https://www.tp-link.com/us/home-networking/deco/deco-m5/">TP-Link Deco M5</a> Mesh WiFi connected to a <a href="https://motorolanetwork.com/mb8600.html">Motorola MB8600</a> DOCSIS 3.1 Cable Modem. There are 3 Deco units placed in different locations in the house, providing reliable WiFi coverage to the 25–30 devices connected to the mesh at a time. Setting up this mesh network was probably the best thing that happened to our home network.</p><p>So that was a super quick tour of my home studio/office and various pieces that enable it to be a great place for work and creative pursuits. It took several years for it to get to this point, and even though it remains work in progress, it is a fun and inspiring space to create something.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f88b5fcad2c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Journey of a Line of Code on Git]]></title>
            <link>https://medium.com/@ahmadb/journey-of-a-line-of-code-on-git-f2f470956383?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2f470956383</guid>
            <category><![CDATA[source-control]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Tue, 31 Mar 2020 06:39:30 GMT</pubDate>
            <atom:updated>2020-03-31T06:39:30.139Z</atom:updated>
            <content:encoded><![CDATA[<p>Last weekend I was going through Git internals, and did a little exercise to better understand what happens behind the scenes when a line of code is added and committed to a local repository, and then the changes are pushed to a remote repository.</p><h3>Local Repository</h3><p>Git is a content-addressable file system based on a key-value data store. As we will see below, when a file is added and committed to a Git repository, its content and metadata is stored as a set of objects in the Git file system.</p><h4>Initialization</h4><p>First step in this process is to create an empty Git repository in a source folder. Let’s create a folder called ‘hello’:</p><pre>% mkdir hello<br>% cd hello</pre><p>Now, initialize Git inside this folder:</p><pre>% git init</pre><p>This initializes a ‘.git’ folder in the ‘hello’ source folder. This is what the structure of this folder looks like:</p><pre>.git<br>├── FETCH_HEAD<br>├── HEAD<br>├── config<br>├── description<br>├── hooks<br>│ ├── applypatch-msg.sample<br>│ ├── commit-msg.sample<br>│ ├── fsmonitor-watchman.sample<br>│ ├── post-update.sample<br>│ ├── pre-applypatch.sample<br>│ ├── pre-commit.sample<br>│ ├── pre-push.sample<br>│ ├── pre-rebase.sample<br>│ ├── pre-receive.sample<br>│ ├── prepare-commit-msg.sample<br>│ └── update.sample<br>├── info<br>│ └── exclude<br>├── objects<br>│ ├── info<br>│ └── pack<br>└── refs<br>├── heads<br>└── tags</pre><p>At this point, there are no files and commits in this repository.</p><h4>Add Source File</h4><p>Now that the repository is initialized, let’s create a new source file in it:</p><pre>% vi hello.txt</pre><p>After adding ‘Hello Git!’ text to the file and saving it, let’s add it to the repository:</p><pre>% git add hello.txt</pre><p>Adding the file to our repository creates a new object for it under the ‘objects’ folder:</p><pre>objects<br>├── 10<br>│ └── <strong>6287c47fd25ad9a0874670a0d5c6eacf1bfe4e<br></strong>├── info<br>└── pack</pre><p>This newly created object is a blob object representing the contents of the source file that we just added to our repository:</p><pre>% git cat-file -t 106287c47fd25ad9a0874670a0d5c6eacf1bfe4e<br>blob<br>% git cat-file -p 106287c47fd25ad9a0874670a0d5c6eacf1bfe4e<br>Hello Git!</pre><p>The actual data of the file is compressed using zlib to minimize storage requirements. To optimize things further, Git can also pack multiple objects in a packfile, and save file deltas as separate objects.</p><h4>Commit Source File</h4><p>After adding the file, we can now commit it to the Git repository:</p><pre>% git commit -m “First Commit”<br>[master (root-commit) 87e6bf9] First Commit<br>Committer: Ahmad Bilal &lt;bilal@Bilals-MacBook-Pro.local&gt;<br>1 file changed, 1 insertion(+)<br>create mode 100644 hello.txt</pre><p>Now we can see that two new objects are created under the ‘.git’ folder:</p><pre>├── objects<br>│ ├── 10<br>│ │ └── 6287c47fd25ad9a0874670a0d5c6eacf1bfe4e<br>│ ├── 54<br>│ │ └── <strong>de96a5745ec763b592943bf4d6667a8b8e3b78<br></strong>│ ├── 87<br>│ │ └── <strong>e6bf92627af6f32527b240dd7e621c8074d026<br></strong>│ ├── info<br>│ └── pack<br>└── refs<br>├── heads<br>│ └── master<br>└── tags</pre><p>The first object is a tree object, representing a snapshot of the folder containing ‘hello.txt’ in our source tree. This object contains a pointer to the ‘hello.txt’ blob object that we just committed:</p><pre>% git cat-file -t 54de96a5745ec763b592943bf4d6667a8b8e3b78<br>tree<br>% git cat-file -p 54de96a5745ec763b592943bf4d6667a8b8e3b78<br>100644 blob 106287c47fd25ad9a0874670a0d5c6eacf1bfe4e hello.txt</pre><p>And the second object is a commit object, representing the commit itself, with a pointer to the tree object above:</p><pre>% git cat-file -t 87e6bf92627af6f32527b240dd7e621c8074d026<br>commit<br>% git cat-file -p 87e6bf92627af6f32527b240dd7e621c8074d026<br>tree 54de96a5745ec763b592943bf4d6667a8b8e3b78<br>author Ahmad Bilal &lt;bilal@Bilals-MacBook-Pro.local&gt; 1584935879 -0700<br>committer Ahmad Bilal &lt;bilal@Bilals-MacBook-Pro.local&gt; 1584935879 -0700</pre><p>In addition to these two new objects, a new Git Reference is also created under ‘refs/heads/master’ to point to the latest commit object:</p><pre>% cat master<br>87e6bf92627af6f32527b240dd7e621c8074d026</pre><h3>Remote Repository</h3><p>Now that we have a local repository with the source file in place, we can add a remote repository and push our changes to it. Git uses the Git Protocol to transfer data between a local repository and a remote repository. There are various transport mechanisms supported. The two most common ones are HTTPS and SSH. We will use GitHub, which supports both of these.</p><h4>Create Remote Repository</h4><p>For this part, we will go to the GitHub website and create a new repository. Let’s create a private repository because this is a test project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*bobrfjE_o9EF8m5jr8mBIw.png" /></figure><h4>Add Remote Repository</h4><p>Now let’s add the remote repository to our local repository so that we can sync up the changes. SSH is configured on GitHub by generating an SSH key pair on the local machine, and adding the public key to GitHub, so that username/password authentication is not required when authenticating with GitHub. Since SSH is already configured on this machine, we will go ahead and use SSH (the other option is HTTPS, which requires username/password authentication) to add the remote repository:</p><pre>% git remote add origin git@github.com:ahmadbilal/hello.git</pre><p>This adds the remote repository to the config file:</p><pre>% cat config<br>[core]<br>repositoryformatversion = 0<br>filemode = true<br>bare = false<br>logallrefupdates = true<br>ignorecase = true<br>precomposeunicode = true<br>[remote “origin”]<br>url = git@github.com:ahmadbilal/hello.git<br>fetch = +refs/heads/*:refs/remotes/origin/*</pre><h4>Push Changes</h4><p>Now we are ready to push the changes from the local repository to the remote repository:</p><pre>% git push -u origin master<br>Enumerating objects: 3, done.<br>Counting objects: 100% (3/3), done.<br>Writing objects: 100% (3/3), 233 bytes | 233.00 KiB/s, done.<br>Total 3 (delta 0), reused 0 (delta 0)<br>To github.com:ahmadbilal/hello.git<br>* [new branch] master -&gt; master<br>Branch ‘master’ set up to track remote branch ‘master’ from ‘origin’.</pre><p>As shown in the output of the ‘git push’ command, the 3 objects that were created when we added and committed ‘hello.txt’ file to our local repository are now pushed to the remote repository. Inspecting the ‘.git’ folder, we can see that a Git Reference is added for the remote repository in the ‘refs’ folder:</p><pre>└── refs<br>├── heads<br>│ └── master<br>├── remotes<br>│ └── origin<br>│ └── master<br>└── tags</pre><p>The new Git Reference ‘refs/remotes/origin/master’ contains a pointer to the commit object that was sent to the server the last time the client communicated with it:</p><pre>% cat master<br>87e6bf92627af6f32527b240dd7e621c8074d026</pre><p>Now our source file ‘hello.txt’ has been pushed to the remote repository on GitHub.</p><h4>SSH Client/Server</h4><p>When the ‘push’ operation is initiated over SSH, Git starts a ‘send-pack’ process on the client, which launches a ‘git-receive-pack’ process on the server over SSH. After the initial handshake, the ‘send-pack’ process determines which commits are needed by the server, and sends a packfile of all objects needed to sync the server with the changes on the client. The process is similar for HTTPS transport, except that the initial handshake is an HTTP GET request from the client, after which data is sent through a series of HTTP POST requests.</p><p>More details on Git internals can be found under the <a href="https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain">Plumbing and Porcelain</a> section of the Pro Git book by Scott Chacon and Ben Straub.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2f470956383" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a Headless Raspberry Pi 3]]></title>
            <link>https://medium.com/@ahmadb/setting-up-a-headless-raspberry-pi-3-ad39a51b1df3?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad39a51b1df3</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[wifi]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[cron]]></category>
            <category><![CDATA[iot]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Sun, 19 May 2019 11:50:16 GMT</pubDate>
            <atom:updated>2019-05-19T11:50:16.058Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dZWGIEMrryqz2yD0Sb8rZQ.jpeg" /></figure><p>I picked up a Raspberry Pi 3 a while back, but didn’t get a chance to play with it much. I wanted to set it up as a headless device without a desktop environment, and then SSH into it. Today, I got a chance to set it up and fix some WiFi reliability issues in the process. Please note that I was doing this on macOS, so the paths below might be different for you if you are doing this on a different OS.</p><p>I downloaded the latest Raspbian Lite image from:</p><pre><a href="https://www.raspberrypi.org/downloads/raspbian/">https://www.raspberrypi.org/downloads/raspbian/</a></pre><p>After that, I flashed the image on an SD card:</p><pre>sudo dd bs=4000000 if=~/Downloads/2019-04-08-raspbian-stretch-lite.img of=/dev/disk2</pre><p>You don’t have to start Raspberry Pi and hook it up with keyboard and monitor to configure SSH and WiFi — it can be done offline by mounting the the boot volume on the SD card (removing and reinserting it after flashing is done will automatically mount it) and making some changes at the root of the filesystem.</p><p>To configure SSH, simply create this empty file:</p><pre>touch /Volumes/boot/ssh</pre><p>And to configure WiFi, add this file:</p><pre>nano /Volumes/boot/wpa_supplicant.conf</pre><p>The contents of this file should look something like:</p><pre>ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev<br>update_config=1<br>country=US<br><br>network={<br>    ssid=&quot;Your SSID&quot;<br>    scan_ssid=1<br>    psk=&quot;Your Password&quot;<br>    key_mgmt=WPA-PSK<br>}</pre><p>Please note that specifying the right country code is important.</p><p>After that, unmount or eject the boot volume, insert the SD card in the Raspberry Pi, and power it on. It should automatically boot, connect to WiFi and enable SSH.</p><p>The alternative is to connect the Raspberry Pi to a monitor through HDMI, connect a USB keyboard, and use this handy tool to configure WiFi and SSH:</p><pre>raspi-config</pre><p>It has a decent UI for Raspberry Pi configuration.</p><p>You can then SSH into the Raspberry Pi using:</p><pre>ssh -lpi &lt;IP Address of Raspberry Pi&gt;</pre><p>The default password for the user ‘pi’ is ‘raspberry’. Please change it right away because everyone would know it!</p><p>Once everything was set, I noticed that the Raspberry Pi was very unstable. It kept freezing up on me every few minutes. After trying out a few things, I suspected that the firmware on the device might be outdated. So I updated the firmware and the OS:</p><pre>sudo rpi-update &amp;&amp; sudo apt update &amp;&amp; sudo apt upgrade &amp;&amp; sudo apt dist-upgrade &amp;&amp; sudo apt autoremove &amp;&amp; sudo apt autoclean</pre><p>After the update, I rebooted the Raspberry Pi, and the freezing went away. I thought everything was fine, but then I started hitting intermittent WiFi connectivity issues. Every few hours, Raspberry Pi would lose WiFi connection, and I couldn’t SSH to it anymore. I couldn’t get to the root cause of it, so I decided to apply a bandaid.</p><p>For that, I created this ‘checkwlan.sh’ script in ‘/usr/bin’:</p><pre>#!/bin/bash</pre><pre>/bin/ping -c 1 8.8.8.8</pre><pre>if [ &quot;$?&quot; = &quot;0&quot; ]<br>then<br>  echo &quot;WiFi is Up&quot;<br>else<br>  echo &quot;WiFi is Down&quot;<br>  /sbin/ifconfig wlan0 down<br>  sleep 5<br>  /sbin/ifconfig wlan0 up<br>fi</pre><p>Then I set the right permissions on the script:</p><pre>sudo chmod 755 checkwlan.sh</pre><p>This script pings Google’s public DNS server (8.8.8.8) and then checks the return code. If the ping fails, it restarts the WiFi network interface, reconnecting to the WiFi.</p><p>To make it run automatically, I added it to the cron as root:</p><pre>sudo crontab -e</pre><p>This line needs to be added to the crontab to automatically run this script every minute:</p><pre>* * * * * /usr/bin/checkwlan.sh</pre><p>After that I rebooted the Raspberry Pi, and tested it out by manually bringing down WiFi connectivity on it. Within a minute, it recovered from the situation and reconnected to WiFi.</p><p>So far, so good. Now I will let it run for a few days, and will update this post if there are any other reliability issues. Hope this helps in setting up a headless Raspberry Pi — keep making fun things!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad39a51b1df3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stellarium Display Scaling on HiDPI/4K/UHD Ubuntu/Linux]]></title>
            <link>https://medium.com/@ahmadb/stellarium-display-scaling-on-hidpi-4k-uhd-ubuntu-linux-fe0f5a6870f?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe0f5a6870f</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[hidpi]]></category>
            <category><![CDATA[astronomy]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Tue, 20 Nov 2018 22:09:33 GMT</pubDate>
            <atom:updated>2018-11-20T22:32:38.648Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stellarium HiDPI/4K/UHD Display Scaling in Ubuntu/Linux</h3><p><a href="http://stellarium.org/">Stellarium</a> is an awesome cross-platform desktop astronomy software. However, this is not a review of Stellarium and its awesomeness, but a short post on how to fix Stellarium on HiDPI screens in Ubuntu.</p><p>Stellarium can be installed from the package manager:</p><pre>sudo apt install stellarium</pre><p>It is also available as a flatpak (which is my preferred way of installing it).</p><p>When Stellarium is used on a HiDPI screen (e.g. Dell XPS 15), the fonts look so tiny that it is almost unusable. Scaling the Gnome desktop doesn’t fix the problem. But there is a relatively easy fix (which was hard to find, for some reason). There is an environment variable that can be set to fix this problem. To try it out, launch Stellarium after setting this environment variable:</p><pre>export QT_DEVICE_PIXEL_RATIO=2</pre><p>Since Gnome supports setting environment variables in application shortcuts, it is easy to fix this problem so that whenever Stellarium is launched, it scales correctly to HiDPI displays. First, locate the .desktop file used to launch Stellarium. For me, the flatpak creates the file here:</p><pre>/var/lib/flatpak/app/org.stellarium.Stellarium/current/active/export/share/applications/org.stellarium.Stellarium.desktop</pre><p>Open the file in your favorite text editor, and append the environment variable to each Exec line in the file. For example, this line:</p><pre>Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=stellarium org.stellarium.Stellarium</pre><p>changes to:</p><pre>Exec=env QT_DEVICE_PIXEL_RATIO=2 /usr/bin/flatpak run --branch=stable --arch=x86_64 --command=stellarium org.stellarium.Stellarium</pre><p>Please note that there are multiple Exec lines in the file — make sure to change all of them. Once the changes are made, save the file, and launch Stellarium again (may require logging out of Gnome and logging back in). It will launch with proper scaling.</p><p>Hope this helps. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe0f5a6870f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Perfect Mobile Workstation?]]></title>
            <link>https://medium.com/@ahmadb/the-perfect-mobile-workstation-e2dedc44e273?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2dedc44e273</guid>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Mon, 29 Oct 2018 07:32:52 GMT</pubDate>
            <atom:updated>2018-10-29T07:50:27.228Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Perfect Mobile Workstation? — a weekend adventure of setting up Ubuntu 18.04 on Dell Precision 5530</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8qNJCwQzslEz7u-J_MwrXA.png" /><figcaption>Ubuntu 18.04 on Precision 5530</figcaption></figure><p>This is an interesting time for laptop power users, since there are some compelling options out there for those who want to get some serious work (content creation, software development etc.) done without compromising portability. There are the super thin and light ultrabooks at the lower end of the power spectrum, and then there are the high performance heavier mobile workstations, packing multiple drives with RAID, and powerful workstation graphics. But the segment that I find most interesting is the niche somewhere between these two extremes of portability and power — the thin-and-light mobile workstation.</p><p>The three most well-balanced mobile workstations that I would recommend in this segment in 2018 are Apple MacBook Pro 15, Dell Precision 5530 and Lenovo ThinkPad P1. While I find Microsoft Surface Book interesting too, there have been a lot of complaints about the stability of the device among my acquaintances who own it. HP ZBook is another interesting contender, but it is not as commonly seen around. The devices in this category typically have a light (relatively) form factor, 15 inch UHD (or Retina in case of the Mac) displays, discrete graphics and high-end mobile processors, including the option to configure with server-class Xeon processors in some cases.</p><p>When looking at the three mobile workstation that I had shortlisted, I was gravitating towards the ThinkPad P1, because I have been a fan of ThinkPad laptops for a long time, with a <a href="https://medium.com/@ahmadb/from-macbook-pro-to-thinkpad-x260-6dbfd33d5e7a">ThinkPad X260 running Ubuntu as my personal laptop</a> since a couple of years now. But somehow I couldn’t find the right configuration at the price point I was looking for, since this model is the newest of the three, and Lenovo takes some time before offering discounted prices on new models. The other drawback of the ThinkPad P1 was the lower capacity battery. Lenovo decided to go with a dual-NVMe setup, instead of giving the option of a single NVMe with larger battery. They should address this design limitation in future models of ThinkPad P1.</p><p>And then there is always the MacBook Pro, tempting me back into the Apple ecosystem. Things have improved in the Mac world since I last had a personal MacBook Pro (I still have one for work). For starters, I can see that Homebrew has added more package over the years. And Visual Studio Code provides a uniform developer experience across platforms. Add to that the latest dark theme in Mojave, and MacBook looks quite compelling. I even found a deal on the 2017 model, and will be giving it a second look when it arrives, even though I can still configure a PC with almost double the power for the same price (hello, Apple Tax!). The biggest plus point of Mac for me is the ability to run my pro audio software like Ableton Live and Propellerhead Reason without having to leave the familiar Unix environment. I am not into iOS development or Apple ecosystem in general, but I am sure those factors would be important for some people out there.</p><p>So that left me with the Precision. I already have a Precision 5520 at work, running Windows 10. It is a solid performer with a quality build. One interesting bit about both Precision and ThinkPad P1 is that both of these laptops are “pro” versions of their respective consumer models, XPS 15 and ThinkPad X1 Extreme. They share the same build as their consumer siblings, with some slight variations like offering Xeon processors, pro (as opposed to gaming) graphics and Intel wireless cards, which work better with Linux. Dell has had good success with this model, and Lenovo is now trying the same. But there are some differences between the two. I like the classy matte black finish of the ThinkPad and its almost legendary keyboard. Precision, on the other hand, has a more modern metal finish and a soft carbon fiber palm rest. The biggest difference (for me) in internals of these two laptops is the larger battery on the Precision if you forego the second hard drive. Rest of the options for internals between the two laptops are almost identical.</p><p>To cut the story short, I eventually went with the Precision, since I found an awesome deal on it from Dell Outlet during their workstation sale event earlier this month, topped by my VMware employee discount. Since Dell offers the Precision with Ubuntu (even though it is limited to 16.04 right now), I was confident that the machine would be able to handle Ubuntu well. So, I ordered the Precision 5530 in its beautiful Black Onyx finish (it also comes in Platinum Silver). Another reason for going with the Precision was that since my wife has an XPS 15, we can share accessories like the power adapter and the Thunderbolt dock.</p><p>I managed to configure my Precision with Core i9, UHD display, and the larger battery — will most likely pop it open to double the RAM (from 16 GB to 32 GB) and put in a larger 2TB NVMe drive to dual-boot with Windows (still need it for some software which doesn’t work on Linux). The reasons why I went with Core i9 over Xeon are that Core i9 is faster in single-threaded workloads, and Microsoft has put some artificial limitations on Windows 10, allowing only the expensive Workstation version to run on Xeon processors (really, Microsoft?), inflating the prices of Xeon workstations.</p><p>The Precision arrived on Saturday. It is one beautiful machine! I fired it up, and booted into Windows 10 to apply BIOS updates. The process worked smoothly, and then the device was ready to get some Linux love.</p><p>It took a while to boot into Ubuntu installation on the Precision. I had 18.04 flashed on a USB drive, but Precision couldn’t find it on F12 boot. After some digging around, I found that I had to add USB boot device to the UEFI boot device list. That fixed the boot problem. But then I found that Ubuntu couldn’t see the NVMe drive. I recalled from experience that sometimes these drives are configured in RAID mode, so I went back to UEFI setup, and that was the issue. I switched it to AHCI mode, and booted back into the installation. This time, Ubuntu could happily see the drive and was ready to install. The installation went smoothly as expected, and soon I was booted into the operating system. All hardware was detected out of the box, after which I went to the “Additional Drivers” and installed the proprietary NVIDIA 390 drivers over the open source nouveau drivers.</p><p>Everything worked fine, till I closed the lid of the laptop. It suspended, even though the fan kept running for a bit longer. When I opened the lid, the laptop tried to resume from suspend, but hung in the process. I tried a lot of ideas, but nothing worked. So I had to switch back to Intel graphics, with which the laptop reliably suspends and resumes. Googling around this issue showed that this is a common issue for this graphics card with Ubuntu 18.04 and NVIDIA drivers. Apparently, there is a fix going into Linux kernel 4.18, which has worked for some people. I didn’t get a chance to patch my kernel and try it out yet. The updated kernel should make it to the next dot release of 18.04 after the New Year. Till then, I might stick around with Intel graphics, unless it bothers me enough to patch the kernel!</p><p>The other issue was with the applications, a number of which were not able to handle high DPI of the UHD display. GIMP and Audacity were among the top offenders. I typically install software from APT, but that obviously wasn’t working, so I thought about trying out newer versions. For that, there were two options — use snap, which comes out of the box in Ubuntu, or setup flatpak. I found that the flatpak world has a larger number of packages, and it integrates better with GNOME desktop. So I went with it over snap (even though I used snap to install LXD and Docker) and installed newer versions of my applications. This fixed most of the high DPI issues, since latest versions of GIMP and Audacity handle high DPI fine. There are still some applications (like Stellarium) which don’t work well with high DPI, but hopefully the developers will update them soon. Another issue was that the applications installed through flatpak were not picking up my GTK theme (I use Materia theme to match the dark aesthetics of the hardware, with flat and colorful Papirus icons) correctly, but doing a ‘flatpak update’ fixed it, as it downloaded the right dependencies.</p><p>On a side note, while finding newer versions of my applications, I came across <a href="https://shotcut.org/">Shotcut</a>, which is an awesome multi-platform open source video editor. It has now become my default video editor on Ubuntu.</p><p>There are still some nagging issues, like resume from suspend is not instant, and the splash screen goes blank for a couple of seconds during boot (maybe it has something to do with hybrid graphics?). But overall, Ubuntu on Precision 5530 is working very well. The UHD display is stunning, and the Core i9 just crunches through whatever task I throw at it, from compilation to video rendering. The battery life also seems pretty good, but it will take a few days of normal work to get a better assessment.</p><p>This concludes my weekend adventure setting up a mobile Linux workstation on Precision 5530 with Ubuntu 18.04. This workstation is a delight to use so far, but I am also waiting for the MacBook Pro 15 to arrive, to see if it can tempt me back to macOS. It is great to have choices, but with Microsoft and Apple losing interest in their desktop operating systems, and consumers slowly moving away from traditional desktops, Linux might end up being the top choice for desktop power users in the future. Maybe the year of the Linux desktop will finally arrive? Till then, desktop Linux users like us will remain a vibrant enthusiast minority, brought together by the powerful idea of open computing for all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2dedc44e273" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[10 Product Management Lessons Learnt from Issues with Google Photos]]></title>
            <link>https://medium.com/@ahmadb/10-product-management-lessons-learnt-from-issues-with-google-photos-9ff0e4354f11?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ff0e4354f11</guid>
            <category><![CDATA[google-photos]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[google-drive]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Sat, 21 Jul 2018 09:44:47 GMT</pubDate>
            <atom:updated>2018-07-21T09:44:47.140Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CECQHBy0ry8cAeRgYPkBSA.jpeg" /></figure><p>I have used Google Photos since the service was released. It was perhaps the first useful product of its kind for casual smartphone photographers like me. The convenience of automatically backing up high-res photos to the cloud, without having to worry about storage quota remains a great value proposition. While Amazon offers the same photo backup features to Amazon Prime customers, Google Photos has a superior search experience. Add to that the delightful features like automatic creation of albums behind the scenes, and Google Photos becomes a very attractive offering for connected lifestyles.</p><p>But everything is not perfect with Google Photos. Recently, Google decided to merge desktop sync clients of Google Photos and Google Drive. While this change makes sense from a product perspective (streamlining two similar experiences), the execution of the change resulted in a very frustrating user experience for me. Having said that, it also provided some valuable Product Management lessons, which I am sharing here.</p><p>To start with, the change wasn’t clearly communicated to me as a user, even though it had non-trivial implications for the usage of the service.</p><p><strong>Lesson #1: Communicate major product changes to the users effectively.</strong></p><p>And just like that, the Google Photos desktop sync client got updated to Google Drive desktop sync client on my workstation. On first launch, the desktop sync client made me walk through its settings.</p><p><strong>Lesson #2: Give an option to the users to carry over their existing settings when updating their software.</strong></p><p>As usual, I was in middle of a number of other things while clicking through the settings, so I mostly chose to keep the defaults, but did take extra care to make sure that I only pick my media folders to backup, assuming that it would still backup photos and videos with unlimited storage. Not a good assumption.</p><p><strong>Lesson #3: When the users are selecting new settings which will alter their experience with the product, make sure they understand that.</strong></p><p>Unknowingly, the settings I picked started backing up my media folders to the Google Drive at full-res, including temporary files and RAW files. Two days later, I got a warning email that I was out of my Google Drive storage quota, and services like Gmail will stop working, unless I freed up space or purchased additional storage.</p><p><strong>Lesson #4: Proactively inform the users that their usage activities are trending towards service disruption, so that they can take preventive actions before it is too late.</strong></p><p>I had some important correspondence going on in my Gmail account, so I almost panicked. A brief look at the Google Drive made the situation obvious. So I quickly stopped sync on the desktop, and started looking for options to cleanup Google Drive without having to delete all media. Too bad, there was no option to do that.</p><p><strong>Lesson #5: Provide an easy way to the users to get back to a previously known good state.</strong></p><p>Unable to find a way back, I thought that deleting the root folder of the device from Google Drive and uploading the media again with correct settings would fix the problem. But it wasn’t clear if doing that would make the desktop sync client delete local copies of photos and videos. Looking up online documentation didn’t help either.</p><p><strong>Lesson #6: When user data (especially user-generated content) is involved, go the extra mile to communicate the behavior of the product to the user.</strong></p><p>So I uninstalled the sync client, selected the root folder of the device on Google Drive, and deleted it. Logically, this should have fixed the storage quota problem. But what this actually did was that the folder disappeared from Google Drive, but the service slowly started moving files in the background to trash. And the used storage quota did not change, since the files were still not deleted.</p><p><strong>Lesson #7: Provide a predictable way to the users to easily reset back to clean state.</strong></p><p>On a side note, the setting to upload high-res photos to unlimited storage is also not very obvious anymore. And it includes an option to upload RAW photos, without clearly stating whether it will use up storage quota or not. So it took me some time to find and change the setting.</p><p><strong>Lesson #8: Make it easy to discover and understand high value functionality.</strong></p><p>Back to the storage quota problem, I thought that emptying trash would fix it instantly, but that didn’t work either. Every time I emptied the trash, it would succeed, clear the files in the view, and then moments later, more files would appear in the trash. I tried it several times, without any luck. And all this time, the used storage quota did not change.</p><p><strong>Lesson #9: When the users take an action, clearly communicate the result or the progress back to them.</strong></p><p>At this point I had no idea of what was going on. A search for a solution showed that this is a very common problem, with forums full of user complaints around it. I tried various solutions suggested, but nothing worked. Finally, I contacted Google support. They were courteous as usual, and suggested various other things to try. But whatever I tried didn’t help. The files would reappear in the trash, and the used storage quota wouldn’t change. In the end, they suggested waiting for a few days and contact them again if the quota still didn’t reset.</p><p><strong>Lesson #10: Provide training to the support team to give clear guidance on known product issues.</strong></p><p>With no solution working, I purchased additional storage on Google Drive to make sure my Gmail didn’t get blocked, and started thinking out of the box. I went into the scripting experience of Google Apps, learnt how to use Google Drive API directly, and wrote a short (and rough) script to enumerate and delete files from the trash. Here is a snippet:</p><pre>function removeTrashedFiles() {<br>  Drive.Files.emptyTrash();<br>  var files = DriveApp.getTrashedFiles();<br>  while (files.hasNext()) {<br>    var file = files.next();<br>    Logger.log(file.getName());<br>    Drive.Files.remove(file.getId());<br>  }<br>}</pre><p>The script was at least able to show exact names of the files being deleted, and some assurance that something was happening to clean up storage. There were some limitations though. For instance, the maximum run time for a Google Apps script is fixed. So I had to manually trigger it over and over again. After running the script repeatedly for an hour or so, I saw the used storage quota decreasing a bit, which was encouraging. Since there is also a limit on the maximum time for which a script can run in a day, I decided that if it did not fix the problem, I would write a Node.js service running on a local server at home to attempt cleaning up the trash folder from Google Drive.</p><p>But it didn’t come to that. Two days later, when I checked back, the storage quota had cleared, and the trash was empty. So I restarted the Google Drive desktop sync client, and the photos started syncing again at high-res, using unlimited storage. Everything was back to normal, besides the quirkiness of Google Drive showing the folder structure from the device (which might be useful for some users, depending on how they organize their media), and my decreased confidence in Google Photos. But like every other product problem, this was also a great learning experience as a Product Manager.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ff0e4354f11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using C# Managed Libraries in Scilab]]></title>
            <link>https://medium.com/@ahmadb/using-c-managed-libraries-in-scilab-481a24456f64?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/481a24456f64</guid>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[matlab]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[simulation]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 17:57:50 GMT</pubDate>
            <atom:updated>2018-07-19T18:02:56.033Z</atom:updated>
            <content:encoded><![CDATA[<p>Back when I was working in a clean tech startup, our Power Systems Integration team was investigating modeling and simulation tools, which could do something more complex than Excel for some of our projects. MATLAB would have been a good choice, but it comes with a big price tag. I suggested looking into <a href="http://www.scilab.org/">Scilab</a>, an open source alternative, which is very similar to MATLAB. We created some interesting simulations and presented the results to rest of the team. But then the question was, how do we run these simulations through algorithms implemented in product code. Most of our code base is in C#, so I started investigating how to use managed libraries in Scilab. Googling it revealed that it is a popular topic, but I couldn’t find a solution. There is the <a href="https://code.google.com/p/labsharp/">labsharp</a> project, but it works the other way round (calling Scilab from C#). Long story short, eventually I got it working, and even though I am not proud of my solution (too much marshaling!), it works, and can potentially help someone else in a similar situation.</p><p>At a high level, here is how I got it to work: Scilab talks to Java, which talks to a native DLL through JNI, which talks to a managed assembly over COM.</p><p><strong>Step 1: Implement the Managed Assembly</strong></p><p>The managed assembly in this prototype contains a simple function which generates a random number:</p><pre>using System;<br>using System.Collections.Generic;<br>using System.Linq;<br>using System.Text;<br>using System.Threading.Tasks;</pre><pre>namespace SimEnergy<br>{<br>    public interface ISimEnergy<br>    {<br>        int GetSimulationResult();<br>    }</pre><pre>    public class SimEnergy:ISimEnergy<br>    {<br>        private Random _rand;<br>      <br>        public SimEnergy()<br>        {<br>            _rand = new Random();<br>        }<br>      <br>        public int GetSimulationResult()<br>        {<br>            return _rand.Next(-50, 50);<br>        }<br>    }<br>}</pre><p>After compiling this code as a managed assembly, I followed the instructions in <a href="https://support.microsoft.com/en-us/kb/828736">KB article #828736</a> to register the assembly as a COM component:<br>Generate a key file using the strong name utility:</p><pre>sn.exe -k keyfile.snk</pre><p>Use this key file to sign the assembly in Visual Studio 2013 Project Properties — Signing<br>Enable assembly to be COM-visible in Visual Studio 2013 Project Properties — Application — Assembly Information<br>Build the project<br>Register the assembly and generate the type library:</p><pre>regasm.exe SimEnergyManaged.dll /tlb:SimEnergyManaged.tlb /codebase</pre><p><strong>Step 2: Implement the Java Wrapper</strong></p><p>The Java wrapper is also a simple Java class, which uses JNI to call into native code:</p><pre>package simenergy;</pre><pre>public class SimEnergy {</pre><pre> public SimEnergy() {<br>  // constructor<br> }<br> <br> public native int getSimulationResult();<br> <br> static {<br>  System.loadLibrary(&quot;simenergynative&quot;);<br> }<br>}</pre><p>I followed the instructions in <a href="https://support.microsoft.com/en-us/kb/222092">KB article #222092</a> to generate the JNI header:</p><ol><li>Build the Java project</li><li>Generate JNI header from the class:<br>javah.exe -jni SimEnergy</li><li>Bundle the Java class in a JAR</li></ol><p><strong>Step 3: Implement the Native DLL</strong></p><p>Now that we have the type library and the JNI header, with some help from the two KB articles mentioned above, we can create a native DLL which marshals calls from Java to the managed library:</p><pre>#include &quot;stdafx.h&quot;<br>#include &quot;simenergy_simenergy.h&quot;<br><br>#import &quot;SimEnergyManaged.tlb&quot; raw_interfaces_only<br><br>using namespace SimEnergyManaged;<br><br>JNIEXPORT jint JNICALL Java_simenergy_SimEnergy_getSimulationResult(JNIEnv *env, jobject jobj)<br>{<br> // Initialize COM.<br> HRESULT hr = CoInitialize(NULL);<br><br> // Create the interface pointer.<br> ISimEnergyPtr pSimEnergy(__uuidof(SimEnergy));<br><br> // Call the managed method<br> long result = 0;<br> pSimEnergy-&gt;GetSimulationResult(&amp;result);<br><br> // Uninitialize COM.<br> CoUninitialize();<br><br> return result;<br>}</pre><p><strong>Step 4: Call the Java Wrapper from Scilab</strong></p><p>Now that we have all the pieces in place, we can call the Java wrapper from Scilab:</p><pre>javaclasspath(&quot;C:/SimEnergy/simenergy.jar&quot;)<br>javalibrarypath(&quot;C:/SimEnergy&quot;)<br>jimport simenergy.SimEnergy<br><br>x = []<br>sim = SimEnergy.new()<br>for i = 1:10<br>    x = [x, sim.getSimulationResult()]<br>    sleep(10)<br>end<br><br>plot(x)<br><br>jremove(sim)</pre><p>To execute this successfully, we put the native DLL and the JAR file in C:\SimEnergy so that Scilab can find the JAR file and the Java object can find the native DLL it is calling into. Here is the final result, which just shows a plot of some random numbers generated by the managed library:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*3PDjuGPor99ToRGt.png" /><figcaption>Plot from Scilab</figcaption></figure><p>Note: I had some issues (mostly around missing native references) doing Scilab — Java interop in Windows 8.1, which were resolved by adding these folders to the path:</p><pre>c:\Program Files\scilab-5.5.2\bin;%SystemRoot%\system32\downlevel;</pre><p>Happy modeling and simulation with C# and Scilab. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=481a24456f64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fixing DNS Issues in Ubuntu 18.04 LTS]]></title>
            <link>https://medium.com/@ahmadb/fixing-dns-issues-in-ubuntu-18-04-lts-bd4f9ca56620?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd4f9ca56620</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[dns]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Sun, 20 May 2018 11:06:26 GMT</pubDate>
            <atom:updated>2020-10-11T08:50:17.158Z</atom:updated>
            <content:encoded><![CDATA[<p>Short post today, on fixing DNS issues in the latest Ubuntu 18.04 LTS. I upgraded my ThinkPad from Ubuntu 16.04 LTS, and started hitting DNS issues right away. The common symptoms were:</p><ol><li>Websites taking forever to resolve URL, and eventually timing out or returning random DNS errors.</li><li>Updates getting stuck, waiting for name resolution.</li></ol><p>Here is the solution that worked for me (like a charm!):</p><p><strong>Step 1:</strong> Add Google’s (or your favorite) public DNS to /etc/systemd/resolved.conf:</p><pre>DNS=8.8.8.8 2001:4860:4860::8888<br>FallbackDNS=8.8.4.4 2001:4860:4860::8844</pre><p><strong>Step 2:</strong> Restart networking (or reboot the machine)</p><p>This should fix the issue. Hope it helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd4f9ca56620" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Life with the iPad Pro 10.5]]></title>
            <link>https://medium.com/@ahmadb/life-with-the-ipad-pro-10-5-df33148be4e5?source=rss-bd429c04d807------2</link>
            <guid isPermaLink="false">https://medium.com/p/df33148be4e5</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[surface-pro]]></category>
            <category><![CDATA[ipad-pro]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Ahmad Bilal]]></dc:creator>
            <pubDate>Sat, 26 Aug 2017 22:53:35 GMT</pubDate>
            <atom:updated>2017-08-26T22:53:35.077Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z2pWFNbhtsBK0py58h18Rg@2x.jpeg" /></figure><p>This morning, when I had to write a rather lengthy email to my feature team regarding investigations on a new feature idea, instead of reaching out for the work MacBook Pro, I pulled out my new iPad Pro 10.5 from its sleeve (a $17 replica of the $150 original Apple iPad sleeve from eBay!). Typically, I would not do something like this on a “mobile” device, but the iPad Pro has changed it. So does this imply that the post-PC era has arrived? Let’s find out.</p><p>Before I go into the details, here is the spoiler: iPad Pro is awesome, but it is not for everyone.</p><p>I am usually very picky about the devices in my life (I know it sounds geeky, but that’s what it is). So before adding an iPad Pro to my lifestyle, I did quite a bit of research. The key competitor was Microsoft’s Surface Pro. I finally ordered the iPad Pro, had afterthoughts (mainly due to its high price point for a tablet), and cancelled the order. But it kept tempting me enough to order it again and here I am, using it for some “real” work.</p><p>A lot has already been said and written about the specifications of the new iPad Pro 10.5, so I will skip on those details. In short, this incredibly powerful and efficient device showcases Apple’s finest hardware like no other. Some of the highlights, like the gorgeous screen, indicate areas where another device manufacturer would have cut corners, but Apple perhaps wanted to show off what they can really do, and not just what an average consumer would be content with. The Apple keyboard is comfortable to type on (probably more than the new MacBook Pro keyboard, in my opinion) and the Apple Pencil is the best inking experience that I have had on a device (including the Surface Pro that I tried in Microsoft Store).</p><p>On the software front, iOS 10 is buttery smooth, as any version of iOS usually is on a new Apple device, and it is only going to get better with iOS 11, which will add new multitasking capabilities to the iPad. This is one more step Apple is taking to make the iPad more suitable as a primary device for most users. The app ecosystem is vibrant, and perhaps the only viable tablet app ecosystem around. Microsoft’s app ecosystem (modern apps) is a junkyard, and Android’s app ecosystem still treats tablets as bigger phones with no real differentiation.</p><p>Let’s go into the main use cases where I feel that this device shines.</p><p>Since I am interested in music, my first motivation for getting the iPad Pro was to use it as an instrument and mobile studio. And that is one of the areas where iPad Pro really shines. There are plenty of high quality music apps in the App Store, and an attractive hardware ecosystem around them. Apple’s GarageBand has matured into a viable mobile music workstation. In addition to that, I ordered a <a href="http://www.korg.com/us/products/computergear/nanokey_studio/">Korg nanoKey Studio</a>, which is a wireless MIDI controller. The companion Korg Gadget app provides a collection of synthesizers, converting the iPad Pro into a room full of analog synthesizers and drum machines. I also connected my <a href="http://line6.com/sonicport-audio-interface/sonicport-vx/">Line 6 Sonic Port VX</a>, which is a pro audio interface with the iPad Pro. It still works, and comes with the free Mobile POD companion app, which gives a nice collection of virtual guitar amps. Another app which I added to the mix was SwarPlug, which adds 79 traditional Indian classical music instruments (for a price of $100, but it is worth it if you are into that kind of music) to the mix. This app works great with GarageBand as a virtual instrument through Apple’s support for Audio Units in iOS. All these high quality apps open up the music production experiences which actually cost way more on a PC or a Mac.</p><p>The second unique value that the iPad Pro brings to me is in its capabilities as a digital sketchbook. Inking with Apple Pencil is as close as its gets to a high-end Wacom experience, at a fraction of the cost (assuming you already have an iPad Pro). The strong app ecosystem again comes into play here. There are sketching Adobe apps like Adobe Draw and Adobe Sketch, and Autodesk Sketchbook if you need more capabilities. Then there is the awesome natural media experience through ArtRage (also available on desktop platforms). Procreate is another great app for sketching. For more “pro” experiences, there is the very capable vector graphics design app, Autodesk Graphic, and the excellent photo editing app, Affinity Photo. A “mobile” version of Adobe Lightroom is also available, but it has very limited functionality. I also find Paper by FiftyThree to be a great app for quick sketches when the inspiration strikes. The experience of Apple Pencil on all these apps is consistently high quality.</p><p>Switching gears to the work apps, there are a few options here. Since I have Microsoft Office 365 subscription, I use Outlook for emails, and the familiar Office apps like Word, Excel, PowerPoint and OneNote for work. G Suite apps are also available (I use Google Docs for personal documents). Setting up the iPad Pro for work was a breeze through VMware AirWatch (disclaimer: I am a Product Manager on AirWatch). It configured VPN and work apps with single sign on, and I was connected to work, accessing Intranet sites within minutes. There is no reason why I can’t use the iPad Pro for work when traveling, instead of carrying the heftier 15&quot; MacBook Pro.</p><p>Looking back at the alternatives, I seriously considered the Surface Pro for its versatility, but then a few things worked in favor of the iPad Pro. First and foremost is the thoroughly modern user experience of iOS, compared to the less elegant hybrid combination of new and old worlds on Windows 10. Apple’s mobile OS is a clean break from the past. Unlike Windows 10, it can be navigated end-to-end with touch. The iPad Pro also sheds the Intel baggage in favor of Apple’s own efficient and powerful A10X Fusion processor, which beats Intel Core i5, and compares favorably with Intel Core i7 mobile processors in some performance benchmarks, while maintaining excellent battery life. The iPad Pro is also more compact than the Surface Pro. And it doesn’t have what frustrates me the most on Windows 10 — the clunky Windows Update, which not only nags in middle of work, but also takes ages to complete (Microsoft, please fix this mess!).</p><p>Summing up, if you are into creative stuff (art &amp; music etc.) and are willing to pay for a premium experience, the iPad Pro will be a thoroughly enjoyable experience. It will also help you get work done (unless you are a developer, in which case you should have a ThinkPad running Linux anyway!). But if you just want to use a tablet for browsing and playing games, there are many less expensive options (like the “other” iPad and a host of Android tablets) which will fit the bill, with some extra cash to spend on the new iPhone 8 or Pixel 2. Personally, I think the iPad Pro fits the experiences that I care about the most, and yes, this article was also typed on it!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df33148be4e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>