text stringlengths 3 1.05M |
|---|
"""
pygments.lexers.bibtex
~~~~~~~~~~~~~~~~~~~~~~
Lexers for BibTeX bibliography data and styles
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, default, \... |
import frappe, base64
from frappe.utils import cint
from one_fm.legal.doctype.penalty_issuance.penalty_issuance import get_filtered_employees
from one_fm.legal.doctype.penalty.penalty import send_email_to_legal, upload_image
from one_fm.one_fm.page.face_recognition.face_recognition import recognize_face
from frappe imp... |
// Licensed to the Software Freedom Conservancy (SFC) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The SFC licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you m... |
// Lean compiler output
// Module: Init.Data.Queue.Basic
// Imports: Init.Data.Array Init.Data.Int
#include "runtime/lean.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnosti... |
#pragma once
#include "ixblue_stdbin_decoder/data_models/extended_navigation_data/vehicle_position_deviation.h"
#include "ixblue_stdbin_decoder/memory_block_parser.h"
namespace ixblue_stdbin_decoder
{
namespace Parser
{
class VehiclePositionDeviation : public MemoryBlockParser
{
public:
VehiclePositionDeviation()... |
// Further Exploration
// If the Math.round() method was used, you have the potential to exceed the max
/* We can make the function more robust by
comparing min and max prior to execution. */
// Code
function displayTeddyAge() {
let min = 120;
let max = 20;
if (min > max) {
let temp = min;
min = max... |
# -*- coding: utf-8 -*-
from django.forms import ModelForm
from .models import Snippet
class SnippetForm(ModelForm):
class Meta:
model = Snippet
fields = ['title', 'code', 'description', 'categories'] |
#ifndef bst_h
#define bst_h
typedef struct bstStruct {
unsigned int key;
int count;
void *data;
struct bstStruct *left;
struct bstStruct *right;
} bstType;
int addBstNode(bstType **bst, unsigned int key, void *value);
int incBstNode(bstType **bst, unsigned int key);
void *findBstNode(bstType *bst, unsigned in... |
import os
import dj_database_url
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs... |
from browser import document, bind
from student_add_options import admission_categories, genders, social_categories, classes
from random import choice
autofill_but = document['autofill_dummy_data']
dummy_data = {}
dummy_data_opt = {}
def generate_dummy_data():
global dummy_data, dummy_data_opt
dummy_data = ... |
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license that can
* be found in the License.html file in the root of the source tree.
*/
#ifndef DATABASEWINDOW_H
#define DATABASEWINDOW_H
#include <QFileInfo>
#include <QString>
#include <QStringLis... |
/*
Projection by TEMPLATED
templated.co @templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
*/
(function($) {
// Breakpoints.
skel.breakpoints({
xlarge: '(max-width: 1680px)',
large: '(max-width: 1280px)',
medium: '(max-width: 980px)',
small: '(ma... |
import React from 'react';
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import { Link } from 'gatsby';
const NavLink = styled(Link)`
color: #222;
font-size: 1rem;
// font-weight: normal;
font-weight: ${props => props.fontWeight || 'normal'};
line-height: 1;
margin: 0 0.5rem 0 ... |
import React from 'react';
import RunStartContainer from '../containers/RunStartContainer';
import RunSummary from './RunSummary'
import Button from '@material-ui/core/Button';
// {this.props.runInProgress ? <NodesContainer /> : <RunInfoContainer />}
const styles = {
button: {
position: 'fixed',
top: '75px... |
from flask import jsonify
def send_http_response(data):
response = jsonify(data)
response.headers.add('Access-Control-Allow-Origin', '*')
return response |
"""Modelo del auxiliar de sistemas."""
# Django
from django.db import models
# Utilidades
from andromeda.utils.models import AndromedaModel
class Assistant(AndromedaModel):
"""Modelo del auxiliar de sistemas
Extiende de AndromedaModel y agrega nuevos campos para
el rol de auxiliar de sistemas, que se e... |
#ifndef HeterogeneousCore_CUDAUtilities_eventWorkHasCompleted_h
#define HeterogeneousCore_CUDAUtilities_eventWorkHasCompleted_h
#include "cudaCheck.h"
#include <cuda_runtime.h>
namespace cms {
namespace cuda {
/**
* Returns true if the work captured by the event (=queued to the
* CUDA stream at the point... |
(function(f, define){
define([ "./kendo.core", "./kendo.selectable" ], f);
})(function(){
var __meta__ = { // jshint ignore:line
id: "calendar",
name: "Calendar",
category: "web",
description: "The Calendar widget renders a graphical calendar that supports navigation and selection.",
depends: [... |
#include "Python.h"
#include "structmember.h"
#include "hyphen.h"
#include "string.h"
/* String constants for calls of Py_Unicode_FromEncodedObject etc.*/
static const char unicode_errors[] = "strict";
/* is raised if hnj_hyphen returns an error while trying to hyphenate a word*/
static PyObject *ErrorObject;
/* -... |
from itertools import izip
from collections import Counter
class Solution(object):
def getHint(self, secret, guess):
"""
:type secret: str
:type guess: str
:rtype: str
"""
A = 0
B = 0
C = Counter()
for a, b in izip(secret, guess):
if a == b:
A += 1
continue
C[a] += 1
if C[a] <= 0:
... |
/*!
FixedHeader 3.1.2
©2009-2016 SpryMedia Ltd - datatables.net/license
*/
(function(d){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(g){return d(g,window,document)}):"object"===typeof exports?module.exports=function(g,h){g||(g=window);if(!h||!h.fn.dataTable)h=require("datata... |
'use strict';
var fs = require('fs');
var path = require('path');
var Sequelize = require('sequelize');
var basename = path.basename(module.filename);
var env = process.env.NODE_ENV || 'development';
var config = require(__dirname + '/../config/config.json')[env];
var db = {};
if (process... |
const { expect } = require("chai");
const { solidity } = require("ethereum-waffle");
const chai = require("chai");
const { Fixure } = require("./shared/fixture")
chai.use(solidity);
const log = console.log
const thisChainPos = 0
const thisLanePos = 0
const bridgedChainPos = 1
const bridgedLanePos = 1
let owner, addr1,... |
'use trict'
var app = require('./app');
app.start( function( err) {
if( err) {
throw err;
}
console.log( `Server running... \n At: ${app.info.uri}`);
}); |
from .mobilenet import *
from .resnet import *
from .googlenet import *
from .inception import *
from .shufflenetv2 import *
|
/*
* I2CEEProm.h
*
* Created on: Feb 13, 2018
* Author: jock
*/
#ifndef I2CEEPROM_H_
# define I2CEEPROM_H_
# include "mbed.h"
class I2CEEProm {
public:
I2CEEProm(I2C *i2cPort, uint8_t addr = 0x50)
{
this->i2c = i2cPort;
this->i2cAddr = addr;
}
virtual ~I2CEEProm() {
// Nothing
... |
"""
Title: Dimension-Adaptive Neural Architecture for Multivariate Sensor Data
Author: [malekzadeh](https://twitter.com/malekz4deh)
Date created: 2020/08/07
Last modified: 2020/08/07
Description: Human activity recognition using wearble sensor data for dynamic sensor and sampling rate selection.
"""
"""
## Introductio... |
window.onload = () => {
Sammy('#container', function () {
this.use('Handlebars', 'hbs');
// Home
// this.get('/', homeController.getHome);
this.get('#/home', homeController.getHome);
//User
this.get('#/login', userController.getLogin);
this.get('#/register',... |
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistri... |
from django.http.request import HttpRequest
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import action
from rest_framework.exceptions import ValidationError
from rest_framework.filters import OrderingFilter, SearchFilter
from rest_framework.mixins import (
CreateModel... |
import os
from ocnn import *
from tqdm import tqdm
import tensorflow as tf
from learning_rate import LRFactory
from tensorflow.python.client import timeline
tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR)
class TFSolver:
def __init__(self, flags, compute_graph=None, build_solver=build_solver):
s... |
# -*- coding: utf-8 -*-
from rest_framework import routers
from . import views
router = routers.SimpleRouter()
router.register(r'titles', views.TitleViewSet)
router.register(r'contacts', views.ContactViewSet)
urlpatterns = router.urls
|
export default class Department {
constructor(id, name, code) {
this.id = id;
this.name = name;
this.code = code;
}
}
|
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
//
// Currently we support two types of tables: plain table and block-based table.
// 1. Block-based t... |
//------------------------------------------------------------------------------
// GB_AxB_defs__lxor_gt_int8: definitions for a single semiring
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
// SPDX-Licen... |
import os
from setuptools import setup, find_packages
try:
import pypandoc
long_description = pypandoc.convert('README.md', 'rst')
except:
long_description = ''
classifiers = ['Development Status :: 4 - Beta',
'Operating System :: POSIX :: Linux',
'License :: OSI Approved :: ... |
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[6],{
/***/ "./node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./resources/js/components/dasboard/gradeS.vue?vue&type=script&lang=js&":
/*!**************************************************************************************... |
from tests.base_case import ChatBotTestCase
from app.chatterbot_api.chatterbot.storage import SQLStorageAdapter as Storage
from app.chatterbot_api.chatterbot.logic import BestMatch as Logic_1
from app.chatterbot_api.chatterbot.logic import MathematicalEvaluation as Logic_2
Storage_path = f'chatterbot.storage.{Storage... |
# encoding: utf-8
#
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import, divisio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 15:19:13 2017
@author: Nadiar
"""
def fancy_divide(list_of_numbers, index):
denom = list_of_numbers[index]
return [simple_divide(item, denom) for item in list_of_numbers]
def simple_divide(item, denom):
try:
return item / denom... |
var SLDS=SLDS||{};SLDS["__internal/chunked/showcase/ui/components/scoped-notifications/base/example.jsx.js"]=function(e){function n(n){for(var t,u,a=n[0],c=n[1],i=n[2],l=0,f=[];l<a.length;l++)u=a[l],o[u]&&f.push(o[u][0]),o[u]=0;for(t in c)Object.prototype.hasOwnProperty.call(c,t)&&(e[t]=c[t]);for(p&&p(n);f.length;)f.sh... |
from ipaddress import IPv4Address, IPv6Address, ip_address
from typing import Union
from . import defaults as defs
from warnings import warn
from .descriptor import ReverseProxy, Order
REMOTE_ADDR = 'REMOTE_ADDR'
import logging
log = logging.getLogger(__name__)
def get_client_ip(
request: 'django.http.requ... |
#! /usr/bin/env python
"""inspect_pyc module
This is a refactor of a recipe from Ned Batchelder's blog. He has
given me permission to publish this. You can find the post at the
following URL:
http://nedbatchelder.com/blog/200804/the_structure_of_pyc_files.html
You may use this module as a script: "./inspect_pyc.... |
#!/usr/bin/env python
#
# 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 ... |
const fs = require('fs');
const config = require('./getConfig');
const VALID_ARGS = require('./validArgs');
/**Object with arrays of the conflictive flags.
*
* Conflictive flags ares flags which can not be used in the same execution
*/
const conflictMap = (() => {
const conflictMap = {};
Object.values(VALID_AR... |
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Chunker", {
enumerable: true,
get: function get() {
return _chunker["default"];
}
});
Object.defineProperty(exp... |
""" MLP-Mixer, ResMLP, and gMLP in PyTorch
This impl originally based on MLP-Mixer paper.
Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py
Paper: 'MLP-Mixer: An all-MLP Architecture for Vision' - https://arxiv.org/abs/2105.01601
@article{tolstikhin2021,
t... |
import {isLayoutSizeDefined} from '#core/dom/layout';
import {cssText} from '../../../build/amp-story-player.css';
import {AmpStoryPlayer} from '../../../src/amp-story-player/amp-story-player-impl';
class AmpStoryPlayerWrapper extends AMP.BaseElement {
/** @override @nocollapse */
static prerenderAllowed() {
... |
# -*- coding: utf-8 -*-
# from twisted.words.xish import domish
from base import *
import random
from twisted.internet import defer
answers = ('Pong, чо.',
'Pong, хуле.',
'Pong, блин, pong.',
'Pong. А что я по-твоему должен был ответить?',
'Pong です!',
'Pong. А ты... |
import sdk from "./1-initialize-sdk.js";
// In order to deploy the new contract we need our old friend the app module again.
const app = sdk.getAppModule("0xBf0966bcEa0855d0b0ebAED2f27e99a8B6779C97");
(async () => {
try {
// Deploy a standard ERC-20 contract.
const tokenModule = await app.deployTokenModule(... |
/*
* Copyright 2016-2017 China Mobile, Inc.
*
* 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 ag... |
createClient = require('../client/create-channel.js');
joinClient = require('../client/join-channel.js');
installClient = require('../client/install-chaincode.js');
invokeClient = require('../client/invoke-transaction.js');
queryClient = require('../client/query.js');
var ClientUtils = require('fabric-client/lib/utils... |
from http.server import BaseHTTPRequestHandler, HTTPServer
from os import curdir
import sys
port = int(sys.argv[2])
class RequestHandler(BaseHTTPRequestHandler):
file_path = sys.argv[1]
def _send_cors_headers(self):
""" Sets headers required for CORS """
self.send_header("Access-Control-All... |
# Copyright (c) 2010 Aldo Cortesi
# Copyright (c) 2010, 2014 dequis
# Copyright (c) 2012 Randall Ma
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2012 Craig Barnes
# Copyright (c) 2013 horsik
# Copyright (c) 2013 Tao Sauvage
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# o... |
/*
* Copyright (c) 2020 Pangeanic SL.
*
* This file is part of NEC TM
* (see https://github.com/shasha79/nectm).
*
* 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 copy... |
# Generated by Django 3.2.4 on 2021-11-01 14:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='contact',
name='subject',
... |
//
// 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"
@interface FLEXUtility : NSObject
{
}
+ (id)applicationImageName;
+ (id)applicationName;
+ (id)circularImageWithColor:(id)arg1 radius:(double)arg2;
+ (id)cons... |
# coding=utf-8
import numpy as np
from PIL import Image
from tb_paddle import SummaryWriter
def random_crop(img):
image = Image.open(img)
w, h = image.size
random_w = np.random.randint(0, w-100)
random_h = np.random.randint(0, h-100)
return image.crop((random_w, random_h, random_w + 100, random_h ... |
"""Macintosh binhex compression/decompression.
easy interface:
binhex(inputfilename, outputfilename)
hexbin(inputfilename, outputfilename)
"""
#
# Jack Jansen, CWI, August 1995.
#
# The module is supposed to be as compatible as possible. Especially the
# easy interface should work "as expected" on any platform.
# XXX... |
from abc import (
ABCMeta,
abstractmethod,
)
from typing import (
Optional,
)
from function_tools.runners import (
BaseRunner,
)
class RunnerManager(metaclass=ABCMeta):
"""
Абстрактный класс для создания менеджеров пусковиков запускаемых объектов.
Служит для добавления функций-задач, пуск... |
#include <stdio.h>
#include <stdlib.h>
#include "common/eulersolution.h"
extern const euler_solution *p_problem00009;
int
main
(int argc, char **argv)
{
/* A buffer to print the solution to */
char soln_buffer[4096];
/* Allocated memory required by the solution */
const size_t mem_needed = p_pro... |
/**
* @license
* Copyright (C) 2016 The Android Open Source Project
*
* 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 require... |
/*
* Copyright (c) 2012-2013 Patrick McHardy <kaber@trash.net>
*/
#include <stdio.h>
#include <string.h>
#include <xtables.h>
#include <linux/netfilter_ipv6/ip6_tables.h>
#include <linux/netfilter_ipv6/ip6t_NPT.h>
enum {
O_SRC_PFX = 1 << 0,
O_DST_PFX = 1 << 1,
};
static const struct xt_option_entry SNPT_options[... |
import os
#from rpython.translator.goal import richards
modfilename = os.path.join(os.path.dirname(__file__), 'richards.py')
# Number of times richards is imported in parallel.
# Can be changed on the command line, e.g.
#
# translate.py targetvarsized.py 20
#
DEFAULT_CODE_SIZE_FACTOR = 10
take_options = True
... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2018-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the te... |
import { before, beforeEach, describe, it } from 'mocha';
import { assert } from 'chai';
import { Game } from '../../GlobalsForTesting';
import { CMOptions } from '../../../src/Config/VariablesAndData';
import ToggleDetailedTime from '../../../src/Config/Toggles/ToggleDetailedTime';
import { BackupFunctions } from '..... |
#!/usr/bin/env python3
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import click
import os
from pathlib import Path
import re
import subprocess as sp
import sys
from typing import Any, Iterable, Union
TEST_TIMEOUT = 600 # Seconds
from fpga_testing import (Colors, DACE_DIR, TEST_DIR, cl... |
/**
* Run the passed command line hidden, suitable for a scheduled task.
* Author: Anatol Belski <ab@php.net>
* License: BSD 2-Clause
*/
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define CMD_PRE "cmd.exe /c "
#define CMD_PRE_LEN (sizeof(CMD_PRE)-1)
#ifdef DEBUG
int
main(int argc,... |
/*******************************************************************************
* Copyright 2019 Microchip Corporation.
*
* SPDX-License-Identifier: MIT
*
* MPFS HSS Embedded Software
*
*/
/*!
* \file MPFS HSS Registered Tables
* \brief Contains all registered tables.
*
* Items such as IPI handlers and sta... |
/*
* DateJS Culture String File
* Country Code: nn-NO
* Name: Norwegian, Nynorsk (Norway)
* Format: "key" : "value"
* Key is the en-US term, Value is the Key in the current language.
*/
Date.CultureStrings = Date.CultureStrings || {};
Date.CultureStrings["nn-NO"] = {
"name": "nn-NO",
"englishName": "Norw... |
import { makeStyles } from '@material-ui/core/styles';
export default makeStyles ((theme) => ({
root: {
padding: '0',
margin: '0',
fontFamily: "'DM Sans', sans-serif",
'& .MuiContainer-root': {
paddingLeft: 0,
paddingRight: 0
},
'& .MuiAppBar-... |
"use strict";
/* eslint-disable-next-line no-unused-vars */
function __export(m) {
/* eslint-disable-next-line no-prototype-builtins */
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable-next-line no-unused-vars */
v... |
import discord
from discord.ext import commands
import nekos
class Neko():
"""These commands work with nekos.life api."""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def ncat(self, ctx):
"""Displays a cat."""
cat_url = nekos.cat()
e = discord.Embed... |
import React from 'react';
import PropTypes from 'prop-types';
const UndrawCreditCard = props => (
<svg className={props.class} id='e9df7128-f90d-48f2-af2a-c80f8452c1a7' dataName='Layer 1' xmlns='http://www.w3.org/2000/svg'
xmlnsXlink='http://www.w3.org/1999/xlink' style={{height:props.height,width:'100%'... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... |
from pydent.aqhttp import AqHTTP
from pydent.models import FieldType
def test_field_type_constructor_with_sample_type(fake_session, monkeypatch):
def fake_post(*_, **kwargs):
json_data = kwargs["json_data"]
if json_data["model"] == "SampleType" and json_data["id"] == 5:
return {"id": 5... |
from PyQt5 import QtGui,QtWidgets,QtCore
class ToolBar(QtWidgets.QWidget):
def __init__(self, player, parentClass):
super().__init__()
self.createUI()
self.player = player
self.parentClass = parentClass
def createUI(self):
#Main Layout
self.mainLayout = QtWidgets.QVBoxLayout()
#Position Slider
se... |
from datetime import datetime
import discord
from discord.ext import commands
class MisscCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
async def rg(self, ctx):
"""used to post info on roles, could be made better.
This is honestly very stupid b... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... |
import sys
from itertools import combinations
def get_pi(N):
m = len(N)
pi = [0]*m
begin, matched = 1, 0
while begin + matched < m:
if N[begin+matched] == N[matched]:
matched += 1
pi[begin+matched-1] = matched
else:
if matched == 0:
... |
# coding=utf-8
# Copyright 2022 The Google Research 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
# -*- coding: utf-8 -*-
"""
Change directory to provide relative paths for doctests
>>> import os
>>> filepath = os.path.dirname( os.path.realpath( __file__ ) )
>>> datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
>>> os.chdir(datadir)
"""
from __future__ import print_function, divis... |
async function init() {
const data = await d3.json('http://localhost:3000/executions/1/threadslices')
const margin = {
top: 10,
right: 20,
bottom: 30,
left: 120
}
const width = 1000
const height = data.length * 30
const focusHeight = 100
const dimensions = { margin, height, width, focusH... |
# Copyright 2015 The TensorFlow 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 applica... |
const baseURL = process.env.REACT_APP_SSE_BASE_URL || 'http://localhost:3000/sse';
let instance;
class Streamer {
eventSource = null;
subscribe(channelId, opts, { receiveCallback = null, editCallback = null, removeCallback = null }) {
if (this.eventSource) {
this.eventSource.close();
this.eventSo... |
import makeActionCreator from 'utils/makeActionCreator';
import freesound from 'vendors/freesound';
import { MESSAGE_STATUS } from 'constants';
import { displaySystemMessage } from '../MessagesBox/actions';
export const OPEN_MODAL_FOR_SOUND = 'OPEN_MODAL_FOR_SOUND';
export const HIDE_MODAL = 'HIDE_MODAL';
export const... |
/// <reference path="qunit.js" />
/// <template path="template.tmpl.html"/>
/// <template path="template2.tmpl.html"/>
/// <reference path="../jquery-1.7.1.min.js" />
module("Html Template Test - QUnit");
test("Will load html template", function () {
// Grab template text, convert to html, append to body
$($(... |
var scanner = {
// Application Constructor
initialize: function() {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
bindEvents: function() {
document.... |
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"sapui5/templatesSAPUI5Template/model/models"
], function(UIComponent, Device, models) {
"use strict";
return UIComponent.extend("sapui5.templatesSAPUI5Template.Component", {
metadata: {
manifest: "json"
},
/**
* The component is initialize... |
from collections import deque
n = int(input())
commands = deque(input().split())
road = [input().split() for _ in range(n)]
miner_pos = []
collected_coal = 0
total_coal = 0
for row in range(n):
for col in range(n):
if road[row][col] == "s":
miner_pos = [row, col]
elif road... |
/*!
* Copyright 2022 Cognite AS
*/
module.exports = {
'rules': {
'header/header': 'off'
}
}
|
import numpy as np
from torchvision import transforms
from torchvision.models.detection import maskrcnn_resnet50_fpn
def _convert2Dto3D(intrisics, x, y, z, width, height):
fx = intrisics[0] * float(width)
fy = intrisics[1] * float(height)
cx = intrisics[2] * float(width)
cy = intrisics[3] * float(heig... |
// Setup
// Modify the diameter to expand/contract space between nodes.
var anchor = document.querySelector("#routing-tree-container");
var diameter = anchor.clientWidth;
var color = "#0B5ED7";
var tree = d3.layout.tree()
.size([360, diameter / 2 - 120])
.separation(function(a, b) { return (a.parent == b.par... |
const stripe = require("https://github.com/PipedreamHQ/pipedream/components/stripe/stripe.app.js")
module.exports = {
name: "Customizable events webhook",
props: {
stripe,
enabledEvents: {
type: "string[]",
label: "Events to listen for (select '*' for all)",
options() {
return thi... |
import React from 'react'
import { useSnackbar } from 'notistack'
import { useRecoilState } from 'recoil'
import { withRouter } from 'react-router-dom'
import Resizer from 'react-image-file-resizer'
import dataUriToBuffer from 'data-uri-to-buffer'
import ContentWrapper from '../components/ContentWrapper'
import PhotosF... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
import cv2
import os
import shutil
import pickle as pkl
import time
import numpy as np
import hashlib
import sys
from utee import quant
#from IPython import embed
class Logger(object):
def __init__(self):
self._logger = None
def init(self, logdir, name='log'):
if self._logger is None:
... |
/*-------------------------------------------------------------------------
*
* view.c
* use rewrite rules to construct views
*
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/backend/... |
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Ipsum(models.Model):
title = models.CharField(max_length=255, unique=True)
text = models.TextField()
|
/**
* @Author: Hang Wu <Dukecat>
* @Date: 2017-02-11T23:01:55-05:00
* @Email: wuhang0613@gmail.com
* @Last modified by: Dukecat
* @Last modified time: 2017-02-14T16:59:25-05:00
*/
$(function () {
var data_points = [];
$("#chart").height($(window).height() - $("#header").height() * 2);
$(document.bo... |