text stringlengths 3 1.05M |
|---|
# Copyright 2018 Microsoft 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 in... |
# -*- coding: utf-8 -*-
"""
Struct object implementation.
"""
from __future__ import print_function, division, absolute_import
import string
from ... import sjit
def struct_(fields, name=None, packed=False):
if (not isinstance(fields, list) or not fields or not
isinstance(fields[0], tuple) or not le... |
'''
us_population_stats.py
Read the US population data from a CSV file, calculate the growth in population
in consecutive years and compute various statistical measures.
Also creates two graphs - one showing the total population over the years and other
showing the change between consecutive years.
'''
import matplo... |
import React, { Component } from "react";
import { Container, Row, Col } from "reactstrap";
import { Link } from "react-router-dom";
//Import Icons
import FeatherIcon from "feather-icons-react";
// Modal Video
import ModalVideo from "react-modal-video";
import "../../../node_modules/react-modal-video/scss/mo... |
import time
import RPi
import RPi.GPIO
class DHT11Result:
'DHT11 sensor result returned by DHT11.read() method'
ERR_NO_ERROR = 0
ERR_MISSING_DATA = 1
ERR_CRC = 2
error_code = ERR_NO_ERROR
temperature = -1
humidity = -1
def __init__(self, error_code, temperature, humidity):
s... |
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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 applic... |
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from sklearn.base import TransformerMixin
import pandas as pd
import csv
import re
class AsciiTransformer(TransformerMixin):
def transform(self,X,**transform_params):
if str(type(X)) != "<class 'pandas.core.series.Series'>":
X = p... |
Ext.define('Cetera.fileselect.Panel', {
extend:'Ext.Panel',
requires: ['Cetera.Ajax','Cetera.model.Folder'],
fileData: null,
onDestroy: function(){
if (this.cropWindow) this.cropWindow.destroy();
this.callParent(arguments);
},
initComponent : function(){
if (!this... |
/*
FreeRTOS V9.0.0 - Copyright (C) 2016 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the... |
const mongoose = require('mongoose')
const uniqueValidator = require('mongoose-unique-validator')
const userSchema = mongoose.Schema({
username: {
type: String,
minlength: 3,
required: true,
unique: true,
},
name: String,
passwordHash: String,
blogs: [
{
type: mongoose.Schema.Types.... |
import pytest
from onlineshop.tests.factories import product_factory
from shoppingcart.signals import price_changed, price_changed_callback
from shoppingcart.models import Cart, Line
def handler(sender, product, **kwargs):
sender.called = True
sender.product = product
@pytest.mark.django_db
class TestSign... |
Editor.Colors = function( _e, $element ){
this.$element = $element;
this.render = function(){
};
} |
from math import *
# multiple coordinate systems example
# using a single __init__ to define both cartesian and polar
'''
solution 1 : enum for 2 factories
define __init__(a, b, system=cartesian):
if system == cartesian:
x = a
y = b
else:
x = a * cos(b)
y = b * sin(b)
inconvenient if we add more ...
... |
import { shell } from 'electron';
import { IS_MAC, IS_WINDOWS } from '../constants';
import { aboutMenuItem } from './items/about';
import { checkForUpdatesMenuItem } from './items/check_for_updates';
import { separator } from './items/separator';
const submenu = [{
label: 'Learn More',
click: () => shell.open... |
const express = require('express');
const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const mongoose = require('mongoose');
const passport =... |
import os
import random
from argparse import ArgumentParser, Namespace
from glob import glob
from typing import Any, Dict, Iterable, List, Tuple
from composer.datasets.streaming import StreamingDatasetWriter
def parse_args() -> Namespace:
"""Parse commandline arguments."""
args = ArgumentParser()
args.ad... |
const KryptoRealState = artifacts.require("KryptoRealState");
const SquareVerifier = artifacts.require("./SquareVerifier.sol");
const PreimageVerifier = artifacts.require("./PreimageVerifier.sol");
const ProofVerifierKRS = artifacts.require("./ProofVerifierKRS.sol");
module.exports = function (deployer) {
deployer.t... |
/*
* This file is part of the Front Foundation package.
*
* Copyright (c) 2017-present LIN3S <info@lin3s.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Mikel Tuesta <mikeltuesta@gmail.com>
*/
import {Event} from '... |
import datetime
import pytest
import pytz
from django.urls import reverse
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from wkz import... |
/*
* DeviceManager.h
*
Copyright (c) 2013 Collin Kidder, Michael Neuweiler, Charles Galpin
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 r... |
/*
* This header is generated by classdump-dyld 1.0
* on Saturday, August 24, 2019 at 9:41:50 PM Mountain Standard Time
* Operating System: Version 12.4 (Build 16M568)
* Image Source: /System/Library/PrivateFrameworks/BaseBoard.framework/BaseBoard
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias... |
const path = require('path');
const express = require('express');
const app = express();
const PORT = 3000;
// app.use('/build', express.static(path.resolve(__dirname, '../build')));
app.get('/', (req, res) => {
return res.status(200).sendFile(path.resolve(__dirname, '../index.html'));
})
app.listen(PORT, () => ... |
/**
* Lo-Dash 2.4.1 (Custom Build) <http://lodash.com/>
* Build: `lodash modularize modern exports="node" -o ./modern/`
* Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
* Based on Underscore.js 1.5.2 <http://underscorejs.org/LICENSE>
* Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and In... |
import { AbstractHDElectrumWallet } from './abstract-hd-electrum-wallet';
/**
* HD Wallet (BIP39).
* In particular, BIP84 (Bech32 Native Segwit)
* @see https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki
*/
export class HDSegwitBech32Wallet extends AbstractHDElectrumWallet {
static type = 'HDsegwitBec... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '.\img_treeview.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWin... |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Mstk(CMakePackage):
"""MSTK is a mesh framework that allows users to represent,
manipu... |
# Generated by Django 3.1.12 on 2021-09-28 19:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('onlinecourse', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Choice',
... |
import binascii
import os
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Departamento(models.Model):
id_departamento = models.AutoField(primary_key=True)
nombre_departamento = models.CharField(max_length=25)
def __str__(self):
return super().__str__()
... |
import subprocess
import random
import string
# need to run setup.py first to make sure all our changes are compiled before running
# if you didn't make changes to aioquic, you can comment this step out
# need to run this from inside the root dir
# so do python3 scripts/run_tests.py
directoryName = "aioquic_live"
lo... |
#ifndef CGRA_H
#define CGRA_H
#include "edge.h"
#include "dfgnode.h"
#include "CGRANode.h"
using namespace llvm;
enum ArchType{DoubleXBar,RegXbar,LatchXbar,RegXbarTREG,StdNOC,NoNOC,ALL2ALL};
struct CGRAEdge{
CGRANode* Src;
Port SrcPort;
CGRANode* Dst;
Port DstPort;
Edge* mappedDFGEdge;
CGRAEdge(CGRANode* Src... |
var power : float = 5;
function OnTriggerStay(collisionInfo : Collider)
{
if(collisionInfo.GetComponent.<Rigidbody>())
{
collisionInfo.GetComponent.<Rigidbody>().AddForce(transform.TransformDirection (Vector3.up)*power);
}
}
|
# -*- coding: utf-8 -*-
#Created on Wed Nov 20 15:08:41 2019
#
#@Author: Zhi-Jiang Yang, Dong-Sheng Cao
#@Institution: CBDD Group, Xiangya School of Pharmaceutical Science, CSU, China
#@Homepage: http://www.scbdd.com
#@Mail: yzjkid9@gmail.com; oriental-cds@163.com
#@Blog: https://blog.moyule.me
import os
import shu... |
/**
* Auto-generated action file for "Microsoft Graph API" API.
*
* Generated at: 2019-08-07T14:53:12.369Z
* Mass generator version: 1.1.0
*
* flowground :- Telekom iPaaS / microsoft-graph-api-connector
* Copyright © 2019, Deutsche Telekom AG
* contact: flowground@telekom.de
*
* All files of this connector ar... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from json... |
import { keyBy } from 'lodash';
import * as actionTypes from './actionTypes.js';
export function fetchPost(payload) {
return {type: actionTypes.FETCH_ONE, payload};
}
export function fetchPostSuccess(payload) {
const byId = {[payload.id]: payload};
return {type: actionTypes.FETCH_ONE_SUCCESS, payload: {byId}};
... |
# -*- coding: utf-8 -*-
# @Date : 2020/5/31
# @Author: Luokun
# @Email : olooook@outlook.com
import numpy as np
class RandomForest:
"""
Random forest(随机森林)
"""
pass
|
import re
from markdown.postprocessors import Postprocessor
from markdown.extensions import Extension
class ColorPostprocessor(Postprocessor):
""" Take care of twiki-like colors """
colors = ['blue', 'gray', 'purple', 'fuchsia', 'aqua', 'maroon', 'olive',
'black', 'yellow', 'teal', 'navy', 'gre... |
"""
Price Calculator
Created by Anthony Provenza
Copyright 2019 Anthony Provenza
"""
import os
import string
import sys
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from openpyxl import Workbook, load_workbook
class Constant:
"""
These are the co... |
let backendUrl = "http://localhost:5000/"
let aiBackendUrl = "http://localhost:5001/"
const NOFETCH = "Failed to fetch"
export async function postRequest(completeUrl, data) {
let resp = await fetch(completeUrl, {
method: "POST",
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/js... |
/*
* (C) Copyright 2007
* Heiko Schocher, DENX Software Engineering, hs@denx.de.
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __CONFIG_H
#define __CONFIG_H
/*
* High Level Configuration Options
* (easy to change)
*/
#define CONFIG_MPC5200 1 /* This is an MPC5200 CPU */
#define CONFIG_JUPITER 1 /* .... |
# Released under the MIT License. See LICENSE for details.
#
"""League related UI functionality."""
|
# Generated by Django 2.0.9 on 2021-02-14 13:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('believe_his_prophets', '0014_spiritprophecychapter_archivo'),
]
operations = [
migrations.AddField(
model_name='spiritprophecych... |
#pragma once
#include "Point.h"
namespace Shape
{
bool LinesIntersect(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float* ix, float* iy);
bool PointInRect(float ptx, float pty, float x, float y, float w, float h);
float Sign(const Point& p1, const Point& p2, const Point& p3);
... |
"""
This is the main working file for the StockNLP Project where we are importing the Reddit,
Twitter and the Vader module. Here, we will get a user input from the dashboard in the form
of a String of Stock Ticker Input and we will use as a parameter to get values from the
RedditAPI Module, Twitter API Module, and then... |
load("//internal/js_library:rule.bzl", "js_library", "JsLibraryInfo")
load("//internal/ts_library:rule.bzl", "ts_library")
load("//internal/js_module:rule.bzl", "js_module")
load("//internal/js_binary:rule.bzl", "js_binary")
load("//internal/web_bundle:rule.bzl", "web_bundle")
load("//internal/js_script_and_test:rule.b... |
/*----------------------------------------------------------------------------
SigmaTel Inc
$Archive: /Fatfs/FileSystem/Fat32/handle/FgetFastHandle.c $
$Revision: 3 $
$Date: 9/13/03 4:52p $
Description: FgetFastHandle.c
Notes:
----------------------------------------... |
# Copyright (C) 2018 Garth N. Wells
#
# SPDX-License-Identifier: MIT
#This module contains a collection of functions related to
#geographical data.
#"""
from .utils import sorted_by_key # noqa
from haversine import haversine, Unit
from .station import MonitoringStation
from . import datafetcher
from floodsystem.stat... |
import React from 'react';
import { ShexConfig } from '@context';
import { cleanup, render } from '@testing-library/react';
import AddButton from './add-button.component';
import 'jest-dom/extend-expect';
afterAll(cleanup);
const config = {
languageTheme: {
language: 'en',
addButtonText: '+ Add new '
},
... |
import pytest
import ibis
pytest.importorskip('sqlalchemy')
pytest.importorskip('impala.dbapi')
from ibis.impala import ddl # noqa: E402, isort:skip
from ibis.impala.client import build_ast # noqa: E402, isort:skip
from ibis.impala.compiler import ImpalaDialect # noqa: E402, isort:skip
pytestmark = pytest.mark.... |
import pygame # Importando a biblioteca pygame
from pygame.locals import * # Importando o sub-módulo locals e todas as suas funções
from sys import exit # Importando a função 'exit' da biblioteca 'sys'
f... |
import unittest
from astropy import units as u
from astropy import constants as astroconst
from CelestialMechanics.orbits import parable
class MyTestCase(unittest.TestCase):
def test_parable(self):
self.assertAlmostEqual(0.603086, parable.r(0.301543, 90.), places=6)
self.assertAlmostEqual(120, pa... |
(function (factory) {
typeof define === 'function' && define.amd ? define(factory) :
factory();
}((function () { 'use strict';
(function() {
var select = HTMLSelectElement.prototype;
if (select.hasOwnProperty("selectedOptions")) return
Object.defineProperty(select, "selectedOptions", {
get: f... |
import os
import tempfile
from .vendor.six.moves import range
def printable_decimal_and_hex(num):
return "{0:d} (0x{0:x})".format(num)
def assert_index_sane(index, upper_bound_exclusive):
assert type(index) == int, "Indices should be integers; '%s' is not" % (
index)
assert 0 <= index < upper_boun... |
# Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
#
"""
This module updates the userbot based on Upstream revision
"""
from os import remove, execl
import sys
from git i... |
""" Copyright 2012, 2013 UW Information Technology, University of Washington
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 r... |
import fs from 'fs'
let cachedConfig
let lastCache = 0
/**
* Get the most recently cached config
*/
function getConfig() {
if (Date.now() - lastCache > 10000) {
cachedConfig = JSON.parse(fs.readFileSync("config.json"))
lastCache = Date.now()
}
return cachedConfig
}
/**
* Set a valu... |
import React from"react";import PropTypes from"prop-types";import classNames from"classnames";var classCallCheck=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},createClass=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.conf... |
/* See LICENSE file for copyright and license details. */
#include <ctype.h>
#include <locale.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <time.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#ifdef XINERAMA
#include <X11/extensio... |
/*! jQuery UI - v1.12.1 - 2021-08-21
* http://jqueryui.com
* Includes: widget.js, widgets/progressbar.js
* Copyright jQuery Foundation and other contributors; Licensed MIT */
!function(t){"function"==typeof define&&define.amd?define(["jquery"],t):t(jQuery)}(function(u){u.ui=u.ui||{};u.ui.version="1.12.1";var n,i=0,r=A... |
/**
* Copyright 1993-2017 NVIDIA Corporation. All rights reserved.
*
* Please refer to the NVIDIA end user license agreement (EULA) associated
* with this source code for terms and conditions that govern your use of
* this software. Any use, reproduction, disclosure, or distribution of
* this software and ... |
/*
* Copyright (c) 2008-present The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See https://github.com/geoext/geoext2/blob/master/license.txt for the full
* text of the license.
*/
/*
* @requires GeoExt/Version.js
*/
/**
* A subclass of {@link Ext.tree.Column}, which provides ind... |
from rest_framework import permissions
from sme_management.models import SMEUser
class ViewProjectTimeline(permissions.BasePermission):
"""Allow only INVESTOR_USERs to views all projects that require financing"""
message = 'You do not have permission to see timeline'
def has_permission(self, request, vi... |
from __future__ import print_function, division
import numpy as np
from scipy import integrate
import matplotlib.pyplot as plt
from .vampnet import VampnetTools
from .utils import batch_pdist_pbc
def plot_timescales(predictions, lags, n_splits,
split_axis=0, time_unit_in_ns=1.):
"""
Plot ... |
'use strict';
angular.module('copayApp.services')
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, pluginManager, balanceService, applicationService, storageService, bwcService, configService, notificationService, notification) {
var root = {};
... |
/*
* TERMS OF USE: MIT License
*
* 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... |
# Highest score
# Instructions
# You are going to write a program that calculates the highest score from a List of scores.
# e.g. student_scores = [78, 65, 89, 86, 55, 91, 64, 89]
# Important you are not allowed to use the max or min functions.
# The output words must match the example. i.e
# Example Input
# 78 65... |
from __future__ import absolute_import, print_function
import logging
from datetime import datetime
from changes.config import db
from changes.jobs.signals import fire_signal
from changes.models import Repository, RepositoryStatus
from changes.queue.task import tracked_task
logger = logging.getLogger('repo.sync')
... |
import Button from 'flarum/components/Button';
import Checkbox from 'flarum/components/Checkbox';
import Component from 'flarum/Component';
import EditDecontaminatorRuleModal from './EditDecontaminatorRuleModal';
export default class DecontaminatorListItem extends Component {
view() {
const rule = this.pro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2021 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
... |
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSGTransform_DEFINED
#define SkSGTransform_DEFINED
#include "modules/sksg/include/SkSGEffectNode.h"
class SkM44;
class SkMatrix;
namespace sksg {
/**
* Transform... |
class Car:
def needsFuel(self):
pass
def getEngineTemperature(self):
pass
def driveTo(self, destination):
pass |
first = True
with open('home.htm') as f:
for line in f.readlines():
line = line.rstrip()
if '"' in line:
print("#### ERROR: line contains double quotes")
if first:
first = False
print("const char* homePage = \"" + line + ' \\r\\n\\')
else:
... |
"""
This uses test262 to test the interpreter
"""
# pylint: disable=relative-beyond-top-level, protected-access, no-self-use, missing-function-docstring, missing-class-docstring
class Test262:
def test_one(self):
assert True, "This parses!"
|
import asyncio
import io
import logging
import aiohttp
from PIL import Image
from pydantic import HttpUrl
from starlette.exceptions import HTTPException
from .metrics import ServiceMetrics
logger = logging.getLogger(__file__)
logger.setLevel(logging.INFO)
class DownloadClient:
def __init__(self, service_metri... |
#
# 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... |
class Auto:
__name = None
__color = None
__modelo = None
__tamanio = None #Ñ CAUSA ERRORES POR EXPERIENCIA
__forma = None
#constructor
def __init__(self, name, color, modelo, tamanio, forma ):
self.__name = name
self.__color = color
self.__modelo = modelo
se... |
#ifndef GRAYCODE_H
#define GRAYCODE_H
#include <opencv2/core/core.hpp>
#include <vector>
#define M_PI 3.14159265359
bool CalculateGP(cv::Mat& absPhase, std::vector<cv::Mat> &images, int startGray, int endGray, int startPhase);
bool CalculateGrayCodeImg( cv::Mat& code_img, std::vector<cv::Mat>& images, long StartIndex... |
import React, { Component } from "react";
export class FormInput extends Component {
render() {
const { className, title, type, placeholder, input } = this.props;
return (
<div className={`${className} form-input`}>
<label className='form-input__label'>{title}</label>
... |
/*
En Javascript los comentarios multilinea se rodean
con la barra diagonal ascendente "/" seguida de el asterisco "*".
Como en este comentario
*/
// Los comentarios de una línea se inician con la doble barra diagonal ascendente "//"
// Como en estas líneas. Incluyen todo el texto hasta hasta cambiar a una línea... |
'use strict';
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcryptjs');
const timestamps = require('mongoose-timestamp');
//var joigoose = require('joigoose')(mongoose);
const UserSchema = new Schema({
username: String,
email: String,
password: String,
});
... |
##############################################################################
#
# load_epo_patent_data.py - load EPO patent citation data
#
#
# File: load_epo_patent_data.py
# Author: Alex Stivala
# Created: March 2019
#
##############################################################################
"""Function t... |
import json
import re
from .helpers.common import assert_command, assert_lines, exec_command
from .helpers.marathon import (group, remove_group, show_app,
watch_all_deployments)
GOOD_GROUP = 'tests/data/marathon/groups/good.json'
SCALE_GROUP = 'tests/data/marathon/groups/scale.json'
... |
from ialab.pipeline.model import Processor
import cv2 as cv
import os
class ShowImage(Processor):
"""
Given an input image this just displays it on screen.
"""
def __init__(self, title: str, enable_exit=True):
"""
:param title: Title of the image window
:param enable_exit: Allo... |
import random
class Solution:
def sortArray(self, nums: List[int]) -> List[int]:
# shuffle the array
random.shuffle(nums)
def quickSort(nums, low, high):
if low >= high:
return
p = partition(nums, low, high)
quickSort(nums, low, p-1)
... |
import cmu, sys
def main():
for line in file("0001-1000.txt"):
_, word, _ = line.split(None, 2)
mu = cmu.lookup(word.lower())
hin = cmu.trans(mu)
line = u"%s: %s => %s\n" % (word, mu, hin)
sys.stdout.write(line.encode("utf-8"))
# break
if __name__ == "__main__":
... |
import cx from 'classnames';
import React from 'react';
import PropTypes from 'prop-types';
const Form = ({ children, className, ...props }) => (
<form className={cx('Form', className)} {...props}>
{children}
</form>
);
Form.propTypes = {
className: PropTypes.string,
children: PropTypes.node.isRequired
};... |
# constants to indicate player status
UNINITIALIZED = 0 # No video file loaded
READY = 1 # Video file loaded and ready to start
PAUSED = 2 # Playback is paused
PLAYING = 3 # Player is playing
EOS = 4 # End of stream has been reached
# constants to indicate clock status
RUNNING = 5 # Clock is ticking
# Clock uses ... |
function genFractal (a, b, c, depth) {
if (depth == 0) drawTriangle(a, b, c);
else {
var ab = (a + b) / 2;
var ac = (a + c) / 2;
var bc = (b + c) / 2;
genFractal(a, ab, ac, depth - 1);
genFractal(ab, b, bc, depth - 1);
genFractal(ac, bc, c, depth - 1);
}
}
f... |
/******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019-2020 Baldur Karlsson
* Copyright (c) 2014 Crytek
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (t... |
from django.conf import settings
from django.contrib.auth.hashers import check_password,make_password
from django.contrib.auth.models import User
from django.contrib.auth.backends import ModelBackend,RemoteUserBackend
import logging
import requests
from merchant_portal.models import UserProfile
logger = logging.getLogg... |
from django import forms
from django.contrib.auth.forms import (
PasswordChangeForm,
PasswordResetForm,
SetPasswordForm,
)
from django.utils.translation import ugettext, ugettext_lazy as _
from bag_transfer.models import User
class OrgUserCreateForm(forms.ModelForm):
class Meta:
model = User... |
#
# Copyright 2019 The FATE Authors. 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_INIT_H
#define BITCOIN_... |
import socket
import cv2
import pickle
server_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind(('127.0.0.1', 4000))
cap = cv2.VideoCapture(0)
ret, img = cap.read()
cap.release()
if not ret:
print('exit: no image')
... |
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
#import "NSCopying.h"
@class NSColor;
@interface PXGGradient : NSObject <NSCopying>
{
struct NSColor *_startingColor;
struct NSColor *_endingColor;
... |
/*
* yownfe
* https://github.com/chrisenytc/yownfe
*
* Copyright (c) 2015, Christopher EnyTC
* Licensed under the MIT license.
*/
'use strict';
/*
* Module dependencies
*/
require('colors');
module.exports = function() {
console.log();
console.log(' YOwnFe: A good and cool slave to make repetitive... |
import numpy as np
import pandas as pd
import pandas_datareader.data as web
import random
n225 = web.DataReader("NIKKEI225", "fred")
"""
1128 I have to make it simple because I still suck in thinking about complicated
algorithm or so on. You can hold only one stock or something at a certain price that
what I can do m... |
import tagger from "tagger";
tagger.prop1`
tagged member 1
`;
tagger.prop2`
tagged member 2
`;
tagger.other`
tagged other
`;
tagger`
tagged
`;
|
/*jslint white:true, browser:true, plusplus:true, nomen:true, vars:true */
/*global wooga */
(function () {
"use strict";
var utils = wooga.castle.utils,
ENEMY_RESPAWN_INTERVAL = 40 * 1000;
var _instance = null;
var Game = function (config) {
if (_instance) {
... |
export const fonts = "@font-face{"+
"font-family: 'RobotoCondensed-Regular';"
+"src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAErEABMAAAAAg0QAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAABqAAAABwAAAAcYGrX40dERUYAAAHEAAAAKQAAACwC2wHAR1BPUwAAAfAAAAaMAAAOqjvcLb9HU1VCAAAIfAAAAEMAAABQsiy0U09TLzIAAAj... |