content stringlengths 5 1.05M |
|---|
#!/usr/bin/env python
from pwn import *
exe = ELF("CyberRumble")
context(binary=exe)
REMOTE = 1
SHELL = 0
def connect_remote():
return remote("archive.sunshinectf.org", 19002)
def connect_local():
r = exe.process()
# gdb.attach(r, "c")
return r
def connect():
return connect_remote() if REMOTE else connect_lo... |
###########################################################################
# Imports
###########################################################################
# Standard library imports
import os
###########################################################################
# Code
####################################... |
import math
def square_root(x):
y = math.sqrt(x)
return y
if __name__ == "__main__":
print(square_root(400)) |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Change continuous frequency to one_time
Revision ID: 23f5b46fc4a3
Revises: 4d00d05f9e84
Create Date: 2014-08-22 17:30:20.558870
"""
# revision identifiers, used by Alembic.
revision = '23f5b46fc4a3'
d... |
# -*- coding: utf-8 -*-
"""
SHOW_REGIONS
Emphasizes some regions in the image, by decreasing the importance of the rest.
@author: vlad
"""
from __future__ import (absolute_import, division, print_function, unicode_literals)
from builtins import *
import argparse as opt
import skimage.io
from util.visualization imp... |
# -*- coding: utf-8 -*-
# @Author: theo-l
# @Date: 2017-06-26 18:50:30
# @Last Modified by: theo-l
# @Last Modified time: 2017-07-10 10:12:15
import json
from django.db import models
from django.db.models.fields.files import (
ImageField, ImageFieldFile, FileField)
from django.db.models.fields.related import F... |
# --------------
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
# Code starts here
df=pd.read_csv(path)
#print(df.head())
df.info()
df['INCOME']=df['INCOME'].str.replace('$','')
df['INCOME']=df['INCOME'].str.replace(',',... |
import torch
import torch.nn.functional as F
from lib.generator.base import GeneratorBase
from lib.model.mlp import MLP
LOGINF = 1000
class FMGFlowNetGenerator(GeneratorBase):
def __init__(self, args, tokenizer):
super().__init__(args)
self.leaf_coef = args.gen_leaf_coef
self.out_coe... |
import numpy as np
import mayavi.mlab as mlab
def draw_groundtruth_3dbboxes(groundtruth_3dbboxes, fig, color=(1, 1, 1), line_width=1, draw_text=True,
text_scale=(1, 1, 1), color_list=None, label=""):
num_bboxes = len(groundtruth_3dbboxes)
for idx in range(num_bboxes):
bbo... |
import os
import pickle
import re
from fuzzywuzzy import fuzz, process
from sklearn.decomposition import PCA
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.preprocessing import StandardScaler
def clean_text(text, findall="[a-zA-Z]+", keep='all', min_words_count=0):
"""
Performs clea... |
import math
import os
from copy import deepcopy
from ast import literal_eval
import pandas as pd
from math import factorial
import random
from collections import Counter, defaultdict
import sys
from nltk import word_tokenize
from tqdm import tqdm, trange
import argparse
import numpy as np
import re
import csv
from skle... |
import random
import synapse.common as s_common
import synapse.neuron as s_neuron
import synapse.lib.cell as s_cell
import synapse.lib.crypto.vault as s_vault
import synapse.tools.neuron as s_tools_neuron
from synapse.tests.common import *
logger = logging.getLogger(__name__)
class TstCell(s_cell.Cell):
def ... |
from webserver import app
from flask import render_template
@app.route('/connect/')
def connect():
return render_template('connect.html') |
''' iterator design pattern '''
from collections.abc import Iterable, Iterator
from typing import Any, List
class AlphabeticalOrderIterator(Iterator):
""" Alphabetical ordered collection.
this class stores the traversal positon at all time
"""
#`_position` attribute stores the current tra... |
'''
Created on 2016/10/9
:author: hubo
'''
from vlcp.config import defaultconfig
from vlcp.service.connection.tcpserver import TcpServerBase
from vlcp.server.module import api, ModuleLoadStateChanged, call_api, send_api
from vlcp.event.lock import Lock
from zlib import compress, decompress, error as zlib_error
import ... |
'''
pre-command
'''
import sys
from performance.logger import setup_loggers
from shared.precommands import PreCommands
setup_loggers(True)
precommands = PreCommands()
precommands.execute()
|
import os
import torch
import time
from apgs.dmm.models import Enc_rws_mu, Enc_apg_local, Enc_apg_mu, Decoder
from apgs.dmm.objectives import apg_objective
def train(objective, optimizer, models, data, K, num_epochs, sample_size, batch_size, CUDA, device, **kwargs):
"""
training function of apg samplers
""... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import uuid
import base64
import uuid
import os
import sys
import json
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),
os.path.pardir)))
from datetime import datetime
from dateutil.tz import tzlocal
from modules.sensor import getTempC, g... |
from selenium.common.exceptions import *
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from php4dvd.pages.page import Page
from php4dvd.pages.login_page import LoginPage
... |
from .abstract import AbstractIaasDriver # noqa
from .dummy_driver import DummyIaasDriver # noqa
from .openstack_driver import OpenStackDriver # noqa
from .vm import Vm, VmState # noqa
|
import tkinter as tk
'''
BMI Calculation tool using the Tkinter framework.
Calculated using the following formula:
****************************************************
! weight % (height ^ 2) !
****************************************************
'''
class BMICalculator:
... |
"""
Copyright 2019 Pingpong AI Research, ScatterLab
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... |
#!/usr/bin/python
# Starts a bunch of fetches for a page w/ wget
import sys
import alarm
import threading
import random
class fetcher(threading.Thread):
def __init__(self, tid, min_time, max_time, url):
threading.Thread.__init__(self)
self.id = tid
self.min_time = min_time
self.ma... |
# coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from typing import TYPE_CHECKING
from six import string_types
from utils.feishu.dt_drive import DriveComment
from utils.feishu.dt_help import make_datatype
from utils.feishu.exception import LarkInvalidArguments
if T... |
import logging
import unittest
import calculator.calculator as calculator
class TestCalculate(unittest.TestCase):
def setUp(self):
self.calculator = calculator.Calculator()
def testExampleStrings(self):
iExpr = "1*4+3.3/(3+.3)*3(sqrt(4))/(sin(0)+1)"
self.assertEqual(self.calculator.cal... |
import time
import logging
from enum import Enum, unique
from copy import deepcopy
from collections import defaultdict
from termcolor import cprint, colored
from pybullet_planning import set_random_seed, set_numpy_seed, elapsed_time, get_random_seed
from pybullet_planning import wait_if_gui, wait_for_user, WorldSaver
... |
from app.db import db
from sqlalchemy import Sequence
class Base(db.Model):
__abstract__ = True
id = db.Column(db.Integer, Sequence('id'), primary_key=True)
date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
date_modified = db.Column(db.DateTime, default=db.func.current_time... |
#!/usr/bin/env python
# coding: utf-8
import torch
from torch import nn
import math
# Loss functions
# Definition of loss functions for L1 and L2 norm
def masked_ABS(prediction, target, mask):
batch_SE = torch.abs(prediction - target).mul_(mask)
batch_MSE = torch.sum(batch_SE, [-1, -2]).div_(torch.sum(mask... |
#!/usr/bin/env python
from ecmwfapi import ECMWFDataServer
from bypy import ByPy
import datetime as dt
import os
from configs import load_download_config
CONFIG = load_download_config()
server = ECMWFDataServer()
def get_ECMWF_file(mDateRange, dataset='cams_nrealtime', filepath='output'):
"""
retrieve the EC... |
from django.shortcuts import render
from django.conf import settings
def serve_frontend_view(request):
# return render(request, settings.INDEX_FILE, {'CDN_ENDPOINT': settings.CDN_ENDPOINT})
return render(request, settings.INDEX_FILE) |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import pathlib
import sys
from collections import defaultdict
import numpy as np
import torch
from torch.utils.data import DataLoader
from ... |
import falcon
from cyberdas.services import SessionManager
class Logout(object):
def __init__(self, ses_manager: SessionManager):
self.ses_manager = ses_manager
def on_post(self, req: falcon.Request, resp: falcon.Response):
'''
Обрабатывает запрос от авторизованного пользователя на ... |
#!/usr/bin/env python3
"""Plot the trees that represents GSGP individuals"""
__author__ = "João Francisco Barreto da Silva Martins"
__email__ = "joaofbsm@dcc.ufmg.br"
__license__ = "MIT"
import os
import argparse
import networkx as nx
from shell_command import shell_call
from networkx.drawing.nx_agraph import write_... |
from atari_environments import EnvironmentWrapper
# test
if __name__ == '__main__':
env_name = 'BreakoutNoFrameskip-v4'
env = EnvironmentWrapper(env_name, atari_wrapper=True)
|
"""
@author : anirudh-jwala
@date : 12/01/2019
"""
# Pattern 1
'''
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
'''
print("Enter n value")
n = int(input())
def pattern1(n):
for i in range(1, n+1):
for j in range(1, i+1):
print(j, end=" ")
print()
# Pattern 2
'''
1... |
# -*- coding:utf-8 -*-
import time
import threading
# yield 关键字的作用挂起函数,并且将函数右面的返回, 第一次执行到右半边,继续执行的时候返回值往下,停不下来的时候报错
gen_model = None
def new_long_io():
# 接受一个函数作为参数
"""def func():"""
"""执行完线程的方法调用回调函数
第一次执行到右半边,继续执行的时候返回值往下,停不下来的时候报错
"""
global gen_model
print("开始耗时操作~~~~~~~~~~~... |
"""
Scraping student jobs.
"""
__version__ = '1.0.0'
__author__ = 'Yarin Levi <yarinl330@gmail.com>'
from .Job_Master import jobmaster
from .Sqlink_Jobs import sqlink
from .Drushim_Jobs import drushim
from .AllJobs_Scraper import alljobs
from .Telegram_Jobs_Scraper import telegram_jobs
import os
import warnings
def ... |
# Generated by Django 2.0.8 on 2018-11-21 17:18
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('session', '0005_merge_20181120_1442'),
]
operations = [
migrations.AddField(
model_name='session',... |
# -*- coding: utf-8 -*-
"""OpenMaker text stemmers.
Author: Bulent Ozel
e-mail: bulent.ozel@gmail.com
"""
from nltk.stem.porter import PorterStemmer
porter = PorterStemmer().stem |
power = {'BUSES': {'Area': 1.33155,
'Bus/Area': 1.33155,
'Bus/Gate Leakage': 0.00662954,
'Bus/Peak Dynamic': 0.0,
'Bus/Runtime Dynamic': 0.0,
'Bus/Subthreshold Leakage': 0.0691322,
'Bus/Subthreshold Leakage with power gating': 0.0259246,
'Gate... |
csv_file = 'cards2.csv'
|
#!/usr/bin/env python3
import argparse
from distutils.util import strtobool
import os.path
import re
import toml
from common import (
config as c,
Colors,
get_cmd_or_die,
invoke,
invoke_quietly,
pb,
setup_logging,
)
git = get_cmd_or_die('git')
cargo = get_cmd_or_die('cargo')
python3 = ge... |
# Copyright 2018 The Cirq Developers
#
# 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 ... |
def extractDsrealmCom(item):
'''
Parser for 'dsrealm.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Reincarnated As A Dragons Egg', 'Reincarnated As A Dragons Egg', ... |
#!/usr/bin/env python
# coding: utf-8
#%% [markdown]
# ## Random walker
# (c) 2019 Manuel Razo. This work is licensed under a [Creative Commons
# Attribution License CC-BY 4.0](https://creativecommons.org/licenses/by/4.0/).
# All code contained herein is licensed under an [MIT
# license](https://opensource.org/licens... |
import cv2
import numpy as np
from depthai_helpers.utils import to_tensor_result
import pyttsx3
import speech_recognition as sr
r = sr.Recognizer()
keypointsMapping = ['Nose', 'Neck', 'R-Sho', 'R-Elb', 'R-Wr', 'L-Sho', 'L-Elb', 'L-Wr', 'R-Hip', 'R-Knee', 'R-Ank',
'L-Hip', 'L-Knee', 'L-Ank', 'R-Eye',... |
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from macaddress.fields import MACAddressField
class Tag(models.Model):
name = models.SlugField(_('Name'))
def __str__(self) -> str:
return self.name
class Meta:
verbose_n... |
import unittest
from ratetransformer import rate
from ratetransformer import Transformer
import yaml
class TestRateTx(unittest.TestCase):
""" Tests the rate transformer module gives the expected rating
"""
def test_converged_values(self):
""" Test the calculated rating for example1.yam... |
# Need to import path to test/fixtures and test/scripts/
# Ex : export PYTHONPATH='$PATH:/root/test/fixtures/:/root/test/scripts/'
#
# To run tests, you can do 'python -m testtools.run tests'. To run specific tests,
# You can do 'python -m testtools.run -l tests'
# Set the env variable PARAMS_FILE to point to your ini ... |
def subseq(s):
l = len(s)
sub = []
for i in range(len(s)):
for j in range(i,len(s)):
sub.append(s[i:j + 1])
return sub
for _ in range(int(input())):
s = input()
x = int(input())
sub = subseq(s)
ans = 0
frq = {}
for i in sub:
if len(i) == x or len(i) == (len(s) - x):
# print(i,n)
if(i ... |
from funfactory.urlresolvers import reverse
from nose.tools import eq_
from apps.common.tests import ESTestCase
class TrailingSlashMiddlewareTestCase(ESTestCase):
def test_strip_trailing_slash(self):
url = reverse('about')
r = self.client.get(url + '/')
self.assertRedirects(r, url, statu... |
#
# 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 Apache License, Version 2.0
# (the "License"); you may not us... |
#!/usr/bin/env python
from ptmv import __main__ as main
if __name__ == '__main__':
main.main()
|
from django import forms
from wmsmanager.models import WmsLayer
from layergroup.models import LayerGroup,LayerGroupLayers
from tablemanager.models import Publish,Workspace
from borg_utils.form_fields import GeoserverSettingForm,MetaTilingFactorField,GridSetField
from borg_utils.form_fields import GroupedModelChoiceFie... |
import json
from django.http import HttpResponse
from .forms import NicEditImageForm
def upload(request):
if not request.user.is_authenticated():
json = simplejson.dumps({
'success': False,
'errors': {'__all__': 'Authentication required'}})
return HttpResponse(json, mimety... |
from concurrent import futures
import time
import grpc
import app.helloworld_pb2 as helloworld_pb2
import app.helloworld_pb2_grpc as helloworld_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
class Greeter(helloworld_pb2_grpc.GreeterServicer):
def Greet(self, request, context):
print('Saying `hello` to %s... |
from ioscreen.coremedia.CMTime import CMTimeConst
from ioscreen.coremedia.CMTime import CMTime as CM
from ioscreen.sync import *
def test_afmt():
with open('./fixtures/afmt-request', "rb") as f:
data = f.read()
BufPacket = SyncAfmtPacket.from_bytes(data[4:])
print(BufPacket)
Bytes = Bu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# the above line is to avoid 'SyntaxError: Non-UTF-8 code starting with' error
'''
Created on
Course work:
@author: raja
Source:
'''
# Import necessary modules
import pickle
file_Name = "city"
def get_name_details(name):
return "Your name has " + str(l... |
"""``runway taxi`` command."""
# docs: file://./../../../docs/source/commands.rst
import logging
from typing import TYPE_CHECKING, Any, cast
import click
from .. import options
from ._plan import plan
if TYPE_CHECKING:
from ..._logging import RunwayLogger
LOGGER = cast("RunwayLogger", logging.getLogger(__name__... |
from datetime import datetime
from unittest import TestCase, main
from unittest.mock import Mock, patch
from dateutil import relativedelta
from MySQLdb import DatabaseError
from spectacles_xix.db_ops import(
NOT_TWEETED_CONDITION,
PLAY_SELECT,
abbreviation_db,
play_db,
query_by_wicks_id,
query... |
import yaml
import os
''' Contains Paths of the program'''
MAIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__ + '/../..')) + '/'
CONFIG_NAME = 'config.yml'
def get_root_dir():
return MAIN_DIRECTORY + '' # + 'project\\' #change it for the compiled version remove 'project'
def get_directory(section):
... |
import numpy as np
from matplotlib import pyplot as plt
from scipy.ndimage import median_filter, gaussian_filter
import epics
import time
import imageio
import logging, coloredlogs
coloredlogs.install(fmt='%(asctime)s,%(msecs)d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',datefmt='%H:%M:%S',level=logging.IN... |
import os, sys
sys.path.insert(1, os.path.join(os.path.abspath('.'), 'flaskstuff'))
from flask import Flask
app = Flask(__name__)
from app import views
|
# -*- coding: utf-8 -*-
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unit tests for proc_metrics."""
# pylint: disable=protected-access
from __future__ import absolute_import
from __future__ imp... |
#!/usr/bin/env python
import io
import os
import sys
import uuid
import time
import json
import common
# 1. fetch variables
if 'SCRIPT' in os.environ:
template = common.get_template(os.environ['SCRIPT'])
deref, vars_ = common.get_script_variables()
deref = common.deref_block(deref)
script = io.String... |
import re
import sys
if __name__ == "__main__":
print ("\nScraper Started...\n")
request_url=""
site_modules = ["www.dealerrater.com","www.insiderpages.com","www.wellness.com","www.thumbtack.com","www.homeadvisor.com","www.avvo.com","www.tripadvisor.com","www.indeed.com","www.glassdoor.co... |
import gtk
from ipython_view_gtk import *
import pango
import platform
if platform.system()=="Windows":
FONT = "Lucida Console 9"
else:
FONT = "Luxi Mono 10"
W = gtk.Window()
W.set_size_request(750,550)
W.set_resizable(True)
S = gtk.ScrolledWindow()
S.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
V = ... |
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
import abc
from abc import abstractmethod
class ClassifierHead(abc.ABC):
def __init__(self):
pass
@abstractmethod
def fit(self, features, labels):
raise NotImplementedError
@abstractmethod
def predict... |
from typing import Dict, Callable
from unittest.mock import Mock
from durand.adapters import AdapterABC
class TestAdapter(AdapterABC):
def __init__(self):
self._subscriptions = None
self.tx_mock = Mock()
def bind(self, subscriptions: Dict[int, Callable]):
self._subscriptions = subscr... |
import argparse
import myutils
import torch
from torch import optim, nn
import torch.nn.functional as F
from torchvision import datasets, transforms, models
from PIL import Image
import model_builder
parser = argparse.ArgumentParser()
parser.add_argument('data_dir', type=str, default='flowers', help='data root')
pars... |
{
"targets": [
{
"target_name": "engine_addon",
"sources": [ "engine.cpp" ],
"cflags": ["-Wall", "-std=c++11"],
"build_v8_with_gn": "true"
}
]
} |
#本文件通过对登录网站进行连续的错误表单请求来获得验证码示例,并利用网站反馈构造标签数据集
import re
import os
import sys
import time
import random
import selenium
from selenium.webdriver import Chrome
from constant import *
from pretreatment import recognize
from alive_progress import alive_bar
PATH = os.path.dirname(__file__)
browser = Chrome(os.path.jo... |
#A program to calculate the Area of a Trapezium
a = int(input("Enter First Base\n"))
b = int(input("Enter Second Base\n"))
h = int(input("Enter Height\n"))
area = int(0.5 * int(a + b) * int(h))
print("Area of Trapezium with the first base %s"%a ,"and second base %s"%b ,"and height %s"%h,"is %s"%area,"cm2")
|
"""empty message
Revision ID: cf65e3c1a6c5
Revises: 894aa7756f5b
Create Date: 2018-05-30 12:28:09.858408
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'cf65e3c1a6c5'
down_revision = '894aa7756f5b'
branch_labels = None... |
# -*- coding: utf-8 -*-
"""DFTimewolf artifact collectors, responsible for collecting artifacts."""
import threading
from dftimewolf.lib import utils
class BaseCollector(threading.Thread):
"""Base class for collectors.
Attributes:
console_out: DFTimewolfConsoleOutput helper.
results: List of collector ... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A wrapper for common cmd operations"""
import logging
import os
import subprocess
def RunCmd(args, cwd=None, quiet=False):
"""Opens a subprocess to ex... |
for i in range (1,21):
print(i, end = ' ') |
__version__ = "0.0.3"
from .core import *
from .data import *
from .layer_features import *
from .models import *
from .loss import *
from .callback import *
from .learner import *
|
import json_settings as js
class DictionarySetting(js.Settings):
"""A base class for a dictionary of settings classes.
This class is used to store a number of settings objects. Instances must be
of same type.
The implementation of the derived class constructor should be as follows::
@Settin... |
import os, sys
import learn.rl.RLConfig as config
import utils.utils as cu
from pybrain.rl.agents import LearningAgent
from pybrain.rl.learners import Q, SARSA
from pybrain.rl.experiments import Experiment
import shutil
class BoxSearchRunner():
def __init__(self, mode):
self.mode = mode
cu.mem('Reinforcem... |
import struct
import pytest
from pybind11_tests import buffers as m
from pybind11_tests import ConstructorStats
pytestmark = pytest.requires_numpy
with pytest.suppress(ImportError):
import numpy as np
def test_from_python():
with pytest.raises(RuntimeError) as excinfo:
m.Matrix(np.array... |
# encoding: utf-8
'''
Created on Nov 26, 2015
@author: tal
Based in part on:
Learn math - https://github.com/fchollet/keras/blob/master/examples/addition_rnn.py
See https://medium.com/@majortal/deep-spelling-9ffef96a24f6#.2c9pu8nlm
'''
from __future__ import print_function, division, unicode_literals
import os
imp... |
import argparse
import os
from golf_tracker.tracker import Shot, Hole, Round
class EndRound(Exception):
pass
# TODO:
# - Dont ask about distance for driver/tee shots?
# - Change connection for putting to be putter-specific?
def validated_input(input_name: str):
# Used instead of the built in input() fu... |
from discord.ext import commands
from discord_slash import SlashContext, cog_ext
from discord_slash.model import SlashCommandOptionType
from discord_slash.utils.manage_commands import create_choice, create_option
from discordTogether import DiscordTogether
import config
class DiscordTogetherCog(commands.Cog, name="Di... |
import plotly.express as px
df = px.data.tips()
fig = px.scatter(df, x='total_bill', y='tip', facet_col='sex', width=1000, height=600)
fig.update_layout(
margin=dict(l=20, r=20, t=20, b=20),
paper_bgcolor="LightSteelBlue",
)
fig.show()
|
import abc
from hive.utils.registry import Registrable
class Agent(abc.ABC, Registrable):
"""Base class for agents. Every implemented agent should be a subclass of
this class.
"""
def __init__(self, obs_dim, act_dim, id=0):
"""
Args:
obs_dim: Dimension of observations tha... |
# Django settings for storyboard project.
#
# Copyright 2013 Thierry Carrez <thierry@openstack.org>
# All 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
#
# ... |
import os
import inspect
import numpy as np
import csv
import json
import matplotlib.pyplot as plt
class Data:
def __init__(self):
iac = InterAreaConnections()
self.FLNe = iac.get_interpolated_FLNe_Schmidt()
self.SLN = iac.get_interpolated_SLN_Schmidt()
self.connections = iac.get_c... |
import socket, time
from cubeutil import Cube, SocketConnection
def main():
""" Simple prompt program for displaying on the sim """
c = Cube(8, SocketConnection(4444))
prompt = ''
c.startFrame()
while prompt != 'exit':
prompt = input('>')
if 'SEND' in prompt:
c.endFr... |
# coding: utf-8
# flake8: noqa
"""
clouddb
OpenAPI spec version: 2018-06-21T02:28:05Z
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import apis into sdk package
from ncloud_clouddb.api.v2_api import V2Api
# import ApiClient
from ncl... |
import pytest
from ffai.core.game import *
from unittest.mock import *
import numpy as np
@patch("ffai.core.game.Game")
def test_turn_start_player_action_default(mock_game):
# patch the mock game proc stack
stack = Stack()
mock_game.state.stack = stack
with patch("ffai.core.util.Stack", new_callable=P... |
from roppy import *
from time import sleep
# flag{one_write_two_write_good_write_bad_write}
HOST = "jh2i.com"
PORT = 50031
libc = ELF("libc6_2.30-0ubuntu2.1_amd64.so")
exit_got = "0x404058"
sleep_got = "0x404060"
main = "0x401260"
read_got = "0x404038"
p = remote(HOST, PORT)
def send_data(where, what):
... |
import pytest
from ratelimit.auths import EmptyInformation
from ratelimit.auths.session import from_session
@pytest.mark.parametrize(
"scope, user, group",
[
({"session": {"user": "user-id"}}, "user-id", "default"),
(
{"session": {"user": "other-user-id", "group": "group-name"}},
... |
from example import app
app.run(debug=True)
|
import datetime
import os
import sys
def measure_bmi(patient, environment, patient_time):
# Could import outpatient_encounter function from general.py instead here
encounter = {
"resource_type": "Encounter",
"name": "outpatient encounter",
"start": patient_time,
}
bmi = {
... |
#!/usr/bin/env python3
import mysql.connector
from mysql.connector import errorcode
from time import strftime, localtime
import json
class Topo_DB_Interactions():
"""
Module to handle SQL queries for topo webapp actions
March 2019
SDLENS Monitoring Solution
Brad Fitzgerald
... |
# DRUNKWATER TEMPLATE(add description and prototypes)
# Question Title and Description on leetcode.com
# Function Declaration and Function Prototypes on leetcode.com
#3. Longest Substring Without Repeating Characters
#Given a string, find the length of the longest substring without repeating characters.
#Examples:
#Giv... |
import os
import tensorflow as tf
from nets import nets_factory
import time
from dl.step1_cnn import Step1CNN
from dl.step2_cnn import Step2CNN
from dl.util import get_labels_to_names
import GPUtil as GPU
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main.settings")
django.setup()
from goods.models im... |
"""Flask app for deeppaint"""
from flask import (Flask, render_template, redirect, request, session, flash,
jsonify)
from model import (User, Image, SourceImage, StyledImage, Style, Like, db,
connect_to_db)
from flask_debugtoolbar import DebugToolbarExtension
# from pprint import ... |
# Copyright (c) 2015-2018 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
# from memory_profiler import profile
import copy
from scipy.constants import c
import astropy.io.fits as pf
import healpy ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.