Skip to content

Instantly share code, notes, and snippets.

View AlexMikhalev's full-sized avatar

Dr Alexander Mikhalev AlexMikhalev

View GitHub Profile
@AlexMikhalev
AlexMikhalev / inexact-search-aho-corasick.ipynb
Created June 1, 2021 19:24 — forked from sujitpal/inexact-search-aho-corasick.ipynb
Code demonstrating building and querying an Aho-Corasick FSM for inexact search
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Problem

When I use docker to work with the shared workspace with host under Ubuntu, I find that files created by docker user is owned by root. This is not the same with macOS.

Maybe this is becuase docker is run by root user and the default user mapping mechanism is to map container-root to host-user or host-root. So can I map the container-root or container-any-user to host-current-user?

Fortunately the latest docker supports the re-map the container user to any host user via Linux namespace. Refer to this.

Linux namespace

@AlexMikhalev
AlexMikhalev / export_trace.py
Created March 18, 2021 22:53 — forked from lantiga/export_trace.py
🤗 Huggingface Bert on RedisAI
from transformers import BertForQuestionAnswering
import torch
bert_name = "bert-large-uncased-whole-word-masking-finetuned-squad"
model = BertForQuestionAnswering.from_pretrained(bert_name, torchscript=True)
model.eval()
inputs = [torch.ones(1, 2, dtype=torch.int64),
torch.ones(1, 2, dtype=torch.int64),
@AlexMikhalev
AlexMikhalev / couchimport-jq-json-zip.sh
Created June 14, 2020 18:26 — forked from assafmo/couchimport-jq-json-zip.sh
Import an archive full of JSONs into CouchDB
#!/bin/bash
#json per line (same result, but for example can use jq to set _id)
7z x -so $1 | jq -c . | couchimport --db mydb --type jsonl