Skip to content

Instantly share code, notes, and snippets.

@robdmc
robdmc / holoviews_fontsize.py
Last active August 2, 2023 20:49
holoviews font size control
c1 = dfj.hvplot.scatter(
"x_col_name",
"y_col_name",
xlabel="My x label",
ylabel="My y label",
).options(
logx=True,
logy=True,
color="red",
fontsize={
@robdmc
robdmc / visidata_from_python_interpreter.py
Created January 11, 2022 15:46
Start visidata from python interpreter
import pandas as pd
from visidata import vd
df = pd.DataFrame({'a': [1, 2, 3], 'b':[4, 5, 6]})
vd.view_pandas(df)
# Some class definition out of your control
class JaredLewis:
def loves(self):
return 'Savage Garden'
# A method you wish the class had
def hates(self):
return "Randy Travis"
# Instantiate the class
@robdmc
robdmc / holoviews_hv_independent_axes.py
Created December 30, 2021 00:03
Holoviews Independent Axes
c1 = hv.Curve(...)
c2 = hv.Curve(...)
obj = hv.Layout([c1, c2]).cols(1).options(shared_axes=False)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@robdmc
robdmc / notebook_ssl_syscall_eof_django.py
Created April 22, 2021 16:46
Jupyter Notebook SSL SYSCALL error: EOF detected
# This is a fix for the following notebook error in django notebooks
# OperationalError: SSL SYSCALL error: EOF detected
from django.db import connections
conn = connections['default']
conn.connect()
------------------------------------------------------------------------------
-- Identify the kind they are using for scoring
------------------------------------------------------------------------------
WITH scored_entity_kind AS (
SELECT
id
FROM
entity_entitykind
WHERE
name='collection.Role'
@robdmc
robdmc / kill_processes.sh
Created February 24, 2021 17:16
Kill unix linux processes by session id. also pstree
# Keywords: zombies processes ps pstree kill
# See all processes with pids and session ids
ps -efj | grep -E 'UID|python'
# See process tree with pids
pstree -ap
# Kill processes using session id
pkill -s <session_id>
# First, from within the docker ambition container run
# lamb.instance sync
# Then run this code in a container
# You'll have to choose an instance, but it doesn't matter
# which one. Multiquery can access all instances from anywhere.
import django
django.setup()
@robdmc
robdmc / vscode_view_markdown
Created February 1, 2021 14:31
vscode preview markdown
command-shift-v