Skip to content

Instantly share code, notes, and snippets.

View kordless's full-sized avatar
🦥
sloth mode

Коrd Campbell kordless

🦥
sloth mode
  • Straight outta the 60s.
View GitHub Profile
import openai
import numpy as np
from openai.embeddings_utils import get_embedding
openai.api_key = ""
def gpt3_embedding(content, engine='text-similarity-ada-001'):
content = content.encode(encoding='ASCII',errors='ignore').decode()
response = openai.Embedding.create(input=content,engine=engine)
vector = response['data'][0]['embedding'] # this is a normal list
// google docs app
var line = "{{line}}";
if ("{{text}}" == "" && "{{view}}" == "") {
// just nothing
url = "https://docs.google.com/";
} else if ("{{text}}" == "" && "{{view}}" != ""){
// view
var view = "{{view}}".substring(1); // trim the | off (fix this)
if (view == "sheets") {
@kordless
kordless / auth.py
Created March 5, 2021 23:29
Passwordless Authentication for Mitta
import datetime
import logging
import os
import socket
import time
from random import randrange
import urllib.parse
from google.cloud import ndb
@kordless
kordless / timewarp.py
Created March 5, 2021 03:52
Mitta Timewarp
import datetime
from dateutil.relativedelta import relativedelta
import re
# timewarp.py
# Kord Campbell
# Copyright 2020, Mitta Corp.
# All Rights Reserved.
# description: common name to solr timerange converter in python3
@kordless
kordless / models.py
Created March 5, 2021 03:46
Models for Mitta
import datetime
import os
import requests
from google.cloud import ndb
import flask_login
from lib.util import random_string, random_number, generate_token, random_name
from lib.solr import doc_count
@kordless
kordless / spool.json
Last active March 1, 2021 17:25
Upload Reference for Mitta.us
{
"timestamp": "{{timestamp}}",
"request_url": "/g",
"result": "success",
"response": [{
"source_type": "spool",
"created": "{{created}}",
"updated": "{{updated}}",
"name": "{{name}}",
"upload_url": "{{upload_url}}",
@kordless
kordless / tag.py
Created February 27, 2021 17:58
Example code for loading a file out of a Google Cloud bucket and sending it to Google Vision.
import datetime
import json
import io
from google.cloud import ndb
from google.cloud import vision
from google.cloud import storage
from flask import Blueprint, request, make_response, render_template, abort
import flask_login
@kordless
kordless / README.md
Created December 16, 2020 20:41
Secure Solr Server in 2 Minutes with NGINX

Deploy Solr on Google Cloud in 2 Minutes

Useful information and scripts for deploying an instance based Solr Cloud in 2 minutes.

Check this repo out on your Google Cloud Shell terminal.

Launch Solr

Deploy a secure Solr instance on Google cloud:

$ ./deploy-solr.sh
@kordless
kordless / 10M_FUSION_SOLR_SKG_DEPLOY.md
Last active December 12, 2019 14:26
10 Minute Fusion and Solr Deployment Script for Google Cloud

10 Minute Fusion Solr SKG Deployment Script

This script deploys Lucidwork's Fusion 4.1.1 on a Google Cloud instance. Fusion includes Solr 7.4.

Solr 7.4 provides the semantic knowledge graph relatedness() function. This function may be used to extract related topics from datasets which represent a question/answer type structure.

Video

No video for this script exists.

Install

TBD

@kordless
kordless / 10M_TENSORFLOW2_DEPLOY.md
Last active August 27, 2023 17:12
10 Minute Tensorflow Deployment Script

UNFORTUNATELY THIS IS BROKEN AND NEEDS TO BE FIXED

Deploy Tensorflow 2 with Object Detection in 10 Minutes

This gist guide starts a server on your Google Cloud Free account. That server will be configured with Tensorflow. A script and sample notebook will guide you through trying out image recognition.

The instance takes about 10 minutes to launch.

Watch the Video

https://www.youtube.com/watch?v=LmjslM2NK3c