text stringlengths 1 1.05M |
|---|
#!/bin/bash
# Derive the list of active POR (point of reference) entries
# for any given language, from the OPTD-maintained data file of POR:
# ../opentraveldata/optd_por_public.csv
#
# => optd_por_public_lang.csv
#
##
# Temporary path
TMP_DIR="/tmp/por"
##
# Path of the executable: set it to empty when this is the ... |
<gh_stars>0
import {SetLiveValidatorResult} from "./types"
import {LiveValidator, HookProps, ControlOutputDataProps} from "@common-types"
/**
* @description
* Записывает результат живого валидатора, в объект вывода данных контрола
*
* @param {LiveValidator} validator - Живой валидатор, результат которого будет за... |
#!/bin/sh
# Copyright 2018 Google 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 to i... |
<reponame>EdixonAlberto/instagrapi
import axios from 'axios';
class Request {
public static async api(query: string): Promise<TInstagramApi | TPostApi> {
const isUrl = query.search(/^(https)/) > -1;
const url: string = isUrl ? query : `${global.config.urlBase}/${query}`;
const { status, data } = await a... |
import sys
from utils.console import parse_arguments, create_progressbar
from utils.output import write_to_console, write_to_file, generate_json, generate_text
from utils.vkontakte import fetch_messages_by_user_id, get_messages_count, create_api_connection
from analyze import generate_analyze_results
if __name__ == '... |
<filename>nmap2md.py
#!/usr/bin/env python
import re
import sys
import magic
import xml.etree.ElementTree as ET
from optparse import OptionParser
import columns_definition
__version__ = "1.1.0"
parser = OptionParser(usage="%prog [options] file.xml", version="%prog " + __version__)
parser.add_option("-c", "--column... |
def objective_function(x):
return x**2 + 6*x - 4
def find_local_minima(func):
x = 0
delta = 0.01
while True:
x_new = x + delta
if objective_function(x_new) < objective_function(x):
x = x_new
else:
return x
print('The local minima is', find_local_minima(objective_function)) |
/* ###
* IP: GHIDRA
*
* 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 writin... |
package main
import (
"fmt"
)
// lowestIndex simply returns the index of the lowest value in the array starting
// at "start"
func lowestIndex(a []int, start int) (lowest int) {
lowest = start
for i := start + 1; i < len(a); i++ {
if a[i] < a[lowest] {
lowest = i
}
}
return
}
func selectionSort(arr ... |
var config = {
GOOGLE_PLACE_API_KEY: "<KEY>",
WEATHER_API_KEY: "<KEY>",
};
|
CUDA_VISIBLE_DEVICES=0 python ./tools/test_net.py \
--config-file ms_mask_rcnn_R_50_FPN_3dce_mod.yaml \
--ckpt ./ms_mask_rcnn_R_50_FPN_3dce_mod_resnet/model_final.pth \
TEST.IMS_PER_BATCH 2 DATALOADER.NUM_WORKERS 1
|
<reponame>smagill/opensphere-desktop
package io.opensphere.filterbuilder.state;
import java.util.List;
import javax.xml.parsers.ParserConfigurationException;
import org.junit.Assert;
import org.junit.Test;
import org.w3c.dom.Document;
import com.bitsys.fade.mist.state.v4.QueryEntryType;
import io.opensphere.core.m... |
<filename>routes/download.js
exports.download = (req, res) => {
try {
console.log("User requested file :", req.query.name);
res.sendFile(req.query.name);
} catch (err) {
console.error(err);
res.render("error", { err: JSON.stringify(err) });
}
};
|
export const CREATE_EVENT = 'CREATE_EVENT';
export const FETCH_ALL_EVENT = 'FETCH_ALL_EVENT';
export const UPDATE_EVENT = 'UPDATE_EVENT';
export const DELETE_EVENT = 'DELETE_EVENT';
export const AUTH = "AUTH";
export const LOGOUT = "LOGOUT";
export const SIGNUP = "SIGNUP";
export const LOGIN = "LOGIN";
export const SEA... |
<filename>sdk/src/main/java/com/iovation/launchkey/sdk/error/AuthorizationInProgress.java
package com.iovation.launchkey.sdk.error;
import java.util.Date;
import java.util.Objects;
public class AuthorizationInProgress extends InvalidRequestException {
private final String authorizationRequestId;
private final... |
module MechanicalTurk
class TurksController < BaseController
def index
@turks = Turk.all
end
def show
@turk = Turk.get(params[:id])
end
end
end
|
#!/bin/bash
# Common functions definitions
function check_fileServerType_param
{
local fileServerType=$1
if [ "$fileServerType" != "gluster" -a "$fileServerType" != "azurefiles" -a "$fileServerType" != "nfs" ]; then
echo "Invalid fileServerType ($fileServerType) given. Only 'gluster', 'azurefiles' or ... |
<reponame>naga-project/webfx
package dev.webfx.kit.mapper.peers.javafxcontrols.base;
import javafx.scene.control.ToggleButton;
/**
* @author <NAME>
*/
public interface ToggleButtonPeerMixin
<N extends ToggleButton, NB extends ToggleButtonPeerBase<N, NB, NM>, NM extends ToggleButtonPeerMixin<N, NB, NM>>
... |
export STARDLLS_VERSION=1.3.0
export DIPC_VERSION=1.5.0
export STARCORE_VERSION=1.3.8
export STARLANG_VERSION=1.1.0
export PROTOCOL_VERSION=1.2.1
|
#!/bin/bash
# EPOS Command Library 6.6.2.0 installation script
# Copyright (c) maxon motor ag 2014-2020
if [[ $UID != 0 ]]; then
echo 'Please run this installation script with sudo:'
echo 'sudo' $0 $*
exit 1
fi
function check_result {
if (($? > 0)); then
printf ' [FAILED]\n'
else
printf ' [OK]\n'
fi
}
func... |
source <(kubectl completion zsh)
# function kubectx {
# if [ -z "$1" ]; then
# kubectl config get-contexts
# else
# kubectl config use-context $1
# fi
# }
# function kubens {
# if [[ -z "$1" ]]; then
# kubectl get ns
# else
# kubectl config set-context --current --namespace=$1
# fi
# }
# ... |
<reponame>prasadtechnology/vertx<filename>src/main/java/io/vertx/blog/first/MyFirstVerticle.java<gh_stars>0
package io.vertx.blog.first;
import java.util.LinkedHashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Future;
i... |
<gh_stars>1-10
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
import common
from datadog_checks.cassandra_nodetool import CassandraNodetoolCheck
@pytest.mark.integration
def test_integration(aggregator, cassandra_cluster):
"""
Testing... |
#!/bin/sh
/deploy/api0/bin/api0 foreground -mnesia dir '"/deploy/data/api0"' |
def parse_config(config_file_path: str) -> dict:
config = {}
with open(config_file_path, 'r') as file:
for line in file:
key, value = line.strip().split(' = ')
if value.lower() == 'true':
value = True
elif value.lower() == 'false':
valu... |
<filename>lib/osa/util/constants.rb
# frozen_string_literal: true
module OSA
CLIENT_ID = 'befa4a9e-5d16-4a48-9792-4bd1d125abe8'
REDIRECT_URL = 'https://storage.googleapis.com/outlook-spam-automator/login.html'
SCOPE = 'https://graph.microsoft.com/Mail.ReadWrite https://graph.microsoft.com/MailboxSettings.ReadWri... |
public class Account {
private int accountNumber;
private double currentBalance;
private ArrayList<Transaction> transactions;
public Account(int accountNumber) {
this.accountNumber = accountNumber;
this.currentBalance = 0;
this.transactions = new ArrayList<>();
}
public int getAccountNumber() {
return a... |
import pandas as pd
class eQTLAnalyzer:
def __init__(self, annot, dosages, gene_name):
self.annot = annot
self.dosages = dosages
ordering = self.annot['pos'].argsort()
self.annot = self.annot.iloc[ordering, :]
self.dosages = self.dosages.iloc[ordering, :]
self.gene_n... |
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import configureStore from 'src/redux/configureStore';
import { createAuthListener } from 'src/redux/modules/auth';
import Auth from 'src/Auth';
import ErrorBoundary from 'src/ErrorBoundary';
import { initAnalytics } fr... |
<filename>fractions/microprofile/microprofile-metrics/src/main/java/org/wildfly/swarm/microprofile/metrics/deployment/AMetricRegistryFactory.java
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (t... |
package com.epam.reportportal.extension.azure;
import com.epam.reportportal.extension.CommonPluginCommand;
import com.epam.reportportal.extension.IntegrationGroupEnum;
import com.epam.reportportal.extension.PluginCommand;
import com.epam.reportportal.extension.ReportPortalExtensionPoint;
import com.epam.reportportal.e... |
# coding: utf-8
# ## Aim
#
# Analyse the drifts on the tuning tape
# In[95]:
from imctools.io import txtparser
import matplotlib.pyplot as plt
import os
import seaborn as sns
import pandas as pd
import numpy as np
get_ipython().magic('matplotlib notebook')
# Define the variables:
# The folder should contain th... |
#!/bin/bash
set -eE
trap 'echo "An error occured, policy was not deployed"' ERR
./cleanup.sh
kubectl create configmap ingress-whitelist --from-file=ingress-whitelist.rego -n opa &> /dev/null
kubectl apply -f namespaces.yaml &> /dev/null
echo "Policy deployed!!!" |
#!/bin/bash
# Generic Colorize Functions
RED="`tput setaf 1`"
GREEN="`tput setaf 2`"
YELLOW="`tput setaf 3`"
BLUE="`tput setaf 4`"
MAGENTA="`tput setaf 5`"
CYAN="`tput setaf 6`"
WHITE="`tput setaf 7`"
RESET="`tput sgr0`"
function colorize() {
if [[ "$USE_COLORS" != "no" ]]; then
c="$1"
shift
... |
#!/bin/bash
# This file contains some utilities to test the elasticsearch scripts with
# the .deb/.rpm packages.
# WARNING: This testing file must be executed as root and can
# dramatically change your system. It should only be executed
# in a throw-away VM like those made by the Vagrantfile at
# the root of the Elas... |
#!/bin/sh
[ ! -n "$1" ] && echo "1st arg (target_dir) is required." && exit 0
rsync -avh --progress \
--include 'src/***' --include 'lib/***' --exclude '*' \
. $1/node_modules/coreds
|
import argparse
# Create an ArgumentParser object
parser = argparse.ArgumentParser()
# Add the command-line arguments expected by the avaStarter program
parser.add_argument('-nodeList', help='File containing the list of nodes')
parser.add_argument('-isController', help='Indicates if the node is the controller')
parse... |
<filename>src/infra/database/models/batatinha/BatatinhaSchema.js
const { Schema } = require('mongoose');
module.exports = () => {
const batatinhaSchema = new Schema({
batatinha_header: {
type: String,
required: true
},
batatinha_id: {
type: String,
required: true,
},
batat... |
#!/bin/bash
cp .env.dev .env
docker-compose up -d |
# Copyright 2018-2021 Streamlit 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 to in wr... |
# (C) Copyright 2017 Hewlett Packard Enterprise Development LP.
#
# 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... |
def find_all_occurrences(document, word):
word_list = []
for line in document.splitlines():
index = 0
while index < len(line):
index = line.find(word, index)
if index == -1:
break
word_list.append((index, line[index]))
index += 1
return word_list |
<filename>go/arrow/memory/util.go
// 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, Versi... |
#!/usr/bin/env python3
import logging
import datetime
from PIL import Image
from pytesseract import image_to_string
from bs4 import BeautifulSoup
from urllib.request import urlopen, Request
from io import BytesIO
import re
# The arrow library is used to handle datetimes
import arrow
# The request library is used to ... |
package ma.ensias.ticket_me.adpater;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recycler... |
def freq_table(arr):
freq_dict = {}
for i in arr:
if i not in freq_dict:
freq_dict[i] = arr.count(i)
return freq_dict |
const {describe, it} = require('mocha');
const should = require('should');
const sinon = require('sinon');
const StripeAPIService = require('@tryghost/members-stripe-service');
const StripeWebhookService = require('../../../../lib/services/stripe-webhook');
const ProductRepository = require('../../../../lib/repositorie... |
#! /bin/bash
###########################################
#
###########################################
# constants
baseDir=$(cd `dirname "$0"`;pwd)
# functions
# main
[ -z "${BASH_SOURCE[0]}" -o "${BASH_SOURCE[0]}" = "$0" ] || return
cd $baseDir/..
if [ -d ./private/plugins ]; then
./private/plugins/scripts/un... |
#!/bin/bash
# This script provides common script functions for the hacks
# Requires STI_ROOT to be set
set -o errexit
set -o nounset
set -o pipefail
# The root of the build/dist directory
STI_ROOT=$(
unset CDPATH
sti_root=$(dirname "${BASH_SOURCE}")/..
cd "${sti_root}"
pwd
)
STI_OUTPUT_SUBPATH="${STI_OUTPUT... |
package lx.calibre.util;
public final class ConvertUtils {
private ConvertUtils() {
}
public static long toLong(Object obj) {
return ((Number) obj).longValue();
}
public static String toString(Object obj) {
return obj != null ? obj.toString() : null;
}
public static Double toDouble(Object obj) {
if (o... |
/*
* MIT License
*
* Copyright (c) 2018 <NAME> (@smallcreep) <<EMAIL>>
*
* 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
*... |
<reponame>shanghai-edu/vsphere-mon<gh_stars>1-10
package core
//NewMetricValue decorate metric object,return new metric with tags
func NewMetricValue(endpoint, metric string, val interface{}, dataType string, tags map[string]string) *MetricValue {
mv := MetricValue{
Endpoint: endpoint,
Metric: metric,
... |
<filename>Include/KAI/Core/Type/ContainerOperations.h
#pragma once
#include <KAI/Core/Config/Base.h>
#include <KAI/Core/Base.h>
#include <KAI/Core/TriColor.h>
KAI_TYPE_BEGIN
template <typename Reference, bool IsContainer>
struct ContainerOperations
{
struct ColorSetter
{
ObjectColor::Color _c;
... |
<reponame>OhFinance/oh-app
import { Box, Grid } from "@material-ui/core";
import { Button, DOCS_URL, Flex, Heading, Subtitle } from "@ohfinance/oh-ui";
import { Web3ProviderButton } from "components/Web3ProviderButton";
import connectors from "config/constants/connectors";
const Login = () => {
return (
<Flex ce... |
#!/bin/sh
set -o errexit
TAG_VERSION=$1
BUILD_DIRECTORY=$2
function usage()
{
echo "This script builds the dynamically and statically linked version"
echo "and generates the checksum files of the Athena tag provided."
echo
echo "USAGE: $0 <tag> <build-directory>"
echo
exit 1
}
function check... |
import tensorflow as tf
print("Creating tensors...")
# These operations return a tensor.
t1 = tf.add(1,2)
t2 = tf.sub(1,2)
t3 = tf.mul(1,2)
t4 = tf.div(1,2)
# Create a session
sess = tf.Session()
result = sess.run(t1)
print(result)
result = sess.run(t2)
print(result)
result = sess.run(t3)
print(result)
result = sess... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 6 14:34:08 2020
@author: CodeAndQuarks
Desc: A simple random maze generator that randomly creates a maze of size
in the range of (3x3-20x20).
There are modules I could have used to randomise the range,
but I wanted to see if I could randomise it m... |
#!/bin/bash
SUBMISSION_URL="http://vcloud.sosy-lab.org/submit.php"
function print_help_and_exit {
echo "Submit files to VerifierCloud."
echo "Parameters:"
echo " --help Print this help"
echo " --analysis Analysis to use"
echo " --file File for verification"
exit
}
# loop over all input para... |
#!/bin/sh
set -e
export REPOSITORY_NAME="panvala/frontend"
scripts/publish-image.sh
|
(function(){
'use strict';
/**
* Code module for services.
*
* @author <NAME>
* @author $Author: fzhang $
* @version $Revision: 643 $ $Date: 2015-03-31 12:38:41 -0600 (Tue, 31 Mar 2015) $
*/
angular.module('services', []);
}());
|
<gh_stars>0
package auth
import "golang.org/x/oauth2"
// NewDropboxProvider defines details needed use Dropbox for OAuth2
// authorization.
//
// https://www.dropbox.com/developers/reference/oauth-guide
func NewDropboxProvider() *AuthProvider {
return &AuthProvider{
ID: Dropbox,
Key: "dropbox",
Enable... |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const state = {
count: 0,
interval: 0,
};
chrome.action.onClicked.addListener(onClicked);
chrome.runtime.onInstalled.addListener(onInstalled);
function onInstalled() {
state.interval = Math.ceil(5 * Math.rando... |
// +build !pro,!ent
package nomad
type EnterpriseState struct{}
func (s *Server) setupEnterprise(config *Config) error {
return nil
}
func (s *Server) startEnterpriseBackground() {}
|
import { combineReducers } from 'redux'
import home from './HomeReducer'
const reducer = (handlers, state, action) =>
handlers[action.type] ? handlers[action.type](state, action) : state
export default combineReducers({
home: home(reducer)
})
|
package com.yan.demo.dao;
import com.yan.demo.bean.OnClass;
import com.yan.demo.bean.OnClassExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface OnClassMapper {
long countByExample(OnClassExample example);
int deleteByExample(OnClassExample example);
int deleteByP... |
#!/bin/bash
MD="mdd"
CH="ch.md"
[ -e $MD ] && rm -rf $MD
mkdir $MD
# Collect files.
cp index.rst $MD/
cp -R img $MD/
for f in chapter*/*; do
dir=$(dirname "$f")
if [ "${f##*.}" = "md" ] || [ "${f##*.}" = "ipynb" ]; then
mkdir -p $MD/$dir
cp $f $MD/$f
fi
done
# ipynb to md.
for f in $MD/chapter*/*ipynb; do
... |
<filename>mosby-utils/src/main/java/net/fangcunjian/mosby/utils/logger/Logger.java
package net.fangcunjian.mosby.utils.logger;
/**
* Logger is a wrapper of {@link android.util.Log}
* But more pretty, simple and powerful
*/
public final class Logger {
public static final String DEFAULT_TAG = "Logger";
priv... |
#!/bin/bash -e
# exit on error to make sure they get resolved
# get common functionality
[ -z "${lib_dir}" ] && . ../../common.sh
# nos_template stdout
nos_set_evar engine_template_dir '/tmp'
echo "{{big_deal}}" > /tmp/nos_template.mustache
out=$(nos_template 'nos_template.mustache' '-' '{ "big_deal": "mustache"}')
i... |
<filename>src/Bounds2D.ts
export default class Bounds2D{
left:number
top:number
right:number
bottom:number
constructor(left:number, top:number, right:number, bottom:number){
this.left = left
this.top = top
this.right = right
this.bottom = bottom
}
get x(){
return this.left
}
get y(){
return this... |
// RBException.h
// #define _SCL_SECURE_NO_WARNINGS
#ifndef SURFACE_EXCEPTION_H
#define SURFACE_EXCEPTION_H
#pragma once
#include <wx/string.h>
#include <wx/msw/winundef.h>
class RBException
{
public:
RBException(const wxString & msg)
: wxstrMsg( msg)
{ }
const wxChar *what() const
{
return w... |
<filename>pb5/balloons.py
#!/usr/bin/env python3
import sys
import os
import logging
import argparse
import itertools
from wordpal import puzzicon
_log = logging.getLogger(__name__)
_BLANK = '?'
class WordSearcher(object):
def __init__(self, puzzeme_set):
self.puzzerarian = puzzicon.Puzzarian(puzzeme_s... |
package com.example.google3;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.google.firebase.auth.FirebaseAuth;
import com.g... |
<gh_stars>100-1000
/*
* This source file is part of libRocket, the HTML/CSS Interface Middleware
*
* For the latest information, see http://www.librocket.com
*
* Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this... |
<filename>src/commands/Settings/Welcome & Leave/setleave.js<gh_stars>0
const { Command } = require('klasa');
const { MessageEmbed } = require('discord.js');
module.exports = class extends Command {
constructor(...args) {
super(...args, {
enabled: true,
runIn: ['text'],
aliases: [],
cooldown: 10,
per... |
<filename>src/main/java/net/jamsimulator/jams/mips/assembler/InstructionSnapshot.java
/*
* MIT License
*
* Copyright (c) 2021 <NAME>
*
* 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 Softw... |
<gh_stars>1-10
var _;
_ = toString.length;
_ = toString.name;
toString();
|
/*
Command-lne app to convert Rimu source to HTML.
*/
package main
import (
"embed"
"fmt"
"io/ioutil"
"os"
"os/user"
"path"
"path/filepath"
"strconv"
"strings"
"github.com/srackham/go-rimu/v11/internal/utils/stringlist"
"github.com/srackham/go-rimu/v11/rimu"
)
const VERSION = "11.3.0"
const STDIN = "-"... |
<reponame>pradeep-gr/mbed-os5-onsemi
/*
* Copyright (c) 2013-2016 Realtek Semiconductor Corp.
*
* 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/LIC... |
import subprocess
def execute_command(command: str) -> str:
if command == "exit":
sublime.run_command('exit')
return "Command executed successfully"
else:
try:
output = subprocess.check_output(command, shell=True, text=True)
return output
except subproces... |
<gh_stars>0
package ee.ituk.api.user.dto;
import lombok.Getter;
@Getter
public class NewPasswordDto {
private String code;
private String password;
}
|
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(user_params)
if @user.save
redirect_to @user
else
render :new
end
end
private
def user_params
params.require(:user).permit(:username, :email, :password)
end
end |
#!/bin/bash
exec 3<> /dev/null
function red {
printf "\e[91m$1\e[0m\n"
}
function green {
printf "\e[32m$1\e[0m\n"
}
set -e
set -x
ORIGIN="origin"
LOCALBRANCH="master"
REMOTEBRANCH="master"
trim() {
local var="$*"
# remove leading whitespace characters
var="${var#"${var%%[![:space:]]*}"}"
#... |
const db = require('../data')
const getExistingHold = async (holdCategoryId, frn, transaction) => {
return db.hold.findOne({
transaction,
lock: true,
skipLocked: true,
where: { holdCategoryId, frn, closed: null }
})
}
module.exports = getExistingHold
|
def update_metadata(metadata: dict, operation_type: str) -> dict:
if operation_type == 'DATABASE_BACKUP':
metadata['name'] = metadata['name'].split('/')[-1] + ':label=BACKUP'
metadata['database'] = metadata['database'].split('/')[-1] + ':label=SOURCE_DATABASE'
elif operation_type == 'DATABASE_RE... |
def longest_palindrome(str):
# Base case
if len(str) == 0:
return
longest = ""
for i in range(len(str)):
current_palindrome = get_palindrome(str, i, i)
if len(current_palindrome) > len(longest):
longest = current_palindrome
current_palindrome = get_palindrome(str, i, i+1)
if len(... |
<filename>__tests__/generate-vue-components.spec.ts<gh_stars>0
import { createComponentDefinition } from '../src/generate-vue-component';
describe('createComponentDefinition', () => {
it('should create a Vue component with the render method using createCommonRender', () => {
const generateComponentDefinition = ... |
<reponame>nightskylark/DevExtreme<filename>testing/helpers/frameworkMocks.js
"use strict";
(function(root, factory) {
/* global jQuery */
if(typeof define === 'function' && define.amd) {
define(function(require, exports, module) {
module.exports = factory(
require("jquery"),... |
var Share = function(element)
{
var dmp,
editor,
timer,
text = "";
;
var dmp = new diff_match_patch();
function diff() {
delta[timestamp] = dmp.diff_toDelta(dmp.diff_main(a, b));
};
var appendToDeltaFile = function(delta) {
var oldDeltas = JSON.parse( l... |
<reponame>jhonfre1994/multi-tenant-spring-boot
package com.tenant.example.exceptions.responses;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
*
* @author jhonfre
*/
@ResponseStatus(HttpStatus.BAD_REQUEST)
public class BadRequestException extends Runt... |
#!/bin/sh
npm --prefix ui i
npm --prefix server i
npm --prefix server run build
npm --prefix server run install
docker build . -t timer:latest
|
package me.legit.models.decoration;
public class DecorationInventoryItem {
private DecorationId decorationId;
private Number count;
public DecorationInventoryItem(DecorationId decorationId, Number count) {
this.decorationId = decorationId;
this.count = count;
}
public DecorationI... |
#pragma once
#include <typed-geometry/functions/basic/limits.hh>
#include <typed-geometry/types/scalars/default.hh>
/**
* Provides random generators:
* - splitmix
* - xorshift
* - pcg
*
* Default rng: tg::rng
*
* Provides detail::uniform01<float / double>(rng) for 0..1 (inclusive)
*/
namespace tg
{
struc... |
# models.py
from django.db import models
class Movie(models.Model):
title = models.CharField(max_length=200)
description = models.TextField()
# views.py
from django.shortcuts import render
from .models import Movie
def movies_list(request):
movies = Movie.objects.all()
return render(request, 'movies/... |
package com.cutout.kit.immersionbar;
/**
* Author: 侯亚东
* Date: 2021-10-21 17:02
* Email: <EMAIL>
* Des: The interface On navigation bar listener.
*/
public interface OnNavigationBarListener {
/**
* On navigation bar change.
*
* @param show the show
*/
void onNavigationBarChange(boolea... |
//
// JJTabbarController.h
// xiaoyulvtu
//
// Created by 杨剑 on 2018/10/19.
// Copyright © 2018年 贱贱. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
//#import "JJRootShebeiController.h"
//#import "JJRootTongzhiController.h"
//#import "JJRootWoController.h"
#import "JJJiance... |
<filename>packages/database-provider/src/dao/ranking.ts
import { RankingProvider } from "@cph-scorer/core";
import { Repository } from "typeorm";
import { RankingEntity } from "../entity/ranking";
import { RankingType, Ranking, Player, uuid } from "@cph-scorer/model";
import { PlayerEntity } from "../entity/player";
e... |
<gh_stars>0
package state
import "fmt"
type LeaderState struct {
StateBase
State StateEnum
}
func (l *LeaderState) Do() {
fmt.Printf("Leader DO")
fmt.Println()
//l.SwitchTo(StateFollower)
}
|
#!/bin/bash
# could add this script to "npm run build"
# but would make it complicated to read.
# for now we just need to manually run this
cd lib
python3 -m venv twitterVenv
source twitterVenv/bin/activate
pip uninstall requests
pip install requests==2.25.1
pip install urllib3==1.26.2
pip install boto3==1.17.4
pip ins... |
# Construct the episode URL using the url_template and next_episode
episode_url=$(printf ${url_template} ${next_episode})
# Print debug information
echo "Number of videos: ${num_videos}"
echo "last_episode: ${last_episode}"
echo "Regular expression result: ${regexp_result}"
echo "Next episode: ${next_episode}"
echo "U... |
The proposed algorithm for classifying spam emails using machine learning will involve two steps.
Step 1: Preparing the Data
The first step is to prepare the data by extracting the features from the emails. The features could include the presence of certain words, the presence of certain links, and more sophisticated... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.