Skip to content

Instantly share code, notes, and snippets.

@avneesh91
avneesh91 / performance.py
Created January 12, 2020 13:10
Performance Comparision
import time
import requests
from concurrent.futures import ThreadPoolExecutor
url_list = ['https://docs.python.org/3/library/concurrent.futures.html',\
'https://technokeeda.com',
'http://home.pipeline.com/~hbaker1/Futures.html']
def get_sequential_get(urls):
"""
Function which does a get requests
{
'$children': [
{
'$children': [Array],
'$text': 'Grapeville, PA, United States',
'$name': 'location'
},
{
'$children': [Array],
'$text': 'Flatbed Truck Driver',
'''
Script for picking up changes from the change stream
'''
import os
import json
import pymongo
from bson.json_util import dumps
from bson import ObjectId
client = pymongo.MongoClient('mongodb://localhost:27017/')
'''
Script for picking up changes from the change stream
'''
import os
import json
import pymongo
from bson.json_util import dumps
from bson import ObjectId
client = pymongo.MongoClient('mongodb://localhost:27017/')
@avneesh91
avneesh91 / gist:86065c466982dd7c0ed7648e52103695
Created July 16, 2020 08:51
For generating kubectl file from gcloud
this article -> https://gravitational.com/blog/kubectl-gke/
Installation
sudo apt-get install uuid
install cfssl, this article => https://www.pimwiddershoven.nl/entry/install-cfssl-and-cfssljson-cloudflare-kpi-toolkit
then this script => https://raw.githubusercontent.com/gravitational/teleport/master/examples/gke-auth/get-kubeconfig.sh
audio_processor_config:
feat_language_identification: False
# defaults to hi-IN
language: ''
# path of the files on gcs which need to be processed
remote_raw_audio_file_path: ''
snr_done_folder_path: ''
@avneesh91
avneesh91 / metrics_exporter.py
Created May 1, 2023 21:06
Prometheus Metrics Exporter
import os
from prometheus_client import start_http_server
from prometheus_client import Histogram, Summary, Counter
from app_io.constants import PROMETHEUS_PORT
class MetricType:
SUMMARY='SUMMARY'
HISTOGRAM='HISTOGRAM'
COUNTER='COUNTER'
package repositories
import (
"context"
"fmt"
"github.com/ory/dockertest/v3"
"github.com/ory/dockertest/v3/docker"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"log"
type MyStruct struct {
FirstName string
LastName string
}
func NewMyStruct(firstName string, lastName string) MyStruct{
return MyStruct{
FirstName: firstName,
LastName: lastName
}
@avneesh91
avneesh91 / pool.go
Last active November 30, 2023 17:23
type Pool interface{}
func (p *Pool) Get() any