Skip to content

Instantly share code, notes, and snippets.

View stonecobra's full-sized avatar

Scott Sanders stonecobra

View GitHub Profile
@xrl
xrl / README.md
Last active November 8, 2025 03:33
Quickwit+Vector for Kubernetes (EKS-flavored) Observability
@cavit99
cavit99 / qwen2vl.py
Last active August 11, 2025 13:49
Qwen2-VL-7B-Instruct inference on Apple silicon
import torch
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
from PIL import Image
from pathlib import Path
import sys
# Toggle to switch between full response and extracted description
OUTPUT_FULL_RESPONSE = False
# Ensure we're using the MPS device if available
@revmischa
revmischa / appsyncDirectives.graphql
Last active June 23, 2025 13:28 — forked from davidimoore/_aws.graphql
AWS AppSync GraphQL scalars and directives
# AWS AppSync GQL directives
#
## Scalars come from here:
# https://raw.githubusercontent.com/aws-amplify/amplify-cli/master/packages/amplify-graphql-types-generator/awsAppSyncDirectives.graphql
# https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html
#
## Directives came from a GitHub issue here:
# https://github.com/apollographql/eslint-plugin-graphql/issues/263
## And comparing with the JSON output of
# https://docs.aws.amazon.com/appsync/latest/APIReference/API_GetIntrospectionSchema.html
@mosch
mosch / repository.ts
Created April 3, 2022 08:35
Cloudflare Typed Repository with Prefixa
class RepositoryNamespace<Entity = string, Metadata = {}> {
private readonly ns: string
private readonly kv: KVNamespace
constructor(kv: KVNamespace, namespace: string) {
this.ns = namespace
this.kv = kv
}
put(key: string, entity: Entity) {
@markelliot
markelliot / getGoogleAuthToken.js
Last active July 22, 2025 01:17
Converts Google service user OAuth2 credentials into an access token in Cloudflare-compatible JS
/**
* Get a Google auth token given service user credentials. This function
* is a very slightly modified version of the one found at
* https://community.cloudflare.com/t/example-google-oauth-2-0-for-service-accounts-using-cf-worker/258220
*
* @param {string} user the service user identity, typically of the
* form [user]@[project].iam.gserviceaccount.com
* @param {string} key the private key corresponding to user
* @param {string} scope the scopes to request for this token, a
* listing of available scopes is provided at
@developit
developit / hydra-alias.md
Last active February 27, 2020 01:54
Alias to invoke Chrome Canary w/ tracing, for IRHydra

An Alias to run Chrome with tracing enabled

For Chrome Canary:

alias hydra='/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --no-sandbox --js-flags="--user-data-dir=/tmp/profile --trace-hydrogen --trace-phase=Z --trace-deopt --code-comments --hydrogen-track-positions --redirect-code-traces"'

For regular ol' Chrome:

@ygotthilf
ygotthilf / jwtRS256.sh
Last active October 29, 2025 15:38
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@max-mapper
max-mapper / index.js
Last active May 9, 2021 02:20
fast loading of a large dataset into leveldb
// data comes from here http://stat-computing.org/dataexpo/2009/the-data.html
// download 1994.csv.bz2 and unpack by running: cat 1994.csv.bz2 | bzip2 -d > 1994.csv
// 1994.csv should be ~5.2 million lines and 500MB
// importing all rows into leveldb took ~50 seconds on my machine
// there are two main techniques at work here:
// 1: never create JS objects, leave the data as binary the entire time (binary-split does this)
// 2: group lines into 16 MB batches, to take advantage of leveldbs batch API (byte-stream does this)
var level = require('level')
Download EasySIMBL: https://github.com/norio-nomura/EasySIMBL
Download Maximizer: http://chpwn.com/apps/maximizer.html
EasySIMBL is SIMBL with some added compatibility for OS X Lion / Mount'n Lion.
Drag the app to your applications folder, open it up and check the box that says "Use SIMBL".
Then click the button that says "Show Plugin Folder" and drag the Maximizer into that folder.
Close EasySIMBL and Emacs.
When you reopen emacs, you'll be able to go into fullscreen emacs by clicking the arrows on the top right corner.
The end.