Skip to content

Instantly share code, notes, and snippets.

View devxpy's full-sized avatar

Dev Aggarwal devxpy

View GitHub Profile
import torch
from PIL import Image
from diffusers import StableDiffusionPipeline, StableDiffusionControlNetImg2ImgPipeline, ControlNetModel, DDIMScheduler
from diffusers.utils import load_image
controlnet = ControlNetModel.from_pretrained("DionTimmer/controlnet_qrcode-control_v11p_sd21",
torch_dtype=torch.float16)
model_id = "stabilityai/stable-diffusion-2-1"
pipe = StableDiffusionControlNetImg2ImgPipeline.from_pretrained(
@devxpy
devxpy / gist:f3b224d28a8634193b4296dcfae6779d
Created May 2, 2023 16:03
import react-markdown in remix
serverDependenciesToBundle: [
"react-markdown",
"react-markdown-preview",
/^@mdx-js*/,
/^estree*/,
/^hast-*/,
/^parse5*/,
/^mdast*/,
/^micromark*/,
/^remark*/,
@devxpy
devxpy / gist:747e18a5dfeba4a05d0b975b70cc4805
Created April 30, 2023 00:42
SentenceSplitter splits between sentences
www.ramanuj.evenweb.com
---
The 3 Mistakes
of My Life
A Story about Business, Cricket and Religion
Chetan Bhagat
Rupa & Co
@devxpy
devxpy / main.dart
Created August 24, 2022 09:11
crimson-glacier-2866
import 'package:flutter/material.dart';
void main() => runApp(MainApp());
class MainApp extends StatefulWidget {
const MainApp({
Key? key,
}) : super(key: key);
@override
@devxpy
devxpy / mem_usage.dart
Created January 21, 2022 00:17
dart print out memory usage
import 'dart:developer' as developer;
import 'package:intl/intl.dart';
// https://pub.dev/packages/vm_service
import 'package:vm_service/vm_service.dart' show MemoryUsage, VM, VmService;
import 'package:vm_service/vm_service_io.dart' show vmServiceConnectUri;
Future<void> printHeapUsage() async {
@devxpy
devxpy / output.txt
Last active May 4, 2021 20:58
Example code to remove openai prompt
Thanks. I’m sure you are too.
Besides coding, I write a lot of poetry and I’m working on a novel.
Also:
https://www.amazon.in/Mindfulness-Workbook-OCD-Overcoming-Compulsions/dp/1608828786/ref=b2b_gw_d_simh_3?pd_rd_w=AEsn9&pf_rd_p=9ea11b01-714c-4a00-ab30-c9b4be5135c7&pf_rd_r=57JXGFCJJWK23B7EQEHQ&pd_rd_r=4dc493f3-e340-4fee-b7ac-d4234227d3e5&pd_rd_wg=E4ZxL&pd_rd_i=1608828786&psc=1
I love walking, particularly along the beach, which I do often.
I am also very interested in self-transformation and User: sometimes I wonder how the world might change if everyone embraced this pursuit,
or at least tried to. I love talking to people, Dara: and I’m interested in the way the world is changing thanks to technology. I also love chatting with people about politics.
set -ex
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
void main() {
Map<int, String> myIntMap = {5: "hello!"};
print(myIntMap["5"]);
}
@devxpy
devxpy / main.py
Last active August 9, 2020 23:43
Script to run startlette & uvicorn in a way that forcefully exits/kills all pending background tasks automatically. A must have for development!
"""
Tired of seeing this annoying message - "Waiting for background tasks to complete."?
This hack can take care of that for you!
Usage -
$ python main.py
Bonus - easy to attach a debugger now
$ python -m pdb main.py