Skip to content

Instantly share code, notes, and snippets.

@hoshiyosan
hoshiyosan / main.py
Last active June 29, 2023 12:32
Iterate over large XML hosted by a web server. Download is performed once, then cached file is used.
import io
import logging
import os
from typing import Generator
import xml.etree.ElementTree
import requests
logging.basicConfig(level=logging.DEBUG, format="%(levelname)s :: %(message)s")
@hoshiyosan
hoshiyosan / exceptions.md
Last active May 3, 2022 07:48
I describe here the errors I encountered while using VMware Workstation and how I was able to solve them

Error: message "module disk power on failed" at VM startup

Explaination: This happens when VMware fails to release lock on virtual disk, for example after a power failure

Resolution: with VMware Workstation closed, check whether the VM's folder contains files, or sub-directories with a .lck (lock) extension, and delete them.

@hoshiyosan
hoshiyosan / install_docker_bash_completions.sh
Last active March 9, 2022 16:29 — forked from toschneck/install_docker_bash_completions.sh
Install Docker and Docker-Compose bash completion
#!/usr/bin/env bash
set -e
echo "install docker bash completion"
curl -L https://raw.githubusercontent.com/docker/cli/v$(docker version --format '{{.Server.Version}}' | sed 's/-.*//')/contrib/completion/bash/docker -o /etc/bash_completion.d/docker
echo "install docker-compose bash completion"
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
echo ".... done!"
@hoshiyosan
hoshiyosan / dataclasses_utils.py
Last active November 12, 2021 12:23
Dataclass serialization / deserialization in Python
import dataclasses
import importlib
import json
from typing import Any
def dataclass_from_dict(d: dict):
try:
modulepath, classname = d.pop("__class__").rsplit(".", 1)
module = importlib.import_module(modulepath)
@hoshiyosan
hoshiyosan / Create a Vue.js plugin using Typescript.md
Last active July 22, 2024 00:43
Create a Vue.js plugin using Typescript

Create a Vue.js plugin using Typescript

Initialize project with npm

Create the project directory and initialize an npm project

mkdir my-plugin && cd my-plugin
npm init -y