Skip to content

Instantly share code, notes, and snippets.

@yasushisakai
yasushisakai / main.py
Created February 13, 2024 22:02
vector database small example
import chromadb
client = chromadb.Client()
collection = client.create_collection(name="fruits")
collection.add(
embeddings=[[1.25, 0.3, 0.4], [0.30, 0.5, 0.05], [1.00, 0.35, 0.5]],
documents=["apples", "bananas", "strawberries"],
metadatas=[{"store":"wholefoods"}, {"store":"traders joes"}, {"store": "wholefoods"}],
ids=["a", "b", "s"]
@yasushisakai
yasushisakai / config.py
Created March 30, 2023 13:40
ControlNet Hack
save_memory = False
image_file = 'C:\\Users\\yasushi\\shibuya.png'
save_dir = 'C:\\Users\\yasushi\\images'
repo_dir = 'C:\\Users\\yasushi\\code\\ControlNet'
a_prompt = 'city, birds eye view, best quality, insane details'
n_prompt = 'longbody, lowres, extra digit, fewer digits, cropped, low quality, worst quality'
# num_samples = gr.Slider(label="Images", minimum=1, maximum=12, value=1, step=1)
num_samples = 1
# image_resolution = gr.Slider(label="Image Resolution", minimum=256, maximum=768, value=512, step=64)
image_resolution = 512
@yasushisakai
yasushisakai / upscale.py
Created December 15, 2021 21:42
upscale images using opencv + deeplearning
import cv2
from cv2 import dnn_superres
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--in_dir', help='where is the images?')
parser.add_argument('--out_dir', help='where should I save the images?')
parser.add_argument('--num', help='id');
if __name__ == "__main__":
@yasushisakai
yasushisakai / vote.ipynb
Last active May 19, 2021 14:13
vote.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@yasushisakai
yasushisakai / cityio_stuff.md
Last active November 6, 2020 18:41
memo on cityio

tmux session

the shared tmux session is /tmp/shared. The following command will attach the session.

tmux -S /tmp/shared attach

please use this shared session, so the rest of us can see it.

you can detach the session by ``

@yasushisakai
yasushisakai / tensoflow_docker.md
Last active November 18, 2019 21:18
commands to start tensorflowing

ssh-ing with Tunneling

if using jupyter notebook, ssh tunnel so you can use your local browser

ssh -L 8888:localhost:8888 guest@IP.ADD.RE.SS

once shelled in, most of the containers are already setup

@yasushisakai
yasushisakai / nord.js
Created June 15, 2019 10:07
testing nord theme for blink shell (ios terminal emulator)
t.prefs_.set('color-palette-overrides',["#2e3440", "#3b4252", "#434c5e", "#4c556a", "#d8dee9", "#e5e9f0", "#eceff4", "#8fbcbb", "#88c0d0", "#81a1c1", "#5e81ac", "#bf616a", "#d08770", "#ebdb8b", "#a3be8c", "#b48ead"]);
t.prefs_.set('foreground-color', "#eceff4");
t.prefs_.set('background-color', "#2e3340");
t.prefs_.set('cursor-color', "#e5e9f0");
@yasushisakai
yasushisakai / location.py
Last active September 20, 2021 21:51
Hack for getting GPS from iOS Pythonista app, you will need the data folder and ‘geolocation.pyui’
import location
import console
import ui
import time
from datetime import datetime
running = True
interval = 5 #sec
@yasushisakai
yasushisakai / curves_to_geojson.py
Last active October 16, 2018 16:10
rhinopython script to convert curves to a geojson
import rhinoscriptsyntax as rs
import Rhino.Geometry.Point3d as Point
import json
# creates network from curves
# curves that are not ```Line```s will be divided
CURVE_DIVISION = 4
# points that are separted less then this value will
# be treated as one point
Verifying my Blockstack ID is secured with the address 1AHVq1CPaXyZydvRMNY6S9yNLRimCR4uTv https://explorer.blockstack.org/address/1AHVq1CPaXyZydvRMNY6S9yNLRimCR4uTv