Skip to content

Instantly share code, notes, and snippets.

{"cmdline": ["/usr/local/b52","-p","11212","-slave","someip:11212","-loops","-1","-params","sizelru=1024\u0026dbdir=/var/lib/somedir"],"memstats": {"Alloc":1376075872,"TotalAlloc":3064795276440,"Sys":1814112504,"Lookups":0,"Mallocs":10459923703,"Frees":10459790273,"HeapAlloc":1376075872,"HeapSys":1736605696,"HeapIdle":348364800,"HeapInuse":1388240896,"HeapReleased":37822464,"HeapObjects":133430,"StackInuse":8224768,"StackSys":8224768,"MSpanInuse":1040264,"MSpanSys":3211264,"MCacheInuse":55552,"MCacheSys":65536,"BuckHashSys":1722223,"GCSys":58826752,"OtherSys":5456265,"NextGC":1651137302,"LastGC":1573573520429522192,"PauseTotalNs":907269193,"PauseNs":[38559,41868,45578,71952,39489,37591,56100,41930,51938,50999,56712,53932,51550,41156,45520,60234,35935,52250,48101,86082,52070,53983,32345,54403,35896,38617,111902,144605,47452,40141,35223,52007,51257,74409,107788,38392,84990,85595,41260,65704,47984,77121,39105,112070,37919,41408,92024,31839,95383,33065,34490,42069,34207,52734,41615,40328,44085,48865,40548,63130,9
package main
import (
"fmt"
"net/http"
"strings"
"time"
)
// Server is a HTTP interface
package main
import (
"bufio"
"fmt"
"log"
"net"
)
// mac: brew install vowpal-wabbit
@recoilme
recoilme / hash_test.go
Created February 19, 2021 16:26
Benchmark murmur3(32) and xxHash64
package main_test
import (
"strconv"
"testing"
"github.com/cespare/xxhash"
"github.com/spaolacci/murmur3"
)
package main
import (
"bufio"
"log"
"os"
ljpg "github.com/pixiv/go-libjpeg/jpeg"
)
@recoilme
recoilme / server.go
Created March 24, 2021 08:45
server for html parsing with readability
package main
import (
"fmt"
"net/http"
"github.com/recoilme/clean"
. "github.com/stevelacy/daz"
)
@recoilme
recoilme / weightedsim.py
Created February 19, 2023 18:01
Cosine similarity merging
import os
import argparse
import torch
import numpy as np
from tqdm import tqdm
parser = argparse.ArgumentParser(description="Merge models with weighted similarity")
parser.add_argument("a", type=str, help="Path to model a")
parser.add_argument("b", type=str, help="Path to model b")
parser.add_argument("--out", type=str, help="Output file name, without extension", default="merged", required=False)
import torch
from typing import Tuple, Callable
def do_nothing(x: torch.Tensor, mode:str=None):
return x
def mps_gather_workaround(input, dim, index):
if input.shape[-1] == 1:
@recoilme
recoilme / img.py
Created October 2, 2023 08:57
Create mask from image based on face coords
import cv2
import numpy as np
import dlib
import mediapipe as mp
import argparse
import torch
from diffusers import StableDiffusionImg2ImgPipeline
from diffusers import EulerAncestralDiscreteScheduler
from typing import Any, Callable, Dict, List, Optional, Union
import PIL
@recoilme
recoilme / videomaskbyface.py
Last active October 6, 2023 15:00
videomaskbyface.py
import cv2
import os
import time
import mediapipe as mp
import numpy as np
def extract_faces(image):
center_faces = []
BaseOptions = mp.tasks.BaseOptions
FaceDetector = mp.tasks.vision.FaceDetector