Skip to content

Instantly share code, notes, and snippets.

View AlexMikhalev's full-sized avatar

Dr Alexander Mikhalev AlexMikhalev

View GitHub Profile
@AlexMikhalev
AlexMikhalev / rust-xp-01-s3.rs
Created December 9, 2022 19:35 — forked from jeremychone/rust-xp-01-s3.rs
Rust Quick Example to connect to S3 and Minio bucket server
#![allow(unused)] // silence unused warnings while exploring (to comment out)
use std::{error::Error, str};
use s3::bucket::Bucket;
use s3::creds::Credentials;
use s3::region::Region;
use s3::BucketConfiguration;
// Youtube Walkthrough - https://youtu.be/uQKBW8ZgYB8
@AlexMikhalev
AlexMikhalev / app.py
Created August 8, 2022 08:24 — forked from xros/app.py
Use Github's OAuth/Account to Login Your Server -- Python/Flask Example
# github生成的两把钥匙
client_id = 'e3a53e8921975c37fe3d'
client_secret = '739a252f5022855aadcc832a2facd86b1b836ef6'
from flask import Flask, \
redirect, \
jsonify
from furl import furl
import requests
import json
from flask import request
@AlexMikhalev
AlexMikhalev / Pulumi.production.yaml
Created August 1, 2022 17:50 — forked from GavinRay97/Pulumi.production.yaml
Deploy Hasura on Fargate, including creating a Route53 Domain w/ Cert Manager certificate, and Load Balancer configured for HTTPS on new domain
config:
aws:region: us-east-2
my-project:HASURA_GRAPHQL_DATABASE_URL:
secure: <snipped>
@AlexMikhalev
AlexMikhalev / steve-yegge-google-platform-rant.md
Created July 27, 2022 16:28 — forked from kislayverma/steve-yegge-google-platform-rant.md
A copy (for posterity) of Steve Yegge's internal memo in Google about what platforms are and how Amazon learnt to build them

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't really have SREs and they make engineers pretty much do everything,

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