Fav Mac Terminal Setup

Andale Mono 13

export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=GxFxCxDxCxegedabagaced

Python class attributes from/to dictionary

class McItems(dict):

    attrs = ["guid"]

    def as_dict(self):
        return self.__dict__

    def from_dict(self, *val, **kwargs):
        for key in val:
            setattr(self, key, val[key])
        for key in kwargs:
            setattr(self, key, kwargs[key])

    def from_dict_selected(self, *val, **kwargs):
        if len(self.attrs) == 1:
            raise "overwrite for McItems has to have attrs with list of more than one item"

        for key in val:
            if key in val.attrs:
                setattr(self, key, val[key])

Spotify in Container

REF: https://stackoverflow.com/questions/41083436/how-to-play-sound-in-a-docker-container

you will notice

docker run -it \
    -v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
    -e DISPLAY=unix$DISPLAY \ # pass the display
    --device /dev/snd \ # sound
    --name spotify \
    jess/spotify
or for Chrome, at the end

docker run -it \
    --net host \ # may as well YOLO
    --cpuset-cpus 0 \ # control the cpu
    --memory 512mb \ # max memory it can use
    -v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
    -e DISPLAY=unix$DISPLAY \ # pass the display
    -v $HOME/Downloads:/root/Downloads \ # optional, but nice
    -v $HOME/.config/google-chrome/:/data \ # if you want to save state
    --device /dev/snd \ # so we have sound
    --name chrome \
    jess/chrome