Skip to content

Instantly share code, notes, and snippets.

@sfpprxy
sfpprxy / cleanup_swap.md
Created June 12, 2023 05:51 — forked from anildigital/cleanup_swap.md
Cleanup swap space on macOS

To see current swap usage

sysctl -a | grep swap

Use only when when your system is in a very bad shape

$ sudo pkill -HUP -u _windowserver 
@fankaidev
fankaidev / chatpdf.py
Last active November 24, 2023 07:09
A Very Simple ChatPDF Implementation with LangChain
#!/usr/bin/env python3
# 需要安装一些依赖 pip3 install openai langchain chromadb pypdf sentence_transformers
from langchain.chat_models import ChatOpenAI
from langchain.embeddings.openai import OpenAIEmbeddings
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.vectorstores import Chroma
from langchain.text_splitter import CharacterTextSplitter, RecursiveCharacterTextSplitter
from langchain.document_loaders import TextLoader, PyPDFLoader
from langchain.chains.retrieval_qa.base import RetrievalQA
@openhoangnc
openhoangnc / install-fish-shell-debian-11.sh
Last active November 29, 2023 06:54
Install Fish Shell debian 11
#Ref https://software.opensuse.org/download.html?project=shells%3Afish%3Arelease%3A3&package=fish
echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_11/ /' | sudo tee /etc/apt/sources.list.d/shells:fish:release:3.list
curl -fsSL https://download.opensuse.org/repositories/shells:fish:release:3/Debian_11/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_fish_release_3.gpg > /dev/null
sudo apt update
sudo apt install fish -y
sudo chsh -s /usr/bin/fish
@Zheaoli
Zheaoli / Jetbrains JVM Config
Last active July 27, 2022 05:37
This is a JVM config for Jetbrains IDE on my laptop(With i9 10th CPU and 64G RAM)
-Xms128m
-Xmx8182m
-XX:ReservedCodeCacheSize=512m
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:+UnlockExperimentalVMOptions -XX:+UseZGC
-XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5
-XX:+UnlockDiagnosticVMOptions -XX:-ZProactive
@anildigital
anildigital / cleanup_swap.md
Last active April 9, 2024 15:52
Cleanup swap space on macOS

To see current swap usage

sysctl -a | grep swap

Use only when when your system is in a very bad shape

$ sudo pkill -HUP -u _windowserver 
@csknk
csknk / unwrap_or_else.rs
Last active March 25, 2023 22:35 — forked from rust-play/playground.rs
unwrap_or_else examples
//! Examples for `unwrap_or_else()`
use std::process;
fn func(in_num: u8) -> Option<&'static str> {
if in_num % 2 != 0 {
return None;
}
Some("even")
}
@fworks
fworks / install-zsh-windows-git-bash.md
Last active April 19, 2024 19:52
Zsh / Oh-my-zsh on Windows Git Bash
@majek
majek / netstack4netns.go
Last active April 16, 2021 07:07
netstack from gvisor 4 netns
package main
import (
"flag"
"fmt"
"math/rand"
"net"
"os"
"os/signal"
"runtime"
@sfpprxy
sfpprxy / no-ssh-password-mac.txt
Created June 12, 2019 06:58 — forked from eegrok/no-ssh-password-mac.txt
disable password ssh authentication on mac os
make sure the following lines are set in /etc/sshd_config (or /etc/ssh/sshd_config on ubuntu)
(they all exist already, but are commented, some may have a value of yes)
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
then restart the ssh server (uncheck / recheck 'Remote Login' in the 'System Preferences' -> 'Sharing' panel)
@laggardkernel
laggardkernel / startup-time-of-zsh.md
Last active April 12, 2024 13:24
Comparison of ZSH frameworks and plugin managers

Comparison of ZSH frameworks and plugin managers

Changelog

  • update 1: add a FAQ section
  • update 2: benchmark chart and feature comparison table
  • update 3:
    • improve the table with missing features for antigen
    • new zplg times result

TLDR