This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: '3.0.0' | |
info: | |
title: BOMS API | |
description: BOMS API Specification | |
version: "0.1.1" | |
servers: | |
- url: localhost:8080 | |
description: test server |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os, sys, re, subprocess | |
group_id = 'com.fr' | |
repo_id = 'znbt' | |
repo_url = 'http://192.168.12.233:8081/repository/znbt/' | |
sample_settings = '''<settings> | |
<servers> | |
<server> | |
<id>znbt</id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
basedir = '/home/leo/.donno/repo' | |
notebook = 'dsnote' | |
err_coll = [] | |
for fn in os.listdir(basedir): | |
print('upload %s' % fn) | |
fullname = os.path.join(basedir, fn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser( | |
description='Sync docs in MongoDB to Elasticsearch server') | |
parser.add_argument('inputfile_name', | |
help='the json file contains data to synced from MongoDB') | |
parser.add_argument('-s', '--server-name', | |
help='the IP address of Elasticsearch server') | |
parser.add_argument('-i', '--index', help='the index name of ES') | |
parser.add_argument('-t', '--type-name', help='the type name of the index') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import random | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def normal_cdf(x, mu=0, sigma=1): | |
return (1 + math.erf((x - mu) / math.sqrt(2) / sigma)) / 2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys, re | |
from os import system | |
usage = """ | |
Usage: | |
Full style: ./cpColl sUser:sPwd@sHost:sPort/sDb-sColl dUser:dPwd@dHost:dPort/dDb-dColl | |
Abbr for source on localhost: ./cpColl sDb-sColl dUser:dPwd@dHost:dPort/dDb-dColl | |
Abbr for destination on localhost: ./cpColl sUser:sPwd@sHost:sPort/sDb-sColl dDb-dColl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aa = [{'a': 3}, {'a': 2}, {'a': 5}, {'b':8}] | |
sorted(aa, key=lambda rec: rec['a'] if 'a' in rec else 1, reverse=True) | |
#: [{'a': 5}, {'a': 3}, {'a': 2}, {'b': 8}] | |
sorted(aa, key=lambda rec: rec['a'] if 'a' in rec else 6, reverse=True) | |
#: [{'b': 8}, {'a': 5}, {'a': 3}, {'a': 2}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sed 's/{\"\$date\":\(\".\{10\}T.\{12\}Z\"\)}/\1/g' f1000.json > temp.json | |
sed -i 25d temp.json | |
mongoimport -d test -c strDate --type json --file temp.json | |
# sample data: | |
"timeStart":{"$date":"1015-09-01T00:00:00.000Z"},"timeEnd":{"$date":"2018-03-02T00:00:00.000Z"}, | |
"timeStart":{"$date":"2016-09-01T00:00:00.000Z"},"timeEnd":{"$date":"2021-04-0kT00:00:00.000Z"}, | |
"timeStart":{"$date":"2017-09-01T00:00:00.000Z"},"timeEnd":{"$date":"2021-05-09T00:00:00.000Z"}, |