content
stringlengths
0
1.05M
origin
stringclasses
2 values
type
stringclasses
2 values
#!/usr/bin/env python import sys,socket,getopt,threading,subprocess listen = False command = False upload = False execute = "" target = "" upload_dest = "" port = 0 def banner(): print "[***] NetCat p19 [***]" print "...
nilq/baby-python
python
import json import sys # Enter the filename you want to process file = sys.argv[1] filename = f'{file}_changedFunctions.json' print(f'Reading from filename {filename}') with open(filename) as f: init_database = json.load(f) # Print total number of examples in dataset print(f'Total number of functions (including all ...
nilq/baby-python
python
import os from io import BytesIO import tarfile from six.moves import urllib import matplotlib matplotlib.use('Agg') from matplotlib import gridspec from matplotlib import pyplot as plt import numpy as np from PIL import Image import tensorflow as tf flags = tf.app.flags FLAGS = flags.FLAGS # flags.DEFINE_string('mod...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ nodeenv ~~~~~~~ Node.js virtual environment :copyright: (c) 2011 by Eugene Kalinin :license: BSD, see LICENSE for more details. """ nodeenv_version = '0.3.5' import sys import os import time import logging import optparse import subprocess import...
nilq/baby-python
python
# # Copyright (c) 2017, Massachusetts Institute of Technology All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # Redistributions of source code must retain the above copyright notice, this # list o...
nilq/baby-python
python
#!/usr/bin/env python from setuptools import setup, find_packages try: README = open('README.rst').read() except: README = None try: REQUIREMENTS = open('requirements.txt').read() except: REQUIREMENTS = None setup( name='spotify2piratebay', version="0.1", description='Download your Spoti...
nilq/baby-python
python
from django.urls import include, path from django.contrib import admin from config import views urlpatterns = [ path('admin/', admin.site.urls), path('health/', views.health), path('', include('engine.urls', namespace="engine")), ]
nilq/baby-python
python
import transmogrifier.models as timdex from transmogrifier.helpers import generate_citation, parse_xml_records def test_generate_citation_with_required_fields_only(): extracted_data = { "title": "A Very Important Paper", "source_link": "https://example.com/paper", } assert ( genera...
nilq/baby-python
python
def findRanges(nums): sol = [] if len(nums) == 0 or len(nums) == 1: return nums # temp = nums # [temp.append(x) for x in nums if x not in temp] i,j = 0,1 prev, cur = nums[i],nums[j] while j < len(nums): if prev+1 == cur or prev == cur: prev = cu...
nilq/baby-python
python
import torch def select_optimizer(model, config): optimizer = None if config["optimizer"] == "SGD": optimizer = torch.optim.SGD(model.parameters(), lr=config["learning_rate"]) elif config["optimizer"] == "Adam": optimizer = torch.optim.Adam(model.parameters(), lr=config["learning_rate"]) ...
nilq/baby-python
python
#!/usr/bin/env python import numpy as np import math import random import time # This was created to separate make_data and the model and the solver rnd = np.random #rnd.seed(0) #This version is changed according the JMetal def make_data(U1,V1,K1,N1,Psi_u1,Psi_u2,Phi_u1,Phi_u2,B_u1,B_u2,r_u1,tau_v1,tau_v2,s...
nilq/baby-python
python
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in September 2020 @author: karliskanders Functions and classes for generating and analysing career transition recommendations """ import pandas as pd import numpy as np import pickle from time import time import yaml import os from ast import literal_eval fr...
nilq/baby-python
python
from setuptools import setup setup(name='docx-mailmerge-conted', version='0.5.1', description='Performs a Mail Merge on docx (Microsoft Office Word) files', long_description=open('README.rst').read(), classifiers=[ 'License :: OSI Approved :: MIT License', 'Programming Langu...
nilq/baby-python
python
# This python script scrapes data from the scanA.csv and # scanB.csv files created by the python_cbc_building module # and stores this scraped data in the SMAP archiver. # import os from string import * import time from pytz import timezone from smap import driver, util # SMAP heading smapHeading = "ORNL/cbc" # Data...
nilq/baby-python
python
# Copyright 2021-2022 NVIDIA Corporation # # 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 ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # -------------------------------------------------------- # RefineDet in PyTorch # Written by Dongdong Wang # Official and original Caffe implementation is at # https://github.com/sfzhang15/RefineDet # -------------------------------------------------------- import sys import torch import torc...
nilq/baby-python
python
# ***************************************************************************** # Copyright 2004-2008 Steve Menard # # 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://...
nilq/baby-python
python
# lista = [2, 4, 2, 2, 3, 3, 1] def remove_repetidos(lista): lista_aux = [] for element in lista: if element not in lista_aux: lista_aux.append(element) return sorted(lista_aux) # print(remove_repetidos(lista))
nilq/baby-python
python
FTX_MAX_REQUESTS_RESET = "FTX_MAX_REQUESTS_RESET" FTX_TOTAL_REQUESTS = "FTX_TOTAL_REQUESTS" API_URL = "https://ftx.com/api" MAX_RESULTS = 200 MIN_ELAPSED_PER_REQUEST = 1 / 30.0 # 30 req/s # For MOVE BTC = "BTC" BTCMOVE = "BTC-MOVE"
nilq/baby-python
python
import uuid from django.conf import settings from django.contrib.auth.hashers import make_password, check_password from django.contrib.auth.models import (User) from django.utils.module_loading import import_module from authy_me.models import AuthenticatorModel def is_int(s): """ Checks if the content is of...
nilq/baby-python
python
# Original code from: https://github.com/m4jidRafiei/Decision-Tree-Python- # # Modified by a student to return the Digraph object instead of rendering it automatically. # Modified to avoid error of mis-identification of graphviz nodes. Although I used a random # generation and probabilistic cosmic rays might introduce ...
nilq/baby-python
python
#Roman numerals are: [i v x l c d m] def stringer (x): number_string = str(x) if number_string[0] /= 0: a = number_string[0]; elif continue: if number_string[1] /= 0: b = number_string[1]; elif continue: if number_string[2] /= 0: c = number_string[2]; elif cont...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Generates a scoring function from worm data that can be fed a time and distance gap to predict connected worm tracks. """ from __future__ import ( absolute_import, division, print_function, unicode_literals) import six from six.moves import (zip, filter, map, r...
nilq/baby-python
python
import unittest import os import v1 from fs import TestApi class V1FormatEntryTest(unittest.TestCase): def setUp(self): self.fs = TestApi(cwd = '/a/b/c') def test_with_absolute_path(self): entry = v1.format_entry('vdir', '/root/some/path:one/dir', self.fs) self.assertEqual(entry, ('/root/some/path',...
nilq/baby-python
python
from __future__ import absolute_import, division, print_function import datetime import os import shutil class Logger(object): def __init__(self): self.file = None self.buffer = '' def __del__(self): if self.file is not None: self.file.close() def set_log_file(self, f...
nilq/baby-python
python
from kivy.uix.button import Button from streetlite.panel.sequence.sequence import Sequence class SequenceButton(Button): def __init__(self, start, end, **kwargs): super().__init__(**kwargs) is_default = self.text == "Default" self.sequence = Sequence(is_default, start, end)
nilq/baby-python
python
import quizzer.serializers.assessment_json_serializer as json_serializer import quizzer.serializers.assessment_xml_serializer as xml_serializer __author__ = 'David Moreno García' def serialize_grades(grades, format): """ Returns an string with the representation of the grades in the desired format. :par...
nilq/baby-python
python
# Generated from sdp.g4 by ANTLR 4.8 # encoding: utf-8 from __future__ import print_function from antlr4 import * from io import StringIO import sys def serializedATN(): with StringIO() as buf: buf.write(u"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2") buf.write(u"\u0102\u0403\b\1\4\2\t\2...
nilq/baby-python
python
import torch import torch.nn as nn # for network import torch.nn.functional as F # for forward method drop_out_value = 0.1 class Network(nn.Module): def __init__(self): super(Network,self).__init__() # extending super class method # Input block self.convblock_input= nn.Sequential( ...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Resource object code # # Created by: The Resource Compiler for PyQt4 (Qt v4.8.7) # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore qt_resource_data = "\ \x00\x00\x03\x92\ \x89\ \x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\ \x00\x00\x1f\x00...
nilq/baby-python
python
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest class TestTest(unittest.TestCase): # @unittest.skip("skip this test") def test_bench(self): from tocoli.test import bench, Bencher # Test 1 - add() def add(a, b): return a + b res = bench(add, 2, 3) ...
nilq/baby-python
python
import os def start_preparation_st(test_data_path, data_root, src_lang, tgt_lang): os.system(test_data_path + " --data-root " + data_root + " --vocab-type char" " --src-lang " + src_lang + " --tgt-lang " + tgt_lang) def start_preparation_asr(test_data_path...
nilq/baby-python
python
from .query import *
nilq/baby-python
python
# -*- coding: utf-8 -*- import base64 import json from watson_developer_cloud import ConversationV1 class FarmerConversation: def __init__(self): pass def converse(self, text): conversation = ConversationV1( username='a5f91c9c-12e8-4809-9172-6f68ed4b01d3', password='...
nilq/baby-python
python
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -----------------------------------------------------------------...
nilq/baby-python
python
import re def do_selection_sort(in_list: list): for i in range(len(in_list)): print(f'Step {i}: {in_list}') minimum = i for j in range(i, len(in_list)): if in_list[j] < in_list[minimum]: minimum = j in_list[i], in_list[minimum] = in_list[mini...
nilq/baby-python
python
# standard library import warnings import pdb # 3rd party library from torch import nn as nn # mm library from mmcv.cnn import build_conv_layer # gaia lib from gaiavision.core import DynamicMixin from gaiavision.core.bricks import build_norm_layer, DynamicBottleneck class DynamicResLayer(nn.ModuleList, DynamicMixi...
nilq/baby-python
python
import csv import os # from utility import uprint import pandas as pd def extract_stat_names(dict_of_stats): """Extracts all the names of the statistics Args: dict_of_stats (dict): Dictionary containing key-alue pair of stats """ stat_names = [] for key, val in dict_of_stats.items(): ...
nilq/baby-python
python
# Created by wangmeng at 2020/11/19 from toolkit.models.base_host import BaseHost from toolkit.models.host import Host from toolkit.models.operator import HostOperator async def get_host_info_by_label(label: str) -> dict: operator = HostOperator('localhost', 27017) host_info = await operator.get_host_info_by_...
nilq/baby-python
python
# -*- coding: UTF-8 -*- from redis import ConnectionPool, Redis from redlock import RedLockFactory class RedisDB(object): """ Redis数据库连接池和Redis分布式锁统一获取入口,当前Redis只支持单节点,可以通过简单修改支持Redis集群 """ def __init__(self, nodes): assert len(nodes) > 0 self.__nodes = nodes self.__redis_pool ...
nilq/baby-python
python
import sys import random from math import sqrt, log import subprocess32, struct U = 0.5 C = sqrt(2) samples = 10 max_rounds = 100 total = 0 max_iterations = 10 class Node(): def __init__(self, path): assert(path) self.addr = path[-1] self.path = path self.children = {...
nilq/baby-python
python
from .data_catalog import DataCatalog from .deltalake import PyDeltaTableError, RawDeltaTable, rust_core_version from .schema import DataType, Field, Schema from .table import DeltaTable, Metadata from .writer import write_deltalake
nilq/baby-python
python
with open("even_more_odd_photos.in") as input_file: N = int(input_file.readline().strip()) breed_IDs = list(map(int, input_file.readline().strip().split())) odds = 0 evens = 0 for i in breed_IDs: if i%2 == 0: evens+=1 else: odds+=1 groups = 0 if odds == 0: groups = 1 elif evens == ...
nilq/baby-python
python
#coding=utf-8 ''' Created on 2015-10-22 @author: zhangtiande ''' from gatesidelib.common.simplelogger import SimpleLogger from model_managers.model_manager import ModelManager class LoggerManager(ModelManager): ''' classdocs ''' def all(self): return super(LoggerManager,self).get_qu...
nilq/baby-python
python
#!/usr/bin/env python3 import socket # HOST = '127.0.0.1' # Standard loopback interface address (localhost) HOST = '192.168.0.100' # Standard loopback interface address (localhost) PORT = 65432 # Port to listen on (non-privileged ports are > 1023) #PORT = 8000 hostname = socket.gethostname() # getting the I...
nilq/baby-python
python
#!/usr/bin/env pybricks-micropython from spockbots.gyro import SpockbotsGyro as Gyro from spockbots.motor import SpockbotsMotor import time def run_crane(): """ lower the block from the crane """ robot = SpockbotsMotor() robot.debug = True robot.setup() robot.colorsensors.read() pri...
nilq/baby-python
python
import bottle import model import pyperclip gesla = model.Geslo(model.DATOTEKA_S_S) with open("skrivnost.txt") as f: SKRIVNOST = f.read() @bottle.get("/") def index(): return bottle.template("index.tpl") @bottle.post("/geslo/") def novo_geslo(): st = bottle.request.forms.get('prva') or 0 mc = bot...
nilq/baby-python
python
import os import traceback from argparse import ArgumentParser import sys import signal from anime_automove.feature import Learn, Execute, Remove, Show from anime_automove.util.app import Config from anime_automove.util.dal import init def main(): """Run the main program""" # ARGS # parser = Argum...
nilq/baby-python
python
import argparse import base64 import glob import io import json import os import random import pycocotools import cv2 import imageio from PIL import Image, ImageColor, ImageDraw import numpy as np import visvis as vv from pycocotools import mask from skimage import measure CAT_TO_ID = dict(egg=1, blob=2) CAT_TO_COLOR ...
nilq/baby-python
python
import numpy as np """ Hidden Markov Model using Viterbi algorithm to find most likely sequence of hidden states. The problem is to find out the most likely sequence of states of the weather (hot, cold) from a describtion of the number of ice cream eaten by a boy in the summer. """ def main(): np.set_printoptio...
nilq/baby-python
python
# -*- coding: utf-8 -*- from __future__ import unicode_literals import os from django.conf import settings from django.utils.timezone import now from django.utils.translation import activate, override from aldryn_newsblog.models import Article from cms import api from . import NewsBlogTestCase, NewsBlogTransaction...
nilq/baby-python
python
# ============================================================================== # Copyright 2018-2020 Intel Corporation # # 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://ww...
nilq/baby-python
python
# Copyright 2018 AT&T Intellectual Property. All other rights reserved. # # 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...
nilq/baby-python
python
from Mask_RCNN.mrcnn.utils import Dataset from Mask_RCNN.mrcnn.utils import extract_bboxes from Mask_RCNN.mrcnn.visualize import display_instances from numpy import expand_dims from numpy import mean from mrcnn.config import Config from mrcnn.model import MaskRCNN from mrcnn.utils import Dataset from mrcnn.utils impor...
nilq/baby-python
python
# -*- coding: utf-8 -*- import os def count_files(path): """Count number of files in a directory recursively. Args: path (str): Directory. Returns: int: Return number of files. """ count = 0 for root, dirs, files in os.walk(path): for f in files: count +=...
nilq/baby-python
python
# Generated by Django 2.1.7 on 2019-03-20 14:14 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('internet_nl_dashboard', '0003_uploadlog'), ] operations = [ migrations.AddField( model_name='up...
nilq/baby-python
python
from numpy import double import torch import torch.nn as nn import torch.nn.functional as F """ Multi-agent Modules """ # define the actor network class actor_shared(nn.Module): def __init__(self, env_params, identification = True): # Note: id for agent is important super(actor_shared, self).__in...
nilq/baby-python
python
""" calendarimg.py 获取单向历,存储于本地 调用方式: calendarAcquirer.getImg() write on 2018.09.15 """ __author__ = "Vincent Zhang" import pgconfig import usrconfig import requests import json import re import time import os class calendarAcquirer: @staticmethod def getUrl(): ...
nilq/baby-python
python
from flask import Flask, request import os app = Flask(__name__) @app.route("/upload", methods=["POST"]) def upload(): file = request.files.get("file_name") if file is None: return "None file" localfile = open("demo.png", "wb") data = file.read() localfile.write(data) localfile.close(...
nilq/baby-python
python
from flask import Blueprint, render_template, request from users.models import SessionModel from utils.http import require_session application = Blueprint('dashboard', __name__) @application.route("/dashboard/", methods=['GET']) @require_session() def get_list(session): return render_template('index.html', ...
nilq/baby-python
python
from flask import Flask, send_file, send_from_directory, make_response, request, abort, session, redirect, jsonify import re, threading, datetime, time, os, random, string, base64 from flask_pymongo import PyMongo # 此程序只能在64位机器上运行,否则可能溢出 password = "password" # when deploy, change this !!! imagepath = "/home/hw...
nilq/baby-python
python
from .authentication import * from .external_authentication import * from .guest_authentication import * from .key_authentication import * from .plain_authentication import * from .transport_authentication import *
nilq/baby-python
python
import json, os, re, sublime, sublime_plugin, time class PhpNamespaceMonkey(): namespaces = {} def addBoilerplate(self, view): settings = sublime.load_settings('PhpNamespaceMonkey.sublime-settings') if not view.file_name() or not self.isPhpClassFile(view.file_name()) or view.size(): return ...
nilq/baby-python
python
# Given a string text, # you want to use the characters of text to form as many instances of the word "balloon" as possible. # You can use each character in text at most once. # Return the maximum number of instances that can be formed. # Example 1: # Input: text = "nlaebolko" # Output: 1 # Example 2: # Input: text...
nilq/baby-python
python
import pytest from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.permissions import IsAuthenticated from rest_framework.exceptions import PermissionDenied from ..decorators import resolver_permission_classes from .test_views import url_string, response_json class user(object): ...
nilq/baby-python
python
import matplotlib.pyplot as plt import numpy as np import os import random class City: def __init__(self, x, y): self.x = x self.y = y def distance_to(self, city): x_dist = abs(self.x - city.x) y_dist = abs(self.y - city.y) distance = np.sqrt(x_dist ** 2 + y_dist ** 2...
nilq/baby-python
python
import rasterio as rio import numpy as np def rio_read_all_bands(file_path): with rio.open(file_path, "r") as src: meta = src.meta n_bands = src.count arr = np.zeros((src.count, src.height, src.width), dtype=np.float32) for i in range(n_bands): arr[i] = src.read(i+1).as...
nilq/baby-python
python
# Django Rest Framework from rest_framework import viewsets from rest_framework.permissions import IsAuthenticated # Models from sunnysouth.marketplace.models.categories import Category # Serializers from sunnysouth.marketplace.serializers.categories import CategoryModelSerializer class CategoryViewSet(viewsets.Mod...
nilq/baby-python
python
# ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distrib...
nilq/baby-python
python
import unittest from routes import request_config, _RequestConfig from routes.base import Route class TestBase(unittest.TestCase): def test_route(self): route = Route(None, ':controller/:action/:id') assert not route.static def test_request_config(self): orig_config = request_confi...
nilq/baby-python
python
#!/usr/bin/env python # encoding=utf-8 # Created by andy on 2016-08-03 18:38. import pickle import common import utils __author__ = "andy" a = ['a','b','c','d'] print (a.index('d')) #for batch in xrange(common.BATCHES): # train_inputs, train_targets, train_seq_len = utils.get_data_set('train', batch*common.BATCH_...
nilq/baby-python
python
import unittest from dxtrack import dxtrack class TestFramework(unittest.TestCase): def test_configure(self): """ Test the simple base case """ default_metadata = {'default': 'metadata'} dxtrack.configure( context='test_error_track', stage='test', ...
nilq/baby-python
python
from datetime import datetime # Three log levels, ERROR enforced by default messages = { 0: "ERROR", 1: "INFO", 2: "DEBUG", } class logger: def __init__(self, level, logfile=None): if logfile: self.logfile = open(logfile, "wb") else: self.logfile = None ...
nilq/baby-python
python
from .base_config import base_config, get_config new_config = { 'exp_name': "protonet_default", 'trainer': 'prototypical', 'num_training_examples': 14000, 'n_support': 5, 'n_query': 20, 'n_test_query': 100, 'freeze_until_layer': 10, } config = get_config(base_config, new_config)
nilq/baby-python
python
# # All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or # its licensors. # # For complete copyright and license terms please see the LICENSE at the root of this # distribution (the 'License'). All use of this software is governed by the License, # or, if provided, by the license below or th...
nilq/baby-python
python
from src.targets import * from src.states import GameLevelState from src.spawner import Spawner def create_level_two(game): spawners = list() spawners.append(Spawner(spawn_type=Strawberry, ammunition=3, initial_delay=3.0, cooldown=2.0, min_velocity=(160., -10.), max_velocity=(200.,...
nilq/baby-python
python
import time from kivy.lang import Builder from kivy.uix.boxlayout import BoxLayout from kivymd.app import MDApp from kivymd.uix.button import MDRectangleFlatButton, MDRoundFlatIconButton, MDTextButton from kivymd.uix.label import MDLabel, MDIcon from kivymd.uix.screen import MDScreen from kivy.app import App Builder.l...
nilq/baby-python
python
import logging l = logging.getLogger("archinfo.arch_mips64") try: import capstone as _capstone except ImportError: _capstone = None try: import keystone as _keystone except ImportError: _keystone = None try: import unicorn as _unicorn except ImportError: _unicorn = None from .arch import Ar...
nilq/baby-python
python
# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
nilq/baby-python
python
class Solution: def trap(self, height: [int]) -> int: n = len(height) l = [0]*(n+1) r = [0]*(n+1) for i in range(n): l[i+1] = max(l[i], height[i]) for i in range(n-2, -1, -1): r[i] = max(r[i+1], height[i+1]) print(l, r) ans = 0 ...
nilq/baby-python
python
#source, from django-tracking from django.conf import settings import re # threadlocals middleware for global usage # if this is used elsewhere in your system, consider using that instead of this. try: from threading import local except ImportError: from django.utils._threading_local import local _thread_l...
nilq/baby-python
python
#Import Flask, dependencies, sessions, basics like from titanic example import numpy as numpy import os import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify #Setup database engine = create_eng...
nilq/baby-python
python
from mutation_variants.helpers import * def fair_rank( x ): #ranks = [] ix = np.argsort(x) sx = x[ix] rnk = 0 old_x = sx[0] ranks = [rnk] cnter = 1 for xi in sx[1:]: if xi > old_x: rnk += 1 #cnter cnter = 1 else: cnter += 1 old_x = xi ranks.append(rnk) ranks = np.arr...
nilq/baby-python
python
from .lfads import LFADS from .tndm import TNDM
nilq/baby-python
python
import collections import sys def anagram(string1, string2): if not len(string1)==len(string2): return False def create_counter(from_string): counter = collections.Counter() for symbol in from_string: counter[symbol] +=1 return counter counter1 = create_counter(s...
nilq/baby-python
python
#start menu of Game of Life import pygame, sys, time, random sys.path.append('../widgets') from pygame.locals import * from pygame import gfxdraw from ListView import ListView from Button import Button from InputBox import InputBox from Grid import Grid FPS = 5 WINDOWWIDTH = 640 WINDOWHEIGHT = 480 CELLSIZE = 20 asse...
nilq/baby-python
python
''' image ''' import cv2 import numpy as np def parse_image(f: bytes): ''' parse image ''' nparr = np.frombuffer(f, np.uint8) return cv2.imdecode(nparr, cv2.IMREAD_COLOR) def load_image(path: str): ''' load image ''' return cv2.imread(path) def a_hash(img) -> int: ''' 均值...
nilq/baby-python
python
from .tADT_h import TADT_h from .tClass1_h import TClass1_h from .tADT_c import TADT_c from .tMemoryPool_ADT_c import TMemoryPool_ADT_c
nilq/baby-python
python
from django.db import models # This model refers to contact us page in the site class CoachingContact(models.Model): username = models.CharField(max_length=100, unique=True, blank=False, default='') address = models.CharField(max_length=500, default='') city = models.CharField(max_length=500, default='') ...
nilq/baby-python
python
x = float(input("Enter your first number: ")) y = float(input("Enter your second number: ")) print("The sum of ",x," and ",y, "is equal to ",x+y)
nilq/baby-python
python
# Copyright 2016 ClusterHQ Inc. See LICENSE file for details. from zope.interface import implementer from twisted.internet.defer import succeed from twisted.internet.task import Clock from flocker.testtools import TestCase from benchmark._interfaces import IRequest from benchmark.scenarios._request_load import Req...
nilq/baby-python
python
# Generated by Django 2.2.7 on 2019-11-16 17:58 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('resource_data', '0004_auto_20191116_2233'), ] operations = [ migrations.AlterModelOptions( name='course', options={'ordering...
nilq/baby-python
python
#!/usr/bin/env python3 import coiled coiled.create_software_environment( name="coiled-science-thursdays-itk", conda="environment.yml", )
nilq/baby-python
python
import sys import json import asyncio import websockets URI = 'ws://harmony-1.hackable.software:3380/chat' async def register(ws, name: str) -> str: await ws.send(json.dumps({'type': 'register', 'displayName': name})) uid_msg = await ws.recv() parsed_msg = json.loads(uid_msg) if not 'uid' in pars...
nilq/baby-python
python
#!/usr/bin/env python3 # Picross Puzzle Solver (CLI version) # # Author: Ibb Marsh # Created: 2018-06-25 # # Description: Accepts a JSON of 2 2D arrays of counts of bit blocks in each row/column. # Solves for, and then outputs, all grids which fit those constraints. import sys, argparse, json from solver_logic import ...
nilq/baby-python
python
import time import numpy from ..Instruments import EG_G_7265 #from ..Instruments import SRS_SR830 from ..UserInterfaces.Loggers import NullLogger class VSMController2(object): #Controlador y sensor del VSM def __init__(self, Logger = None): self.LockIn = EG_G_7265(RemoteOnly = False) ...
nilq/baby-python
python
# -*- coding: utf-8 -*- from django.conf.urls import url from django.views.generic import TemplateView from . import views app_name = 'interface' urlpatterns = [ url(r'^$', views.MainPageView.as_view(), name='main'), url(r'^game/(?P<uuid>[^/]+)/$', views.GameView.as_view(), name='game'), url(r'^game/(?P<u...
nilq/baby-python
python
# -*- coding: utf-8 -*- """ Justin Clark CSYS 300 Final Project popularityPrediction.py Use different ML methods to predict song popularity Outline: """ ### 1. Imports ### import matplotlib.pyplot as plt import numpy as np import pandas as pd import os from sklearn import preprocessing from sk...
nilq/baby-python
python
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: dm.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf i...
nilq/baby-python
python
print("Ausgangsabundanz der Bakterienpopulation 100 Exemplare") print("Verdopplung alle 30 min") abundanz=100 stunde=0 while stunde<=48: stunde+=1 abundanz=abundanz*4 print("Stunde",stunde,abundanz,"Ind.") abundanz1=100 for zeit in range(49): print("Stunde",zeit,"",abundanz1,"Ind.") ...
nilq/baby-python
python