Skip to content

Instantly share code, notes, and snippets.

@wseaton
wseaton / notebook.patch
Last active March 16, 2021 20:27
add nbviewer button to jupyterhub
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 November 9, 2018 18:41
SSL certs by hand AE5

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.

"""
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 April 19, 2024 12:30
Self Signed Certificate with Custom Root CA

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

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 18:36
Upgrade checklist, May 2016
  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 September 18, 2023 20:21
Test performance of different counting functions in Python
"""
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@danielballan
danielballan / yaml_context.py
Created November 19, 2014 21:36
YAML context
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):
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 18, 2024 10:01
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname