Skip to content

Instantly share code, notes, and snippets.

View yelinaung's full-sized avatar
🏠
Working from home

Ye Lin Aung yelinaung

🏠
Working from home
View GitHub Profile
// YELIN MONGO UTILS
// get index usage
db.orders.aggregate( [ { $indexStats: { } } ] )
// find connection status
ar status = db.serverStatus()
status.connections
// kill operations taking longer than 5s
@yelinaung
yelinaung / asyncio_waiting.py
Created September 28, 2021 09:24
Asyncio demo
import time
import asyncio
import logging
import aiohttp
logging.basicConfig(
format='%(asctime)s %(levelname)-8s %(message)s',
level=logging.INFO,
datefmt='%Y-%m-%d %H:%M:%S')
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: my-hpa
namespace: sg-prod
annotations:
metric-config.object.istio-requests-total.prometheus/per-replica: "true"
metric-config.object.istio-requests-total.prometheus/query: |
sum(rate(istio_requests_total{reporter="destination", destination_workload="<deployment-name-here>"}[2m]))
spec:
#!/bin/bash
NAME=$1
HOST=$2
PORT=$3
if [ -z "$3" ]; then
echo "$0 [name] [ip] [port]"
exit 1
fi
@yelinaung
yelinaung / tutorial.md
Created July 20, 2018 01:49 — forked from swalkinshaw/tutorial.md
Designing a GraphQL API

Tutorial: Designing a GraphQL API

This tutorial was created by Shopify for internal purposes. We've created a public version of it since we think it's useful to anyone creating a GraphQL API.

It's based on lessons learned from creating and evolving production schemas at Shopify over almost 3 years. The tutorial has evolved and will continue to change in the future so nothing is set in stone.

Keybase proof

I hereby claim:

  • I am yelinaung on github.
  • I am yelinaung (https://keybase.io/yelinaung) on keybase.
  • I have a public key ASATtA1d5QNT3Nu0q73LRZiQLFrmVi5vgAfbNdqvaZeiBwo

To claim this, I am signing this object:

@yelinaung
yelinaung / tree.md
Created December 28, 2017 03:01 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

Bash shortcuts

Command Description
Ctrl + a To the beginning of the line
Ctrl + e To the end of the line
Alt + b One word back
Alt + f One word forward
Ctrl + k Delete to the end of the line
Ctrl + u Delete to the beginning of the line
package main
import "fmt"
import "unicode/utf8"
func main() {
str1 := "ခ"
str2 := "a"
str3 := "界"
public static int getFreq(List<Integer> list) {
int mostFreq = 0;
//System.out.println("list is " + list);
Map<Integer, Integer> map = new HashMap<>();
for (int i : list) {
int freq = Collections.frequency(list, i);
map.put(i, freq);
}