Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin Šošić Martinsos

View GitHub Profile
@Martinsos
Martinsos / wifi-dongle.sh
Last active Oct 16, 2019
Script that uses NetworkManager to disconnect wifi card when wifi dongle connects and to reconnect it when wifi dongle disconnects.
View wifi-dongle.sh
#!/usr/bin/env bash
# This script should be positioned in /etc/NetworkManager/dispatcher.d/
# This script disconnects wifi card when wifi dongle connects and reconnects wifi card when
# wifi dongle disconnects. That way, when dongle is connected, we are sure it is being used instead of
# wifi card being used, and it all happens automatically.
event_interface=$1
event_type=$2
@Martinsos
Martinsos / parseAzureBlobUri.js
Last active Jun 17, 2020
Regex for parsing Azure Blob URI (javascript)
View parseAzureBlobUri.js
/**
* Validates and parses given blob uri and returns storage account, container and blob names.
* @param {string} blobUri - Valid Azure storage blob uri.
* Check link for more details: https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#resource-uri-syntax .
* Few examples of valid uris:
* - https://myaccount.blob.core.windows.net/mycontainer/myblob
* - http://myaccount.blob.core.windows.net/myblob
* - https://myaccount.blob.core.windows.net/$root/myblob
* @returns {Object} With following properties:
* - {string} storageAccountName