Skip to content

Instantly share code, notes, and snippets.

View trojblue's full-sized avatar

yada trojblue

  • Toronto
  • 01:35 (UTC -07:00)
View GitHub Profile
@trojblue
trojblue / cuda_11.8_installation_on_Ubuntu_22.04
Created August 30, 2023 16:56 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
# https://gist.github.com/MihailCosmin/affa6b1b71b43787e9228c25fe15aeba
###
@trojblue
trojblue / pytthon_debug.md
Created June 27, 2023 02:50
common python debug commands

save to txt:

my_list =  responses[56]

with open('my_file2.txt', 'w', encoding="utf-8") as f:
    for item in my_list:
        f.write("%s\n" % item)

save to clipboard:

@trojblue
trojblue / one-liners.md
Last active November 12, 2023 01:12
命令行one-liners

Windows

列出文件夹里的子文件夹的每个的大小:

Get-ChildItem -Path "." -Directory | ForEach-Object { $_.FullName + ": " + ((Get-ChildItem $_.FullName -Recurse | Measure-Object -Property Length -Sum).Sum / 1MB) + " MB" }

Linux

查看zip文件里的总文件个数:

# use in a ipynb notebook
import os
from PIL import Image
from IPython.core.display import HTML, display as disp
import io
import base64
# Disable truncating of text
pd.set_option('display.max_colwidth', None)
import re
import json
from selenium import webdriver
def try_get_page():
url = "https://bcy.net/illust/toppost100?type=week&date=20230612"
# You need to have the correct WebDriver executable (geckodriver for Firefox) in your PATH
driver = webdriver.Chrome()

更新环境:

apt-get -y update && apt-get -y upgrade && apt-get -y install iftop libgl1

miniconda:

cd ~/
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -P miniconda.sh
bash miniconda.sh
@trojblue
trojblue / webui_heartbeat.sh
Last active March 4, 2023 00:44
Checks if stable diffusion webui is not running every 5 seconds, and restarts if it is killed
#!/bin/bash
# Start the program
cd /root/webui
source /root/miniconda3/bin/activate /root/miniconda3/envs/py310
python ~/webui/launch.py --lowram --no-half-vae --port 6006 --disable-console-progressbars --disable-safe-unpickle --api & pid=$!
# Wait for the program to start
while ! netstat -an | grep "LISTEN" | grep ":6006" > /dev/null; do
sleep 1

FFMPEG-commands

自用简单操作备份


基本设置

码率, 分辨率

  • b:v 视频码率; b:a 音频码率
@trojblue
trojblue / christmas_tags.py
Last active December 21, 2022 10:53
christmas tags
import random
start_str = "a clean painting of ((1girl)), best quality, "
description_tags = "short pointy ears, solo, red hair, palace, carpet, royal, town, bangs, medium hair, long sleeves, blue rose, striped, rose, long hair, elf, alternative costume, crown".split(", ")
christmas_tags = "jingle bell, official art, shawl, shorts, christmas ornaments, scenery, snow, gift, full body, confetti, postage stamp, stuffed toy, tassle, white flower, (close-up:0.5), fur collar, scenery, christmas tree".split(', ')
end_str = "original"
[random.shuffle(i) for i in (description_tags, christmas_tags)]
title
test page

This is the test document for using non-alphabetical symbols in quartz;

Steps to reproduce

  • save this file to quartz/content/test/test.md
  • start hugo
  • search for recherchée in the search box