content stringlengths 5 1.05M |
|---|
import requests
import threading
import queue
# 设置基本参数
user_thread = 10
username = "admin"
wordlist_file = "pass1000.txt"
target_url = "http://172.16.100.103/dvwa/login.php"
success_check = "Login failed"
# 定义类
class Bruter(object):
# 初始化时需传参,接受用户名,密码参数
def __init__(self, username, words):
self.usern... |
#
# This file is part of pyasn1-alt-modules software.
#
# Created by Russ Housley with assistance from asn1ate v.0.6.0.
# Modified by Russ Housley to include the opentypemap manager.
#
# Copyright (c) 2019-2021, Vigil Security, LLC
# License: http://vigilsec.com/pyasn1-alt-modules-license.txt
#
# The scrypt Password-Ba... |
# Copyright 2022. Tushar Naik
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.target_types import COMMON_PYTHON_FIELDS, PythonSources
from pants.engine.target import Dependencies, Target
class PylintPluginSources(PythonSources):
requi... |
#
# MIT License
#
# Copyright (c) 2020 Airbyte
#
# 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, pu... |
#!/usr/bin/env python3
import logging
import argparse
from version.VersiON import VersiON
import version.git_help
def main(args):
logger = logging.getLogger(__file__)
versiON = VersiON(args.style_name, args.config)
if args.name is not None:
versiON.style.set_variable('{component_name}', args.na... |
# -*- coding: utf-8 -*-
import os
from genotype.server.app import create_app
config = {
"GENOTYPE_INCLUDE_KEY": "-CG-",
"GENOTYPE_GENOTYPE_DIR": os.environ.get("GENOTYPE_GENOTYPE_DIR"),
"GENOTYPE_MAX_NOCALLS": 15,
"GENOTYPE_MAX_MISMATCH": 3,
"GENOTYPE_MIN_MATCHES": 35,
"SQLALCHEMY_DATABASE_URI... |
"""Traceability"""
__version__ = '0.1.dev'
__license__ = 'BSD License'
__author__ = 'Joost VanDorp'
__email__ = 'joostvandorp@gmail.com'
__url__ = 'https://github.com/vandorjw/django-traceability'
|
from basepokemon import BasePokemon, BaseMove, Type
class Pokemon(BasePokemon):
def __init__(self):
BasePokemon.__init__(self)
# Has to sum to 100
self.spend_hp(30)
self.spend_attack(50)
self.spend_defence(20)
self.add_move(Escupitajo_nuclear())
self.add_move... |
"""
Exceptions that are raised by sam package
"""
from samcli.commands.exceptions import UserException
class InvalidLocalPathError(UserException):
def __init__(self, resource_id, property_name, local_path):
self.resource_id = resource_id
self.property_name = property_name
self.local_path =... |
# Copyright (c) 2016, Samantha Marshall (http://pewpewthespells.com)
# All rights reserved.
#
# https://github.com/samdmarshall/pyconfig
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
#
# 1. Redistributions of sourc... |
import os # noqa
from argparse import ArgumentParser, Namespace
from math import ceil
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from ignite.contrib.handlers import WandBLogger
from ignite.engine import Engine, EventEnum... |
# Generated by Django 2.1.5 on 2020-01-04 12:04
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('robot', '0001_initial'),
]
operations = [
migrations.AddField(
mod... |
from rest_framework import viewsets
from rest_framework_simplejwt.authentication import JWTAuthentication
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from . import serializers as serializers
from . import models as models
class LaboratoryViewSe... |
import pytest
from uuid import UUID
from zeus import factories
from zeus.db.utils import create_or_update, try_create
# we use the User model to test
from zeus.models import User
def test_try_create_only_where_new_instance():
instance = try_create(User, {"email": "foo@example.com"})
assert instance
ass... |
#!/usr/bin/env python3
""""Provide a tkinter text box class for file viewing.
Copyright (c) 2022 Peter Triesberger
For further information see https://github.com/peter88213/yw-viewer
Published under the MIT License (https://opensource.org/licenses/mit-license.php)
"""
import re
import tkinter as tk
from ywvie... |
from siptrackdlib import errors
from siptrackdlib import log
class ObjectClass(object):
"""A class definition in the object registry.
Stores a reference to the class itself and also a list of valid child
classes (class_ids).
"""
def __init__(self, class_reference):
self.class_reference = c... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter(trailing_slash=True)
router.register('seekers', views.SeekerViewSet, base_name='seeker')
router.register('employers', views.EmployerViewSet, base_name='employer')
urlpatterns = [
path... |
# K-Means Clustering
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Importing the dataset
dataset = pd.read_csv('cars.csv')
X = dataset.iloc[:,:-1].values
X = pd.DataFrame(X)
X = X.convert_objects(convert_numeric=True)
X.columns = ['mpg', ' cylinders', ' cubicinch... |
import telebot
import os
import requests
import threading
from flask import Flask, request
from emoji import emojize
# set up config variables en your heroku environment
# your bot TOKEN
token = os.environ.get('TOKEN')
# your heroku app URL and add path "bot" for active update
appURL = os.environ.get('APPURL') + '/bot... |
#!/usr/bin/env python2
import sys
def unstuff(x, start, size):
return (x >> start) & (2**size - 1)
def main(name, args):
if len(args) != 1:
print "Syntax: %s <card>" % (name, )
print "Example: %s mmcblk0" % (name, )
return 100
card = args[0]
dev = "/sys/class/block/%s/device/c... |
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils import timezone
@python_2_unicode_compatible # only if you need to support Python 2
class signals(models.Model):
Date = models.DateField()
Close = models.Float... |
# -*- coding: utf-8 -*-
from pickle import load
import pkg_resources
TAGGER_PATH = pkg_resources.resource_filename(__name__, 'POS_TAGGER.pkl')
with open(TAGGER_PATH, 'rb') as f:
TAGGER = load(f)
def get_POS_tagged_sent(sentence):
"""
Params:
sentence should be a list of tokens, including punctuation... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... |
#GitHub.com/tanujdey7
try:
name = input("Enter Name")
print(name)
except KeyboardInterrupt:
print("error")
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for DHS
"""
import copy
from os.path import join
import pytest
from hdx.data.dataset import Dataset
from hdx.data.vocabulary import Vocabulary
from hdx.hdx_configuration import Configuration
from hdx.hdx_locations import Locations
from hdx.location.country imp... |
from random import shuffle
def midrand(sentence):
words = sentence.split()
newwords = [randomized(word) for word in words]
newsentence = ' '.join(newwords)
if sentence == newsentence:
return "They can't be different"
else:
return newsentence
def randomized(word):
if len(set(w... |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class Linear_regression:
def __init__(self, theta, alpha):
self.theta = theta
self.alpha = alpha
def computeCost(self, X, y, theta=None):
inner = np.power((np.dot(X, theta.T) - y), 2)
return np.su... |
import jwt
import datetime
from functools import wraps
from application.models import db, User
from flask import current_app, request, g, abort, jsonify
def identity(token_or_payload):
payload = _ensure_decode(token_or_payload)
user_id = payload.get('user_id')
return User.find(id=user_id, active=True)
... |
import hwtypes as ht
from hwtypes import BitVector, UIntVector, SIntVector
from magma.array import Array
from magma.bit import Bit
from magma.bits import Bits, UInt, SInt
from magma.bitutils import clog2, seq2int
from magma.circuit import coreir_port_mapping
from magma.generator import Generator2
from magma.interface i... |
""" Tests for test cases directory. """
# TODO: check http://code.google.com/p/unladen-swallow/wiki/Benchmarks
import os
import unittest
from pythran.tests import TestFromDir
class TestCases(TestFromDir):
""" Class to check all tests in the cases directory. """
path = os.path.join(os.path.dirname(__file__... |
import serial
import time
serial_com = 'com8'
serial_bps = 9600
class MySerial(object):
def __init__(self, com, bps):
# assert isinstance(ser, serial.Serial)
# 连接串口 com是串口号,bps是波特率固定值9600
self.ser = serial.Serial(com, int(bps), parity="E", stopbits=1, bytesize=8)
... |
#!/usr/bin/env python
import math
import time
import numpy
import random
from scipy import ndimage
#from appionlib.apImage import imagefile
"""
adapted from:
http://code.google.com/p/python-for-matlab-users/source/browse/Examples/scipy_canny.py
"""
#=======================
#=======================
def getRadialAndAn... |
# -*- coding: utf-8 -*-
"""
@Time: 2021/7/14 16:32
@Author: zzhang zzhang@cenboomh.com
@File: ModelUpdate.py
@desc:
"""
import json
from collect.collect_service import CollectService
from collect.utils.collect_utils import get_safe_data
class EventService(CollectService):
data_json_dict = {}
ESConst = {
... |
import os
import json
image_dir = 'data/validation_set'
truth = 'data/validation_cardinfo'
out_base = 'data/tune_only_mip_det'
mip_splits = ['cb', 'cr', 'cbcr', 'sat', 'val']
mip_features = ['fft', 'hog', 'sobel', 'none']
# i = 0
# trials = []
# for mip_split in mip_splits:
# for mip_feature in mip_features:
# ... |
import UserDict
import calendar
import requests
class UsdRates(UserDict.UserDict):
def __init__(self, currencies, backup_rates={}, translations={}):
UserDict.UserDict.__init__(self)
translations_r = {v: k for k, v in translations.iteritems()}
BATCH_SIZE = 4
todo = currencies[:]
... |
"""
Copyright 2021 Merck & Co., Inc. Kenilworth, NJ, USA.
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the ... |
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function
"""
Interpolate between colours in RGB space; make continuous colour maps.
Definition
----------
Calculates colour between two given colors in RGB space
def rgb_blend(col1, col2, fraction=0.5):
n interpolated colours between tw... |
#!/usr/bin/env python3
# TODO: why are the keras models saved with python 2?
from __future__ import print_function
import tensorflow as tf
import os
import sys
import tensorflow.keras as keras
import numpy as np
from tensorflow.keras.models import Model
from tensorflow.keras.models import load_model
def read(sz):
d... |
#!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, subprocess, sys, glob, string
import zipfile
from datetime import date
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
os.chdir(cwd)
required_module_keys = ['name','version','moduleid','description','copyright','... |
from collections import defaultdict
from datetime import datetime
from django.conf import settings
from django.contrib.auth.models import User
from django.core.cache import cache
from django.db import models
from caching.base import CachingManager, CachingMixin
from shared.models import LocaleImage, ModelBase, Multi... |
# preprocessing
import pandas as pd
import sys
import numpy as np
def main(size):
"""
Metoda na pouzitie sliding window
"""
all_csv = pd.read_csv("all2.csv", dtype={'x':np.int16, 'y':np.int16, 'z':np.int16,'movement':np.int8, 'user':np.int8})
#print(all_csv)
# print (all_csv.dtypes)
# return
start = 0
inde... |
from datetime import datetime
import os
import pytz
from pytz import timezone
project_urls = {}
projects = os.listdir('all')
for project in projects:
git_config = os.path.join('all', project, '.git', 'config')
with open(git_config, encoding='utf-8') as f:
for line in f:
if line.strip().sta... |
import numpy as np
from numpy.linalg import matrix_rank
from pprint import pprint
from scipy.spatial.distance import cdist, pdist, squareform
from scipy.linalg import hankel
from functools import partial, lru_cache, reduce
from tqdm.autonotebook import tqdm
from .optimized import *
from .ops import *
from sklearn.... |
#!/usr/bin/env python
# coding: utf-8
import torch
import time
def exo1():
dalle_step = 5
dalle_nb = 3
matrix_size = dalle_step * dalle_nb + 3
x = torch.full([matrix_size, matrix_size], 1)
twos_line = torch.empty(0).set_(x.storage(),
storage_offset=matrix_siz... |
from abc import ABC, abstractmethod
class AbstractEvaluationSuite(ABC):
@abstractmethod
def evaluate(self, predictions, truth):
raise NotImplementedError()
|
import struct
from newsroom import jsonl
import os
from utils import preprocess_text
import parameters as p
import pandas as pd
import pickle as pkl
from tensorflow.core.example import example_pb2
import argparse
def trim_and_transform(example_generator, new_filename, transformation, constraint):
oldcount, newcoun... |
#!/usr/bin/env python
# NOTE: pass -d to this to print debugging info when the server crashes.
from flask import Flask, render_template, url_for, request
from subprocess import Popen, PIPE, check_call, check_output
import sys, os, string, glob, logging, pathlib
app = Flask(__name__)
app.logger.addHandler(logging.Stre... |
from .tidyup_pandas_df import OpenFace, Librosa, downsample
from .findwav import findwav
from .features2db import create_db, create_connection, check_db_content, add_features
from .fragments import *
from .openface_aggregation import *
|
'''
----------------------------------------------------------------------------
coco.py
- Coordinate Conversions
2020/21/22
Mike Alexandersen & Matthew Payne & Matthew Holman
This module provides functionalities to perform coordinate conversions / rotations / shifts of frame
---------------------------------------... |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
head = ListNode(-1)
retme = head
carry = 0
while l1 or l2:
... |
# Copyright 2021 The Pigweed Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... |
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
# Input data files are available in the "../input/" directory.
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory
import os
for dirname, _,... |
"""Example module that will be deleted in the future
This file demonstates proper coding conventions along with how to
document your functions and classes. The docstring format that we are
using is numpy docstrings
https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_numpy.html
"""
def do_work_sum(a, b):... |
from django.utils.translation import ugettext_lazy as _
from grappelli.dashboard import modules, Dashboard
class CustomIndexDashboard(Dashboard):
def __init__(self, **kwargs):
Dashboard.__init__(self, **kwargs)
self.children.extend([
modules.ModelList(
title=_('P... |
from flask import Flask, render_template, request, jsonify
from flask_sqlalchemy import SQLAlchemy
from flask_cors import CORS
import logging
import yaml
app = Flask(__name__)
log = logging.getLogger('werkzeug')
log.disabled=True
log.setLevel(logging.ERROR)
db_config = yaml.load(open('database.yaml'))
app.config['S... |
from enum import Flag
class AstronomyEventType(Flag):
Rise = 1
Set = 1 << 1
|
class DummyTracer(object):
def __init__(self, with_subtracer=False):
super(DummyTracer, self).__init__()
if with_subtracer:
self._tracer = object()
self.spans = []
def clear(self):
self.spans = []
def start_span(self, operation_name, child_of=None):
spa... |
begin_unit
comment|'# Copyright (C) 2014, Red Hat, Inc.'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\... |
from django import template
register = template.Library()
@register.filter(name='saludo')
def saludo(value):
largo =''
if len(value) >=8:
largo="<p>Tu nombre es muy largo</p>"
return f"<h1 style='background:green;color:white;'>Bienvenido {value}</h1>"+largo |
import util
from util.include import *
arrow_up = [-1, "up"]
arrow_down = [1, "down"]
arrow_left = [-1, "left"]
arrow_right = [1, "right"]
|
from django.urls import path
from django.views.generic import TemplateView
from articleapp.views import ArticleDetailView, ArticleCreateView, ArticleUpdateView, ArticleDeleteView, ArticleListView
app_name = 'articleapp'
urlpatterns = [
path('list/', ArticleListView.as_view(), name='list'),
path('create/', A... |
import numpy as np
import cv2
import os
import json
from collections import OrderedDict
import argparse
from PIL import Image as PILImage
from utils.transforms import transform_parsing
from tqdm import tqdm
LABELS = ['background', 'skin', 'nose', 'eye_g', 'l_eye', 'r_eye', 'l_brow', 'r_brow', 'l_ear', 'r_ear', 'mouth'... |
import sys
OFFSET_BOOTLOADER = 0x1000
OFFSET_PARTITIONS = 0x8000
OFFSET_APPLICATION = 0x10000
files_in = [
('bootloader', OFFSET_BOOTLOADER, sys.argv[1]),
('partitions', OFFSET_PARTITIONS, sys.argv[2]),
('application', OFFSET_APPLICATION, sys.argv[3]),
]
file_out = sys.argv[4]
cur_offset = 0
with open(fi... |
from .models import Images,Items
from django import forms
from django.forms.models import inlineformset_factory
class Imageform(forms.ModelForm) :
class Meta :
model=Images
fields=('images',)
imageformset=inlineformset_factory(Items,Images,Imageform,widgets={}) |
import numpy as np
from scipy.special import rel_entr
import matplotlib.pylab as plt
N = 1000000
p = np.random.randint(0,13,size=N)
p = np.bincount(p)
p = p / p.sum()
q = np.random.binomial(12,0.9,size=N)
q = np.bincount(q)
q = q / q.sum()
w = np.random.binomial(12,0.4,size=N)
w = np.bincount(w)
w = w / w.sum()
print(... |
###########################
# 6.00.2x Problem Set 1: Space Cows
from ps1_partition import get_partitions
import time
#================================
# Part A: Transporting Space Cows
#================================
def load_cows(filename):
"""
Read the contents of the given file. Assumes th... |
from django.conf.urls import url
from django.core.urlresolvers import reverse_lazy
from . import views
urlpatterns = [
url(r'^register/', views.register_patient_page, name='register'),
url(r'^patient/', views.patient_landing, name='patient'),
url(r'^patients/', views.view_patients, name='view patients'),
... |
#!/usr/bin/env python
"""
Copyright 2020, Benjamin L. Dowdell
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or ... |
from typing import Collection
from storm.checks import Checker
from storm.collection import OPERATORS, OPERATOR_PRIORITY_ORDER, PREFIXES
from storm.tokens import *
from storm.utils import Paginator, strip, extend
def tokenize(string: str) -> list[Token]:
return Tokenizer(string).parse()
class Tokenizer(Checker... |
import torch
import torch.nn.functional as F
from torch import nn
def custom_init_fun(m):
if isinstance(m, nn.ConvTranspose2d) or isinstance(m, nn.Conv2d):
m.weight.data.normal_(0.0, 0.02)
if m.bias is not None:
m.bias.data.fill_(0)
elif isinstance(m, nn.BatchNorm2d):
m.wei... |
if __name__ == '__main__':
N = int(input())
mylist = []
for _ in range (0,N):
values = input().split()
if values[0] == "insert":
mylist.insert(int(values[1]),int(values[2]))
elif values[0] == "print":
print (mylist)
elif values[0] == "remove":... |
import inception_v3
def save_proto(proto, prototxt):
with open(prototxt, 'w') as f:
f.write(str(proto))
if __name__ == '__main__':
model = inception_v3.InceptionV3('imagenet_test_lmdb', 'imagenet_train_lmdb', 1000)
train_proto = model.inception_v3_proto(64)
test_proto = model.inception_v3_p... |
import sys
import torch
import torch.nn as nn
from torch.optim import Adam
from torch.autograd import Variable
import torch.nn.functional as F
def soft_update(target, source, tau):
for target_param, param in zip(target.parameters(), source.parameters()):
target_param.data.copy_(target_param.data * (1.0 - ... |
'''
Venn diagram plotting routines.
Utility routines
Copyright 2012, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
from matplotlib_venn._venn2 import venn2, compute_venn2_subsets
from matplotlib_venn._venn3 import venn3, compute_venn3_subsets
def venn2_unweighted(subsets, set_labels=('A', ... |
import numpy as np
import pickle
import gzip
import h5py
def save_zipped_pickle(obj, filename, protocol=-1):
with gzip.open(filename, 'wb') as f:
pickle.dump(obj, f, protocol)
def load_zipped_pickle(filename):
with gzip.open(filename, 'rb') as f:
loaded_object = pickle.load(f)
return l... |
# This file is part of the Reproducible and Reusable Data Analysis Workflow
# Server (flowServ).
#
# Copyright (C) 2019-2021 NYU.
#
# flowServ is free software; you can redistribute it and/or modify it under the
# terms of the MIT License; see LICENSE file for more details.
"""Unit tests for file parameter declaration... |
#!/usr/bin/env python
import configparser
import os
import spotipy
import json
import sys
import logging
from etlutils.datafiles import get_monthly_file_path
# string constant
NOT_SET_VALUE = 'NOT SET'
config_parser = configparser.ConfigParser()
config_parser.read('config.ini')
client_id = config_parser.get('Login Pa... |
from collections import defaultdict
onehot_dict = {'A': 0, 'C': 1, 'D': 2, 'E': 3, 'F': 4, 'G': 5, 'H': 6, 'I': 7, 'K': 8, 'L': 9, 'M': 10,
'N': 11, 'P': 12, 'Q': 13, 'R': 14, 'S': 15, 'T': 16, 'V': 17, 'W': 18, 'Y': 19,'-':20}
onehot_dict = defaultdict(lambda: onehot_dict['-'], onehot_dict)
onehot_di... |
import struct
from .. import fileio
from ...weights import W
__author__ = "Myunghwa Hwang <mhwang4@gmail.com>"
__all__ = ["Wk1IO"]
class Wk1IO(fileio.FileIO):
"""
MATLAB wk1read.m and wk1write.m that were written by Brian M. Bourgault in 10/22/93
Opens, reads, and writes weights file objects in Lotus Wk... |
import fileinput
from collections import deque
def parse(lines):
it = iter(lines)
line = next(it)
assert line.rstrip() == 'Player 1:'
deck1 = deque()
while (line := next(it)).rstrip():
deck1.append(int(line))
line = next(it)
assert line.rstrip() == 'Player 2:'
deck2 = deque()
... |
import cptac
import math
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import scipy.stats
import seaborn as sns
import statsmodels.stats.multitest
from statannot import add_stat_annotation
from scipy.stats import pearsonr
def downloadCptac():
# To view available datasets... |
from django.contrib import admin
from shrapnel.polls.models import Poll, PollAnswer, PollOption
admin.site.register(Poll)
admin.site.register(PollAnswer)
admin.site.register(PollOption)
|
import tensorflow as tf
import numpy as np
matrix1 = np.array([(2,2,2),(2,2,2),(2,2,2)],dtype = 'int32')
matrix2 = np.array([(1,1,1),(1,1,1),(1,1,1)],dtype = 'int32')
print (matrix1)
print (matrix2)
matrix1 = tf.constant(matrix1)
matrix2 = tf.constant(matrix2)
matrix_product = tf.matmul(matrix1, matrix2)
matrix_sum ... |
# # The pdia Library: Process Data in Assessment
#
# ```
# Gary Feng & Fred Yan
# 2016, 2017
# Princeton, NJ
# ```
#
# This is a collection of functions written for processing the NAEP process data.
from pdia.dataImport.sql2csv import *
from pdia.dataImport.parsePearsonObservableXML import *
from pdia.utils.durSince... |
from __future__ import annotations
from pydantic import BaseModel, Field, validator
from typing import List, Optional
class MorphActionModel(BaseModel):
"""Morph Model - generated from the Morph module. A type of SchemaActionModel."""
name: str = Field(..., description="Name of the Action. Uppercase.")
t... |
#!/usr/bin/python
"""Alienvault Asset Removal Tool - For hosts that haven't been spotted in awhile.
Nicholas Albright
Copyright, 2017.
"""
import sys
import socket
import struct
import MySQLdb, MySQLdb.cursors
CONFIG_FILE = '/etc/ossim/ossim_setup.conf'
MYHOSTNAME = socket.gethostname()
REMOVE_OLDER_THAN = 30 # Re... |
import random
from time import sleep
i01 = Runtime.createAndStart("i01", "InMoov")
i01.startHead("COM3")
sleep(1)
#this is a function that do a job ( called inside the timer )
def MoveHeadRandomize():
if IcanMoveHeadRandom==1:
i01.moveHead(random.randint(50,130),random.randint(50,130))
#we create the timer o... |
# -*- coding: utf-8 -*-
import tensorflow as tf
from tensorflow.python.ops import control_flow_ops
import ssd_mobilenet_v1 as ssd
from datasets import dataset_factory
from preprocessing import preprocessing_factory
import tf_utils
import os
import pdb
slim = tf.contrib.slim
# ssd network flags
tf.app.flags.DEFINE... |
"""
Copyright (c) 2016, Jose Dolz .All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the f... |
"""
Every parameter (except for CONFIG_FILE) can be
overwritten by external config file
"""
import mailcap
import os
import platform
import runpy
from typing import Any, Dict, List, Optional, Tuple
_os_name = platform.system()
_linux = "Linux"
_global_mailcap = mailcap.getcaps()
CONFIG_DIR: str = os.path.expanduser(... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-02-09 02:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dominion', '0006_auto_20170201_0444'),
]
operations = [
migrations.AddField(... |
#!/usr/bin/env python3
'''Go through the files in the current directory and remove and caffemodel/solverstate
files where there is a higher iteration available'''
import glob,re,sys,collections,os
prefixes = sys.argv[1:]
if not prefixes:
prefixes = ['.']
for prefix in prefixes:
for suffix in ['caffemodel','... |
#!/usr/bin/python
import numpy as np
import os
import sys
# ====================== constants
eVA_Nm = 16.0217657
CoulombConst = -14.3996448915;
# default parameters of simulation
params={
'PBC': True,
'nPBC' : np.array( [ 1, 1, 1 ] ),
'gridN': np.array( [ -1, ... |
import torch
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from .SegmentationDataset import *
def get_loader(img_dir, mask_dir, batch_size):
seg_dataset = SegmentationDataset(img_dir, mask_dir)
loader = torch.utils.data.DataLoader(seg_dataset,
... |
from typing import Dict, List
from .model import Model
class ModelManager:
def __init__(self) -> None:
self.models: Dict[str, Model] = {}
def add_model(self, name: str, model: Model):
self.models[name] = model
def remove_model(self, name: str):
del self.models[name]
def __ge... |
# # coding=utf-8
# """
# test_auxiliary.py
#
# Test auxiliary functions.
# """
# import unittest
# import numpy as np
# import scipy.stats as sps
# from odefilters import auxiliary as aux
#
# np.random.seed(568)
#
#
#
# class TestGaussianPDF(unittest.TestCase):
# """
# Tests gaussian_pdf() function.
# Check... |
# Copyright 2022 Nicolas Perrin-Gilbert.
#
# Licensed under the BSD 3-Clause License.
from abc import ABC
from typing import Any, Tuple, Sequence, Callable
import dataclasses
import flax
from flax import linen
import jax
import jax.numpy as jnp
import optax
from xpag.agents.agent import Agent
import os
import joblib
... |
#!/usr/bin/env python
import pandas as pd
import datetime
from scipy import sparse
import scipy.io
from scipy.stats import zscore, wilcoxon, spearmanr
from sklearn.preprocessing import binarize, normalize
from sklearn import metrics
from itertools import cycle
import os
import pickle
import seaborn as sns
import subp... |
from __future__ import annotations
from datetime import datetime
from typing import Iterator
from sqlalchemy.ext.asyncio import AsyncSession
from sqlmodel import SQLModel, Field, Relationship, select
from todo_app.status import Status
class Task(SQLModel, table=True):
id: int = Field(primary_key=True)
name: s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.