Skip to content

Instantly share code, notes, and snippets.

View AlexMikhalev's full-sized avatar

Dr Alexander Mikhalev AlexMikhalev

View GitHub Profile
@AlexMikhalev
AlexMikhalev / create_bucket_s3.sh
Created September 6, 2024 11:33
Create AWS s3 bucket and make it publick
#!/bin/bash
bucket_name="my-unique-name"
aws s3api create-bucket --bucket "${bucket_name}" > /dev/null # 1
aws s3api put-public-access-block --bucket "${bucket_name}" --public-access-block-configuration "BlockPublicPolicy=false" # 2
aws s3api put-bucket-policy --bucket "${bucket_name}" --policy '{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
@AlexMikhalev
AlexMikhalev / Sublime Linux Keymap
Created June 16, 2024 19:50
Sublime Linux keymap for Mac users
[
{ "keys": ["alt+shift+p"], "command": "show_overlay", "args": {"overlay": "command_palette"} },
{ "keys": ["ctrl+k","ctrl+a"], "command": "select_all" },
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["shift+right"], "command": "lsp_symbol_definition",
"args": {"side_by_side": false, "force_group": true, "fallback": false, "group": -1},
"context": [
{"key": "lsp.session_with_capability", "operand": "definitionProvider"},
{"key": "auto_complete_visible", "operand": false}
@AlexMikhalev
AlexMikhalev / config.toml
Created October 15, 2023 16:33
Helix Editor
# Editor Config
theme = "catppuccin_macchiato"
[editor]
scrolloff = 6
mouse = true
middle-click-paste = true
scroll-lines = 3
shell = [ "zsh","-c" ]
line-number = "absolute"
@AlexMikhalev
AlexMikhalev / python_time.py
Created May 11, 2023 14:52
Monitonic time in NS in python
import time
time_ns = time.monotonic_ns()
@AlexMikhalev
AlexMikhalev / sensor.jsonl
Created March 14, 2023 14:19
Synthetic data based on cloud events spec
{"data":"<much wow=\"xml\"/>","device_id":3,"device_type":"accelerometer","id":0,"timestamp":"2017-05-31T04:10:48+0000"}
{"data":{"appinfoA":"abc","appinfoB":123,"appinfoC":true},"device_id":1,"device_type":"temperature","id":1,"timestamp":"2013-07-17T23:18:51+0000"}
{"data":1.5,"device_id":1,"device_type":"flow","id":2,"timestamp":"2013-04-26T07:34:51+0000"}
{"data":"I'm just a string","device_id":3,"device_type":"accelerometer","id":3,"timestamp":"2001-10-01T22:52:57+0000"}
{"data":"eyAieHl6IjogMTIzIH0=","device_id":1,"device_type":"temperature","id":4,"timestamp":"2005-01-01T09:05:50+0000"}
{"data":"<much wow=\"xml\"/>","device_id":1,"device_type":"flow","id":5,"timestamp":"2012-09-08T19:14:16+0000"}
{"data":{"appinfoA":"abc","appinfoB":123,"appinfoC":true},"device_id":3,"device_type":"accelerometer","id":6,"timestamp":"2003-09-26T07:22:09+0000"}
{"data":1.5,"device_id":1,"device_type":"temperature","id":7,"timestamp":"2000-05-11T21:20:53+0000"}
{"data":"I'm just a string","device_id":1,"device_type":"flow
@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,