Skip to content

Instantly share code, notes, and snippets.

@amitsaha
amitsaha / notes.md
Last active May 28, 2022 07:45
Extras handling in micropip

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 11:49
Pyowm + Pyodide - patching "requests" module
<!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 April 12, 2022 01:26 — forked from codingbaobao/client.go
grpc interceptor in Python/Golang
package main
import (
"context"
pb "example/helloworld"
"io"
"log"
"time"
"google.golang.org/grpc"
@amitsaha
amitsaha / QEMU-Silicon-Mac-Virtualization.md
Created March 6, 2022 04:34 — forked from nrjdalal/QEMU-Silicon-Mac-Virtualization.md
Create Virtual Machines using QEMU on Silicon based Apple Macs

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 July 23, 2021 03:04
Example of recreating a gRPC stream for bidi - if the client gets disconnected or there is another issue
// 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 July 16, 2021 23:13
Go's net/http Server Behavior When a handler panics

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 January 22, 2021 00:44
# Python Web Conference 2021 accepted talk

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 05:57
Kubernetes: List all running pods and their pod security policies using Golang
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 August 15, 2019 06:34
test python + prometheus
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 August 15, 2019 00:03
Redis + go
module github.com/amitsaha/redis-demo
go 1.12
require github.com/go-redis/redis v6.15.2+incompatible