Skip to content

Instantly share code, notes, and snippets.

View MelikbekyanAshot's full-sized avatar
🐢

Melikbekyan Ashot MelikbekyanAshot

🐢
  • CoelusLLC
  • Moscow
View GitHub Profile
@Lh4cKg
Lh4cKg / mongodb_backup.py
Created January 22, 2020 07:50
MongoDB Dump And Restore Database With Python PyMongo Driver
import bson
from pymongo import MongoClient
def dump(collections, conn, db_name, path):
"""
MongoDB Dump
@alimanfoo
alimanfoo / find_runs.py
Created November 5, 2017 23:53
Find runs of consecutive items in a numpy array.
import numpy as np
def find_runs(x):
"""Find runs of consecutive items in an array."""
# ensure array
x = np.asanyarray(x)
if x.ndim != 1:
raise ValueError('only 1D array supported')