Skip to content

Instantly share code, notes, and snippets.

via (https://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun)

  • zf#j creates a fold from the cursor down # lines.
  • zf/string creates a fold from the cursor to string .
  • zj moves the cursor to the next fold.
  • zk moves the cursor to the previous fold.
  • zo opens a fold at the cursor.
  • zO opens all folds at the cursor.
  • zm increases the foldlevel by one.
  • zM closes all open folds.
@miku
miku / clx.go
Created November 14, 2024 00:15 — forked from Sh4yy/clx.go
Generate CLI commands for common tasks.
package main
import (
"context"
"errors"
"fmt"
"io"
"log"
"os"
"runtime"
@miku
miku / add_gaussian_noise.py
Created October 27, 2024 12:52 — forked from Prasad9/add_gaussian_noise.py
Python code to add random Gaussian noise on images
import cv2
def add_gaussian_noise(X_imgs):
gaussian_noise_imgs = []
row, col, _ = X_imgs[0].shape
# Gaussian distribution parameters
mean = 0
var = 0.1
sigma = var ** 0.5
@miku
miku / spread.cpp
Last active September 25, 2024 12:08
4-1
/** getSpread returns the difference between the highest bid and the lowest
* offer (ask). It throws an exception, if the orders do not contain both bids
* and asks. */
double OrderBook::getSpread(std::vector<OrderBookEntry>& orders)
{
if (orders.empty()) {
return 0;
}
// https://web.stanford.edu/class/cme241/lecture_slides/Tour-OrderBook.pdf#page=3
@miku
miku / .gitignore
Last active August 23, 2024 09:56
Rotating fds for keeping logs intact after logrotate / golang
go.log
@miku
miku / colors.py
Created May 16, 2024 09:51 — forked from rene-d/colors.py
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"
@miku
miku / 01-Learning-Python3.md
Created March 29, 2024 22:25 — forked from kenjyco/01-Learning-Python3.md
Learn Python 3 with Jupyter Notebook
@miku
miku / VectorSearch.py
Created March 27, 2024 11:15 — forked from howard-haowen/VectorSearch.py
Text similarity search using sentence_transformers and faiss
# Reference: kstathou/acl-search-engine
# !pip install faiss-cpu --no-cache
# !pip install sentence_transformers
import faiss
import numpy as np
import pandas as pd
import pickle
import torch
@miku
miku / llmc.sh
Created February 28, 2024 12:07 — forked from montasaurus/llmc.sh
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
@miku
miku / normcore-llm.md
Created February 20, 2024 17:15 — forked from veekaybee/normcore-llm.md
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models