Skip to content

Instantly share code, notes, and snippets.

View netllama's full-sized avatar

Lonni J Friedman netllama

View GitHub Profile
@PatrikHlobil
PatrikHlobil / nested_iterator.py
Last active February 9, 2024 23:29
Get all keys or values of a nested dictionary or list in Python
def iterate_all(iterable, returned="key"):
"""Returns an iterator that returns all keys or values
of a (nested) iterable.
Arguments:
- iterable: <list> or <dictionary>
- returned: <string> "key" or "value"
Returns:
@gwpl
gwpl / example_use_way_of_playing_mp3s_over_https_on_Sonos_using_socos.sh
Last active January 25, 2019 16:12
Play FLAC m3u playlist from NAS on Sonos via http URIs
#!/bin/bash
#find speaker IP with `socos` :
# socos list
#(1) 192.168.1.101 Moon
#(2) 192.168.1.102 Mars
# (...)
#(6) 192.168.1.106 Playroom stereo
python3 soco_play_m3u_by_uri_http_flac_Sonos_NAS.py 192.168.1.106 meshuggah*.m3u 4dots*.m3u phobh*.m3u the_number_twelve_looks_like_you*.m3u the_dillinger_escape_plan*.m3u
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error