Skip to content

Instantly share code, notes, and snippets.

View neosavvy's full-sized avatar
🖖
HODL

Adam Parrish neosavvy

🖖
HODL
View GitHub Profile
## Git Workflow
We want to closely monitor what gets merged down to `master` branches and keep
our commit history as clean as possible. To accomplish this we can employ a few best
practices to ensure we don't see large numbers of useless `merge` commits and in addition
to that it will keep the ordering of our commits with priority on merged work vs local
changes.
### Basic Assumptions
@neosavvy
neosavvy / gist:b01788cf7d95086aed415c0d9b06386a
Created March 2, 2018 20:41
Example Interview Question
// ==================
// Utility code start
// ==================
var Readable = require('stream').Readable;
var util = require('util');
/**
* Stream which returns numbers in ascending sorted order.
*
@neosavvy
neosavvy / gist:bacdf28b69399785599b16b0c093e70e
Created March 28, 2018 17:04
Kill all the errant EC2 Instances that have disableApiTermination set to True
import boto3
client = boto3.client('ec2', region_name='us-east-1')
ec2_regions = [region['RegionName'] for region in client.describe_regions()['Regions']]
for region in ec2_regions:
conn = boto3.resource('ec2', region_name=region)
instances = conn.instances.filter()
ids = []
import instructor
import time
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings
from langchain.text_splitter import TokenTextSplitter
from langchain_community.document_loaders import UnstructuredURLLoader
from openai import OpenAI
from pydantic import BaseModel
import instructor
import time
from langchain_community.vectorstores import FAISS
from langchain_openai import OpenAIEmbeddings
from langchain.text_splitter import TokenTextSplitter
from langchain_community.document_loaders import UnstructuredURLLoader
from openai import OpenAI
from pydantic import BaseModel
To address the security issue you're facing, you need to ensure that sensitive API details are not exposed to the frontend. Here’s a step-by-step guide to help you secure your application:
### 1. **Move Sensitive Logic to the Backend**
- **Create a Backend Service**: Since you're using Netlify, you can use Netlify Functions to create serverless functions that handle sensitive operations. These functions will run on the server-side, keeping your API keys and other sensitive information secure.
- **Environment Variables**: Store your API keys and sensitive information in environment variables. Netlify allows you to set environment variables in the build settings.
### 2. **Set Up Netlify Functions**
- **Create a Functions Directory**: In your project, create a directory named `netlify/functions` (if it doesn’t already exist).
- **Write Serverless Functions**: Create a new file for each function, e.g., `netlify/functions/generateContent.js`.