Skip to content

Instantly share code, notes, and snippets.

@malisetti
malisetti / combine-junit-xml.sh
Created July 3, 2023 04:35 — forked from spedepekka/combine-junit-xml.sh
Combine multiple JUnit XML files from folder into single XML file
#!/bin/bash
#
#
# Script combines given JUnit XML files into one.
#
# Script assumes that file begins with XML header.
# Script will copy content between <testsuite> tags
# to new file with XML header and <testsuites> tags.
# Script will not affect original files, but it will
# overwrite output file contents. Script searches all
@malisetti
malisetti / main.go
Created March 2, 2023 08:41
correlating datadog logs and apm with chi trace and logrus packages in a http server
package main
import (
"net/http"
// "os"
"time"
chitrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/go-chi/chi.v5"
ddlogrus "gopkg.in/DataDog/dd-trace-go.v1/contrib/sirupsen/logrus"
@malisetti
malisetti / lru_cache_main.go
Last active August 5, 2022 14:21
LRU Cache implementation with concurrent cleaning based on ttl
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"math"
"math/rand"
"sync"
@malisetti
malisetti / grid.html
Created March 1, 2022 04:36
upload and display images as grid
<!DOCTYPE html>
<html>
<head>
<title>Image Grid</title>
<style>
body {
font-family: 'Segoe UI';
font-size: 12pt;
}
@malisetti
malisetti / transaction.ts
Created August 16, 2021 11:30
Execute several functions in a transaction
export type fn = () => Error | null;
export type tfn = { run: fn, revert: fn };
export const doInTransaction = async (i: tfn[]): Promise<Error | null> => {
const reverts: fn[] = [];
for (const fn of i) {
try {
const err = await fn.run();
if (err) {
throw err;
@malisetti
malisetti / bitmasks.ts
Last active June 8, 2021 03:44
typescript enum bitmasks
https://www.typescriptlang.org/play?#code/PTAEGUFMGcAsEMDGCA28C2oC0oAuBPABxkQCcBLQ3UAI3N3XmgGtoBYAKE8gDsBXTAGEASgFUAIqADenUHNCDSkeLkigAvKACMoADy7QABgA0s+cOUATDdr0GtpjvNCjCllWs079oAEyPncUgUSFUbbwMAZkcAX05ORAB7HmhqAEEUFBEJAHkqcmToG2zxADpFZTCAHwUxMot4axqS0td3atqJUqCQ1QBueI4klMSQ0pREgHMACgysurzcApSASgGuIcLqeEzEgHdLReWizQBtFoqPY06yto8AXXXOXtp6E6N1gDNE0lBp4dSoESQM+oB2EwOR0KK2kZjkdFwRSqmkS6ziGwBo0g4ym0wR0DWg0xYwmMzxb1AADIbuUlB4YepGTTLqpCZsRiTceTEVSaXdWRomS1+ZA2Zx8VTNAA-YVuDxPdnQLE4mb4sWK5Wk6bcorUi50gWMzT6yqi9bE7FanW82XtUWC411Vpy1nrIA
// Seshachalam - typescript bitmasks
enum CRUD {
Create = 1 << 0,
Read = 1 << 1,
Update = 1 << 2,
Delete = 1 << 3,
}
@malisetti
malisetti / gist:23e0f1976dfcda3d7188c921b92fc0ed
Created October 20, 2019 16:32
Letter to my fellow Software Engineers
I started working in mid 2012 as a software engineer for a multi national services company based in Bangalore as a post graduate from a very famed university from south India which was in 11th position when I started my studies there in the list of top engineering colleges in India. I graduated in 2012. Most of my classes felt like school mostly because of my department. Even in university campus I was not exposed to practical real world usages to sciences be it may any kind science. The internet was not accessible very easily at that time and exposure to online courses was limited to 0. I always dreamt of studying at Stanford some course related to computer science. I had to take work a job than study after 2012. Its not fair to study after getting a master's degree. I shouldn't say this but I was limited by my surroundings, society, everyone in colleges, my family and relatives, mostly everyone I know of. The thing is you have to work and earn somehow after you complete your education. This is true in ideal
@malisetti
malisetti / pl-types.txt
Created September 26, 2019 06:46
Programming languages types
pl
assembly
binaryDataFormat
xmlFormat
standard
compiler
computingMachine
grammarLanguage
application
ir
@malisetti
malisetti / learn_python.txt
Created September 17, 2019 10:14
learn python
Read history of python
How python evolves ? python2 to python3 https://www.python.org/dev/peps/
How python is different from C like languages ?
Can concurrent programs be written in python ? If yes, what are the concurrent models built into the language
When can python be slow ? or what kind of applications cant be written in python ?
How python can use libraries written in other languages, like C and rust ?
Why is python used majorly in scientific computing ? What are the other languages that are alternative to python in scientific computing ?
Understand package management for libraries in python ? Use an external library in a program.
How are the libraries related to SQL databases ? Use sqlite with python
Are complex numbers(imaginary numbers) supported in python standard library?
@malisetti
malisetti / gif-to-images-tar-gz.go
Last active September 10, 2019 08:40
A simple web server to convert GIF from an url to compressed archive of images
package main
import (
"archive/tar"
"bytes"
"compress/gzip"
"fmt"
"image/gif"
"image/png"
"io"