Skip to content

Instantly share code, notes, and snippets.

@saurabh2590
saurabh2590 / Experiment.md
Last active March 7, 2024 09:01
Brainstorming ideas
@saurabh2590
saurabh2590 / experiment.md
Last active February 23, 2024 07:51
MongoDB experiment Request

Note:

  • This is something to consider and discuss if we should do it now or later, and I would love a healthy debate about the pros and cons of doing it now or later.

Context:

  • We are going to turn on reading and writing both from MongoDB.
  • I believe that it is going to increase the load on our MongoDB Atlas clusters
  • Increased load means we may be required to use the large cluster size.
  • The large size of the cluster means higher costs.
  • The experiment aims to validate if MongoDB is a cost-effective & performant event store for the long run.
@saurabh2590
saurabh2590 / generatePdf.ts
Created January 19, 2024 08:30
GeneratePDF for webpage
import * as puppeteer from 'puppeteer';
import * as fs from 'fs';
import * as readline from 'readline';
async function downloadWebpageAsPdf(url: string, outputFilePath: string): Promise<void> {
const browser = await puppeteer.launch();
const page = await browser.newPage();
try {
await page.goto(url, { waitUntil: 'networkidle2' });
#!/usr/bin/python3
# Author: Timotheus Pokorra <timotheus.pokorra@solidcharity.com>
# source hosted at https://github.com/SolidCharity/exportMediaWiki2HTML
# licensed under the MIT license
# Copyright 2020-2021 Timotheus Pokorra
import os
from urllib import parse
import requests
@saurabh2590
saurabh2590 / settings.md
Created December 5, 2023 14:16
Managing your custom settings
@saurabh2590
saurabh2590 / generate_name_logic.md
Last active March 31, 2023 07:10
Names Generating logic in GLU

Generate name logic

Inputs

  • We have two defined arrays for names, first part and last part. And theu are localised for country and languag. Please find example from DE.
"usernames": {
                "part1": "Adler\nAffen\nAmeisen\nAmsel\nAustern\nBienen\nBison\nDachs\nDelfin\nDino\nDrossel\nEinhorn\nElch\nElefanten\nElster\nEnten\nEulen\nFalken\nFisch\nFlamingo\nFliegen\nFloh\nForellen\nFrosch\nFuchs\nGiraffen\nGorilla\nHahnen\nHamster\nHasen\nHecht\nHirsch\nHummer\nIgel\nJaguar\nKatzen\nKoala\nKobra\nKorallen\nKrokodil\nLachs\nLama\nLemming\nLeoparden\nLuchs\nMaulwurfs\nMeisen\nNashorn\nOtter\nPanda\nPapageien\nPelikan\nPferde\nPinguin\nPuma\nQuallen\nRaben\nReh\nRobben\nSchafs\nSchnecken\nSchwalben\nSpatzen\nSpecht\nSpinnen\nStorchen\nTauben\nTiger\nUhu\nVogel\nWal\nWespen\nWolfs\nZebra", 
                "part2": "Acker\nAllee\nBach\nBerg\nBrunnen\nBurg\nChaussee\nDamm\nDorf\nFeld\nFelsen\nFlur\nForst\nGarten\nGasse\nGrund\nHaus\nHausen\nHeim\nHof\nInsel\nKoppel\nLand\nNest\nPark\nPlatz\nRi
@saurabh2590
saurabh2590 / exception.txt
Created March 21, 2023 13:29
Djangoexception
Traceback (most recent call last):
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/django/db/backends/utils.py", line 89, in _execute
return self.cursor.execute(sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 211, in execute
return self._trace_sql(self.__wrapped__.execute, sql, params)
File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/elasticapm/instrumentation/packages/dbapi2.py", line 249, in _trace_sql
result = method(sql, params)
psycopg2.OperationalError: server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
@saurabh2590
saurabh2590 / stacktrace.txt
Created September 20, 2022 09:37
kotlin stacktrace
./gradlew build
Downloading https://services.gradle.org/distributions/gradle-7.3.3-bin.zip
...........10%...........20%...........30%...........40%...........50%...........60%...........70%...........80%...........90%...........100%
Welcome to Gradle 7.3.3!
Here are the highlights of this release:
- Easily declare new test suites in Java projects
- Support for Java 17
- Support for Scala 3
@saurabh2590
saurabh2590 / snippet_nagios_notify.sh
Created September 20, 2022 09:02
Why SMS are not sent for unknown state
# Do not alert state UNKKNOWN
if [[ "${TYPE}" == "PROBLEM" && "${STATE}" == "UNKNOWN" ]] ; then
EMAIL=false
SMS=false
X_SERVICE=$(echo "${SERVICE}" | tr -d '/')
# Safe host and service in ${UNKNOWN_STATE} file
echo "${HOST}: ${X_SERVICE}" >> ${UNKNOWN_STATE}
fi
# Remove host and service from ${UNKNOWN_STATE} file in case of new PROBLEM
@saurabh2590
saurabh2590 / check-aws-lambda-runtimes.sh
Created September 20, 2022 08:33
Checks AWS Lamdba
#!/bin/bash
PROFILE=$1
RUNTIME=$2
REGIONS=$(aws --profile ${PROFILE} ec2 describe-regions --query 'Regions[*].RegionName' --output text)
for REGION in ${REGIONS}; do
echo ${REGION}
aws --profile ${PROFILE} lambda list-functions --function-version ALL --region ${REGION} --output json --query "Functions[?Runtime=='${RUNTIME}'].FunctionArn"
done