Skip to content

Instantly share code, notes, and snippets.

@ahoho
ahoho / prompt_alpaca_lora.py
Last active May 7, 2024 04:28
Create a huggingface pipeline with a lora-trained alpaca
from typing import Optional, Any
import torch
from transformers.utils import is_accelerate_available, is_bitsandbytes_available
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
GenerationConfig,
pipeline,
@sindresorhus
sindresorhus / esm-package.md
Last active May 7, 2024 04:27
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@csukuangfj
csukuangfj / default-linker-script.txt
Last active May 7, 2024 04:19
This file shows the default linker script of `ld`, use `ld --verbose` to show it.
GNU ld (GNU Binutils for Ubuntu) 2.25.1
Supported emulations:
elf_x86_64
elf32_x86_64
elf_i386
i386linux
elf_l1om
elf_k1om
i386pep
i386pe
@fhferreira
fhferreira / nginx-proxy.conf
Created August 16, 2019 02:52
Proxy nginx to use Google Tag Manager
# Google Analytics Bypassing Adblockers
## Client
change www.googletagmanager.com => your.domain.com
```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://your.domain.com/gtag/js?id=UA-123456789-1"></script>
```
@frolleks
frolleks / DECOMPILING_AN_ELECTRON_APP.md
Last active May 7, 2024 04:18
How to decompile an Electron app

Let me tell you how easy it is to decompile an Electron app (that's closed source).

Prerequisites

Decompilation

First of all, you find the install path of your Electron app. If you found it, find the resources folder. If you found it, you'll have to install asar globally, by running:

@Meshiest
Meshiest / godot multiplayer.md
Last active May 7, 2024 04:17
overview of how I understand godot multiplayer

Godot 4 Scene Multiplayer

I'm too lazy to write this as official documentation so I'm transcribing my experiences here for reference.

This is high level and does not cover how to setup your peer, only how to use the API itself.

This is not a tutorial.

If you are just getting started, this tutorial by DevLogLogan is worth watching.

# This supports merging as many adapters as you want.
# python merge_adapters.py --base_model_name_or_path <base_model> --peft_model_paths <adapter1> <adapter2> <adapter3> --output_dir <merged_model>
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
import os
import argparse
@amit
amit / db.rake
Last active May 7, 2024 04:11 — forked from hopsoft/db.rake
Update for rails 7.0.X and handle postgres password
# apt install postgresql-client
# apt-get -y install bash-completion wget
# wget --no-check-certificate --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
# echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
# apt-get update
# apt-get -y install postgresql-client-12
namespace :db do
desc "Dumps the database to backups"
@n1snt
n1snt / Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md
Last active May 7, 2024 04:11
Oh my ZSH with zsh-autosuggestions zsh-syntax-highlighting zsh-fast-syntax-highlighting and zsh-autocomplete.md

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.