Skip to content

Instantly share code, notes, and snippets.

View transitive-bullshit's full-sized avatar
👋
Searching for AGI

Travis Fischer transitive-bullshit

👋
Searching for AGI
View GitHub Profile
import defaultKy, { type KyInstance } from 'ky';
import { z } from 'zod';
import { getEnv } from '../../utils/helpers.js';
export namespace serper {
export const BASE_URL = 'https://google.serper.dev';
export const SearchParamsSchema = z.object({
q: z.string().describe('search query'),
autocorrect: z.boolean().default(true).optional(),
@transitive-bullshit
transitive-bullshit / dexa-vegas-sphere.glsl
Created December 1, 2023 09:22
Dexa logo superimposed onto the Las Vegas Sphere
// paste this into https://whenistheweekend.com/theSphere.html
// shadertoy source: https://www.shadertoy.com/view/cldBz2
uniform float time;
varying vec2 vUv;
varying vec3 vNormal;
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 center = vec2(0.25, 0.55);
@transitive-bullshit
transitive-bullshit / splade.py
Last active November 6, 2023 02:40 — forked from rileytomasek/splade.py
SPLADE on Modal
from fastapi.responses import JSONResponse
from modal import Image, Mount, NetworkFileSystem, Secret, Stub, method, web_endpoint
from pydantic import BaseModel
# This is copied from: https://github.com/pinecone-io/examples/blob/2f51ddfd12a08f2963cc2849661fab51afdeedc6/learn/search/semantic-search/sparse/splade/splade-vector-generation.ipynb#L10
# Which is recommended here: https://docs.pinecone.io/docs/hybrid-search
stub = Stub("splade")
image = Image.debian_slim().pip_install("torch", "transformers")
volume = NetworkFileSystem.persisted("splade-model-cache-vol-gcp", cloud="gcp")
alias ..='cd ..;ls'
alias ...='cd ../..;ls'
alias ....='cd ../../..;ls'
alias .....='cd ../../../..;ls'
alias ......='cd ../../../../..;ls'
alias .......='cd ../../../../../..;ls'
alias ........='cd ../../../../../../..;ls'
alias .........='cd ../../../../../../../..;ls'
alias ..........='cd ../../../../../../../../..;ls'
GRPC_TRACE=all GRPC_VERBOSITY=DEBUG node benchmark-multiple-gets.js
using gRPC via @google-cloud/firestore
2020-03-27T19:51:39.594Z | resolving_load_balancer | firestore.googleapis.com:443 IDLE -> IDLE
2020-03-27T19:51:39.594Z | connectivity_state | firestore.googleapis.com:443 IDLE -> IDLE
2020-03-27T19:51:39.595Z | dns_resolver | Resolver constructed for target firestore.googleapis.com:443
2020-03-27T19:51:39.598Z | channel | firestore.googleapis.com:443 createCall [0] method="/google.firestore.v1.Firestore/BatchGetDocuments", deadline=Fri Mar 27 2020 15:56:39 GMT-0400 (Eastern Daylight Time)
2020-03-27T19:51:39.599Z | call_stream | [0] Sending metadata
2020-03-27T19:51:39.599Z | channel | Pick result: QUEUE subchannel: undefined status: undefined undefined
2020-03-27T19:51:39.600Z | call_stream | [0] write() called with message of length 117
2020-03-27T19:51:39.601Z | call_stream | [0] end() called
master* in ~/dev/saasify/temp/gcp-test $ yarn why @grpc/grpc-js
yarn why v1.22.0
[1/4] 🤔 Why do we have the module "@grpc/grpc-js"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "@grpc/grpc-js@0.7.4"
info Has been hoisted to "@grpc/grpc-js"
info This module exists because it's specified in "dependencies".
{
"openapi": "3.0.2",
"info": {
"title": "Fast API",
"version": "0.1.0"
},
"paths": {
"/stylecloud": {
"post": {
"responses": {
GRPC_TRACE=all GRPC_VERBOSITY=DEBUG node benchmark-multiple-gets.js
D0326 16:48:14.918318000 4490681792 dns_resolver.cc:294] Using native dns resolver
I0326 16:48:14.918674000 4490681792 timer_manager.cc:88] Spawn timer thread
I0326 16:48:14.918704000 4490681792 init.cc:164] grpc_init(void)
I0326 16:48:14.918728000 123145542873088 timer_manager.cc:250] timers not checked: expect another thread to
I0326 16:48:14.918742000 123145542873088 timer_manager.cc:197] sleep until kicked
I0326 16:48:14.919055000 4490681792 completion_queue.cc:504] grpc_completion_queue_create_internal(completion_type=0, polling_type=0)
using gRPC via @google-cloud/firestore
I0326 16:48:15.248755000 4490681792 ssl_credentials.cc:130] grpc_ssl_credentials_create(pem_root_certs=(null), pem_key_cert_pair=0x0, verify_options=0x7ffeefbfe520, reserved=0x0)
I0326 16:48:15.256503000 4490681792 plugin_credentials.cc:250] grpc_metadata_credentials_creat
const axios = require('axios');
async function main () {
const getImg = (url) => {
return axios.get(url, { responseType: 'arraybuffer' });
}
const url = 'https://octodex.github.com/images/original.png';
const original = await getImg(url);
console.log('original', { status: original.status, size: original.data.length });
const axios = require('axios');
async function main () {
const url = 'https://octodex.github.com/images/original.png';
const optimized = await axios.post('https://ssfy.sh/dev/imagemin/optimizeImageUrl', { url }, {
responseType: 'arraybuffer'
});
console.log('optimized', { status: optimized.status, size: optimized.data.length });