Skip to content

Instantly share code, notes, and snippets.

View myksao's full-sized avatar
🏠
Working from home

Nimi myksao

🏠
Working from home
View GitHub Profile
@myksao
myksao / struct_extraction.rs
Last active October 5, 2023 22:31
field and value extraction using serde json
use serde::{Deserialize, Serialize};
use serde_json::Value;
pub fn extraction<T: Default + Serialize>(data: &T) -> Value {
let columns = serde_json::to_value(data.clone())
.unwrap()
.as_object()
.unwrap()
.keys()
.map(|key| key.to_string())
@myksao
myksao / file-upload-multipart.go
Created October 6, 2021 18:15 — forked from andrewmilson/file-upload-multipart.go
Golang multipart/form-data File Upload
package main
import (
"net/http"
"os"
"bytes"
"path"
"path/filepath"
"mime/multipart"
"io"
@myksao
myksao / rabbitmq_notes.md
Created August 20, 2021 12:26 — forked from Dev-Dipesh/rabbitmq_notes.md
Why RabbitMQ is better over Redis and notes on RabbitMq.

Redis is Database whereas RabbitMQ was designed as a message router or message-orientated-middleware (mom), so I'm sure if you look for benchmarks, you'll find that RabbitMQ will outperform Redis when it comes to message routing.

RabbitMQ is written in Erlang which was specifically designed by the telecom industry to route messages, you get clustering out of the box due to it being written in Erlang which means in a clustered environment, RabbitMQ will outperform Redis even further.

Furthermore, you get guaranteed delivery of messages due to the AMQP protocol, in other words, if the network drops while consuming the message, the consumer won't be able to say thanks for the message, so the consumer will drop the message and Rabbit will requeue the message, if you publish a message and the queue didn't say thanks to the publisher due to network problems or timeouts, Rabbit will drop the message and the publisher will keep on trying to publish the message. You can have publish retries with backoff policies, so

@myksao
myksao / modify.py
Last active June 14, 2022 18:42
Modifying Document in Spacy Using Python
#I won't go through the process of installation in this article,want to go straight to the point but
#there are some few things i would like you to always put in mind;
#I will be talking about how to remove text in Doc object in this Part
#Doc - Document
#Spacy document 'Doc' i.e. Doc works with words and sentences object