This file contains hidden or 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
| sudo apt update && sudo apt upgrade; | |
| sudo apt autoremove nvidia* --purge; | |
| ubuntu-drivers devices; | |
| sudo apt-get install linux-headers-$(uname -r) build-essential; | |
| # reboot | |
| sudo apt install nvidia-cuda-toolkit; | |
| lspci | grep -i nvidia; | |
| sudo apt install nvidia-driver-550; | |
| sudo apt update && sudo apt upgrade; | |
| # reboot |
This file contains hidden or 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
| // ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
| // ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
| // Merge a `source` object to a `target` recursively | |
| const merge = (target, source) => { | |
| // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
| for (const key of Object.keys(source)) { | |
| if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
| } |
This file contains hidden or 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
| /** | |
| * Originally wrote this snippet for Suffragette/Pathé campaign (https://apps.facebook.com/inspiring-women) | |
| * | |
| * The campaign app forms a grid of square images pulled from social APIs based on | |
| * particular hashtags. This snippet sets the new width and | |
| * height based on their natural width and height to maintain the aspect ratio. | |
| * Works best for 1:1 aspect ratio but can be modified to accommodate other ratio. | |
| * | |
| * @param Element|Resource img - An image element/resource from DOM | |
| * @param int expected - Expected width or height |