Instead of concatenation:
str=""
str+="This is a\n"
str+="multiline string"
You can use a heredoc:
Instead of concatenation:
str=""
str+="This is a\n"
str+="multiline string"
You can use a heredoc:
def aspect_ratio(width=0, height=0): | |
if width <= 0 or height <= 0: | |
return None | |
a, b = width, height | |
while b: | |
a, b = b, a % b | |
gcd = a | |
return (width // gcd, height // gcd) |
You can use the $0
variable to get the script's path:
cat "$(dirname $0)/some/file.txt"
If you have Bash, you can use ${BASH_SOURCE[0]}
instead of $(dirname $0)
, to avoid spawning a subshell. To test, create 2 files in /tmp/test
:
mkdir -p /tmp/test
When neural network frameworks are built, they are dynamically linked to CUDA and cuDNN libraries. These are so
or shared object files that are loaded at runtime. The LD_LIBRARY_PATH
environment variable tells Ubuntu where to look for these files.
On Windows, these are dll
or dynamic link library files.
GPUs were originally designed for graphics. When you're running a neural network, you're not using the GPU for graphics. CUDA (Compute Unified Device Architecture) is a general-purpose computing on GPUs (GPGPU) platform that allows C-code to run on the GPU. cuDNN (CUDA Deep Neural Network) is a library of primitives like matrix multiplication and convolution that are optimized for GPUs.
To ensure everything works, you want your system to provide the versions of CUDA and cuDNN that your software expects.
This assumes you have a free Cloudflare account and you're already using it as your DNS provider. Also, this is going to be using cloudflared
directly on-demand, rather than an always-on systemd service. Based on the official tutorial.
Installing the system service is optional.
# mac
Until now, trying to style an article, document, or blog post with Tailwind has been a tedious task that required a keen eye for typography and a lot of complex custom CSS.
By default, Tailwind removes all of the default browser styling from paragraphs, headings, lists and more. This ends up being really useful for building application UIs because you spend less time undoing user-agent styles, but when you really are just trying to style some content that came from a rich-text editor in a CMS or a markdown file, it can be surprising and unintuitive.
We get lots of complaints about it actually, with people regularly asking us things like:
Why is Tailwind removing the default styles on my
h1
elements? How do I disable this? What do you mean I lose all the other base styles too?
These are so sweet. I didn't see an announcement or blog post; first noticed them in vitest-axe
. Here's the community discussion on them.
> [!NOTE]
> Highlights information that users should take into account, even when skimming.
Note
Highlights information that users should take into account, even when skimming.
#!/usr/bin/env bash | |
set -euo pipefail | |
# Generates favicons and a webmanifest from a single image | |
# https://evilmartians.com/chronicles/how-to-favicon-in-2021-six-files-that-fit-most-needs | |
# | |
# Usage: | |
# favicon.sh <file> [dir] [flags] | |
# | |
# Args: |
#!/usr/bin/env bash | |
#shellcheck disable=SC2155 | |
set -euo pipefail | |
# upgrade outdated pinned dependencies and commit the changes | |
npm_upgrade() { | |
local dry_run=false | |
local prod_only=false | |
local help=false | |
local help_msg="npm_upgrade |