Skip to content

Instantly share code, notes, and snippets.

@ksasao
ksasao / TextAssistant.ino
Created November 6, 2024 13:55
M5Stack LLM Module で日本語対話 https://x.com/ksasao/status/1854157588247806342 #M5StackLLM
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
* SPDX-License-Identifier: MIT
* M5Stack LLM Module で日本語対話。Serial MonitorでBoth BL&CRを設定するとよいです。
*/
#include <Arduino.h>
#include <M5Unified.h>
#include <M5ModuleLLM.h>
M5ModuleLLM module_llm;
@kohya-ss
kohya-ss / llm_novelist_v1.py
Last active March 31, 2026 09:32
ローカルLLMに小説を書いてもらう
# Apache License 2.0
# 使用法は gist のコメントを見てください
import time
import argparse
import os
import json
import tomli
import traceback
from typing import Any, Dict, List, Optional, Union, Iterator
# 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,
)
@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 October 9, 2024 06:06
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 October 11, 2026 15:49
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 September 6, 2026 06:03
Twitterの検索API & Twitterでの検索術

twitterの検索術 (search/tweets と search/universal)

注

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

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

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