Skip to content

Instantly share code, notes, and snippets.

@abhishekkrthakur
abhishekkrthakur / falcon_pdf_bot.py
Created July 16, 2023 09:03
This is a reference to the YouTube tutorial here: https://youtu.be/hSQY4N1u3v0
import argparse
from pdfminer.high_level import extract_text
from sentence_transformers import SentenceTransformer, CrossEncoder, util
from text_generation import Client
PREPROMPT = "Below are a series of dialogues between various people and an AI assistant. The AI tries to be helpful, polite, honest, sophisticated, emotionally aware, and humble-but-knowledgeable. The assistant is happy to help with almost anything, and will do its best to understand exactly what is needed. It also tries to avoid giving false or misleading information, and it caveats when it isn't entirely sure about the right answer. That said, the assistant is practical and really does its best, and doesn't let caution get too much in the way of being useful.\n"
PROMPT = """"Use the following pieces of context to answer the question at the end.
If you don't know the answer, just say that you don't know, don't try to

Hi 👋, my name is Ori and I'll help you setup password-protected notes on Quartz!

To do so, you will need to modify a few files.

Firstly, install @expo/spawn-async and Staticrypt with $ npm install @expo/spawn-async staticrypt

After that, paste this code into quartz/password.ts

import spawn from "@expo/spawn-async"
@avidale
avidale / t5_extra_models.py
Created August 29, 2021 07:59
T5ForSequenceClassification
import torch
import copy
from torch import nn
from transformers import T5PreTrainedModel
from transformers.models.t5.modeling_t5 import T5Stack
from transformers.modeling_outputs import SequenceClassifierOutput
from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
def mean_pooling(inputs, mask):
@volks73
volks73 / AutoHotkey.ahk
Created September 26, 2017 14:47
AutoHotkey script to change Caps Lock to Control on hold and Escape on press and release
; Change Caps Lock to Control when held down; otherwise, Escape
;
; Originally based on the answer provided in
; [this](https://superuser.com/questions/581692/remap-caps-lock-in-windows-escape-and-control)
; StackExchange SuperUser question.
;
; A shortcut should be created for this script and placed in the Windows 10
; user's startup folder to automatically enable the feature on boot/startup.
; The user's startup folder can be found using the following steps:
;
@rene-d
rene-d / colors.py
Last active May 1, 2024 17:50
ANSI color codes in Python
# SGR color constants
# rene-d 2018
class Colors:
""" ANSI color codes """
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
@luizomf
luizomf / settings.json
Last active May 1, 2024 17:46
VS Code Python and Code Runner Settings for Windows
{
"window.zoomLevel": 5,
"editor.formatOnSave": true,
"code-runner.executorMap": {
"python": "clear ; .\\venv\\Scripts\\python.exe"
},
"code-runner.runInTerminal": true,
"code-runner.clearPreviousOutput": true,
// Python
"[python]": {
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 1, 2024 17:42
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@vitorbritto
vitorbritto / regex.md
Last active May 1, 2024 17:41
Regex Cheat Sheet

Regular Expressions

Basic Syntax

  • /.../: Start and end regex delimiters
  • |: Alternation
  • (): Grouping
@nkaretnikov
nkaretnikov / README.md
Created September 27, 2019 15:08
lldb trace

Start debugserver:

tty0 # debugserver localhost:8000 main

Start tracing:

tty1 $ lldb
tty1 (lldb) command script import trace.py
tcp:
routers:
rou_dot:
entryPoints:
- dot
rule: HostSNI(`my.dot.domain.here`)
service: svc_dot
tls:
certResolver: le
services: