Skip to content

Instantly share code, notes, and snippets.

Avatar

echorand (Amit Saha) amitsaha

View GitHub Profile
@amitsaha
amitsaha / notes.md
Last active May 28, 2022
Extras handling in micropip
View notes.md

Explanation of micropip's extras handling

From my understanding, a transaction corresponds to a single micropip.install() command.

The method add_requirement_inner() gets called for each package that we will be installing as part of the current microppip transaction.

So, consider the following:

  • pkga with optional dependency marker, all which will bring in packages, depa and depb
@amitsaha
amitsaha / powm_pyodide.html
Last active May 8, 2022
Pyowm + Pyodide - patching "requests" module
View powm_pyodide.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/pyodide/v0.20.0/full/pyodide.js"></script>
</head>
<body>
Pyodide test page <br>
Open your browser console to see Pyodide output
<script type="text/javascript">
async function main(){
@amitsaha
amitsaha / client.go
Created Apr 12, 2022 — forked from codingbaobao/client.go
grpc interceptor in Python/Golang
View client.go
package main
import (
"context"
pb "example/helloworld"
"io"
"log"
"time"
"google.golang.org/grpc"
@amitsaha
amitsaha / QEMU-Silicon-Mac-Virtualization.md
Created Mar 6, 2022 — forked from nrjdalal/QEMU-Silicon-Mac-Virtualization.md
Create Virtual Machines using QEMU on Silicon based Apple Macs
View QEMU-Silicon-Mac-Virtualization.md

Install QEMU on Silicon based Apple Macs (June 2021)

Option 1 - Automatically

zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"

Option 2 - Manually

  • Install Xcode command line tools

xcode-select --install
@amitsaha
amitsaha / main.go
Created Jul 23, 2021
Example of recreating a gRPC stream for bidi - if the client gets disconnected or there is another issue
View main.go
// https://groups.google.com/g/grpc-io/c/PXb2Xx89QH4/m/ox_s98LOAwAJ?utm_medium=email&utm_source=footer
func createHelpStream(c svc.UsersClient) (
users.Users_GetHelpClient, error,
) {
return c.GetHelp(
context.Background(),
grpc.WaitForReady(true),
)
}
@amitsaha
amitsaha / doc.md
Last active Jul 16, 2021
Go's net/http Server Behavior When a handler panics
View doc.md

Consider a test HTTP server in Go:

package main

import "net/http"

func myHandler1(w http.ResponseWriter, r *http.Request) {
	panic("I panicked")
}
@amitsaha
amitsaha / proposal.md
Last active Jan 22, 2021
# Python Web Conference 2021 accepted talk
View proposal.md

Python Web Conference 2021 accepted talk

In this talk, I will discuss the next steps after you have written a web application. Python frameworks and libraries makes it really easy to write a highly performant web application out of the box, but the problems that come next needs a number of building blocks and tools to come together.

We will talk about deploying your web application and discuss scaling up and down policies so that we can cater to peak traffic demands. We will discuss how we can peak into our application’s performance by exporting “health” status and metrics, and learn about implementing distributed tracing into our web application.

You have just implemented your next big feature, your pull request has been merged, testing looks good and you want to roll it out to your users. But, have you thought about monitoring, observability, and logging? These three things are usually an afterthought. They shouldn't be. On this page, I will point to resources and discuss about the things that we shou

@amitsaha
amitsaha / go.mod
Created May 19, 2020
Kubernetes: List all running pods and their pod security policies using Golang
View go.mod
module github.com/amitsaha/kbdd
go 1.14
require (
k8s.io/apimachinery v0.18.0
k8s.io/client-go v0.18.0
)
@amitsaha
amitsaha / test.py
Created Aug 15, 2019
test python + prometheus
View test.py
from prometheus_client import multiprocess
from prometheus_client import generate_latest, CollectorRegistry, CONTENT_TYPE_LATEST, Gauge
from flask import Flask, Response
app = Flask(__name__)
from flask import request
from prometheus_client import Counter, Histogram
import time
@amitsaha
amitsaha / go.mod
Last active Aug 15, 2019
Redis + go
View go.mod
module github.com/amitsaha/redis-demo
go 1.12
require github.com/go-redis/redis v6.15.2+incompatible