Skip to content

Instantly share code, notes, and snippets.

@wseaton
wseaton / notebook.patch
Last active Mar 16, 2021
add nbviewer button to jupyterhub
View notebook.patch
diff --git a/notebook/templates/page.html b/notebook/templates/page.html
index 9e68da1b2..a5539711b 100644
--- a/notebook/templates/page.html
+++ b/notebook/templates/page.html
@@ -133,7 +133,13 @@ dir="ltr">
{% endblock %}
{% block header_buttons %}
-
+
@oldarmyc
oldarmyc / instructions.md
Last active Nov 9, 2018
SSL certs by hand AE5
View instructions.md

To edit/set the SSL certificates by hand.

Before you being ensure that openjdk is installed. At the time of this java-1.8.0-openjdk is the current version on CentOS 7.5

yum install java-1.8.0-openjdk -y

Ensure you have your certificate and private key on the system you are running these commands.

View noblock.py
"""
https://jupyter.readthedocs.io/en/latest/architecture/how_jupyter_ipython_work.html
http://www.tornadoweb.org/en/stable/
https://jupyter-notebook.readthedocs.io/en/stable/extending/handlers.html
"""
from IPython import get_ipython
from IPython.core.magic import register_cell_magic
from tornado import ioloop
from functools import partial
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active Sep 25, 2021
Self Signed Certificate with Custom Root CA
View self-signed-certificate-with-custom-ca.md

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
View pandas-2.0-dask.rst

Background

Wes published notes for a Pandas 2.0 design document. I thought I'd commment from the perspective of dask.dataframe.

`Dask.dataframe`_ is an out-of-core / parallel/ distributed library that logically coordinates many Pandas DataFrames. It replicates a `decently large

@danielballan
danielballan / deployment-plan.md
Last active May 17, 2016
Upgrade checklist, May 2016
View deployment-plan.md
  1. Create 'DAMA Software' logbook in beamline Olog.
  2. Run conda list -n collection > /tmp/conda-list-before-upgrade.txt and include it in an Olog entry as an attachment.
  3. Commit any uncomitted code in the IPython profile, which should be located (or linked to) at ~/.ipython/profile_colllection.
  4. Create a new directory inside the IPython profile, ~/.ipython/profile_collection/acceptance_tests.
  5. Write acceptance tests as short, standalone scripts that can be executed like ipython --profile=collection -i 01-some-test.py. See examples from XPD or CSX.
  6. Run acceptance tests successfully, and commit repo.
  7. Install packages. Use --no-deps to keep conda from installing things you don't want.
    • event_model>=1.0.2
    • bluesky==0.5.1
    • databroker==0.4.1
@treyhunner
treyhunner / time_count_functions.py
Last active Jun 2, 2021
Test performance of different counting functions in Python
View time_count_functions.py
"""
Test performance of these counting methods:
- count_if_else: Set to 1 if not yet seen and increment otherwise
- count_if: Set to 0 if not yet seen, then increment regardless of containment
- count_exception: Attempt to increment and set to 1 if KeyError caught
- count_setdefault: Set default value to 0, then increment
- count_fromkeys: Create dict with necessary keys set to 0, then increment each
- count_set_and_comprehension: Create dict of items and counts using a set
- count_defaultdict: Increment count, automatically setting unseen values to 0
View pygotham_state_of_matplotlib.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View yaml_context.py
class YAML(object):
"""Open a YAML file as a dictionary in a context,
and update the file when the context is closed.
Example
-------
with YAML('data.yml') as data:
data['Trial A'] = {'foo': 1, 'bar': 2}
"""
def __init__(self, filepath):
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname