Skip to content

Instantly share code, notes, and snippets.

mongodump --db=<old_db_name> --collection=<collection_name> --out=data/
mongorestore --db=<new_db_name> --collection=<collection_name> data/<db_name>/<collection_name>.bson
@idaWHALE
idaWHALE / transparency_scale.py
Created December 9, 2019 17:55
Take background and foreground colors and a step count. Generates color scale based on different foreground color transparency steps over the background. Example: https://pasteboard.co/IKu4Sqw.png
from Tkinter import *
def ablend(a, fg, bg):
return ((1-a)*fg[0]+a*bg[0],
(1-a)*fg[1]+a*bg[1],
(1-a)*fg[2]+a*bg[2])
root = Tk()
num=8.0
@idaWHALE
idaWHALE / mongo_group_by_day.js
Created July 1, 2019 17:26 — forked from cschlyter/mongo_group_by_day.js
MongoDB: group by day (aggregate)
var mention_id = 620996;
db.mentionStats.aggregate([
{ $match: {'mention_id': mention_id}},
{ $group: {'_id': {
'year': { '$year': "$verification_date" },
'month': { '$month': "$verification_date" },
'day': { '$dayOfMonth': "$verification_date" }
},
'retweets': { $last: "$retweets" }}},
@idaWHALE
idaWHALE / keybase.md
Created April 11, 2019 19:58
Keybase

Keybase proof

I hereby claim:

  • I am idawhale on github.
  • I am idawhale (https://keybase.io/idawhale) on keybase.
  • I have a public key ASCcHyYgBkp9Buq2z3sUIEBfb6ELTioam5xSpm9xBAKHswo

To claim this, I am signing this object:

import logging
logging.basicConfig(level=logging.DEBUG, format='[%(levelname)s] %(processName)s:%(threadName)-12s %(name)s:%(lineno)-7d (%(asctime)s) %(message)s', )
logger = logging.getLogger('MdnMonReport')
def test():
try:
print('holder')
raise Exception('We got an exception')
except Exception as e:
@idaWHALE
idaWHALE / increment.gs
Last active March 22, 2018 22:34
This script increments A1 value. I use this with a trigger to auto-update CRYPTOFINANCE add-on. 1.- Tools -> Script Editor 2.- Paste script (rename file if desired) and run the script with play button. 3.- Give Google App Script access to sheets 4.- Edit -> Current project's triggers 5.- Choose script and set as time-driven. Choose frequency.
// increment.gs
function increment() {
var s = SpreadsheetApp.getActive().getSheetByName('Sheet1').getRange('A1');
var cur = parseInt(s.getValue());
s.setValue(cur + 1);
}
import sys
import ConfigParser
import paramiko
import functools
args = sys.argv
zconfig = ConfigParser.RawConfigParser()
zconfig.read(args[1])
compconfig = ConfigParser.RawConfigParser()
@idaWHALE
idaWHALE / dddns.py
Created October 4, 2016 19:33 — forked from jpmens/dddns.py
Print results of DNS NAPTR records
#!/usr/bin/env python
#(@)dddns.py by Jan-Piet Mens, February 2012
import dns.resolver
import dns.e164
from dns.exception import DNSException
import sys, re
import optparse
def enum(aus, verbose):