Skip to content

Instantly share code, notes, and snippets.

View rhee-elten's full-sized avatar

rhee-elten

  • Linkgenesis
  • Seoul, South Korea
  • 06:37 (UTC +09:00)
View GitHub Profile
@karpathy
karpathy / stablediffusionwalk.py
Last active July 17, 2024 06:48
hacky stablediffusion code for generating videos
"""
stable diffusion dreaming
creates hypnotic moving videos by smoothly walking randomly through the sample space
example way to run this script:
$ python stablediffusionwalk.py --prompt "blueberry spaghetti" --name blueberry
to stitch together the images, e.g.:
$ ffmpeg -r 10 -f image2 -s 512x512 -i blueberry/frame%06d.jpg -vcodec libx264 -crf 10 -pix_fmt yuv420p blueberry.mp4
@rhee
rhee / proc_stdout_gen.py
Created May 16, 2022 01:08 — forked from rhee-elten/proc_stdout_gen.py
## gen() function for proc.stdout ( run_commands, vdl_run ) ## async read from proc.stdout
## gen() function for proc.stdout ( run_commands, vdl_run )
## async read from proc.stdout
if True:
def gen(proc):
remains = b'' # remaining from prev read
while proc.poll() is None:
rlist, _, _ = select([proc.stdout],[],[],500)
if proc.stdout not in rlist:
continue
data = os.read(proc.stdout.fileno(), 16384)
"""
# https://gist.github.com/rhee/c038393822eabec681092b6941ef1f1e
# fake_ipython.py
Usage:
from fake_ipython import get_ipython
"""
from inspect import stack
def get_ipython():
#!/usr/bin/env python
# coding: utf-8
# // update: 2022-04-15 - single-cell python version
# // gist: https://gist.github.com/rhee/f42aa18c8e3dcb7b6c03c23e750124f7
with open('__nb-convert__.bash', 'w') as fout:
fout.write('''#!/bin/bash
try_nbconvert() {
local prefix="$1"; shift;
if test ! -z "$prefix"
then
## monitor GPU usage in jupyter notebook -- rhee.elten@gmail.com
## migrated to: https://gist.github.com/rhee-elten/1a1070e3a812ca863c3b937b5180b2f8
@rhee
rhee / manipulate_tf_pipeline_config.py
Created December 13, 2019 08:39
manipulate_tf_pipeline_config.py
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.3.0+dev
# kernelspec:
@rhee
rhee / vdl_shm.py
Created July 13, 2019 14:13
vdl_shm.py
# coding: utf-8
from traceback import print_exc
import os
import stat
import sys
from struct import pack, unpack, pack_into, unpack_from
import mmap
import ctypes
@rhee
rhee / TF_FORCE_GPU_ALLOW_GROWTH_example.bashrc
Created June 28, 2019 04:17
TF_FORCE_GPU_ALLOW_GROWTH_example.bashrc
:
export TF_FORCE_GPU_ALLOW_GROWTH=true
@ByungSunBae
ByungSunBae / EditGraph.py
Created December 5, 2017 09:18
simple tensorflow graph edit example
# from : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/graph_editor/examples/edit_graph_example.py
import numpy as np
import tensorflow as tf
from tensorflow.contrib import graph_editor as ge
# create a graph
g = tf.Graph()
with g.as_default():
@santisbon
santisbon / Search my gists.md
Last active July 14, 2024 18:07
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html