Skip to content

Instantly share code, notes, and snippets.

@newmedia2
newmedia2 / worker.js
Created February 1, 2023 22:49 — forked from Suleman-Elahi/worker.js
Sending Free Emails from Cloudflare Workers using MailChannels Send API. You do not need an account with MailChannels in order to start sending email. You also do not have to verify your domain with Cloudflare.
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
let body = {};
async function handleRequest(request) {
let content = "just drop if it fails...okay ?";
for( var i of request.headers.entries() ) {
content += i[0] + ": " + i[1] + "\n";
}
let respContent = "";
@newmedia2
newmedia2 / 00-about-search-api-examples.md
Created February 27, 2023 14:00 — forked from jasonrudolph/00-about-search-api-examples.md
5 entertaining things you can find with the GitHub Search API
@newmedia2
newmedia2 / index.pug
Created February 27, 2023 19:33
Transparent Video
section.e-flex.e-hvh.e-wvw
.marquee.e-abs
- var text = 'this is a repeated text lorem ipsum'
h1.mq.t-color(data-text=""+text)=text
video(autoplay="" loop="" muted="" playsinline="")
//
support to Safari
source(src="https://raw.githubusercontent.com/Efetivos/gallery/master/avulsos/VWLAB_LOGO_1.mov" type="video/quicktime")
@newmedia2
newmedia2 / fading-content-inside-border-ii.markdown
Created April 4, 2023 00:14
Fading content inside border II
@newmedia2
newmedia2 / getGoogleAuthToken.js
Created August 11, 2023 21:43 — forked from markelliot/getGoogleAuthToken.js
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
@newmedia2
newmedia2 / README.md
Created August 12, 2023 00:53 — forked from ryu1kn/README.md
Getting GCP access token from a service account key JSON file

Getting GCP access token from a service account key

Use your service account's key JSON file to get an access token to call Google APIs.

Good for seeing how things work, including the creation of JWT token.

To create a JWT token, you can replace create-jwt-token.sh script with tools like step.

If you just want to get an access token for a service account,

# must have conda installed
git clone https://github.com/joonspk-research/generative_agents.git
cd generative_agents
# open visual studio code, open gen agents folder
# within vscode, go to reverie/backend_server
# create new file utils.py
# copy/paste contents from github (below)
###
# Copy and paste your OpenAI API Key
@newmedia2
newmedia2 / make_patterns.py
Created August 27, 2023 01:53 — forked from koaning/make_patterns.py
Scripts that were used in the "Video Games with Sense2Vec" tutorial found here: https://youtu.be/chLZ6g4t3VA.
"""
This script combines two datasets to generate a file with all found patterns.
"""
import srsly
from prodigy.components.db import connect
import spacy
nlp = spacy.blank("en")
@newmedia2
newmedia2 / make_patterns.py
Created August 27, 2023 01:53 — forked from koaning/make_patterns.py
Scripts that were used in the "Video Games with Sense2Vec" tutorial found here: https://youtu.be/chLZ6g4t3VA.
"""
This script combines two datasets to generate a file with all found patterns.
"""
import srsly
from prodigy.components.db import connect
import spacy
nlp = spacy.blank("en")
from datasets import load_dataset
from sentence_transformers.losses import CosineSimilarityLoss
from setfit import SetFitModel, SetFitTrainer
dataset = load_dataset("yelp_polarity")
print(dataset)
# Select N examples per class (8 in this case)
train_ds = dataset["train"].shuffle(seed=42).select(range(8 * 2))