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 / graphql_api_rate.py
Created August 21, 2022 14:52
Check if user is sponsor and it's tier via Github GraphQL API with rate_limit
import requests
from datetime import datetime
import time
import os
github_token = os.getenv('GITHUB_TOKEN')
real_requests_post = requests.post
def wrap_requests_post(*args, **kwargs):
@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 / fetch_pubmed.py
Created July 26, 2022 14:54
fetch_pubmed_notes.py
import requests
import json
db = 'pmc'
domain = 'https://www.ncbi.nlm.nih.gov/entrez/eutils'
nresults = 4
query = "depression"
retmode='json'
# standard query
@AlexMikhalev
AlexMikhalev / cpuinfo
Created May 29, 2022 12:20
cat /proc/cpuinfo output for Demo The Pattern server
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 151
model name : 12th Gen Intel(R) Core(TM) i9-12900K
stepping : 2
microcode : 0x18
cpu MHz : 4899.942
cache size : 30720 KB
physical id : 0
@AlexMikhalev
AlexMikhalev / bench.zsh
Last active October 15, 2021 22:03
BERT large QA benchmarks
(venv_the_pattern) ➜ qasearch git:(benchmark) ✗ python3 transformers_plain_bert_qa.py
[101, 2040, 10438, 13434, 6726, 2426, 6001, 1029, 102, 2019, 17727, 2098, 14428, 3372, 2000, 2925, 2913, 1997, 10519, 6726, 1997, 16464, 15245, 2003, 1996, 3768, 1997, 2511, 4725, 2005, 1996, 10788, 1997, 10519, 16464, 12702, 21759, 7088, 19230, 6413, 2005, 4958, 5178, 4328, 10091, 2913, 102]
airborne transmission of respiratory infections is the lack of established methods for the detection of airborne respiratory microorganisms
10.494894326999999 seconds
(venv_the_pattern) ➜ qasearch git:(benchmark) ✗ redis-benchmark -p 30003 -h 127.0.0.1 -n 10 get "bertqa{8YG}_PMC302072.xml:{8YG}:10_Who performs viral transmission among adults"
get bertqa{8YG}_PMC302072.xml:{8YG}:10_Who performs viral transmission among aduget bertqa{8YG}_PMC302072.xml:{8YG}:10_Who performs viral transmission among aduget bertqa{8YG}_PMC302072.xml:{8YG}:10_Who performs viral transmission among aduget bertqa{8YG}_PMC302072.xml:{8YG}:10_Who performs vira
@AlexMikhalev
AlexMikhalev / taury_tray.rs
Created June 15, 2021 11:16
Taury Apps tray icon
fn main() {
let show = CustomMenuItem::new("show".to_string(), "Show");
let hide = CustomMenuItem::new("hide".to_string(), "Hide");
let quit = CustomMenuItem::new("quit".to_string(), "Quit");
let tray_menu_items = vec![
SystemTrayMenuItem::Custom(show),
SystemTrayMenuItem::Custom(hide),
SystemTrayMenuItem::Separator,
SystemTrayMenuItem::Custom(quit),