Skip to content

Instantly share code, notes, and snippets.

leocomelli /
Last active June 2, 2023 10:51
Lista de comandos úteis do GIT



  • Modificado (modified);
  • Preparado (staged/index)
  • Consolidado (comitted);


lewangdev / default.custom.yaml
Last active June 2, 2023 10:50
雾凇拼音自定义配置,MacOS-like & Wechat-like Dark/Light Color Scheme For Rime
View default.custom.yaml
# 菜单
page_size: 8 # 候选词个数
# alternative_select_labels: [ ①, ②, ③, ④, ⑤, ⑥, ⑦, ⑧, ⑨, ⑩ ] # 修改候选项标签
# alternative_select_keys: ASDFGHJKL # 如编码字符占用数字键,则需另设选字键
# ascii_mode、inline、no_inline、vim_mode 等等设定,可参考 /Library/Input Methods/
# 中西文切换
# 【good_old_caps_lock】 CapsLock 切换到大写或切换中英。
Birch-san /
Created June 1, 2023 18:24
Converting LLaMA model weights to huggingface format + safetensors

Loading LLaMA via Huggingface + Safetensors, with 4-bit quantization

Let's say we're trying to load a LLaMA model via AutoModelForCausalLM.from_pretrained with 4-bit quantization in order to inference from it:

python -m

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig, LlamaTokenizerFast, LlamaForCausalLM
import transformers
mxmason / webflow-disable-scroll-prefers-reduced-motion.js
Last active June 2, 2023 10:49
These snippets completely disable the smooth-scroll animation that is present on all Webflow sites. Animated scrolling can disorient or surprise users, or even cause motion sickness!
View webflow-disable-scroll-prefers-reduced-motion.js
// Disable smooth scrolling for users who have set `prefers-reduced-motion` in their operating system
// 1. Place this snippet before the end of the <body> tag;
// NOT in the <head> tag!
// 2.Make sure it's inside $(function() {})!
$(function() {
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
if (mediaQuery.matches) $(document).off('');
Birch-san /
Last active June 2, 2023 10:48
Fine-tuning LLaMA-7B on ~10GB VRAM with QLoRA, 4-bit quantization

Fine-tuning LLaMA-7B on ~10GB VRAM with QLoRA, 4-bit quantization

nvidia-smi said this required 11181MiB, at least to train on the sequence lengths of prompt that occurred initially in the alpaca dataset (~337 token long prompts).
You can get this down to about 10.9GB if (by modifying you run torch.cuda.empty_cache() after PEFT has been applied to your loaded model and before you begin training.


All instructions are written assuming your command-line shell is bash.

Clone repository:

robbmcleod /
Last active June 2, 2023 10:47
Convert NumPy `ndarray` to C# `System.Array` and back again

Originally for Python 3.7 and PythonNet 2.4.0 I wrote a snippet of code to transform NumPy ndarray into System.Array from CLR and back again using pure python and the ctypes package memmove function:

However, after the release of PythonNet 2.5.0 there were some changes to the PythonNet interface that created some small breaks in my code snippet:

royshil /
Last active June 2, 2023 10:47
How to implement Touch-to-Focus in Android using Camera2 APIs
//Override in your touch-enabled view (this can be differen than the view you use for displaying the cam preview)
public boolean onTouch(View view, MotionEvent motionEvent) {
final int actionMasked = motionEvent.getActionMasked();
if (actionMasked != MotionEvent.ACTION_DOWN) {
return false;
if (mManualFocusEngaged) {
Log.d(TAG, "Manual focus already engaged");
return true;
elibolonur / cloudSettings
Last active June 2, 2023 10:44
VS Code settings - Public
View cloudSettings
neubig /
Last active June 2, 2023 10:44
A simple script to get results from the OpenAI Asynchronous API
import openai
import asyncio
from typing import Any
async def dispatch_openai_requests(
messages_list: list[list[dict[str,Any]]],
model: str,
temperature: float,
max_tokens: int,
top_p: float,
tanaikech /
Last active June 2, 2023 10:41
Report: Images put with IMAGE function on Google Spreadsheet

Report: Images put with IMAGE function on Google Spreadsheet

This is a report about images put with "=IMAGE(IMAGE_URL)" function on Google Spreadsheet.


When "=IMAGE(IMAGE_URL)" is put to a cell "A1" on Spreadsheet, the image is shown in the cell as shown in the following image.