Skip to content

Instantly share code, notes, and snippets.

@miku
miku / marked-katex.js
Created January 30, 2025 13:03 — forked from carmel/marked-katex.js
marked with katex
import { marked } from 'marked'
import hljs from 'highlight.js'
import katex from 'katex'
marked.setOptions({
langPrefix: 'hljs lang-',
pedantic: false,
gfm: true, // 是否启动类似Github样式的Markdown
breaks: false, // 是否支持Github换行符
tables: true, // 是否支持Github形式的表格
@miku
miku / improveEdgeLabels.gvpr
Created January 28, 2025 16:15 — forked from steveroush/improveEdgeLabels.gvpr
A GVPR program to improve Graphviz edge labels
/***********************************************
1. save this file as improveEdgeLabels.gvpr
2. what it does: it allows you to re-position Graphviz edge labels
3. command line example (works with any Graphviz engine):
dot myfile.gv |gvpr -cf improveEdgeLabels.gvpr |neato -n2 -Tpng >myfile.png
4. how to use:
improveEdgeLabels adds 3 new edge attributes to Graphviz:
- labelOverlay, labelAdjust, label2Node
- they can be used separately or in combination
- if labelOverlay=true
@miku
miku / wordlist-german.txt
Created January 21, 2025 23:38 — forked from MarvinJWendt/wordlist-german.txt
All german words (german wordlist).
This file has been truncated, but you can view the full file.
AA
AAA
Aachen
Aachener
Aachenerin
Aachenerinnen
Aachenern
Aacheners
Aachens
Aal

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 / 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