Skip to content

Instantly share code, notes, and snippets.

# MIT License
from transformers import AutoTokenizer
import transformers
from langchain.document_loaders import PyPDFLoader
import torch
model = "NousResearch/Yarn-Llama-2-13b-128k"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
[alias]
# graph = !"git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)'"
graph = !"git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'"
permission-reset = !git diff -p -R --no-ext-diff --no-color | grep -E \"^(diff|(old|new) mode)\" --color=never | git apply
@kaznak
kaznak / 55-bytes-of-css.md
Created September 26, 2022 00:29 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@kaznak
kaznak / wordle-answers-alphabetical.txt
Created February 8, 2022 12:10 — forked from cfreshman/wordle-answers-alphabetical.txt
Wordle answers from source code in alphabetical order. And if you write a solver, here's a leaderboard! https://freshman.dev/wordle/#/leaderboard
aback
abase
abate
abbey
abbot
abhor
abide
abled
abode
abort

Create a new project

poetry new <project-name>

Add a new lib

potry add <library>

Remove a lib

@kaznak
kaznak / webrtc_for_work.rst
Created August 23, 2020 14:41 — forked from voluntas/webrtc_for_work.rst
仕事で WebRTC
@kaznak
kaznak / configuration.nix
Last active December 14, 2023 08:01
NixOS configuration for AWS EC2 instance
{ modulesPath, pkgs, lib, ... }: {
imports = [
"${modulesPath}/virtualisation/amazon-image.nix"
];
ec2.hvm = true;
################################################
system.autoUpgrade = {
enable = true;
allowReboot = true;
@kaznak
kaznak / README.md
Last active April 5, 2020 07:23
2020-04-05.webassembly
@kaznak
kaznak / gist:bb365649fc82d185a2dd47bc7f38e8e8
Created January 17, 2020 09:58
UNIXという考え方 The UNIX philosophy

UNIXという考え方 The UNIX philosophy

定理

1. Small is beautiful. 小さいものは美しい

小さいものは、大きい物にない利点がいくつもある。小さいもの同士なら簡単に独特の便利な方法で組み合わせることができる
@kaznak
kaznak / terraform_backend_s3.md
Created December 19, 2019 03:10 — forked from imksoo/terraform_backend_s3.md
AWS環境をTerraformで作るときはS3 Backendを活用しましょう

AWS環境をTerraformで作るときはS3 Backendを活用しましょう

Terraformはtfstateファイルで構成情報を管理しているが、 単純にtfstateファイルをgit等で共有すると他の人が構成変更 (terrafrom apply)している最中に別に作業を実行したり出来る。

そういうときに良く競合してあるべきリソースが削除されたりするが Terraform Backend S3 + DynamoDB Lockを利用することで、自動的に ロックしながら最新状態を共有することが可能となる。