Skip to content

Instantly share code, notes, and snippets.

@moyix
moyix / gen_chat_html.py
Created November 15, 2023 23:18
Render LM-Studio Chat as HTML
import json
import argparse
import html
import os
from datetime import datetime
def generate_html(json_file, html_file="chat.html", metadata=None, date=None):
with open(json_file, 'r') as file:
data = json.load(file)
@twobob
twobob / diff.py
Last active July 29, 2023 19:43
Amendment to the stable diffusion notebook to do titling and generate /n/ images
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import math
#Self contain this for easy single clicking
from PIL import Image
def image_grid(imgs, rows, cols):
#assert len(imgs) == rows*cols
w, h = imgs[0].size
grid = Image.new('RGB', size=(cols*w, rows*h))
@xshazwar
xshazwar / Sine.cs
Last active August 12, 2021 16:17
MapMagic2 Custom Generator Node
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using Den.Tools;
using Den.Tools.GUI;
using Den.Tools.Matrices;
using MapMagic.Products;
using MapMagic.Nodes;
@pojda
pojda / example_image_utils.py
Last active April 25, 2024 15:53 — forked from josephkern/example_image_utils.py
Layer on top of Python Imaging Library (PIL) to write text in images easily
#!/usr/bin/env python
# coding: utf-8
# You need PIL <http://www.pythonware.com/products/pil/> to run this script
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use
# any TTF you have)
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com]
# License: GPL <http://www.gnu.org/copyleft/gpl.html>
from image_utils import ImageText
@nathzi1505
nathzi1505 / opencv-4.2.0-cuda-10.1-Ubuntu-20.04.md
Last active February 9, 2024 01:22
Step-by-Step Guide to build OpenCV 4.2.0 with CUDA 10.1 on Ubuntu 20.04

How to install OpenCV 4.2.0 with CUDA 10.1 on Ubuntu 20.04 LTS (Focal Fossa)

Install updates and upgrade your system:

    $ sudo apt update
    $ sudo apt upgrade

Install required libraries:

@arturo182
arturo182 / bom2grouped_csv_jlcpcb.xsl
Last active April 24, 2024 16:08
A KiCad BOM script for generating JLCPCB PCBA-compatible files!
<!--XSL style sheet to convert EESCHEMA XML Partlist Format to grouped CSV BOM Format
Copyright (C) 2014, Wolf Walter.
Copyright (C) 2013, Stefan Helmert.
Copyright (C) 2018, Kicad developers.
Copyright (C) 2019, arturo182.
GPL v2.
Functionality:
Generation of JLCPCB PCBA compatible BOM
@carrierdown
carrierdown / debugLog.js
Last active April 16, 2019 07:41
Drop-in replacement for post()
function debugLog(/* ... args */) {
var result = "";
for (var i = 0; i < arguments.length; i++) {
result += (i !== 0 && i < arguments.length ? " " : "") + debugPost(arguments[i], "");
}
post(result + "\r\n");
}
function debugPost(val, res) {
if (Array.isArray(val)) {
@twobob
twobob / A set of Unity3D extension methods
Created August 18, 2018 18:28 — forked from omgwtfgames/A set of Unity3D extension methods
Some useful extension method for Unity3D
A collection of useful C# extension methods for the Unity engine.
@Alex-Huleatt
Alex-Huleatt / dungeon_maker.py
Last active June 19, 2018 15:29
Simple dungeon maker. Guaranteed connectedness.
'''
@author AlexHuleatt
Generate a simple, connected dungeon. Focus is on rooms, not maze-like features.
Output of get_dungeon is two sets:
1. A set of (y,x) tuples representing the position of walls
2. A set of (y,x) tuples representing the walls removed to make doors
'''
from random import randint, sample
@n1ckfg
n1ckfg / ZipExample.cs
Created September 20, 2017 13:36
Compress and decompress using SharpZipLib in Unity
// http://www.sebaslab.com/how-to-compress-and-decompress-binary-stream-in-unity/
using ICSharpCode.SharpZipLib.BZip2;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
static void Compress (string nameOfTheFileToSave, ISerializable objectToSerialize)
{
using (FileStream fs = new FileStream(nameOfTheFileToSave, FileMode.Create))
{