Skip to content

Instantly share code, notes, and snippets.

View aseifert's full-sized avatar

Alexander Seifert aseifert

View GitHub Profile

This Too Shall Pass

“One day Solomon decided to humble Benaiah Ben Yehoyada, his most trusted minister. He said to him, “Benaiah, there is a certain ring that I want you to bring to me. I wish to wear it for Sukkot which gives you six months to find it.”

“If it exists anywhere on earth, your majesty,” replied Benaiah,

“I will find it and bring it to you, but what makes the ring so special?” “It has magic powers,” answered the king. “If a happy man looks at it, he becomes sad, and if a sad man looks at it, he becomes happy.” Solomon knew that no such ring existed in the world, but he wished to give his minister a little taste of humility.

Spring passed and then summer, and still Benaiah had no idea where he could find the ring. On the night before Sukkot, he decided to take a walk in one of the poorest quarters of Jerusalem. He passed by a merchant who had begun to set out the day’s wares on a shabby carpet. “Have you by any chance heard of a magic ring that makes the happy wearer forget his joy and the

@aseifert
aseifert / renderjson.py
Last active February 22, 2019 13:54
collapsible JSON objects for Jupyter notebooks
class rjson(object):
"""
(with modifications) from:
https://www.reddit.com/r/IPython/comments/34t4m7/lpt_print_json_in_collapsible_format_in_ipython/
which in turn is leveraging http://caldwell.github.io/renderjson/
"""
def __init__(self, json_data, open='🔽', close='🔺', level=1):
if isinstance(json_data, dict):
self.json_str = json.dumps(json_data)
else:
@aseifert
aseifert / functions.fish
Last active January 29, 2020 10:36
quickly launch and set up EC2 instances
function ec-launch -d "launch new EC2 instance"
set -l name ""
set -l instancetype m5.4xlarge
set -l disksize 100
set -l ami ami-02df9ea15c1778c9c # ubuntu 18.04
set -l keyname alex-eu-west-1
# parse arguments
getopts $argv | while read -l key value
switch $key
@aseifert
aseifert / .python-environment.yml
Created March 22, 2022 08:22
default conda environment
channels:
- conda-forge
dependencies:
- python=3
- pip
# python libs
- pytest
- flake8
- black
- isort