text stringlengths 1 1.05M |
|---|
class Users::InvitationsController < Devise::InvitationsController
def after_invite_path_for(inviter, invitee)
user_management_path
end
def after_accept_path_for(resource)
new_volunteer_path
end
end
|
#!/bin/bash
# file: src/bash/pgsql-runner.sh doc at the eof file
umask 022 ;
# set -x # print the commands
# set -v # print each input line as well
# set -e # exit the script if any statement returns a non-true return value. gotcha !!!
trap "exit $exit_code" TERM
export TOP_PID=$$
#v1.0.7
#----------------------... |
<filename>packages/gimbal/src/command/index.ts
import program, { Command as CommandType } from 'commander';
import Config from '@/config';
import EventEmitter from '@/event';
import Logger from '@/logger';
import output from '@/output';
import { StartEvent, EndEvent, ActionStartEvent, ActionEndEvent, Report } from '@/t... |
<filename>clusters/server/tests/recon_test.py
import unittest
from src.factory import DayFactory, TransactionsFactory
from src.day import Day
from src.recon import Recon
class ReconTest(unittest.TestCase):
def setUp(self):
self.D0: Day = DayFactory().create("D0", ["AAPL 100", "GOOG 200", "SP500 175.75"], ... |
<reponame>ctgriffiths/twister
/*
File: PluginsLoader.java ; This file is part of Twister.
Version: 2.001
Copyright (C) 2012-2013 , Luxoft
Authors: <NAME> <<EMAIL>>
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 ... |
<reponame>brighteningStar/rp
import {Errors} from './Errors';
export class Form {
constructor(data) {
this.originalData = data;
this.copyDataToForm(data);
this.errors = new Errors();
this.loading = false;
}
reset() {
for (let field in this.originalData) {
... |
<reponame>AmatanHead/collective-blog
"""Form field for the markdown field
It is based on the `CharField`.
Unlike `CharField`, it works with `Markdown` objects.
"""
from django import forms
from django.core import exceptions
from .datatype import Markdown
from .renderer import BaseRenderer
from .widgets import Markd... |
<reponame>trufflesuite/scaffold-eth
const { execSync } = require("child_process");
const args = " " + process.argv.slice(2).join(" ");
const execOption = { stdio: "inherit" };
const main = async () => {
// get network from command line arguments; set to localhost if not passed
let migrateCommand;
// put together... |
class Article:
def __init__(self, name, serial_id):
self.name = name
self.serial_id = serial_id
@classmethod
def generate_serial_id(cls, existing_serial_ids):
if not existing_serial_ids:
return "S-1"
else:
serial_numbers = [int(sid.split('-')[1]) for ... |
<reponame>ysdtkm/manual_graph_analyzer
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import cgi
import cgitb
import datetime
from hashlib import md5
import os
import pickle
import shutil
from string import Template
import sys
from classes import State, Node
def encode(ustr):
hash = md5(ustr.encode("utf8")).hexdi... |
<filename>include/tev/Lazy.h
// This file was developed by <NAME> <<EMAIL>>.
// It is published under the BSD 3-Clause License within the LICENSE file.
#pragma once
#include <tev/Common.h>
#include <tev/ThreadPool.h>
#include <chrono>
#include <functional>
#include <future>
TEV_NAMESPACE_BEGIN
// Encapsulates a la... |
<filename>lib/car/obj/src/ascend_ll.c
/* **** Notes
Ascend the current temporary knot position - i.e., (*argp).t in a pointer of the knot structure.
Deprecated..
di: Put the address for the current temporary knot i.e., (*argp).t in a pointer of the knot structure at.
si: Put the current temporary knot - or e.g., lea... |
package ch.hslu.pcp;
public class Stack implements Stackable {
private static final int DEFAULT_VALUE = Integer.MIN_VALUE;
private Element head;
@Override
public void push(Element element) {
if (!isEmpty()) {
element.setNext(head);
}
head = element;
}
@Ov... |
import { ValueObject } from '../../../core/valueObject';
import { Result } from '../../../core/resolve';
import { Url } from '../../../common/url';
interface RemoteUrlProps {
value: string;
}
export class RemoteUrl extends ValueObject<RemoteUrlProps> {
get value(): string {
return this.props.value;
}
pri... |
/*
* Copyright 2019 Adobe. All rights reserved.
* This file is licensed to you 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... |
<filename>src/tests/components/modals/EditRoom.test.js
import React from 'react'
import {shallow} from 'enzyme'
import {EditRoom} from '../../../components/modals/EditRoom'
test(`Render 'Edit Room' Modal`, () => {
const wrapper = shallow(<EditRoom/>)
expect(wrapper.getElement()).toMatchSnapshot()
}) |
docker run -it --rm -v $PWD:/tmp -w /tmp skywills87/card-detect-base python ./id_card_detection_image.py
docker run -it --rm \
-v $PWD:/tmp \
-v $PWD:/tmp/source \
-v $PWD:/tmp/target/ \
-w /tmp \
skywills87/card-detect-base python ./cropped.py -s /tmp/source -t /tmp/target
docker run -it --rm \
-v $PWD:/tmp \
-v /... |
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <filename> <serial> (example: ./upload.sh image.bin /dev/ttyUSB0)"
exit 1
fi
sudo stty -F $2 115200 cs8 -parenb -cstopb -ixoff
sx $1 < $2 > $2
|
#!/bin/bash
while true; do
echo 'Diagnostics as at ' $(date)
echo 'top'
top -bn1 -o +%MEM | head -n10 | tail -n4 | awk '{ printf("%-8s %-8s %-8s\n", $9, $10, $12); }'
echo
echo 'db'
pass=$(cat .env | grep SQLALCHEMY_DATABASE_URI | awk -F':' '{ print $3 }' | awk -F'@' '{ print $1 }')
PGPASSWORD=$pass p... |
#!/bin/bash
AUDITD_PATH=`dirname $(realpath "$0")`
cd $AUDITD_PATH
# check version
VERSION=latest
if [ ! -z $1 ]; then
VERSION=$1
fi
# remove old images
docker images | grep kubearmor/kubearmor-cos-auditd | awk '{print $3}' | xargs -I {} docker rmi -f {} 2> /dev/null
echo "[INFO] Removed existing kubearmor/k... |
#!/usr/bin/env bash
docker run --name hello-service-2 -p 8082:8080 --net=default -d step1/hello-service
|
#!/bin/bash
normalize_text() {
awk '{print tolower($0);}' < "$1" | LC_ALL=C sed -e 's/\./ \. /g' -e 's/<br \/>/ /g' -e 's/"/ " /g' \
-e 's/,/ , /g' -e 's/(/ ( /g' -e 's/)/ ) /g' -e 's/\!/ \! /g' -e 's/\?/ \? /g' \
-e 's/\;/ \; /g' -e 's/\:/ \: /g' > "$1"-norm
}
wget http://ai.stanford.edu/~amaas/data/senti... |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.iosPaperOutline = void 0;
var iosPaperOutline = {
"viewBox": "0 0 512 512",
"children": [{
"name": "g",
"attribs": {},
"children": [{
"name": "path",
"attribs": {
"d": "M112,64v16v320h16V80h304v33... |
teardown() {
set -u
echo "$unset_parameter"
}
@test "referencing unset parameter fails in teardown" {
:
}
|
#!/bin/bash
count=0
for i in $(cat ~/.bashrc); do
count=$((count+1))
echo "Word $count ($i) contains $(echo -n $i | wc -c) characters"
done
|
/*
* Copyright 2020 the original author or 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 applica... |
<reponame>DevopsChina/conf
import '@polymer/iron-icon';
import { html, PolymerElement } from '@polymer/polymer';
import 'plastic-image';
import { ReduxMixin } from '../mixins/redux-mixin';
import { dialogsActions, sessionsActions, toastActions } from '../redux/actions';
import { DIALOGS } from '../redux/constants';
imp... |
<reponame>Axam/nsx-web
# Copyright 2014 Mirantis, 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 ... |
#!/bin/bash
#
# Create a tar file containing wiki files
# from the mediawiki docker container.
set -eux
CONTAINER_NAME="stormy_mw"
STAMP="`date +"%Y%m%d"`"
function usage {
set +x
echo ""
echo "wikifiles_dump.sh script:"
echo ""
echo "Create a tar file containing wiki files"
echo "from the med... |
package bd.edu.daffodilvarsity.classmanager.adapters.recyclerViewAdapters;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
im... |
let canvas, ctx;
const particles = [];
const maxParticles = 1000;
const getRandomInt = (a, b) => Math.floor(Math.random() * (b - a + 1) + a);
const getRandomFloat = (a, b) => (Math.random() * (a - b) + b).toFixed(2);
const generateNewParticle = (init) => {
const height = getRandomInt(10, 15);
const y = (init ? g... |
<gh_stars>0
import { TelegramAccountEntity } from '../../entities/telegram-account.entity';
export const AddTelegramAccountToDatabasePortSymbol = Symbol('AddTelegramAccountToDatabasePort');
export interface IAddTelegramAccountToDatabasePort {
addTelegramAccountToDatabase(account: TelegramAccountEntity): Promise<voi... |
#!/bin/bash
awk -F: '{print $4}' /etc/passwd | while read -r gid; do
if ! grep -E -q "^.*?:[^:]*:$gid:" /etc/group; then
echo "The group ID \"$gid\" does not exist in /etc/group"
fi
done
|
docker network create -d overlay parse_net
docker volume create mongo_data
docker stack deploy -c mongodb.yml parse_01
docker stack deploy -c parse.yml parse_02
docker stack deploy -c parse_dashboard.yml parse_03
docker stack deploy -c ingress.yml parse_04
|
#!/bin/sh
set -e
mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
> "$RESOURCES_TO_COPY"
XCASSET_FILES=()
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
;;
1)
... |
<reponame>lananh265/social-network
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ic_border_inner_twotone = void 0;
var ic_border_inner_twotone = {
"viewBox": "0 0 24 24",
"children": [{
"name": "path",
"attribs": {
"d": "M0 0h24v24H0V0z",
"fill": "none"
... |
import AutoPosterSchema from './AutoPosterSchema.js';
export {
AutoPosterSchema,
};
|
<gh_stars>1-10
package br.com.jmsstudio.jumper.elements;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import br.com.jmsstudio.jumper.R;
import br.com.jmsstudio.jumper.graphics.Screen;
/**
* Created by jms on 12/01/17.
*/
publ... |
var express = require('express');
var fortune = require('./lib/fortune.js');
var formidable = require('formidable');
var credentials = require('./credentials.js');
var app = express();
app.set('port', process.env.PORT || 3000);
var handlebars = require('express-handlebars').create({
defaultLayout:'main',
helpers:... |
let str = "Hello World!"
var frequencyMap = [Character: Int]()
for char in str {
if let value = frequencyMap[char] {
frequencyMap[char] = value + 1
} else {
frequencyMap[char] = 1
}
}
for (char, count) in frequencyMap {
print("\(char): \(count)")
}
// Output:
// H: 1
// e: 1
// l: 3
// o: 2
// : 1
// W: 1
//... |
<gh_stars>10-100
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// G... |
describe("BankAccount", function() {
it("is initialized with different properties", function() {
var newAccount = new BankAccount("<NAME>", 350);
expect(newAccount.name).to.equal("<NAME>");
expect(newAccount.balance).to.equal(350);
});
it("deposits money into the account", function() {
var newAcc... |
#!/bin/bash
set -euo pipefail
env GOOS=linux GARCH=amd64 CGO_ENABLED=0 go build
docker build -t armakuni/circleci-workflow-dashboard .
|
# types/common.sh
mypy_() {
local system=mypy
local pip_global=/usr/local/bin/mypy
local pip_user=~/.local/bin/mypy
if test -x $pip_user; then
$pip_user "$@"
elif test -x $pip_global; then
$pip_global "$@"
else
$system "$@"
fi
}
typecheck() {
# we 'import libc' but the source is native/li... |
package auth_test
import (
"errors"
"testing"
"github.com/revel/modules/auth/basic"
"github.com/revel/modules/auth/basic/driver/secret"
)
type User struct {
email string
password string
hashpass string
secret.BcryptAuth // SecurityDriver for testing
}
func NewUser(email, pass string) *User {
u := &User... |
<gh_stars>1000+
/*
* Copyright (C) 2015 The Dagger 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 appl... |
import team
import consts
from nba_py import constants
from numpy import mean
name_to_index = {consts.points: 32, consts.assists: 27, consts.rebounds: 26, consts.steals: 29, consts.blocks: 31,
'year': 3}
class League:
def __init__(self):
self.teams = get_teams_info()
def calculate_... |
#!/bin/bash
COMPOSE="/usr/local/bin/docker-compose --no-ansi"
DOCKER="/usr/bin/docker"
# shellcheck disable=SC2164
cd /home/masha/almond-be/
$COMPOSE run certbot renew --dry-run && $COMPOSE kill -s SIGHUP webserver
$DOCKER system prune -af
|
#include "../../../include/odfaeg/Graphics/viewportMatrix.h"
namespace odfaeg {
namespace graphic {
ViewportMatrix::ViewportMatrix() {
viewportUpdated = true;
scale = math::Vec3f(1.f, 1.f, 1.f);
position = math::Vec3f(-1.f, -1.f, -1.f);
size = math::Vec3f(2.f,... |
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER villagebook_test;
CREATE DATABASE villagebook_test;
GRANT ALL PRIVILEGES ON DATABASE villagebook_test TO villagebook_test;
EOSQL
|
#!/usr/bin/env bash
set -eou pipefail
if [ $# -ne 2 ]
then
echo "usage: $0 <workflow_name> <resource_name>"
exit 1
fi
resource_name=$1
workflow_name=$2
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
state_dir="${TILT_WORKFLOW_STATE_PATH:-$script_dir}"
while read -r CMD_LINE
do
$CMD_... |
/*
* dbtype_PropertyDirectory.cpp
*/
#include <string>
#include <stddef.h>
#include <vector>
#include <map>
#include <sstream>
#include <ostream>
#include "logging/log_Logger.h"
#include "osinterface/osinterface_OsTypes.h"
#include "dbtypes/dbtype_PropertyDirectory.h"
#include "dbtypes/dbtype_PropertyData.h"
#in... |
package com.github.shimmerjordan.exam.mapper;
import com.github.shimmerjordan.common.core.persistence.CrudMapper;
import com.github.shimmerjordan.exam.api.module.Answer;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 答题Mapper
*
* @author shimmerjordan
* @date 2021/03/08 21:09
*/
@Mapp... |
<gh_stars>0
/* jshint indent: 1 */
module.exports = function(sequelize, DataTypes) {
return sequelize.define('dorCuvSubs', {
coname: {
type: DataTypes.CHAR,
allowNull: true,
field: 'CONAME'
},
conum: {
type: DataTypes.CHAR,
allowNull: true,
field: 'CONUM'
},
digyr: {
type: DataTypes.INT... |
#!/bin/sh
set -e
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
install_framework()
{
local source="${BUILT_PRODUCTS_DIR}/Pods-Chillapp/$1"
local destinatio... |
package decorator
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/session"
sparta "github.com/mweagle/Sparta"
cfCustomResources "github.com/mweagle/Sparta/aws/cloudformation/resources"
gocf "github.com/mweagle/go-cloudformation"
"github.com/sirupsen/logrus"
)
// S3ArtifactPublisherDecorator returns a ServiceDeco... |
package weixin.liuliangbao.flowcard.Service.impl;
import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import weixin.liuliangbao.flowcard.Entity.FlowCardDeliveryInfoEntity;
import weixin.liu... |
<filename>ViewPagerDemo/src/main/java/com/creadigol/inshort/Gcm/MyFirebaseInstanceIDService.java<gh_stars>0
package com.creadigol.inshort.Gcm;
/**
* Created by Vj on 2/8/2017.
*/
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.android.volley.AuthFailur... |
<reponame>cn2oo8/molicode<gh_stars>10-100
/**
* Copyright(C) 2004-2017 shareyi.com All Right Reserved
*/
package com.shareyi.molicode.common.valid.group;
/**
* <p>
* 新增操作
* </p>
*
* @author david
* @date 2017-09-14 11:31
*/
public interface Creating {
}
|
# main.py COPYRIGHT Fujitsu Limited 2021
from argparse import ArgumentParser
from collections import OrderedDict
import copy
import os
import torch
from torchvision import transforms as T
import torchvision.datasets as datasets
from tqdm import tqdm
#from cac import auto_prune
import sys
sys.path.append('../../')
fro... |
#!/usr/bin/env bash
set -e
cmd="$1"
shift
until $cmd; do
>&2 echo "Waiting..."
sleep 1
done
>&2 echo "Executing command"
exec "$@"
|
../ghc/dist-stage2/build/ghc/ghc \
-B.. \
--interactive \
Test.hs
|
from .inference_methods import (inference_qpbo, inference_lp,
inference_ad3, inference_ogm,
inference_dispatch, get_installed)
from .common import compute_energy
__all__ = ["inference_qpbo", "inference_lp", "inference_ad3",
"inference_dispatch"... |
import { JSONObject } from './json';
export type MitosisNode = {
'@type': '@builder.io/mitosis/node';
name: string;
meta: JSONObject;
/**
* Key-value store of string values for DOM attributes.
* ```js
* {
* defaultValue: 'initial text',
* width: '100px',
* }
* ```
*/
properties: {... |
<gh_stars>0
// Code generated by ogen, DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"io"
"math"
"math/bits"
"net"
"net/http"
"net/url"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"time"
"github.com/go-faster/errors"
"github.com/go-faster/jx"
"github.com/google/uuid"
"github.com/ogen-go... |
class AttributeLabelManager
{
private $attributeLabels = [];
/**
* Add a new attribute label.
* @param string $attribute The attribute name
* @param string $label The label for the attribute
*/
public function addLabel($attribute, $label)
{
$this->attributeLabels[$attribute]... |
<reponame>shin-kinoshita/dbflute-core
/*
* Copyright 2014-2018 the original author or 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/LI... |
#!/bin/bash
swift build -Xlinker -L/usr/local/lib
./.build/x86_64-apple-macosx/debug/Flea "$@" |
<gh_stars>0
import { Component, OnInit } from '@angular/core';
import { ServicingService } from '../services/addServicing.service';
import { Router } from '@angular/router';
import { QueueTableService } from '../services/queue-table.service';
import { NgxSpinnerService } from 'ngx-spinner';
import { NgbDateStruct, NgbD... |
#!/bin/sh
# you will need to read the top level README, and run boostrap.py
# and buildout in order to make pyjsbuild
options="$*"
#if [ -z $options ] ; then options="-O";fi
../../bin/pyjsbuild --print-statements -m $options Hello
|
<filename>src/AjaxClient.js<gh_stars>1-10
/**
* AjaxClient
* Simple XMLHttpRequest client.
* Now supported 'post' method,dataType 'json'
*/
export class AjaxClient {
constructor() {
}
getAsync(options) {
options.type = 'get';
this.ajax(options);
}
postAsync(options) {
options.type = 'post'... |
#!/bin/bash
# testing compilation of generated kotlin models
rm -rf ../generated/kotlin
pushd ../
python3 generator.py
popd
cp -f ../build-files/kotlin-build.gradle ../generated/kotlin
mv ../generated/kotlin/kotlin-build.gradle ../generated/kotlin/build.gradle
pushd ../generated/kotlin
#gradle compileKotlin --info... |
#!/bin/bash
dieharder -d 101 -g 209 -S 3271649736
|
<reponame>ethan-choe/Proto-01<gh_stars>0
const Phaser = require('phaser');
const SerialPortReader = require('../SerialPortReader.js')
class EndScene extends Phaser.Scene {
constructor() {
super('EndScene');
SerialPortReader.addListener(this.onSerialMessage.bind(this));
}
onSerialMessage(msg) {
this.... |
#!/usr/bin/env bash
# ----------------------------------------------------------------------
# Runs all crawlers.
# ----------------------------------------------------------------------
function make_backup_of() {
BKP_FILENAME="${1}.bkp"
if [ -f $BKP_FILENAME ]; then
rm $BKP_FILENAME
fi
if [... |
#!/bin/bash
## oc new-project imagenes-wordpress --description="Crea las imagenes de mysql8 y wp" --display-name="Imagenes-Wordpress"
## ssh-keygen -f /home/origin/.ssh/id_rsa -b 2048 -t rsa -q -N '' -m pem -C 'ctrl.srv.lab'
## oc secrets new-sshauth github-secret-pc --ssh-privatekey='/home/emilio/.ssh/id_rsa'
## u... |
"""Hashing module
A simple module for hashing.
Contains base class :py:class:`Hash` from which all
hash implementations inherits.
For now contains only MD5 hash class :py:class:`Md5`
"""
from .hash import Hash
from .md5 import Md5
__all__ = ["Hash", "Md5"]
|
<gh_stars>1-10
package parse
import (
"fmt"
"funlang/ast"
"testing"
)
func TestParseExpression(t *testing.T) {
parser := newParser("10+30")
parser.advance()
a := parser.parseExpression()
if len(parser.errs.list) > 0 {
t.Error("errors were not expected in this case", parser.errs.Error())
}
if _, ok := a.(*a... |
function distanceToPlane(pointX, pointY, pointZ, planeNormalX, planeNormalY, planeNormalZ, planePointX, planePointY, planePointZ) {
// Calculate the distance using the formula: distance = |(point - planePoint) dot product planeNormal| / |planeNormal|
const pointVector = new Cesium.Cartesian3(pointX, pointY, poi... |
#!/bin/bash
rm -Rfv linux-host || exit 1
mkdir -p linux-host || exit 1
rm -Rfv linux-build || exit 1
mkdir -p linux-build || exit 1
chmod +x configure || exit 1
srcdir="`pwd`"
instdir="`pwd`/linux-host"
cd linux-build || exit 1
../configure || exit 1
make -j || exit 1
mkdir ../linux-host/include || exit 1
cp -v *... |
def validate_and_add_movie(title, year):
if not title or not year:
return "title and year are required.", True # Flash message and redirect
elif len(year) != 4 or len(title) > 60:
return "info format is invalid", True # Flash message and redirect
else:
movie = Movie(title=title, ye... |
<reponame>alex-dorokhov/gdx-pay
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* 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 L... |
package io.cattle.platform.trigger;
import static io.cattle.platform.core.model.tables.HostTable.*;
import io.cattle.platform.core.addon.metadata.InstanceInfo;
import io.cattle.platform.core.constants.ServiceConstants;
import io.cattle.platform.core.dao.ServiceDao;
import io.cattle.platform.core.dao.VolumeDao;
import... |
function extractSourceMapFilename(sourceMappingURL) {
const match = sourceMappingURL.match(/=(.*).map/);
if (match) {
return match[1];
} else {
return "Invalid sourceMappingURL format";
}
}
// Test the function
const sourceMappingURL = "//# sourceMappingURL=TSpanElement.d.ts.map";
console.log(extractSo... |
package conf
import (
"github.com/hesen/blog/middleware"
)
// IgnoredAuthPath 不需要验证的路由
var IgnoredAuthPath = &middleware.PathRegexp{ "login$", }
// [...]string{
// "login$",
// }
|
<reponame>seawindnick/javaFamily<gh_stars>0
package com.java.study.algorithm.zuo.dadvanced.advanced_class_04;
/**
* 调整[0,x)区间上的数出现的概率
* 【题目】
* 假设函数Math.random()等概率随机返回一个在[0,1)范围上的 数,那么我们知道,在[0,x)区间上的数出现的概率为x (0<x≤1)。
* 给定一个大于0的整数k,并且可以使用 Math.random()函数,请实现一个函数依然返回在[0,1)范围上 的数,但是在[0,x)区间上的数出现的概率为xk(0<x≤1)。
*/
pub... |
<filename>components/builder-web/app/shared/channels/channels.component.ts<gh_stars>10-100
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obt... |
# Import necessary modules
from django.core.mail import send_mail
from staff.models import Staff
def send_email_to_staff(subject, message):
# Get all active staff members
active_staff_members = Staff.objects.filter(is_active=True)
# Send email to all active staff members
send_mail(subject, message, 's... |
import { BaseColor } from './base-color.class';
/**
* HSB and HSV are the same
*
* Hue = ranges from 0 to 360°
* Saturation = ranges from 0 to 100%
* Brightness or Value = ranges from 0 to 100%
* Alpha = range from 0-1
*/
export declare class Hsva extends BaseColor {
hue: number;
saturation: n... |
#!/bin/bash
# Name:mysql.sh
# This is a ShellScript For Auto DB Backup and Delete old Backup
#
# create mysql backup user:
# grant select,lock tables,show databases,show view,event,reload,super,file on *.* to 'mysqlbackuper'@'localhost' identified by 'PASSWORD';
# flush privileges;
#
set -e
readonly BASE_PATH=$(c... |
<gh_stars>1-10
#ifndef token_h
#define token_h
#include "array.h"
#include <gc/cord.h>
struct Module;
struct Token;
/**
* This is attached to operation tokens and is called later to do the actual byte code
* generation.
*/
typedef int (*f_inst_call)(struct Module *state, struct Token *type, array_t *params);
/*... |
import cv2
import numpy as np
def visualize_persons(img, person_dicts):
for person in person_dicts:
bbox = person['bbox']
label = person['label']
x_min, y_min, x_max, y_max = bbox
color = (0, 255, 0) # BGR color for bounding box (green in this case)
thickness = 2 # Thickne... |
def add(x, y):
#Add x and y and return the result
return x + y
def subtract(x, y):
#Subtract y from x and return the result
return x - y
def multiply(x, y):
#Multiply x and y and return the result
return x * y
def divide(x, y):
#Divide x by y and return the result
return x / y
def exponentiate(x, y)... |
<reponame>vadi2/codeql
package org.springframework.security.config.annotation.web.builders;
import org.springframework.security.config.annotation.AbstractConfiguredSecurityBuilder;
import org.springframework.security.config.annotation.SecurityBuilder;
import org.springframework.security.config.annotation.web.HttpSecur... |
package com.acgist.snail.gui.javafx.window.main;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.acgist.snail.config.SystemConfig;
import com.acgist.snail.gui.javafx.Desktops;
import com.acgist.snail.gui.javafx.window.Window;
import com.acgist.snail.gui.javafx.window.statistics.StatisticsWindow;
... |
<reponame>Leyla-Li/data-structures-and-algorithms<filename>401-challenges/linkedList/__test__/linked-list.test.js
'use strict';
const LinkedList = require('../linked-list');
const linkedList = new LinkedList();
describe('test for linkLists methods', ()=>{
it('can insert() a node at head', ()=>{
let val... |
(function () {
'use strict';
const Beacon = cordova.require('fr.milky.cordova.smartbeacon.Beacon');
const Constructor = BeaconList;
const _super = Array.prototype;
function BeaconList(array) {
if (array.__isBeaconList__) return array;
if (this && this instanceof BeaconList) throw new Error('With this... |
def most_frequent(lst):
max = 0
frequent = lst[0]
for item in lst:
freq = lst.count(item)
if freq > max:
max = freq
frequent = item
return frequent |
<gh_stars>1-10
const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const gigSchema = new Schema({
gigName: { type: String },
gigType: { type: String },
userName: { type: String },
phoneNum: { type: String, required: false },
email: { type: String },
dateBooked: { type: Date, default: Date... |
#!/bin/bash
#$ -cwd
#Abort on any error,
#set -e
#echo Running on $HOSTNAME
#echo Current PATH is $PATH
#source $HOME/.bash_profile
################################################################
# Variables: FILLL IN DOWN TO THE END OF VARIABLES
Phy_dir=$HOME/scratch/tree_health/ITS_ratio/WORKED_Phytophthora_infest... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.