This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curve = hv.Curve(range(10)) # Could be any HoloViews object | |
| renderer = hv.renderer('bokeh') | |
| # Using renderer save | |
| renderer.save(curve, 'graph') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| printenv | grep -P '(UID.*|SEGMENT.*)' | awk '{print "export",$0}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import importlib | |
| importlib.reload(my_module) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env python | |
| import os | |
| import sys | |
| import django | |
| sys.path.append('/ambition') | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ambition.settings") | |
| django.setup() | |
| from entity.models import Entity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # Save this to appify on your path and make executable | |
| # Usage: appify my_bash_script.sh "My Name To Click On In Finder" | |
| APPNAME=${2:-$(basename "${1}" '.sh')}; | |
| DIR="${APPNAME}.app/Contents/MacOS"; | |
| if [ -a "${APPNAME}.app" ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %config Completer.use_jedi = False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # From https://github.com/Qix-/better-exceptions | |
| # Install: pip install better_exceptions | |
| # Example usage | |
| from ambition.apps.trigger_management.segment_trackers import TriggerUtilizationTracker | |
| import better_exceptions; better_exceptions.hook() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| %load_ext autoreload | |
| %autoreload 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TimeBatcher: | |
| def __init__(self, ending=None, starting=None, num_days=None, num_batches=5): | |
| if ending is None: | |
| ending = datetime.datetime.now() | |
| if {starting, num_days} == {None}: | |
| raise ValueError('You must supply either starting or num_days') | |
| if num_days is not None: | |
| starting = ending - datetime.timedelta(days=num_days) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /**************************************************/ | |
| /**** put this in ~/.jupyter/custom/custom.css ****/ | |
| /**************************************************/ | |
| /* Make the notebook cells take almost all available width */ | |
| .container { | |
| width: 99% !important; | |
| } | |
| /* Prevent the edit cell highlight box from getting clipped; |