Skip to content

Instantly share code, notes, and snippets.

View maddyonline's full-sized avatar
🌴
On vacation

Madhav Jha maddyonline

🌴
On vacation
View GitHub Profile
# STEP 1: Load
# Load documents using LangChain's DocumentLoaders
# This is from https://langchain.readthedocs.io/en/latest/modules/document_loaders/examples/csv.html
from langchain.document_loaders.csv_loader import CSVLoader
loader = CSVLoader(file_path='./example_data/mlb_teams_2012.csv')
data = loader.load()
@maddyonline
maddyonline / 00-README-NEXT-SPA.md
Created March 18, 2023 07:37 — forked from gaearon/00-README-NEXT-SPA.md
Next.js SPA example with dynamic client-only routing and static hosting

Next.js client-only SPA example

Made this example to show how to use Next.js router for a 100% SPA (no JS server) app.

You use Next.js router like normally, but don't define getStaticProps and such. Instead you do client-only fetching with swr, react-query, or similar methods.

You can generate HTML fallback for the page if there's something meaningful to show before you "know" the params. (Remember, HTML is static, so it can't respond to dynamic query. But it can be different per route.)

Building

@maddyonline
maddyonline / gist_markdown_examples.md
Last active January 12, 2021 07:32 — forked from ww9/gist_markdown_examples.md
Gist markdown examples

Gist markdown examples

A collection of Markdown code and tricks that were tested to work in Gist.

This and all public gists in https://gist.github.com/ww9 are Public Domain. Do whatever you want with it including , no need to credit me.

Cool
Routing

@maddyonline
maddyonline / readme.md
Created January 12, 2021 07:31 — forked from benstr/readme.md
Gist Markdown Cheatsheet

#Heading 1 ##Heading 2 ###Heading 3 ####Heading 4 #####Heading 5 ######Heading 6


Paragraph

@maddyonline
maddyonline / bcrypt.go
Created January 11, 2021 20:26 — forked from somersbmatthews/bcrypt.go
bcrypt hashing functions #bcrypt #go
func hashAndSalt(pwd []byte) string {
hash, err := bcrypt.GenerateFromPassword(pwd, bcrypt.MinCost)
if err != nil {
log.Println(err)
}
return string(hash)
}
func comparePasswords(hashedPassword string, plainPassword []byte) bool {
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@maddyonline
maddyonline / _README.md
Created August 2, 2016 21:55 — forked from schickling/_README.md
Script to import and export docker-machine configurations to sync between hosts/collaborators

docker-machine import/export

Script to import and export docker-machine configurations to sync between hosts/collaborators

Export (on host A)

$ docker-machine ls
NAME       ACTIVE   DRIVER         STATE     URL                            SWARM   DOCKER    ERRORS
dev        -        digitalocean   Running   tcp://example.com:2376                 v1.10.1
@maddyonline
maddyonline / main.go
Created November 28, 2015 10:19 — forked from mschoebel/main.go
Snippet: login/logout (Golang)
package main
import (
"fmt"
"github.com/gorilla/mux"
"github.com/gorilla/securecookie"
"net/http"
)
// cookie handling
@maddyonline
maddyonline / Test File
Last active August 29, 2015 14:06 — forked from mjtestuser/Test File
# include <iostream>
using namespace std;
int main(){
cout << "Hello World!" << endl;
return 0;
}
@maddyonline
maddyonline / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console