Skip to content

Instantly share code, notes, and snippets.

View rommansabbir's full-sized avatar
👓
Only Development

Romman Sabbir rommansabbir

👓
Only Development
View GitHub Profile
@FTKhanFT
FTKhanFT / RemoveDups_MongoDb.txt
Created June 19, 2021 06:45
Delete Any duplicate documents in a collection in Mongo DB in less than seconds with aggregation.
var duplicates = [];
db.getCollection('CollectionName').aggregate([ // CollectionName = Your collection name
{ $match: {
name: { "$ne": '' } // discard selection criteria
}},
{ $group: {
_id: { FieldName: "$FieldName"}, // FieldName = Matching field; can be grouped on multiple properties
dups: { "$addToSet": "$_id" }, // _id
count: { "$sum": 1 }
}},
@emil2k
emil2k / Connectivity.java
Last active August 5, 2024 10:48
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions: