text stringlengths 1 1.05M |
|---|
<reponame>smac89/UVA-Online-Judge-Problem-Solutions<gh_stars>1-10
#include <iostream>
#include <cstring>
#define FMAX 1e10
using namespace std;
void solve()
{
char req[81], name[81], rfp[] = {"RFP #"};
int n, p, rec, s = 0;
double mprc = FMAX, mrec = 0, prc, temp;
while(cin >> n >> p)
{
if... |
package service;
import com.google.gson.Gson;
import play.libs.F.Promise;
import play.libs.ws.WS;
import play.libs.ws.WSResponse;
import utils.Urls;
import utils.Utils;
/*
* @Author(name="<NAME>")
*/
public class RestService {
public enum restServiceEnum {GET, POST, PUT, DELETE}
// Call the REST api *********... |
<gh_stars>0
/*
* Copyright (c) 2015 IBM Corporation and others.
*
* 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 ... |
// http://codeforces.com/contest/935/problem/C
#include <bits/stdc++.h>
using namespace std;
typedef complex<double> p;
int main() {
double R, x1, y1, x2, y2;
cin >> R >> x1 >> y1 >> x2 >> y2;
p p1 = {x1, y1};
p p2 = {x2, y2};
p p3 = p1 - p2;
double d = abs(p3);
cout << fixed << setprecision(17) ;
if (p1 == ... |
print("Welcome to the store!")
print("Choose a product:")
products = ["Milk", "Bread", "Chips", "Cheese"]
for i, product in enumerate(products):
print(str(i+1) + ": " + product)
selection = input("Select one: ")
print(products[int(selection)-1]) |
<reponame>NIRALUser/BatchMake
/*
* Note: This is only required if you use curl 7.8 or lower, later
* versions provide an option to curl_global_init() that does the
* win32 initialization for you.
*/
/*
* These are example functions doing socket init that Windows
* require. If you don't use windows, you can safe... |
<filename>src/test/java/com/keildraco/config/tests/states/ListParserTest.java
package com.keildraco.config.tests.states;
import static com.keildraco.config.testsupport.SupportClass.runParser;
import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertFalse;
impo... |
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="150" Width="200">
<Grid>
<TextBox Name="textBox1"></TextBox>
<Button Name="button1" Click="Button_Click">... |
<gh_stars>1-10
package com.assist.watchnext.model.tmdb;
import java.util.List;
public class TmdbMovie {
private String poster_path;
private List<TmdbGenre> genres;
private String homepage;
private String imdb_id;
private String original_title;
private String overview;
private String releas... |
export type Constructor<T = unknown> = new (
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...args: any[]
) => T
|
from typing import List, Tuple
class SeamProcessor:
def __init__(self, image: List[List[int]]):
self.image = image
def calculate_energy(self) -> List[List[int]]:
energy_map = [[0 for _ in range(len(self.image[0]))] for _ in range(len(self.image))]
# Calculate energy map based on specif... |
<gh_stars>0
class MigrateRunVideoUrlsToVideos < ActiveRecord::Migration[6.0]
# video_url is included in ignored_columns in Run, so we can't use standard ActiveRecord stuff to create Videos or rollback the migration
def up
sql = "INSERT INTO videos (run_id, url, created_at, updated_at)
SELECT id, vide... |
<reponame>basicarrero/pyplsqlparser<gh_stars>1-10
class CaseChangingStream():
def __init__(self, stream, upper):
self._stream = stream
self._upper = upper
def __getattr__(self, name):
return self._stream.__getattribute__(name)
def LA(self, offset):
c = self._stream.LA(offset)
if c <= 0:
return c
ret... |
MIGRATION_ISSUES_DETAILS["0785d94d-b39c-4d3f-9127-df45b30e6cda"] = [
{description: "<p>The application embeds the Spring Boot framework.<\/p>", ruleID: "3rd-party-03000", issueName: "Embedded framework - Spring Boot",
problemSummaryID: "0785d94d-b39c-4d3f-9127-df45b30e6cda", files: [
{l:"spring-petclinic-rest-2.4.2.jar... |
#!/bin/bash
set -e
. ./lib/env.sh
ts=`date '+%s'`
# チームのチャンネルID取得
# 一日に一回でいい
# tested
get_channels_id() {
channel_name=$slack_channel
if [ $# -eq 1 ]; then
channel_name=$1
fi
channels_list_file="tmp/channels_list.json"
channels_list_ts=0
if [ -e $channels_list_file ]; then
chan... |
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); yo... |
#include <iostream>
#include <random>
//Function to simulate a dice roll
int roll_dice()
{
std:: random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dist(1, 6);
return dist(gen);
}
int main() {
int result = roll_dice();
std::cout << result << std::endl;
} |
#!/bin/bash
SCRIPT=$(readlink -f $0)
ROOTDIR=`dirname $SCRIPT`
dispatcherPID=`cat $ROOTDIR/dispatcher.pid`
if ps -p $dispatcherPID > /dev/null; then
#echo -e "Dispatcher Run"
exit
else
#echo -e "Started dispatcher"
nohup $ROOTDIR/dispatcher.sh &
#cho -e "Dispatcher status : \e[31mStopped\e[0m... |
#!/usr/bin/env bash
# Copyright 2015 Johns Hopkins University (author: Jan Trmal)
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE... |
import io.chrisdavenport.rediculous._
import cats.implicits._
import cats.effect._
import fs2.io.net._
import com.comcast.ip4s._
// Send a Single Transaction to the Redis Server
object TransactionExample extends IOApp {
def run(args: List[String]): IO[ExitCode] = {
val r = for {
// maxQueued: How many ele... |
<gh_stars>0
// Fill out your copyright notice in the Description page of Project Settings.
#include "LobbyPlayerController.h"
#include "JamGameInstance.h"
#include "Runtime/UMG/Public/Blueprint/UserWidget.h"
void ALobbyPlayerController::SetupLobbyUI()
{
if (IsLocalPlayerController())
{
if (LobbyHUDWidgetClass ... |
#include <iostream>
#include <string>
class PaginateProjectRequest {
private:
std::string appName_;
public:
void setAppName(const std::string& appName) {
appName_ = appName;
setBodyParameter("AppName", appName);
}
std::string get_NameSpace() const {
// Implement logic to retrie... |
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.ListIterator;
public class List {
private static void expect(boolean v) {
if (! v) throw new RuntimeException();
}
private static String printList(ArrayList<Integer> list) {
StringBuilder sb = new StringBuilder();
for (Intege... |
#!/bin/sh
#
# Copyright (C) 2010 Matthias Buecher (http://www.maddes.net/)
#
# 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 ver... |
#!/bin/bash
date
docker run -it -v ~/.ununifi:/root/.ununifi ghcr.io/ununifi/ununifid:test ununifid collect-gentxs
sudo chown -c -R $USER:docker ~/.ununifi
date
|
export const Uint32SparseSet = (length) => {
const dense = new Uint32Array(length)
const sparse = new Uint32Array(length)
let cursor = 0
dense.count = () => cursor + 1
const has = val => dense[sparse[val]] === val
const add = val => {
if (has(val)) return
sparse[val] = cursor
dense[cursor] = ... |
# frozen_string_literal: true
module Qernel
module NodeApi
# Various helper methods for setting demand of nodes from GQL.
module DemandHelpers
EXPECTED_DEMAND_TOLERANCE = 0.001
# Updates a (power plant) node demand by its electricity output.
#
# That means we have to divide by the co... |
export const lpad = function(str, pad, length){
let _str = ""+str;
if (length && _str.length >= length) {
return _str;
}
return Array((length + 1) - _str.length).join(pad) + _str;
} |
#!/bin/bash
TREEISH=$1
if [ "$TREEISH" == "" ]; then
TREEISH="HEAD"
fi
export DEBIAN_FRONTEND=noninteractive
function die {
echo $*
exit 1
}
function pre_setup {
apt-get update > /dev/null
#apt-get dist-upgrade -y
}
function install_prereqs {
apt-get -y install build-essential git zsync
... |
# Python3 program to find LCM of two numbers
# method to return gcd of a and b
def gcd(a, b):
if a == 0 :
return b
return gcd(b % a, a)
# method to return LCM of two numbers
def lcm(a, b):
return (a*b) // gcd(a, b) |
#!/bin/bash
export GOPATH=$PWD
if [ ! -f .git/hooks/pre-commit ]; then
chmod +x hooks/pre-commit
ln -s ../../hooks/pre-commit .git/hooks/
fi
|
import re
import numpy as np
def process_chinese_sentences(file_path: str) -> List[List[str]]:
sents = []
with open(file_path, 'r', encoding='utf-8') as f:
for line in f.readlines():
sents.append(line.strip())
sents = [re.split(' +', s) for s in sents] # Split sentences into words base... |
#!/usr/bin/env bash
function describe_actions() {
echo " 📦 Install the latest pass package from Homebrew"
echo " 🛠 Configure syncing of the passwordstore database"
}
function install() {
install_homebrew_package "pass"
local -r pass_config_path="$HOME/.password-store"
if [ -d "$pass_config_path" ];... |
<reponame>wuximing/dsshop<gh_stars>0
exports.ids = [69];
exports.modules = {
/***/ 296:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _api_goodIndent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22);
/* har... |
$(function(){
//滑动模块
mui('.mui-scroll-wrapper').scroll({
deceleration: 0.0005 //flick 减速系数,系数越大,滚动速度越慢,滚动距离越小,默认值0.0006
});
//获取左边盒子的信息
$.ajax({
url:'/category/queryTopCategory',
type:'get',
success:function(result){
//获得信息后通过模板引擎拼接字符串
var str = template('leftListTpl',{data:result.rows});
//将字符串内容... |
export JAVA_HOME=/usr/java/jdk1.8.0_40
|
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")" \
&& source "utils.sh"
###############################################################################
# SSH and Github
###############################################################################
copy_key_github() {
# adapted for WSL2
inform 'Public key cop... |
class PlusPuntuation extends BaseObject{
constructor(scene, value, x, y){
super(scene, "PlusPuntuation", true);
this.value = value;
this.x = x;
this.y = y;
this.create();
}
create(forceCreation){
if (forceCreation == undefined)
forceCreation = true;
var $this = this;
this.... |
#!/bin/bash
#kubectl delete ns wardle
#kubectl delete -f artifacts/example/auth-delegator.yaml -n kube-system
#kubectl delete -f artifacts/example/auth-reader.yaml -n kube-system
#kubectl delete -f artifacts/example/apiservice.yaml
kubectl create -f artifacts/example/ns.yaml
kubectl create configmap -n discovery kind... |
import {
BadRequestException,
ValidationError,
ValidationPipe,
} from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { UserInputError } from 'apollo-server-express';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
... |
<gh_stars>0
package duhuafei.function.active;
/** sigmoid激活函数
* Created by Duhuafei on 11/09/2019.
*/
public class Sigmoid {
public static double eval(Double x){
if (null == x){
x = 0.0;
}
return 1.0 / (1 + Math.exp(-x));
}
}
|
#!/bin/bash
# MIT License
# Copyright (c) 2021 Tuukka Pasanen
# Copyright (c) 2020, Ilmi Solutions Oy
#
# 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 ... |
#!/bin/bash
set -e
clear
cat << BASH
############################################################
# "All in the box" (Master, ETCD and Node in a server) #
############################################################
BASH
IP_DETECT=$(ip route get 8.8.8.8 | awk 'NR==1 {print $NF}')
DF=""
read -p "Please enter the F... |
import { filter, each, isArray, clone } from '@antv/util';
import BBox from '../../util/bbox';
import { getLegendComponents, getAxisComponents } from '../../util/common';
/**
* 处理图表padding的逻辑:
* 注册参与padding的自定义组件
*/
var PaddingController = /** @class */ (function () {
function PaddingController(cfg) {
th... |
# Create a dictionary to easily access the numeric values of the Roman Numerals
ROMAN_NUMERALS = {'I': 1,'IV': 4,'V': 5,'IX': 9,'X': 10,'XL': 40,'L': 50,'XC': 90,'C': 100,'CD': 400,'D': 500,'CM': 900,'M': 1000}
# Create a function to convert Roman numerals to numbers
def convertRomanToNumber(numeral):
number = 0
... |
import React from 'react'
import styled from '@emotion/styled/macro'
import mq from 'mediaQuery'
import { hasNonAscii } from '../../utils/utils'
const MainContainer = styled('main')`
width: 100%;
padding: 20px 100px 0px 30px;
@media (max-width: 768px) {
padding: 50px 25px 0px 25px;
}
`
const Main = ({ ch... |
import 'jquery'
import 'materialize-css'
import '../node_modules/materialize-css/dist/css/materialize.css'
import Map from './map'
import './styles/styles.css'
if (module.hot) {
module.hot.accept();
}
const map = new Map()
const inputRefCat = document.getElementById('navRefCatForm')
const toolMeasure = document.g... |
OPS_MGR_PASSWD=$1
mkdir -p decrypted 2>/dev/null
cd decrypted
ruby ../eos.rb decrypt $OPS_MGR_PASSWD ../installation.yml decrypted-installation.yml
ruby ../eos.rb decrypt $OPS_MGR_PASSWD ../actual-installation.yml decrypted-actual-installation.yml
cd ..
|
<filename>setup_test.go<gh_stars>10-100
package restic
import (
"testing"
"github.com/caddyserver/caddy"
"github.com/caddyserver/caddy/caddyhttp/httpserver"
)
func TestSetup(t *testing.T) {
c := caddy.NewTestController("http", `restic /basepath`)
err := setup(c)
if err != nil {
t.Fatalf("Expected no errors, ... |
const Sequelize = require('sequelize')
const sequelize = require('../database')
const Player = sequelize.define(
'player',
{
brawlhalla_id: {
type: Sequelize.INTEGER.UNSIGNED,
primaryKey: true,
},
name: Sequelize.STRING,
xp: Sequelize.INTEGER.UNSIGNED,
level: Sequelize.INTEGER.UNSIG... |
<filename>Renderer.cpp<gh_stars>1-10
//
// Renderer.cpp
// walls3d
//
// Created by <NAME> on 5/12/20.
// Copyright © 2020 <NAME>. All rights reserved.
//
#include <string.h>
#include "Renderer.hpp"
#include "GeomUtils.hpp"
#include "Utils.hpp"
constexpr uint8_t Renderer::ditherPattern8bit[];
Renderer::Renderer(... |
#!/bin/bash
#SBATCH --time=90:55:00
#SBATCH --account=vhs
#SBATCH --job-name=sea_mem_4n_6t_6d_1000f_617m_15i
#SBATCH --nodes=4
#SBATCH --nodelist=comp02,comp03,comp04,comp06
#SBATCH --output=./results/exp_iterations_sea/run-0/sea_mem_4n_6t_6d_1000f_617m_15i/slurm-%x-%j.out
source /home/vhs/Sea/.venv/bin/activate
... |
<!DOCTYPE html>
<html>
<head>
<title>Table Example</title>
</head>
<body>
<h1>Table Heading</h1>
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>25</td>
</tr>
<tr>
<td>Alice</td>
<td>29</td>
</tr>
<tr>
<td>Bob</td>
<td>22</td>
</tr>
</table>
</body>
</html> |
package br.com.alinesolutions.anotaai.model.produto;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.validation.constraints.Min;
import javax.validation.constraints.N... |
import discord
import string
import requests as req
import datetime
import random
import time
import base64
from threading import Thread as thr
import os
from colorama import Fore
import discord, os, json
from discord.ext import commands
from discord.ext.commands import Bot
from plyer import notification... |
package com.landawn.projecteuler._100;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.landawn.abacus.util.N;
import com.landawn.projecteuler.TestBase;
/**
*
* @see <a href="https://projecteuler.net/problem=4">Largest palindrome product</a>
*
*/
public class _004 e... |
#!/bin/bash
AWS_REGION=$(jq -r '.stack.region' ./package.json)
echo "==Attempting to add service role to Amazon Elasticsearch in region $REGION=="
$(aws iam create-service-linked-role --region $AWS_REGION --aws-service-name es.amazonaws.com && echo "Service role successfully added") || echo "Service role already exis... |
#!/usr/bin/env bash
python3 setup.py sdist bdist_wheel
twine upload dist/* |
<reponame>shrishankit/prisma<filename>server/servers/api/src/test/scala/com/prisma/api/schema/MutationsSchemaBuilderSpec.scala
package com.prisma.api.schema
import com.prisma.api.ApiSpecBase
import com.prisma.shared.schema_dsl.{SchemaDsl, TestProject}
import com.prisma.util.GraphQLSchemaMatchers
import org.scalatest.{... |
<gh_stars>0
import styled from 'styled-components';
import {FixedSizeList} from 'react-window';
import {fontPolyglot} from '../../../styles/polyglot.js';
const List = styled(FixedSizeList)`${fontPolyglot}`;
export {List};
|
#!/usr/bin/env bash
# Deploy VMOP to the given cluster
#
# Usage:
# $ deploy-local.sh <deploy_yaml> <vmclasses_yaml>
set -o errexit
set -o pipefail
set -o nounset
YAML=$1
VMCLASSES_YAML=$2
KUBECTL="kubectl"
VMOP_NAMESPACE="vmware-system-vmop"
VMOP_DEPLOYMENT="vmware-system-vmop-controller-manager"
DEPLOYMENT_EXIST... |
#!/usr/bin/env bash
# #### #
# VARS #
# #### #
expt_name='objective_test'
env_name='pusher'
algo_name='sac'
dir_prefix=${algo_name}
python_script=${env_name}'_'${algo_name}
log_dir_path='/home/desteban/logs/'${expt_name}'/'${env_name}'/'
#default_seeds=(610 710 810 910 1010)
default_seeds=(610)
seeds=("${@:-${defaul... |
/*
* straps.c --
*
* A simple SNMP trap-sink. Mainly for scotty's snmp code, but also
* usable by other clients. The straps demon listens to the snmp-trap
* port 162/udp and forwards the received event to connected clients
* (like scotty). Because the port 162 needs root access and the port
* can be opened only ... |
<filename>lang/py/cookbook/v2/source/cb2_4_20_exm_2.py
printf('Result tuple is: %r', result_tuple)
|
#!/bin/bash
###############################################################################
# Copyright (c) 2018 Advanced Micro Devices, Inc.
#
# 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... |
<filename>src/pages/App/App.tsx
import CssBaseline from '@material-ui/core/CssBaseline';
import * as React from 'react';
import { Route, Switch } from 'react-router-dom';
import Header from '../../components/Header';
import Home from '../Home';
import StockDetail from '../StockDetail';
import classes from './App.scss';... |
#!/usr/bin/env bash
set -e
cd "$(dirname "$BASH_SOURCE")/.."
# Downloads dependencies into vendor/ directory
mkdir -p vendor
cd vendor
clone() {
vcs=$1
pkg=$2
rev=$3
pkg_url=https://$pkg
target_dir=src/$pkg
echo -n "$pkg @ $rev: "
if [ -d $target_dir ]; then
echo -n 'rm old, '
rm -fr $target_dir
fi
... |
import { combineReducers } from 'redux';
import { makeCommunicationReducer } from 'shared/helpers/redux';
import { ReducersMap } from 'shared/types/redux';
import * as NS from '../../namespace';
import { initial } from '../data/initial';
// tslint:disable:max-line-length
export const communicationReducer = combineRe... |
package com.therootcoder.sample.masterslavespring.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* It is used to declare the repository for read-only( data fetch queries only) operatio... |
<gh_stars>1-10
package entity
import (
"context"
"github.com/blushft/strana/modules/sink/reporter/store"
"github.com/blushft/strana/modules/sink/reporter/store/ent"
"github.com/blushft/strana/modules/sink/reporter/store/ent/app"
)
type App struct {
ID int `db:"id" json:"id"`
Name string `db:"n... |
<reponame>olivierdemeijer/connect-sdk-java
package com.globalcollect.gateway.sdk.java.gc.product.definitions;
import java.util.List;
public class FixedListValidator {
private List<String> allowedValues = null;
public List<String> getAllowedValues() {
return allowedValues;
}
public void setAllowedValues(List<... |
#!/bin/bash
version=`git ls-remote --tags --sort -refname https://github.com/my-devices/sdk.git | grep -v '\^{}' | head -1 | awk '{ print $2 }' | sed 's#refs/tags/##'`
if [[ "$version" =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] ; then
echo $version
else
echo unknown
fi
|
import tensorflow as tf
# Download the MNIST dataset
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# Normalize the data
x_train = tf.keras.utils.normalize(x_train, axis=1)
x_test = tf.keras.utils.normalize(x_test, axis=1)
# Define the model
model = tf.keras.models.Sequentia... |
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
const btcController = require('./btcController').default;
app.use(bodyParser.json()); // support json encoded bodies
app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies
app.get... |
<reponame>MiguelDelPinto/LCOM_TPs<filename>lab4/i8042.h<gh_stars>0
#ifndef _LCOM_I8042_H_
#define _LCOM_I8042_H_
#include <lcom/lcf.h>
#include <minix/sysutil.h>
/** @defgroup i8042 i8042
* @{
*
* Constants for programming the i8042 Keyboard.
*/
/* General macros */
#define KBD_IRQ 1
#define MOUSE_IRQ 12
#d... |
package org.librairy.harvester.datosgobes.executions;
import org.librairy.harvester.datosgobes.model.Row;
import org.librairy.harvester.datosgobes.service.ParsingService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import j... |
SELECT c.Name as CustomerName, p.Name as ProductName, o.order_date
FROM customers c
JOIN orders o ON c.CustomerId = o.CustomerId
JOIN products p ON p.ProductId = o.ProductId; |
import sys
from computer import Computer
from copy import deepcopy
def move(comp, position, step_count):
step_count += 1
for i in range(4):
pos = deepcopy(position)
if i == 0:
pos[1] += 1
elif i == 1:
pos[1] -= 1
elif i == 2:
pos[0] -= 1
... |
class StatsCalculator():
def __init__(self, arr):
self.arr = arr
# To calculate mean
def calculate_mean(self):
return (sum(self.arr)/len(self.arr))
# To calculate median
def calculate_median(self):
self.arr.sort()
if len(self.arr) % 2 == 0:
retur... |
#Aqueduct - Compliance Remediation Content
#Copyright (C) 2011,2012 Vincent C. Passaro (vincent.passaro@gmail.com)
#
#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 Licens... |
holy-dot src/ os install
nvm-dir() {
local dir
if tis-some $NVM_DIR; then
dir="$NVM_DIR"
elif [ -x "$(command -v brew)" ] && brewCheck nvm; then
# brew is installed, and nvm is installed with it (usually onMac)
# in this case brewOn is rather irrelevant
dir="$(brew --prefix nvm)"
else
# Lin... |
<reponame>Aboutdept/Plugin_Videoplayer<gh_stars>1-10
/* Videoplayer_Plugin - for licensing and copyright see license.txt */
#include <StdAfx.h>
#include <IPluginVideoplayer.h>
#include <Nodes/G2FlowBaseNode.h>
#include <CPluginVideoplayer.h>
#include <CVideoplayerSystem.h>
namespace VideoplayerPlugin
{
class CFlo... |
<gh_stars>1-10
package fr.syncrase.ecosyst.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import javax.persistence.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* Po... |
import { expect } from "chai";
import { spawn } from "child_process";
import {
SOM, HandleStoppedAndGetStackTrace, TestConnection, execSom,
expectStack
} from "./test-setup";
describe("Command-line Behavior", function() {
it("should show help", done => {
let sawOutput = false;
const somProc = spawn(SOM,... |
<reponame>ticlo/server-example<filename>src/route-example/main.ts
import Express from 'express';
import {Root} from '@ticlo/core';
import {connectTiclo, routeTiclo, getEditorUrl} from '@ticlo/express';
import {FileJobLoader} from '@ticlo/node';
// save load jobs from the same folder
Root.instance.setLoader(new FileJob... |
ssh-add -L > ~/myhost/authorized_keys
docker rm builder_sonic -f 2>&1 >> /dev/null
docker run -d --name builder_sonic -it -v $HOME/myhost:/myhost \
-p 5002:22 \
--hostname sonic \
builders_sonic
# -v /run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock -e SSH_AUTH_SOCK="/run/host-services/... |
<reponame>amurrill/Gatsby-Weather-App
module.exports = {
siteMetadata: {
title: `Gatsby Starter Weather - DarkSky and OpenWeather`,
/* pathPrefix: '/static-gatsby-weather',*/
},
plugins: [
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Gatsby-starter-weather`,
short_name: `Gat... |
package scmigration
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/SAP/sap-btp-service-operator/api/v1alpha1"
"github.com/SAP/sap-btp-service-operator/client/sm"
"github.com/SAP/sap-btp-service-operator/client/sm/types"
"github.com/kyma-incubator/reconciler/pkg/reconciler/instances/s... |
declare module 'http' {
export interface Error {
message: string;
status: number;
}
export interface DefaultsHeader {
mode: RequestMode;
cache: RequestCache;
credentials: RequestCredentials;
headers: HeadersInit;
redirect: RequestRedirect;
referrer: RequestReferrer;
}
export ... |
<reponame>jtrussell/candidate-elimination
describe('Constant: uni.UNI_MIN', function() {
'use strict';
var min;
beforeEach(module('uni.min.constant'));
beforeEach(inject(function(UNI_MIN) {
min = UNI_MIN;
}));
it('should be a number', function() {
expect(min).toEqual(jasmine.any(Number));
});... |
<gh_stars>0
/**
* @param preferences - an array of integers. Indices of people, whom they love
* @returns number of love triangles
*/
module.exports = function getLoveTrianglesCount(preferences = []) {
let count=0;
preferences.forEach((item,i,arr)=>{
if(arr.indexOf(arr[arr[arr[item-1]-1]-1]) === i)
{count++};
});... |
fn transform_and_encode(input: &str) -> String {
// Define a function to split the text into graphemes
fn split_into_graphemes(text: &str) -> Vec<String> {
text.graphemes(true).map(|g| g.to_string()).collect()
}
// Apply grapheme-based transformation
let graphemes = split_into_graphemes(inp... |
package bridge
import (
"fmt"
"testing"
)
func Test(t *testing.T) {
t.Run("start: ", NewShapeCircleTest)
}
func NewShapeCircleTest(t *testing.T) {
redCircle := NewShapeCircle(5, 6, 8, NewRedCircle())
if redCircle != nil {
redCircle.Draw()
} else {
fmt.Println("red circle test fail.")
}
greenCircle := New... |
<filename>src/components/onboarding/views/Username.js
import React from 'react'
import PropTypes from 'prop-types'
import Navigation from 'Common/Navigation'
const Username = ({ previous, next, handleValueChange, email, username }) => (
<section>
<h3>
Username
</h3>
<input
type="text"
n... |
module KubeDSL::DSL::V1
class AzureFileVolumeSource < ::KubeDSL::DSLObject
value_field :read_only
value_field :secret_name
value_field :share_name
validates :read_only, field: { format: :boolean }, presence: false
validates :secret_name, field: { format: :string }, presence: false
validates :... |
<reponame>mdominick300/Nutrition_Journal<filename>routes/food-api-routes.js
var db = require('../models');
module.exports = function (app) {
app.get('/api/foods', function (req, res) {
// console.log(req.user)
var query = {};
if (req.user.id) {
query.UserId = req.user.id;
}
db.Food.findAll... |
const express = require('express');
const router = express.Router();
const Product = require('../models/Product');
router.get('/search', (req, res) => {
const query = req.query.name;
const products = Product.findByName(query);
const recommendations = Product.getRecommendations(query);
res.status(200).json({
prod... |
/* $Id$ */
/***************************************************************************
* (C) Copyright 2003-2010 - Stendhal *
***************************************************************************
***************************************************************************
... |
#!/bin/sh
# Prints the UUID of the named provisioning profile.
# The argument should be either "Viewfinder Ad Hoc" or "Viewfinder Distribution".
profile="$1"
full_path=$(grep -l "$profile" "${HOME}/Library/MobileDevice/Provisioning Profiles/"*.mobileprovision)
basename -s .mobileprovision "$full_path"
|
#!/bin/sh
#
# Usage from makefile:
# ELOG = . $(topdir)/build/autoconf/print-failed-commands.sh
# $(ELOG) $(CC) $CFLAGS -o $@ $<
#
# This shell script is used by the build system to print out commands that fail
# to execute properly. It is designed to make the "make -s" command more
# useful.
#
# Note that in the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.