Skip to content

Instantly share code, notes, and snippets.

@lebalz
lebalz / playsound.py
Last active October 10, 2020 13:31
playsound in jupyter
from IPython.display import Audio
from pathlib import Path
def _playsoundJupyter(sound, block=True):
sound = Path(sound)
sound = str(Path(get_ipython().home_dir, sound.name))
audio = Audio(sound, autoplay=False)
display(audio)
from platform import system
@lebalz
lebalz / tts.py
Last active October 10, 2020 12:51
def save(self, savefile):
"""Do the TTS API request and write result to file.
Args:
savefile (string): The path and file name to save the ``mp3`` to.
Raises:
:class:`gTTSError`: When there's an error with the API request.
"""
@lebalz
lebalz / git_sync_all.py
Created December 28, 2020 16:50
sync all git projects in a folder
from pathlib import Path
import os
root = Path(__file__).parent
git_folders = root.rglob("*.git")
for git_dir in git_folders:
git = git_dir.parent
print('stash and pull master: ', git)
res = os.system(f'(cd {git} && git stash && git checkout master && git pull)')