text stringlengths 1 1.05M |
|---|
<reponame>hemtjanst/hemtjanst
package messaging
import (
"time"
mq "github.com/eclipse/paho.mqtt.golang"
)
// TestingMessenger is a no-op messenger useful for when running tests
type TestingMessenger struct {
client mq.Client
Action string
Topic []string
Message []byte
Qos int
Persist bool
Cal... |
<gh_stars>1-10
from hashkernel.bakery import Cake, CakeRole
from hashstore.bakery.lite.node import (
User, Permission, UserType, Portal, PortalHistory, VolatileTree)
from sqlalchemy import or_, and_
def find_normal_user(glue_sess, user_or_email):
if isinstance(user_or_email, str) and '@' in user_or_email:
... |
import React from 'react';
import { Link } from 'react-router-dom';
const MainBanner = () => {
return (
<div className="repair-main-banner">
<div className="container">
<div className="row align-items-center">
<div className="col-lg-6">
<div className="repair-banner-content">... |
#!/bin/bash
set -ex
IMG=${IMG:-kylemanna/openvpn}
temp=$(mktemp -d)
pushd $temp
SERV_IP=$(ip -4 -o addr show scope global | awk '{print $4}' | sed -e 's:/.*::' | head -n1)
docker run --net=none --rm -t -i -v $PWD:/etc/openvpn $IMG ovpn_genconfig -u udp://$SERV_IP
docker run --net=none --rm -t -i -v $PWD:/etc/op... |
<reponame>yangc0921/ATS-based_RSA_Algorithm_ElasticOpticalNetwork_EON
package eon.spectrum;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import eon.general.Constant;
import eon.general.Modulation;
import eon.general.RouteType;
import eon.graph.RouteSearching;
import eon.graph... |
declare module '@next/bundle-analyzer';
|
/*
* Copyright 2018 HM Revenue & Customs
*
* 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 a... |
import AsyncStorage from "@react-native-async-storage/async-storage"
import {includes, pull} from "lodash"
import {FAVORITE_STORAGE} from "../utils/constants"
export async function getPokemonsFavoriteApi(){
try {
const response = await AsyncStorage.getItem(FAVORITE_STORAGE)
//return JSON.parse(resp... |
<gh_stars>0
'use strict';
var directives = angular.module('haoshiyou.directives', []);
directives.directive('postItem', function() {
return {
restrict: "A",
templateUrl: 'partials/post_item.html'
}
});
|
def base64_encode(string)
encoded_string = [string].pack('m')
return encoded_string
end |
/*
* Copyright (C) 2017-2017 Alibaba Group Holding Limited
*/
package action
import (
"github.com/cppforlife/bosh-cpi-go/apiv1"
"bosh-alicloud-cpi/alicloud"
)
type SetDiskMetadataMethod struct {
CallContext
disks alicloud.DiskManager
instances alicloud.InstanceManager
}
func NewSetDiskMetadataMethod(cc CallCo... |
#!/bin/bash
npm ci --no-cache && \
npm build && \
node server.js
|
GRPC_ENABLE_FORK_SUPPORT="1" MG_ALPHAS="localhost" IS_RETRY=False IS_LOCAL=False BUCKET_PREFIX='local-grapl' python3 ./src/analyzer-executor.py
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
let aws_keys = {
s3: {
region: 'us-east-2',
accessKeyId: '<KEY>',
secretAccessKey: '<KEY>'
},
translate: {
accessKeyId: '<KEY>',
secretAccessKey: '<KEY>',
apiVersion: '2017-07-01',
... |
#!/bin/bash
command=`basename $0`
function usage {
echo ""
echo "USAGE: $command <bucket>"
echo ""
}
if [ $# -ne 1 ]
then
usage
exit
fi
bucket=$1
export GOOGLE_APPLICATION_CREDENTIALS=wmt-1f780b38bd7b0384e53292de20.json
echo "Running Scala GoogleStorage application for '$bucket' on GCP..."
scala target/sc... |
import React from 'react';
interface CrosshairLineProps {
x0: number;
x1: number;
y0: number;
y1: number;
}
export declare const CrosshairLine: React.MemoExoticComponent<({ x0, x1, y0, y1 }: CrosshairLineProps) => JSX.Element>;
export {};
//# sourceMappingURL=CrosshairLine.d.ts.map |
"""
414. Third Maximum Number
https://leetcode.com/problems/third-maximum-number/
Example:
Input: nums = [3,2,1]
Output: 1
Explanation: The third maximum is 1.
Input: nums = [1,2]
Output: 2
Explanation: The third maximum does not exist, so the maximum (2) is returned instead.
"""
# Runtime; 48ms (88.46%)
class Sol... |
var KlayRunner = artifacts.require('KlayRunner');
module.exports = function(deployer) {
deployer.deploy(KlayRunner, 'KlayRunner', 'KLR', 'unknownhost', 100, 100000000000000000n, 5, { gas: 100000000 })
};
|
/* global moment:false */
import 'd2l-polymer-siren-behaviors/store/entity-store.js';
import '@brightspace-ui/core/components/button/button-subtle.js';
import { css, html, LitElement } from 'lit-element';
import { findFile, getSubmissionFiles, getSubmissions } from '../helpers/submissionsAndFilesHelpers.js';
import { L... |
<gh_stars>1-10
// Code generated by volcago. DO NOT EDIT.
// generated version: (devel)
package model
const (
LockMeta2IndexLabelTextEqual = "t4" // perfect-match of Text
LockMeta2IndexLabelTextLike = "t3" // like-match of Text
LockMeta2IndexLabelTextPrefix = "t1" // prefix-match of Text
LockMeta... |
<filename>src/main/scala/codecheck/github/utils/Json4s.scala
package codecheck.github.utils
import org.json4s._
import org.json4s.jackson.JsonMethods._
object Json4s {
implicit val formats = DefaultFormats ++ org.json4s.ext.JodaTimeSerializers.all
}
|
#!/bin/bash
os_type() {
# use the OS environment variable, then bash env OSTYPE
if [[ -n "$OS" ]]; then
echo "$OS"
elif [[ "$OSTYPE" = "darwin"* ]]; then
echo "darwin"
else
echo "$OSTYPE"
fi
}
target_arch() {
# if ARCH environment variable is not provided, use the host ... |
<filename>rm_hw/src/hardware_interface/can_bus.cpp
/*******************************************************************************
* BSD 3-Clause License
*
* Copyright (c) 2021, <NAME>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted pro... |
<gh_stars>100-1000
import path from "path";
import * as fs from "fs";
import { Bundler as scssBundler } from "scss-bundle";
import { Bundler as stylusBundler } from "stylus-bundle";
const __dirname = path.dirname(new URL(import.meta.url).pathname);
const projectDirectory = path.resolve(__dirname, "./");
const scss = ... |
<gh_stars>1-10
import ElementUI from 'element-ui';
import VTooltip from 'v-tooltip';
import VeeValidate from 'vee-validate';
import Vue from 'vue';
import App from './App';
import router from './router';
import store from './store';
import locale from 'element-ui/lib/locale/lang/zh-TW';
import './sass/app.sass';
impo... |
/**************************************************************************\
|
| Copyright (C) 2009 <NAME>
|
| 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 3 of the L... |
#!/bin/sh
# Helper function to add a user
add_a_user()
{
USER=$1
PASSWORD=$2
shift; shift;
# Having shifted twice, the rest is now comments ...
COMMENTS=$@
echo "Adding user $USER ..."
echo useradd -c "$COMMENTS" $USER
echo passwd $USER $PASSWORD
echo "Added user $USER ($COMMENTS) with pass $PASSWORD... |
#!/bin/bash
for i in $(seq 1 $NUMBER_OF_WORDS); do
# x=$(curl -s https://random-word-api.herokuapp.com/word)
# x="$(echo $x | sed 's/"//g' | sed 's/\[//g' | sed 's/\]//g')"
WORD=$(curl -s https://random-word-api.herokuapp.com/word | jq -r '.[0]' )
echo Pushing $WORD
aws dynamodb put-item --table-n... |
<gh_stars>1-10
import axios from "../axios";
interface PackageDependenciesModel {
module: string;
[key: string]: any;
}
export function queryPackageDependencies(language: string, systemId: number) {
return axios<PackageDependenciesModel[]>({
baseURL: `/api/systems/${systemId}`,
url: `/package/dependenci... |
<filename>optimism2/ovm2/get_contracts/insert_contract_overrides.sql
--Add contracts where we know their mapping, but their creator is not deterministic and the contracts are not verified.
CREATE SCHEMA IF NOT EXISTS ovm2;
CREATE TABLE IF NOT EXISTS ovm2.contract_overrides (
contract_address bytea NOT NULL,
pro... |
function selcountry()
{
var selitem=document.getElementById('selcount').selected();
alert(selitem);
} |
#!/bin/bash
make cuda_lodepng
mkdir -p export/
bin/image_modifier_cuda grey examples/example_image1_small.png export/example_image1_small_grey.png
bin/image_modifier_cuda blur examples/example_image1_small.png export/example_image1_small_blur.png
bin/image_modifier_cuda hsv examples/example_image1_small.png export/ex... |
#!/bin/bash
# This is a wrapper for a multiversion kafka cluster.
#
#
VERSION=$1
SERVER_IP=$2
function echo_usage {
echo "usage:"
echo "./start-kafka-cluster.sh {version} [ip]"
echo ""
echo "example:"
echo "./start-kafka-cluster.sh 0.9.0.0 192.168.2.77"
echo "./start-kafka-cluster.sh 2.3.0 ... |
#!/bin/bash
set -o pipefail
function finish {
sync_unlock.sh
}
if [ -z "$TRAP" ]
then
sync_lock.sh || exit -1
trap finish EXIT
export TRAP=1
fi
> errors.txt
> run.log
GHA2DB_PROJECT=zephyr PG_DB=zephyr GHA2DB_LOCAL=1 structure 2>>errors.txt | tee -a run.log || exit 1
./devel/db.sh psql zephyr -c "create exten... |
TERMUX_PKG_HOMEPAGE=https://lxqt.github.io
TERMUX_PKG_DESCRIPTION="GUI to query passwords on behalf of SSH agents"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="Simeon Huang <symeon@librehat.com>"
TERMUX_PKG_VERSION=0.17.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL="https://github.com/lxqt/lxqt-openssh-askpass/rele... |
#!/bin/bash
#
# This script performs an integration test of the component,
# deploying the component into the CI environment,
# creating a virtualenv, installing test dependencies,
# running the functional and integration tests,
# then (if those pass) copying the RPM to the QA repository.
#
# It is intended to be run o... |
<reponame>c58/marsdb-react<filename>index.js
var createContainer = require('./dist/createContainer').default;
var DataManagerContainer = require('./dist/DataManagerContainer').default;
module.exports = {
__esModule: true,
createContainer: createContainer,
DataManagerContainer: DataManagerContainer
};
|
import { BusinessException } from '../business-exception';
export class RequestException extends BusinessException {
}
|
import { bot } from '@common/bot';
const { API_URL } = process.env;
export const main = async () => {
await bot.telegram.setWebhook(API_URL);
};
|
<filename>src/tree/expressions/TRelationalExpression.java
package tree.expressions;
import tree.DefaultTreeNode;
import tree.symbols.TSGeOp;
import tree.symbols.TSGtOp;
import tree.symbols.TSLeOp;
import tree.symbols.TSLtOp;
public class TRelationalExpression extends DefaultTreeNode {
public TRelationalExpression(T... |
<reponame>rynop/nativescript-app-templates
import { Observable } from "tns-core-modules/data/observable";
import { ObservableArray } from "tns-core-modules/data/observable-array";
import { Config } from "../shared/config";
import { ObservableProperty } from "../shared/observable-property-decorator";
import { Car } fro... |
<reponame>aurelmegn/boilerplate_flask
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["js/app"],{
/***/ "./assets/js/index.js":
/*!****************************!*\
!*** ./assets/js/index.js ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports) {
/***/ ... |
<filename>java/src/main/java/ch/hslu/pcp/sw8/Exercise3.java
package ch.hslu.pcp.sw8;
public class Exercise3 implements TripleIntOperator{
@Override
public int apply(int first, int second, int third) {
return 0;
}
}
|
<reponame>ppetoumenos/election_data_gr
#!/usr/bin/python
# vim: set ts=4:
# vim: set shiftwidth=4:
# vim: set expandtab:
import logging
import datetime
import unicodecsv as csv
import codecs
from crawler import Crawler
import elections as el
_SECONDS_PER_REQUEST = 3
#-------------------------------------------------... |
class CreditCard:
total_cards_created = 0 # Class attribute to keep track of the total number of credit cards created
def __init__(self, card_number, initial_balance):
self.card_number = card_number
self.balance = initial_balance
CreditCard.total_cards_created += 1 # Increment the tot... |
<gh_stars>0
"use strict";
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _react2 = require("@storybook/react");
var _grommet = require("grommet");
var _themes = require("grommet/themes");
var _utils = require("grommet/utils");
function _... |
#!/bin/bash
#sh /home/alarm/QB_Nebulae_V2/Code/scripts/mountfs.sh rw
echo "starting bootup LEDs"
python2 /home/alarm/QB_Nebulae_V2/Code/nebulae/bootleds.py booting &
echo "optimizing system."
sh /home/alarm/QB_Nebulae_V2/Code/scripts/sys_opt.sh
echo "checking for firmware update"
sh /home/alarm/QB_Nebula... |
<gh_stars>0
def payload_from_form(form, prefix='', delete=False):
"""
Generate a payload for a POST request based on a ModelForm
"""
prefix = f'{prefix}-' if prefix else ''
payload = {f'{prefix}{k}': form[k].value() for k, v in form.fields.items() if form[k].value()}
if getattr(form.instance, '... |
<reponame>alex-scott/php-src
/*
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group ... |
<reponame>crossplatformsweden/react-native-cross-maps<filename>__mocks__/react-native-modal-datetime-picker.js
const mock = {
Collapsible: 'View'
};
jest.mock('react-native-modal-datetime-picker', () => 'View');
export default mock.Collapsible;
module.exports = mock; |
#!/usr/bin/env sh
## Build
npm run build
npm run ebook:build
## Rename and move ebook to dist folder
mv ild_docs/.vuepress/dist/ ild_docs/.vuepress/ebook/
mv ild_docs/.vuepress/ebook/ dist/
## Create CNAME
echo 'ichlernedeutsch.info' >> dist/CNAME
## Stage, commit, push to master branch and deploy to gh-pages
git a... |
<reponame>mehmetkillioglu/rclgo
/*
This file is part of rclgo
Copyright © 2021 Technology Innovation Institute, United Arab Emirates
Licensed under the Apache License, Version 2.0 (the "License");
http://www.apache.org/licenses/LICENSE-2.0
*/
/*
THIS FILE IS AUTOGENERATED BY 'rclgo-gen generate'
*/
package example... |
#!/bin/bash
#
# This script runs NGINX as a reverse proxy as a docker container
# It expects to find DAPR_HTTP_PORT variable, so always run via `dapr run`
#
echo "### API gateway nginx wrapper magic doohicky script"
echo "### Dapr port is $DAPR_HTTP_PORT"
echo "### Starting nginx in docker"
sed -i "s/localhost:[[:di... |
let array = [2,9,7,8,5];
let min = Math.min(...array);
console.log(min); // 2 |
package mezz.jei.gui.elements;
import net.minecraft.client.Minecraft;
public interface IMouseClickedButtonCallback {
boolean mousePressed(Minecraft mc, int mouseX, int mouseY);
}
|
<reponame>aashish24/paraview-climate-3.11.1<gh_stars>1-10
/*=========================================================================
Program: ParaView
Module: $RCSfile$
Copyright (c) Kitware, Inc.
All rights reserved.
See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
... |
import React from 'react';
import ReadChapterScreen from '../ReadChapterScreen';
export default {
title: 'Screen/ReadChapter',
component: ReadChapterScreen,
};
// !prettier-ignore
const chhands = [
{
id: 358,
order_number: 1,
chhand_name_english: 'Dohra',
chhand_type_id: 1,
chapter_id: 39,
... |
<gh_stars>100-1000
/***********************************************************************************************************************
* OpenStudio(R), Copyright (c) 2008-2021, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
* Redistribution and use in source and binary forms... |
edit_distance = len(word_a) + len(word_b) - 2 * len(set(word_a).intersection(set(word_b))) |
#!/usr/bin/env bash
ghr_version="0.13.0"
# NOTE: This release will generate a new release on the installers
# repository which in turn triggers a full package build
target_owner="hashicorp"
target_repository="vagrant-builders"
csource="${BASH_SOURCE[0]}"
while [ -h "$csource" ] ; do csource="$(readlink "$csource")";... |
package implementation;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Boj4948 {
public static final String NEW_LINE = "\n";
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder s... |
package create
import (
"fmt"
"io"
"github.com/spf13/cobra"
kapi "k8s.io/kubernetes/pkg/apis/core"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/genericclioptions"
routev1 "github.com/openshift/api/route/v1"
cmdutil "github.com... |
class UserManagementSystem:
def __init__(self):
self.userslist = []
def imprimirUsuarios(self):
for user in self.userslist:
user.muestra()
def deleteUser(self, name):
users_to_remove = [user for user in self.userslist if user.getName() == name]
for user in users... |
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy
from .abstract_is_candidate import AbstractIsCandidate
from .abstract_is_examiner import AbstractIsExaminer
from .basenode import BaseNode
from .custom_db_fields import ShortNameField, LongNameField
from de... |
function network_device_ip_address() {
ifconfig $1 | grep "inet " | cut -f 2 -d " "
}
|
$(document).ready(function(){
$(".button a").click(function(){
$(".overlay").fadeToggle(0);
$(this).toggleClass('btn-open').toggleClass('btn-close');
$('.btn-open').click(function(){
$('.click-overlay').addClass('body-overlay');
$('body').addClass('noscroll');
});
... |
import boto3
# Create an EC2 client
ec2 = boto3.client("ec2", region_name="YOUR_REGION")
# Create an EC2 instance
ec2.run_instances(
ImageId="ami-xxxxxxx",
InstanceType="t2.micro",
MinCount=1,
MaxCount=1,
KeyName="YOUR_KEY",
SecurityGroupIds=["YOUR_SECURITY_GROUP_ID"],
OperatingSystem="Red... |
docker run --name cassandra-node-2 -d \
-e CASSANDRA_CLUSTER_NAME="Oauth-cluster" \
-e CASSANDRA_CLUSTER_TOKENS="8" \
-e CASSANDRA_CLUSTER_DC="dc1" \
-e CASSANDRA_RACK="rack2" \
-e CASSANDRA_ENPOINT_SNITCH="GossipingPropertyFileSnitch" \
-e CASSANDRA_SEEDS="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPA... |
package com.alibaba.spring.boot.rsocket.demo;
import com.alibaba.user.AccountService;
import com.alibaba.rsocket.invocation.RSocketRemoteServiceBuilder;
import com.alibaba.rsocket.loadbalance.LoadBalancedRSocket;
import com.alibaba.rsocket.metadata.RSocketMimeType;
import com.alibaba.rsocket.upstream.UpstreamManager;
... |
class ItemCatalogue():
def __init__(self):
self.items = {}
def add(self, item_name, item_details):
self.items[item_name] = item_details
def update(self, item_name, item_details):
self.items[item_name] = item_details
def delete(self, item_name):
del self.ite... |
<reponame>akokhanovskyi/kaa
/*
* Copyright 2014-2016 CyberVision, 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 ... |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ltr = void 0;
var ltr = {
"viewBox": "0 0 16 16",
"children": [{
"name": "path",
"attribs": {
"fill": "#000000",
"d": "M8 0c-2.209 0-4 1.791-4 4s1.791 4 4 4v8h2v-14h2v14h2v-14h2v-2h-8zM0 11l4-4-4-4z"
}
... |
<filename>src/test/java/ed/biodare2/backend/features/rhythmicity/RhythmicityResultsExporterTest.java<gh_stars>0
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ed.biodare... |
//Dijkstra's Algorithm : O(ElogV)
//Min-priority Queue implemented using min-heap.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define inf ((int)(1e9))
#define N 1000
typedef struct graph_adj_list
{
int node;
int weight;
struct graph_adj_list *next;
}node;
typedef struct pair
{
int weight;
int n... |
#!/usr/bin/env bats
load jboss-kie-wildfly-common
export JBOSS_HOME=$BATS_TMPDIR/jboss_home
mkdir -p $JBOSS_HOME/standalone/configuration
mkdir -p $JBOSS_HOME/bin/launch
cp $BATS_TEST_DIRNAME/../../../tests/bats/common/launch-common.sh $JBOSS_HOME/bin/launch
touch $JBOSS_HOME/bin/launch/logging.sh
export CONFIG_FIL... |
#--timeout=900
PREPS='copyOnly'
STEPS=(
'splCompile'
'submitJob'
'checkJobNo'
'waitForFinAndHealth'
'cancelJobAndLog'
'checkTuples'
'linewisePatternMatchInterceptAndSuccess data/WindowMarker "true" "{seq_=199,typ_=\"w\",avroMessage=}"'
'linewisePatternMatchInterceptAndSuccess data/FinalMarker "" "{seq_=200,t... |
(function() {
'use strict';
angular
.module('sentryApp')
.controller('BotDeleteController',BotDeleteController);
BotDeleteController.$inject = ['$uibModalInstance', 'entity', 'Bot'];
function BotDeleteController($uibModalInstance, entity, Bot) {
var vm = this;
vm.bot ... |
#!/bin/sh
#
# Copyright 2019 PingCAP, 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 agreed t... |
/**
* Flym
* <p/>
* Copyright (c) 2012-2015 <NAME>
* <p/>
* 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.
* <p/... |
<reponame>doorbash/android-useful-modules<gh_stars>1-10
package ir.doorbash.licensechecker.util.lock;
import android.content.Context;
import android.os.PowerManager;
import android.util.Log;
import ir.doorbash.licensechecker.util.LogUtil;
/**
* Created by <NAME> on 3/16/16.
*/
public class CheckPowerLock {
p... |
<filename>src/app/app.routing.ts
import { NgModule } from '@angular/core';
import { CommonModule, } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { ProfileComponen... |
package be.kwakeroni.evelyn.test;
import be.kwakeroni.evelyn.model.Event;
import be.kwakeroni.evelyn.storage.Storage;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.stream.Stream;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mock... |
from typing import List
import numpy as np
def clip_to_range(arr: List[float], min_val: float, max_val: float) -> List[float]:
return np.clip(arr, min_val, max_val).tolist()
# Test the function
arr = [1, 5, 10, 15, 20]
min_val = 5
max_val = 15
print(clip_to_range(arr, min_val, max_val)) # Output: [5, 5, 10, 15, ... |
<filename>routes/index.js
var express = require('express');
var router = express.Router();
var mysql = require('mysql');
/* GET home page. */
router.get('/', function(req, res, next) {
var newstype = req.query.newstype;
var connection = mysql.createConnection({
host: "localhost",
user: "root",
... |
<gh_stars>1-10
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
const fs = require('fs-extra');
const path = require('path');
const {idx} = require('../utils');
/**
* Check that item ... |
def validateRoleTypeLocation(modelXbrl, modelObject, parentModelObject, xmlDocument):
if modelObject.isMislocated:
error_message = _("Schema file link:roleType may only be located at path //xs:schema/xs:annotation/xs:appinfo but was found at %(elementPath)s")
modelXbrl.error("xbrl.5.1.3.roleTypeLoca... |
import Phone from '@/util/phone'
test('isMobile', () => {
expect(Phone.isMobile(13800138000)).toBeTruthy()
expect(Phone.isMobile('13800138000')).toBeTruthy()
})
test('getPurePhone and beautifyPhone', () => {
expect(Phone.getPurePhone(13800138000123)).toBe('13800138000')
expect(Phone.getPurePhone('1380a0138000... |
<filename>node_modules/@reactivex/rxjs/dist/es6/operator/windowTime.js
import { Subscriber } from '../Subscriber';
import { Subject } from '../Subject';
import { async } from '../scheduler/async';
/**
* Branch out the source Observable values as a nested Observable periodically
* in time.
*
* <span class="informal"... |
<gh_stars>0
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package clock.controller;
import clock.controller.ScheduleDate.DayOfWeek;
import java.io.UnsupportedEncodingException;
imp... |
#!/bin/bash
# This script parses in the command line parameters from runCust,
# maps them to the correct command line parameters for DispNet training script and launches that task
# The last line of runCust should be: bash $CONFIG_FILE --data-dir $DATA_DIR --log-dir $LOG_DIR
# Parse the command line parameters
# tha... |
import React from 'react';
import { render } from 'react-native-testing-library';
import { RootToaster } from '../RootToaster';
jest.useFakeTimers();
describe('RootToaster', () => {
it('renders correctly', () => {
const component = render(
<RootToaster visible defaultDuration={3000} defaultMessage="Error" ... |
import { UsersModule } from "../modules/users.module."
import { CatsModule } from "../modules/cats.module"
import { TagsModule } from "../modules/tags.module"
import { PostsModule } from "../modules/posts.module"
import { CategorysModule } from "../modules/cate.module"
export {
UsersModule,
CatsModule,
T... |
import { Component } from '@angular/core';
@Component({
selector: 'horz-buttons-scroll-demo',
template: `
<div>
<h3>
Horizontal Buttons Scroll
<small>
<a
href="https://github.com/swimlane/ngx-datatable/blob/master/demo/basic/scrolling.component.ts"
targ... |
import pandas as pd
import numpy as np
import sklearn
from sklearn.linear_model import LinearRegression
# Load the data
data = pd.read_csv('stock_data.csv')
# Separate the independent variables
X = data.drop(['Date', 'Close'], axis=1).values
y = data['Close'].values
# Split the data into training and test sets
X_... |
<filename>node_modules/@babylonjs/loaders/glTF/glTFFileLoader.d.ts
import * as GLTF2 from "babylonjs-gltf2interface";
import { Nullable } from "@babylonjs/core/types";
import { Observable } from "@babylonjs/core/Misc/observable";
import { Camera } from "@babylonjs/core/Cameras/camera";
import { BaseTexture } from "@bab... |
import numpy as np
import cv2
class ImageProcessor:
def apply_shadow_mask(image, blur_width, intensity, ellipse):
shadow_mask = np.zeros(image.shape[:2], dtype=np.uint8)
shadow_mask.fill(const.WHITE)
shadow_mask = cv2.ellipse(shadow_mask, ellipse, const.BLACK, -1)
blurred_image = c... |
# Python program to generate
# n random numbers within a given range
import random
# Function to generate random numbers
def random_numbers(rangeStart, rangeEnd, numberOfNumbers):
res = []
for j in range(numberOfNumbers):
res.append(random.randint(rangeStart, rangeEnd))
return res
... |
"""
Convert english text to Morse code
"""
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
... |
<gh_stars>1000+
from os import environ as env
from twilio.rest import Client
# Twilio Config
ACCOUNT_SID = env.get("ACCOUNT_SID")
AUTH_TOKEN = env.get("AUTH_TOKEN")
FROM_NUMBER = env.get("FROM_NUMBER")
TO_NUMBER = env.get("TO_NUMBER")
# create a twilio client using account_sid and auth token
tw_client = Client(ACCOUN... |
package main
import (
"errors"
"fmt"
"io"
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
func uploadObject(bucket, region, key, filename strin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.