Skip to content

Instantly share code, notes, and snippets.

@beddari
beddari / dict_merge.py
Created October 17, 2017 13:29 — forked from angstwad/dict_merge.py
Recursive dictionary merge in Python
import collections
def dict_merge(dct, merge_dct):
""" Recursive dict merge. Inspired by :meth:``dict.update()``, instead of
updating only top-level keys, dict_merge recurses down into dicts nested
to an arbitrary depth, updating keys. The ``merge_dct`` is merged into
``dct``.
:param dct: dict onto which the merge is executed
:param merge_dct: dct merged into dct
@beddari
beddari / listdisks.sh
Created January 8, 2015 20:08
listdisks.sh
#!/bin/bash
# Lists Linux block devices and for each one the controller
# it is connected to.
set -o pipefail
for i in /sys/block/sd*; do
# Find the path that contains the PCI ID of the controller.
link=$(readlink $i)
# Assume that the PCI ID of the controller is the path part
# right before the /host... part.