The simplest approach is to use mock.mock_open
to simulate reading from a file.
This method works well when one only needs a single return value.
import unittest
from unittest import mock
#!/usr/bin/env bash | |
remove_containers_by_image() { | |
local image_name="" | |
local dry_run=false | |
# Local function to display help | |
display_help() { | |
echo "Usage: ${FUNCNAME[1]} [-h|--help] [-n|--dry-run] [-i|--image IMAGE_NAME]" | |
echo "" |
These commands generate and use private keys in unencrypted binary (not Base64 “PEM”) PKCS#8 format. The PKCS#8 format is used here because it is the most interoperable format when dealing with software that isn't based on OpenSSL.
OpenSSL has a variety of commands that can be used to operate on private
key files, some of which are specific to RSA (e.g. openssl rsa
and
openssl genrsa
) or which have other limitations. Here we always use
The snippets found here are a part of the Using Chart.js in Trilium tutorial.
The files should be linked to a render note to work, the video tutorial goes through the setup steps.
Note: The following versions appeared in the tutorial:
jira supports 5 colors for the panels that could be created programmatically
{panel:title=BlueDefault}
{panel}
{panel:title=Green|bgColor=e3fce3}
{panel}
{panel:title=Purple|bgColor=f3f0ff}
{panel}
{panel:title=Orange|bgColor=fff7d6}
{panel}
The code shows how to jump between the fake and real time allowing to:
Avoid using await Promise.resolve()
by ticking asynchronously, for example using fakeClock.tickAsync()
and then you could move between fake and real time, the code is updated to show this solution.
Using a macro to add double quotations over multiple lines in vim
Select the Lines of Interest:
Shift+V
.Start Recording the Macro:
q
followed by a letter (like a
) to start recording the macro into register a
.This gist is now packaged and maintained at weshouman/nautilus-meld-compare-extension
This Nautilus extension allows us to easily compare files and directories using the Meld comparison tool directly from the Nautilus context menu.
import unittest | |
import tempfile | |
import subprocess | |
# One could use vimdiff, meld, or even diff | |
def diff_with(test_func=None, tool='vimdiff'): | |
# The decorator was used with parentheses | |
# thus the test_func is not set, we need to call it ourself | |
if test_func is None: | |
return functools.partial(diff_with, tool=tool) |
Following is an index for the official Cilium documentation