Skip to content

Instantly share code, notes, and snippets.

View avinash2's full-sized avatar

Avinash K. avinash2

View GitHub Profile
@s-macke
s-macke / gpt-4-tokens.txt
Last active July 16, 2024 11:55
All 100k GPT-4 Tokens. New lines are replaced with \n and carriage returns with \r. The index of the token is (index=line-1). The list is extracted using https://github.com/openai/tiktoken
!
"
#
$
%
&
'
(
)
*
@peterw
peterw / embed.py
Created April 17, 2023 16:30
embedding the pdf
import openai
import streamlit as st
from streamlit_chat import message
from dotenv import load_dotenv
import os
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.vectorstores import Chroma
import openai
from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.chains.question_answering import load_qa_chain
import openai
import streamlit as st
from streamlit_chat import message
from dotenv import load_dotenv
import os
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.vectorstores import Chroma
import openai
from langchain.document_loaders import UnstructuredMarkdownLoader
from langchain.chains.question_answering import load_qa_chain
@lucasjahn
lucasjahn / functions.php
Last active June 19, 2024 08:03
Woocommerce Checkout - Display custom inline error messages (including custom validation messages)
<?php
/**
* adds custom js file to handle inline error messages
*/
add_action( 'woocommerce_after_checkout_form', 'add_custom_validation_script', 20 );
function add_custom_validation_script() {
wp_enqueue_script(
@ErxrilOwl
ErxrilOwl / laraws_nginx.md
Last active May 31, 2024 15:46
Deploy Laravel on AWS EC2 Ubuntu (nginx)
####### Apache Installation
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
brew install httpd
#Now we just need to configure things so that our new Apache server is auto-started
sudo brew services start httpd
#You can see Apache running on the browser by default http://localhost:8080
@anthonylrivera
anthonylrivera / body-overflow.js
Created November 15, 2017 18:01
Finding/Fixing Unintended Body Overflow
// Courtesy of CSS Tricks : https://css-tricks.com/findingfixing-unintended-body-overflow/
var docWidth = document.documentElement.offsetWidth;
[].forEach.call(
document.querySelectorAll('*'),
function(el) {
if (el.offsetWidth > docWidth) {
console.log(el);
}
@devinsays
devinsays / customer-new-account.php
Created October 3, 2017 20:36
Sends new WooCommerce customers an account email that with their email address as a login rather than a username.
<?php
/**
* Customer new account email
*
* This template has been overriden to change account creation text.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates/Emails
* @version 1.6.4
@takeit
takeit / INSTALL.md
Last active March 23, 2024 19:03
Write to NTFS on macOS Sierra (osxfuse + ntfs-3g)
  1. Install osxfuse:
brew cask install osxfuse
  1. Reboot your Mac.

  2. Install ntfs-3g:

@mjangda
mjangda / ngrok-and-jetpack.md
Last active February 7, 2023 07:57
How to connect ngrok to your local WordPress environment (props @DanReyLop)

How to develop with Jetpack locally with ngrok

To connect Jetpack in your local installation, you'll need a way for WP.com servers to reach your server. That can be done in a number of different ways:

  • You can open your router's ports and use your public IP
  • You can use some kind of Dynamic DNS provider.

But these options fall short of ngrok, which is a "localhost tunnel". It basically allows the Internet to hit a local port on your machine without worrying about ports or IPs.

As long as ngrok is running, Jetpack / WP.com will be able to communicate with your local site. This will allow remote modules like Site Search and Manage to work.