Skip to content

Instantly share code, notes, and snippets.

from numpy.random import choice
class KMedoid:
def __init__(self, k, verbose=False):
self.k = k
self.maxiter = 100
self.verbose = verbose
def assign_labels(self, S):
return np.argmin(S, axis=1)
@sunhwan
sunhwan / gist:197446cdb29ff2cf0b7562fabf5d31b0
Created June 21, 2021 01:52
ipython cell magic - kroki
from IPython.core.magic import register_cell_magic
from IPython.display import SVG, display
import requests
diagrams_supported = set(['blockdiag', 'seqdiag', 'mermaid', 'actdiag',
'nwdiag', 'packetdiag', 'rackdiag', 'erd',
'nomnoml', 'plantuml', 'umlet', 'wavedrom',
'bpmn', 'bytefield', 'pikchr', 'graphviz',
'vega', 'vega-lite', 'ditaa', 'svgbob'])
@sunhwan
sunhwan / config
Last active April 11, 2023 19:48
AWS parallel-cluster config file
[aws]
aws_region_name = us-east-1
[aliases]
ssh = ssh {CFN_USER}@{MASTER_IP} {ARGS}
[global]
cluster_template = default
update_check = true
sanity_check = true