This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PyQt5.QtWidgets import ( | |
QPushButton, | |
QComboBox, | |
QTabWidget, | |
QHBoxLayout, | |
QFileDialog, | |
QDialogButtonBox, | |
QWidget, | |
QSlider, | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder