A versatile object mocking utility for unit testing.
For example, assuming a function that uses a connection utility:
def find_python_files_at(connection):
try:
status, stdout, stderr = connection.send_command("ls /my/path", shell=True)
#!/usr/bin/env bash | |
# Use this `rustr` script as a shebang target. | |
# put `rustr` somewhere on your PATH | |
filename="$1"; shift | |
temp="$(mktemp)" | |
rmtemp() { rm "$temp"; } | |
touch "$temp" |
#!/usr/bin/env bash | |
# Run `goenv ./env-dir` to create an isolated dependencies dir | |
# Source the resulting file to activate it in a local shell session | |
# . env-dir/go-activate | |
# This sets GOPATH and adds a PATH entry to the environment | |
# Run `go-deactivate` to deactivate it. | |
if [[ -z "$1" ]]; then | |
echo "No name specified" |
// Some things | |
List<String> items = ["banana", "pear", "apple"] | |
// Filtering out | |
List<String> e_items = items.findAll { it.contains("e") } | |
println(e_items) | |
// List from list | |
List<String> fruity = items.collect { "Fruit: $it" } | |
println fruity |
Commentary published in an article: https://dev.to/taikedz/rusts-option-type-in-python-547p
Using this type allows the developer to express nullness and force the recipient of the Option to code for it. The Option does not stand in for the value, the value must be unpacked from it.
#!/usr/bin/env bash | |
if [[ -z "$*" ]]; then | |
echo -e "Usage:\n\t$(basename "$0") \$SERVER/\$IMAGE:\$TAG [delete]" | |
echo "Omit the 'delete' argument to query the manifest for the image" | |
echo "Use 'delete' to actually perform deletion" | |
exit 0 | |
fi | |
REGISTRY_SERVER="$(echo "$1" | cut -d/ -f1)" |
A quick and dirty script for loading/appending to PATH
Oftentimes when I write install scripts i have to go looking for a path and its presence to avoid duplication, parsing the .bashrc and .profile scripts .
This is tedious, and prone to issues.
If we could have a basic utility that already took care of this as a default item in the system, it would be handy.
Converterd to an articla: https://dev.to/taikedz/considering-syncthing-at-work-3pin
An interim solution for passing around large files using decentralised means
Syncthing uses end-to-end encryption to send files directly to other devices. If two devices are on the same network, the instances communicate directly with eachother. If not, they send traffic, encrypted, via a relay server (akin to a router).
This solution can be useful for sending large files between workstations, when other means are unavailable.