Skip to content

Instantly share code, notes, and snippets.

View Ouwen's full-sized avatar

Ouwen Huang Ouwen

View GitHub Profile
#!/bin/bash
# "Check if Screen is installed..."
if ! command -v screen &> /dev/null; then
sudo apt-get install -y -qq screen >/dev/null 2>&1;
else
echo "screen is already installed.";
fi
if screen -list | grep -q "vs_code_tunnel"; then
@Ouwen
Ouwen / query.js
Last active January 31, 2023 16:53
Query Dicoms
import { api } from 'dicomweb-client'; // see: https://www.npmjs.com/package/dicomweb-client
const c = {
name: 'aws',
wadoUriRoot: 'https://.../dicomweb',
qidoRoot: 'https://.../dicomweb',
wadoRoot: 'https://.../dicomweb',
qidoSupportsIncludeField: false,
supportsReject: false,
imageRendering: 'wadors',
from functools import partial
# Try to code partial from scratch! (hint, use *args and **kwargs as parameter catch alls)
def function_with_several_params(a='None', b='None'):
print(a, b)
tmp = partial(function_with_several_params, a='hello')
tmp(b='goodbye')
def partial(fn, *fargs, **fkwargs):
def wrapper_fn(*args, **kwargs):
return fn(*fargs, *args, **fkwargs, **kwargs)
return wrapper_fn
def function_with_several_params(a='None', b='None'):
print(a, b)
tmp_fn = partial(function_with_several_params, a='hello')
"""TODO(isic): Add a description here."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow_datasets as tfds
# TODO(isic): BibTeX citation
_CITATION = """
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
v = tf.get_variable(name="v", shape=(), initializer=tf.glorot_uniform_initializer())
saver = tf.train.Saver()
sess = tf.Session(graph=g1);
saver.restore(sess, "/tmp/model.ckpt")
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
v = tf.get_variable(name="v", shape=(), initializer=tf.glorot_uniform_initializer())
saver = tf.train.Saver()
sess = tf.Session(graph=g1);
sess.run(v.initializer)
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
v = tf.get_variable(name="v", shape=(), initializer=tf.zeros_initializer())
sess = tf.Session(graph=g1);
sess.run(v.initializer)
# sess.run(tf.global_variables_initializer())
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
# Add a single variable to our graph
v = tf.get_variable(name="v", shape=(), initializer=tf.glorot_uniform_initializer())
sess = tf.Session(graph=g1)
sess.run(v.initializer) # Run just the initializer on our variable
import tensorflow as tf
g1 = tf.Graph()
with g1.as_default():
my_input = tf.constant([-1,0,1], dtype=tf.float16, name="input")
my_printed_input = tf.Print(my_input, [], message="Running the graph", name="print")
a = tf.square(my_printed_input, name="A")
b = tf.cos(a, name="B")
c = tf.sin(a, name="C")