View ChristmasTree.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
printTree :: Int -> IO () | |
printTree h = (putStrLn . unlines . center) $ "()" : (showTreeLvl <$> [0 .. h]) ++ ["[]"] | |
where showTreeLvl l = "/" ++ (take (l * 2) . drop (l `mod` 3) . concat . repeat) "~~o~~*~o~~*~~o~*" ++ "\\" | |
center ss = let w = maximum (length <$> ss) in (\s -> concat (replicate ((w - length s) `div` 2) " ") ++ s) <$> ss | |
-- > printTree 5 | |
-- | |
-- () | |
-- /\ | |
-- /~o\ |
View gist:73c61312eabf5b5aea9ccbd7be2e3700
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.mmsF1c:nth-child(10)::after, .mmsF1c:nth-child(19)::after { | |
border-bottom-color: black; | |
border-bottom-width: 2px; | |
} | |
// Good way to apply this CSS consistently is to use Stylebot Chrome extension. |
View wifi-dongle.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
View parseAzureBlobUri.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |