Skip to content

Instantly share code, notes, and snippets.

# Script for converting a HF Diffusers saved pipeline to a Stable Diffusion checkpoint.
# *Only* converts the UNet, VAE, and Text Encoder.
# Does not convert optimizer state or any other thing.
# Written by jachiam
import argparse
import os.path as osp
import torch
@julkwel
julkwel / html5-canvas-and-javascript-fireworks-tutorial.markdown
Created January 1, 2019 06:49
HTML5 canvas and javascript fireworks tutorial

HTML5 canvas and javascript fireworks tutorial

Learn to make a fireworks display with HTML5 Canvas and JavaScript. In this demo, the pixel sized rockets launch from the bottom of the screen automatically, and by the click of your mouse. You can also click and drag to launch multiple fireworks.

The tutorial covers keeping track of and looping over objects contained in arrays, tracking mouse clicks and coordinates, animating fireworks to specific target coordinates, and making beautiful particle explosions through the use of randomly generated values.

Feel free to play with the config variables in the JS code to have fun with the experiment.

This was made by: https://twitter.com/jackrugile

@miyagawa
miyagawa / curl.rb
Created August 30, 2018 01:54
curl --resolve with typhoeus
require 'typhoeus'
require 'ethon'
resolve = Ethon::Curl.slist_append(nil, "example.com:443:1.2.3.X")
r = Typhoeus::Request.new(
"https://example.com",
resolve: resolve,
# verbose: true,
)
@akirattii
akirattii / make-zipcode-database.md
Last active July 24, 2022 08:07
[MySQL] SQLのパフォーマンステスト用に郵便番号のデータベースでも作ってみる(郵便番号CSVのダウンロードからインポートまで)

郵便局のHPからken_all.zipをダウンロード(Download zipcode CSV file "ken_all.zip"):

$ wget http://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip

ZIPを解凍(Extract KEN_ALL.CSV from ken_all.zip):

$ unzip ken_all.zip
@dbernheisel
dbernheisel / finder_functions.ex
Last active January 12, 2021 13:05
Elixir module to use for Ecto models. This macro will implement Rails-like finder functions for the given module.
defmodule Common.FinderFunctions do
@moduledoc """
Certainly not a perfect replication of Rails' finder methods, but at least gives Rails developers
some sense of home with Ecto. This does not reach into associations, nor is it huge-db friendly.
## Usage:
0. Don't. Just learn Ecto.
1. In your given module that implements Ecto's schema, let it
`use Common.FinderFunctions, repo: MyApp.Repo`. This also assumes there
is a changeset function on your model.
@johannesjo
johannesjo / table-to-json.js
Last active April 30, 2024 21:10
Snippet to convert html table to json (to be used with google chrome or similiar)
function tableToJson(table) {
var data = [];
// first row needs to be headers
var headers = [];
for (var i=0; i<table.rows[0].cells.length; i++) {
headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi,'');
}
// go through cells
@n0531m
n0531m / list_gcp_iprange.sh
Last active April 17, 2024 21:50
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`
@cucmberium
cucmberium / gist:e687e88565b6a9ca7039
Last active February 28, 2024 01:23
Twitterの検索API & Twitterでの検索術

twitterの検索術 (search/tweetssearch/universal)

search/tweets では一週間以上前のツイートは検索できないので注意

search/universal は公式のConsumerKey/ConsumerSecretでないと使用できない

当方では一切の責任を負いません

@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL