Skip to content

Instantly share code, notes, and snippets.

View VolkerH's full-sized avatar
🌏
Somewhere at large

Volker Hilsenstein VolkerH

🌏
Somewhere at large
View GitHub Profile
@VolkerH
VolkerH / pprint_numpy.py
Created September 5, 2023 14:51 — forked from eric-wieser/pprint_numpy.py
A super janky example of how _repr_html_ could be implemented
import numpy as np
def _html_repr_helper(contents, index=()):
dims_left = contents.ndim - len(index)
if dims_left == 0:
s = contents[index]
else:
s = ''.join(_html_repr_helper(contents, index + (i,)) for i in range(contents.shape[len(index)]))
return "<div class='numpy-array-ndim-{} numpy-array-ndim-m{}' title='[{}]'>{}</div>".format(
@VolkerH
VolkerH / PY-CircleFitting.ipynb
Created March 29, 2023 11:21 — forked from WetHat/PY-CircleFitting.ipynb
Fitting a Circle to a 2d Point Cloud by Linear Least Squares
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@VolkerH
VolkerH / stable_diffusion_walk.py
Created September 1, 2022 15:07 — forked from nateraw/stable_diffusion_walk.py
Walk between stable diffusion text prompts
"""
Built on top of this gist by @karpathy:
https://gist.github.com/karpathy/00103b0037c5aaea32fe1da1af553355
stable diffusion dreaming over text prompts
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stable_diffusion_walk.py --prompts "['blueberry spaghetti', 'strawberry spaghetti']" --seeds 243,523 --name berry_good_spaghetti
@VolkerH
VolkerH / paramiko_example.py
Created March 2, 2021 20:50 — forked from batok/paramiko_example.py
Paramiko example using private key
import paramiko
k = paramiko.RSAKey.from_private_key_file("/Users/whatever/Downloads/mykey.pem")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print "connecting"
c.connect( hostname = "www.acme.com", username = "ubuntu", pkey = k )
print "connected"
commands = [ "/home/ubuntu/firstscript.sh", "/home/ubuntu/secondscript.sh" ]
for command in commands:
print "Executing {}".format( command )
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@VolkerH
VolkerH / napari_browser.py
Created May 29, 2020 04:23 — forked from bioimage-analysis/napari_browser.py
File browser for napari
from PyQt5.QtWidgets import (
QPushButton,
QComboBox,
QTabWidget,
QHBoxLayout,
QFileDialog,
QDialogButtonBox,
QWidget,
QSlider,
)
@VolkerH
VolkerH / main.py
Created November 8, 2019 01:50 — forked from Bomberus/main.py
Asyncqt, concurrent executor example
import sys, asyncio, random, threading, datetime
from qtpy.QtWidgets import QApplication, QProgressBar
from asyncqt import QEventLoop, QThreadExecutor
app = QApplication(sys.argv)
loop = QEventLoop(app)
asyncio.set_event_loop(loop)
progress = QProgressBar()
@VolkerH
VolkerH / runZonalTempViz.py
Created May 30, 2019 07:08 — forked from anttilipp/runZonalTempViz.py
This is the Python code I used to make the visualization # "Temperature anomalies, zonal means, 1900 - 2016"
#
# Hi all,
# this is the Python code I used to make the visualization
# "Temperature anomalies, zonal means, 1900 - 2016"
# (https://twitter.com/anttilip/status/921809347658895361).
# Please be aware that originally I wrote this just to see how this type
# of visualization would work. The code was not ment to be published
# and therefore has only a couple of/no comments and is most likely
# not written in the most optimal way.
#
@VolkerH
VolkerH / temperatureCircle.py
Created May 30, 2019 07:08 — forked from anttilipp/temperatureCircle.py
Code to reproduce the "Temperature Circle" visualization.
#
# Hi all,
# this is the Python code I used to make the visualization "Temperature circle"
# (https://twitter.com/anttilip/status/892318734244884480).
# Please be aware that originally I wrote this for my tests only so the
# code was not ment to be published and is a mess and has no comments.
# Feel free to improve, modify, do whatever you want with it. If you decide
# to use the code, make an improved version of it, or it is useful for you
# in some another way I would be happy to know about it. You can contact me
# for example in Twitter (@anttilip). Unchecked demo data (no quarantees)
@VolkerH
VolkerH / asciiart.py
Created April 12, 2019 00:09 — forked from wshanshan/asciiart.py
Create ASCII art from an image
from PIL import Image, ImageDraw, ImageFont
from colour import Color
import numpy as np
# The function convert an image to ascii art
# f: Input filename
# SC: the horizontal pixel sampling rate. It should be between 0(exclusive) and 1(inclusive). The larger the number, the more details in the output.
# If you want the ascii art output be the same size as input, use ~ 1/ font size width.
# GCF: >0. It's an image tuning factor. If GCF>1, the image will look brighter; if 0<GCF<1, the image will look darker.
# out_f: output filename