text stringlengths 1 1.05M |
|---|
// https://cses.fi/problemset/task/1196/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple<ll,ll>ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef priority_queue<ii,vii,greater<ii>> pq;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n,m... |
def is_odd_number(num):
if num % 2 == 0:
return False
else:
return True
result = is_odd_number(37)
print(result) |
import PropTypes from 'prop-types';
import React from 'react';
export interface MissingComponentProps {
rendering?: {
componentName?: string;
};
}
export const MissingComponent: React.SFC<MissingComponentProps> = (props) => {
const componentName =
props.rendering && props.rendering.componentName
?... |
from io import StringIO
import attr
from girder.api import access
from girder.api.describe import autoDescribeRoute, Description
from girder.api.rest import Resource
from girder.constants import AccessType
from girder.models.folder import Folder
from girder_jobs.models import Job
from nli_simulation_runner.tasks impo... |
#!/bin/bash
####################################################################################################################
#####################################################################################################################
## detect-and-install-new-relic.sh
## ©Copyright IBM Corporation 2016
#... |
#!/usr/bin/env bash
THE_FONTS_DIR_PATH="$HOME/.local/share/fonts"
mkdir -p "$THE_FONTS_DIR_PATH"
echo
echo "cp Demo-Copy.ttf $THE_FONTS_DIR_PATH/Demo-Copy.ttf"
cp "Demo-Copy.ttf" "$THE_FONTS_DIR_PATH/Demo-Copy.ttf"
echo
fc-cache -fv "$THE_FONTS_DIR_PATH"
echo
fc-list | grep 'DemoCopy'
#ls -l "$HOME/.local/share/fo... |
<filename>test/main.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rss.h"
#include "rss-item.h"
#include "parser.h"
#include "fetcher.h"
#include "pp.h"
void usage();
int
main(int argc, const char* argv[])
{
if (argc < 2)
{
usage();
return 1;
}
fetch_data_t* fetch_data = fetc... |
#!/usr/bin/env bash
docker build \
--tag="lburgazzoli/app-t" \
--build-arg DOCKER_USER=$LOGNAME \
--build-arg DOCKER_USER_GID=$(id $LOGNAME -g) \
--build-arg DOCKER_USER_UID=$(id $LOGNAME -u) \
.
|
<filename>src/software/webapp/front/components/training/setup/SelectTrailDialog.tsx
import * as React from 'react';
import {Trail} from "../../../types/training/Trail";
import Button from "@mui/material/Button";
import Dialog from "@mui/material/Dialog";
import DialogActions from "@mui/material/DialogActions";
import D... |
<reponame>LiuFang07/bk-cmdb
/*
* Tencent is pleased to support the open source community by making 蓝鲸 available.
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
* Licensed under the MIT License (the "License"); you may not use this file except
* in compliance with the License. Yo... |
#!/bin/bash
#Created by : ravinayag@gmail.com | Ravi Vasagam
source scripts/.c.env
source scripts/.hlc.env
echo -e $PCOLOR"Sending invoke transaction on {PEER_NAME0}.{ORG_1} {PEER_NAME0}.{ORG_2}..."$NONE
export CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peerOrganizations/{ORG... |
#include "defines.h"
#include "lib.h"
#include "intr.h"
#include "interrupt.h"
#include "timer.h"
#include "kozos.h"
#define TIMER_NUM 4
#define PIC_TIMER2 ((volatile struct pic_timer *)0xBF800800)
#define PIC_TIMER3 ((volatile struct pic_timer *)0xBF800A00)
#define PIC_TIMER4 ((volatile struct pic_timer *)0xBF800C00... |
<reponame>daviz00/react-native
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @flow
*/
import type {RNTesterNavState, ComponentList} from '../types/RNTesterTypes... |
#!/bin/bash -e
upstream_main() {
git clone https://github.com/keycloak/keycloak
mvn clean install -Pdistribution -DskipTests -f keycloak -B
find keycloak/distribution/server-dist/target -maxdepth 1 -type f -name 'keycloak-[[:digit:]]*.tar.gz' -exec tar xzf {} --strip-components=1 -C keycloak-dist \;
}
latest_re... |
# name: Cloudsuite benchmark in cluster
# auth: Mohammad Sahihi <msahihi1 at gwdg.de>
# vim: ts=4 syntax= bash sw=4 sts=4 sr noet
#!/bin/bash
# set -x
# set -e
# #
# D I S P L A Y U S A G E F U C N T I O N #
# ... |
<reponame>minuk8932/Algorithm_BaekJoon
package math;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author minchoba
* 백준 5347번: LCM
*
* @see https://www.acmicpc.net/problem/5347/
*
*/
public class Boj5347 {
private static final String NEW_LINE = "\... |
number = 123
# find the sum of its digits
sum = 0
temp = number
while (temp > 0):
digit = temp % 10
sum = sum + digit
temp = temp // 10
# printing the output
print( "The sum of digits in the given number is", sum) |
python transformers/examples/language-modeling/run_language_modeling.py --model_name_or_path train-outputs/1024+0+512-N-VB/model --tokenizer_name model-configs/1536-config --eval_data_file ../data/wikitext-103-raw/wiki.valid.raw --output_dir eval-outputs/1024+0+512-N-VB/1024+0+512-rare-256 --do_eval --per_device_eval_b... |
<gh_stars>0
//
// ___FILENAME___
// Project: ___PROJECTNAME___
//
// Module: ___VARIABLE_viperModuleName___
// Description: ___VARIABLE_viperModuleDescription___
//
// By ___FULLUSERNAME___ ___DATE___
// ___ORGANIZATIONNAME___ ___YEAR___
//
#import <UIKit/UIKit.h>
#import "___VARIABLE_viperModuleName:identi... |
"""
Collection of helpers for ivy unit tests
"""
# global
import ast
try:
import numpy as _np
except ImportError:
_np = None
try:
import jax.numpy as _jnp
except ImportError:
_jnp = None
try:
import tensorflow as _tf
_tf_version = float('.'.join(_tf.__version__.split('.')[0:2]))
if _tf_vers... |
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Please specify indy-sdk version tag"
echo "e.g ./setup-dev-dependencies.sh 1.6.7"
exit 1
fi
indy_sdk_version=$1
brew update
echo 'Installing libsodium...'
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/65effd2b617bade68a8a2c5b39e1c3089cc0e9... |
#!/bin/bash
gsed -i -e 's/ff1717/ABRACADABRA/g' season{12,13,14,15,16,17,18,19,20,21,22,23}/*.json
gsed -i -e 's/bb0000/ff1717/g' season{12,13,14,15,16,17,18,19,20,21,22,23}/*.json
gsed -i -e 's/ABRACADABRA/bb0000/g' season{12,13,14,15,16,17,18,19,20,21,22,23}/*.json
|
#!/bin/bash
echo -e "\n\xF0\x9F\x9B\x91 Stopping the development site.\n"
docker-compose stop |
const path = require('path');
const express = require('express');
const passport = require('passport');
const { Strategy } = require('passport-facebook');
const session = require('express-session');
const { ensureLoggedIn } = require('connect-ensure-login');
const bodyParser = require('body-parser');
const logger = req... |
<gh_stars>0
package io.stargate.grpc.service;
import io.grpc.stub.StreamObserver;
import io.stargate.db.Persistence;
import io.stargate.proto.QueryOuterClass;
public class SingleBatchHandler extends BatchHandler {
private final StreamObserver<QueryOuterClass.Response> responseObserver;
SingleBatchHandler(
... |
words_starting_with_s = [word for word in sentence.split() if word.startswith('S')] |
<!doctype html>
<html>
<head>
<title>Products</title>
</head>
<body>
<h1>Products</h1>
<ul>
<li>
<h2>Laptop</h2>
<p>Price: $799</p>
<img src="laptop.jpg" alt="Laptop" />
</li>
<li>
<h2>Watch</h2>
<p>Price: $199</p>
<img src="watch.jpg" alt="Watch" />
</li>
<li>
<h2>Bag</h2>
... |
json.extract! room_category, :id, :name, :description, :price, :created_at, :updated_at
json.url room_category_url(room_category, format: :json)
|
# frozen_string_literal: true
# Responsible for the relationship between identities and permissions retrieved
# from SSO, and the internal Users and Estates. Also for additional information
# returned from the SSO application which is stored in the user's session.
class SignonIdentity
class InvalidSessionData < Runt... |
# vim: ft=sh
dot_list() {
_dot_list() {
echo $1,$2
}
parse_linkfiles _dot_list
unset -f _dot_list $0
}
|
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Check Azure CLI login..."
if ! az group list >/dev/null 2>&1; then
echo "Login Azure CLI required" >&2
exit 1
fi
resource_group=aks-test
location=eastus
aks_name=kube-test
dns_name_suffix=<your-dns-name-suffix>
companion_rg="MC_${resou... |
<filename>src/main/java/com/softhale/utils/UndirectedGraph.java<gh_stars>0
package com.softhale.utils;
import java.util.*;
public class UndirectedGraph<T> {
private final Map<T, LinkedList<T>> nodes = new HashMap<>();
public Map<T, LinkedList<T>> getNodes() {
return nodes;
}
public void add... |
#include <stdio.h>
#include <string.h>
// function to swap two strings
void swapStrings(char *str1, char *str2)
{
char *temp = (char *)malloc((strlen(str1) + 1) * sizeof(char));
strcpy(temp, str1);
strcpy(str1, str2);
strcpy(str2, temp);
free(temp);
}
// function to sort an array of strings
// u... |
# Function to calculate the highest tip generated by waiter in a given month
def find_max_tip(tips):
max_tip = 0
waiter = ''
# Iterate over all the employees in the list
for tip in tips:
# Check if current employee's tip is greater than the maximum tip
if tip[1] > max_tip:
m... |
export declare function assertHardhatNetworkInvariant(invariant: boolean, description: string): asserts invariant;
//# sourceMappingURL=assertions.d.ts.map |
#! /bin/sh
# Created Time: 2016-04-23 14:26:54
#
cscope -Rbkq
|
<gh_stars>0
/*
* Number.sql
* Chapter 3, Oracle10g PL/SQL Programming
* by <NAME>, <NAME>, <NAME>
*
* This script demonstrates the NUMBER datatype
*/
exec clean_schema.trigs
exec clean_schema.procs
exec clean_schema.tables
CREATE TABLE precision (
value NUMBER(38,5),
scale NUMBER(10));
INSERT INTO precis... |
<reponame>mevlanaayas/miye-behance-collector
import sendgrid
import os
from sendgrid.helpers.mail import *
USER_SIDE_ERROR_REPORT_MAIL_LIST = os.environ.get('USER_SIDE_ERROR_REPORT_MAIL_LIST')
PROGRAM_SIDE_ERROR_REPORT_MAIL_LIST = os.environ.get('PROGRAM_SIDE_ERROR_REPORT_MAIL_LIST')
def report(subj, cont, report_co... |
const { pool } = require('../database')
/**
*
* @param {*} param0
* @param {String} param0.username
* @param {Number} param0.limit
* @return {Promise}
*
*/
function getCreatorNotifications({ username, limit }) {
return new Promise((resolve, reject) => {
pool.query(
`SELECT id,heading,description,cr... |
#!/bin/bash
set -e
set -o xtrace
if [ -z "${on_exit_hooks:-}" ]; then
on_exit_hooks=()
fi
on_exit()
{
for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0); do
eval "${on_exit_hooks[$i]}"
done
}
add_on_exit()
{
local n=${#on_exit_hooks[*]}
on_exit_hooks[$n]="$*"
if [[ $n -eq 0 ]]; then
... |
<gh_stars>1-10
// Code generated by entc, DO NOT EDIT.
package ent
import (
"context"
"fmt"
"time"
"github.com/blushft/strana/modules/sink/reporter/store/ent/alias"
"github.com/blushft/strana/modules/sink/reporter/store/ent/event"
"github.com/blushft/strana/modules/sink/reporter/store/ent/group"
"github.com/b... |
#!/bin/bash
## Script from https://github.com/deepguider/dg_cart_ros
## Git clone sensor ros file
git clone https://github.com/deepguider/dg_cart_ros.git src/dg_cart_ros
# symbolic link for door detect weight file
cd src/dg_cart_ros/src/door_detect
ln -sf ../../../../data_door_detect/checkpoints .
cd ../../../..
#... |
/* **** Notes
Count words.
Remarks:
Refer at fn. cv_wo.
*/
# define CAR
# include "./../../../incl/config.h"
signed(__cdecl ct_wo(signed char(*sym),signed char(*argp))) {
auto signed i,r;
// if(!sym) return(0x00);
if(!argp) return(0x00);
if(!(*argp)) return(0x00);
r = cue(sym,argp);
if(!r) return(0x00);
argp =... |
#include "simulator.hpp"
#include <chrono>
#include <iostream>
#include <random>
#include <vector>
void Simulator::_register_methods()
{
// Exposes internal methods to be called from GDScript
godot::register_method("setHamiltonian", &Simulator::_setHamiltonian);
godot::register_method("setPsi0", &Simulato... |
import * as util from "../util.js";
import type { Request, Warnings } from "../util.js";
import jsesc from "jsesc";
const supportedArgs = new Set([
"url",
"request",
"user-agent",
"cookie",
"data",
"data-raw",
"data-ascii",
"data-binary",
"data-urlencode",
"json",
"referer",
"form",
"form-st... |
const squares = [];
for (let i = 1; i <= 10; i++) {
squares.push(i * i);
} |
package implementation;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
/**
*
* @author minchoba
* 백준 2740번: 행렬 곱셈
*
* @see https://www.acmicpc.net/problem/2740/
*
*/
public class Boj2740 {
private static final String NEW_LINE = "\n", SPACE = " ";
public ... |
package com.cgfy.mybatis.bussApi.domain.model;
import com.cgfy.mybatis.base.domain.model.BaseModel;
import java.io.Serializable;
import javax.persistence.*;
/**
* cgfy
*
* @author cgfy_web
*/
@Table(name = "test_gen")
public class TestGen implements BaseModel, Serializable {
/**
* 主键
*/
@Id
... |
/**
* 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"); you... |
function isDestinationOccupied(creep, destinationRoomName) {
if (
Game.rooms[destinationRoomName] &&
Game.rooms[destinationRoomName].lookForAt(
LOOK_CREEPS,
creep.memory.destination.x,
creep.memory.destination.y
).length > 0
) {
return true; // Destination is occupied
} else {
... |
# python3 finetune_v2.py --data=./data/TrainVal/ --mode=train_then_finetune --net=densenet_169 --workers=2 \
# --train_lr=0.0004 --train_epochs=4 --train_steps_per_epoch=640 \
# --finetune_lr1=0.0002 --finetune_epochs1=10 --finetune_steps_per_epoch1=1280 \
# -... |
#! /bin/sh
set -e
# Smoke-test timestamp-abort as part of running "make check". Use the -s option
# to add a stress timing in checkpoint prepare.
default_test_args="-t 10 -T 5"
while getopts ":sb:" opt; do
case $opt in
s) default_test_args="$default_test_args -s" ;;
b) test_bin=$OPTARG ;;
esa... |
import os
import shutil
def organize_files(source_dir: str) -> None:
if not os.path.exists(source_dir):
raise FileNotFoundError("Source directory does not exist")
organized_dir = os.path.join(source_dir, "organized_files")
os.makedirs(organized_dir, exist_ok=True)
for root, _, files in os.wal... |
^([1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9])$ |
<?php
namespace Drupal\avoindata_events\Controller;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Core\Datetime\DrupalDateTime;
/**
* Adds event controller.
*
* Class EventsController
* Implements event controller.
*
* @package Drupal\avoindata_events\Controller
*/
class EventsController {
/**... |
# ipython --pylab
# two joint arm in a horizontal plane, no gravity
# compute a min-jerk trajectory
def minjerk(H1,H2,t,n):
"""
Given hand initial position H1=(x1,y1), final position H2=(x2,y2) and movement duration t,
and the total number of desired sampled points n,
Calculates the hand path H over time T that s... |
package datapath
import (
"encoding/binary"
"fmt"
"net"
"regexp"
"strconv"
"syscall"
"github.com/AliyunContainerService/terway/plugin/driver/ipvlan"
"github.com/AliyunContainerService/terway/plugin/driver/nic"
"github.com/AliyunContainerService/terway/plugin/driver/types"
"github.com/AliyunContainerService/... |
<reponame>ninga6b/leaflet-maps-with-google-sheets<filename>google-doc-url.js
var googleDocURL = 'https://docs.google.com/spreadsheets/d/1a-GNN5cpPK0fuOd1Z1eX-b7uDDoKT7W33uBU8QxGMIw/edit#gid=0';
|
#!/bin/bash
# Copyright 2019 dfuse Platform 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 a... |
#!/bin/sh
#. /opt/pgi/linux86-64/13.10/pgi.sh
gdvroot=/home/shiva/software/gdv-h21
GAUSS_MEMDEF=67108864
GAUSS_SCRDIR=/tmp
export PATH /opt/pgi/linux86-64/13.3/bin:$PATH
export gdvroot GAUSS_MEMDEF GAUSS_SCRDIR
. $gdvroot/gdv/bsd/gdv.profile
|
<reponame>stefli/sentinl
import template from './dd_watcher_agg_type.html';
class DdWatcherAggType {
constructor($scope) {
this.$scope = $scope;
this.aggTypeSelected = this.aggTypeSelected || this.$scope.aggTypeSelected;
this.aggTypeOnSelect = this.aggTypeOnSelect || this.$scope.aggTypeOnSelect;
this... |
/* Primitive data types is pass by value */
/* Primitive data types: string, number, bigint, boolean, undefined, symbol, and null. */
/* https://developer.mozilla.org/en-US/docs/Glossary/Primitive */
/* Pass by value vs Pass by reference: https://blog.penjee.com/wp-content/uploads/2015/02/pass-by-reference-vs-pass-by-... |
<gh_stars>0
/*
* Copyright (c) 2008 Princeton University
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met: redistributions of source code must retain the above copyright
* notice, this list... |
import subprocess
kraken_out = "path_to_kraken_output_file"
output_file = "path_to_output_file"
cmd = "cat {} | cut -f1-4".format(kraken_out)
kraken_result = subprocess.check_output(cmd, shell=True)
kraken_result = kraken_result.strip()
kraken_result = kraken_result.split("\n")
contigs_bin_dict = {}
with open(outp... |
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
loc=/mnt/hugetlbfs
mount | grep $loc
if [ $? -eq 0 ]; then
echo "$loc already mounted"
exit 1
fi
mkdir -p $loc
mount -t hugetlbfs none $loc
mkdir -p $loc/craildata/datanode/
mkdir -p $loc/craildata/cache/
chown -R $S... |
/**
* Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.analytics.math.minimization;
import com.opengamma.analytics.math.function.Function1D;
import com.opengamma.analytics.math.matrix.DoubleMatrix1D;
import com.op... |
/*
This file is part of the JitCat library.
Copyright (C) <NAME> 2019
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
*/
#include "jitcat/CatOwnershipSemanticsNode.h"
#include "jitcat/CatLog.h"
using namespace jitcat;
using namespace jitcat::AST;
using namespace ji... |
<reponame>0lixiz/assettomc
/**
* Paladium Launcher - https://github.com/Chaika9/paladiumlauncher
* Copyright (C) 2019 Paladium
*/
const $launcherHomePlayButton = $('#launcher-home-play-button');
function initLauncherHomePanel() {
refreshServer();
}
$("#launcher-home-options-button").click(function() {
swi... |
module.exports = {
plugin: true,
data: function () {
return {
helper: this.$parent.$options.utils['lightbox-helper'].methods
};
},
created: function () {
var vm = this, editor = this.$parent.editor;
if (!editor || !editor.htmleditor) {
return;
}
this.lightboxes = [];
editor.addButton ('lig... |
def sum_products_engineer_tech(engineers, technicians):
total_costs = sum([x.cost for x in engineers] + [x.cost for x in technicians])
return total_costs |
#!/bin/bash
#SBATCH --time=90:55:00
#SBATCH --account=vhs
#SBATCH --job-name=lustre_5n_32t_6d_1000f_617m_5i
#SBATCH --nodes=5
#SBATCH --nodelist=comp02,comp03,comp04,comp06,comp07
#SBATCH --output=./results/exp_threads/run-2/lustre_5n_32t_6d_1000f_617m_5i/slurm-%x-%j.out
source /home/vhs/Sea/.venv/bin/activate
s... |
import tensorflow as tf
def make_weights(shape, name='weights'):
return tf.Variable(tf.truncated_normal(shape=shape, stddev=0.05), name=name)
def make_biases(shape, name='biases'):
return tf.Variable(tf.constant(0.05, shape=shape), name=name)
def convolution_layer(prev_layer, f_size, inp_c, out_c, stride_s):... |
import React from "react";
import Modal from "../Modal";
import { connect } from "react-redux";
import { deleteStream, getStream } from "../../actions";
class StreamDelete extends React.Component {
renderContent = () => {
if (this.props.stream === undefined) {
return "Loading ...";
}
return `Are y... |
<filename>js_modules/profile.js
/* ///////////////////////// LEGAL NOTICE ///////////////////////////////
This file is part of ZScripts,
a modular script framework for Pokemon Online server scripting.
Copyright (C) 2013 <NAME>, aka "ArchZombie" / "ArchZombie0x", <<EMAIL>>
This program is free software: you can red... |
function makeToc(contentElement, tocSelector, options) {
if (options == null) {
options = {};
}
if (contentElement == null) {
throw new Error('need to provide a selector where to scan for headers');
}
if (tocSelector == null) {
throw new Error('need to provide a selector where inject the TOC');
... |
curl "http://localhost:8080/user/Delete" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"id": "fdf34f34f34-f34f34-f43f43f34-f4f34f"
}' |
package io.opensphere.imagery.algorithm.genetic;
import io.opensphere.core.util.lang.ExpectedCloneableException;
/**
* A candidate for the genetic algorithms fitness function.
*/
public class Candidate implements Cloneable
{
/**
* Fitness as judged by fitness function.
*/
private doubl... |
#!/bin/bash
set -e
set -o pipefail
if [ $(uname -s) = Darwin ]; then
basedir=$(dirname $(cd "$(dirname "$0")"; pwd -P))
else
basedir=$(dirname $(dirname $(readlink -fm $0)))
fi
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
: "${TARGETS:="linux mac win"}"
declare -A variables=()
# Get latest JDK version from... |
def compute_average(a, b):
return (a + b) / 2
print(compute_average(2, 3)) # 2.5 |
# ============================================================
# Author: 凍仁翔 / chusiang.lai (at) gmail.com
# Blog: http://note.drx.tw
# Filename: wheel-scrolling.sh
# Modified: 2014-12-31 21:39
# Description:
# Reference:
# 1. 凍仁的筆記: Logitech Marble Trackball on Ubuntu 10.04+
# - http://note.drx.tw/2010/0... |
package server
import "gopkg.in/mgo.v2"
type DBImpl struct {
Session *mgo.Session
DB *mgo.Database
}
func (s *DBImpl) InitDB() {
s.Session, _ = mgo.Dial(Settings.DB["url"][0])
if s.Session != nil {
s.DB = s.Session.DB(Settings.DB["name"][0])
}
}
|
package com.sbsuen.fitfam.exercise;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface ExerciseRepository extends MongoRepository<Exercise,String> {
}
|
import React from 'react';
import {shallow} from 'enzyme';
import Footer from './Footer';
describe ('Footer Component', () => {
// Component Tests
let wrapper;
beforeEach(() => {
wrapper = shallow(<Footer />);
});
it('renders the footer', () => {
const footer = wrapper.find('footer');
expect(foo... |
#!/bin/sh
kubectl create -f namespaces.yml
kubectl create -f clusterRole.yml
kubectl create -f kube-state-metrics.yml
kubectl create -f grafana-deployment.yml
kubectl create -f grafana-service.yml
kubectl create -f alertmanager-configmap.yml
kubectl create -f alertmanager-deployment.yml
kubectl create -f alertmanager-s... |
<filename>idem_azurerm/states/azurerm/containerregistry/task.py
# -*- coding: utf-8 -*-
"""
Azure Resource Manager (ARM) Container Registry Task State Module
.. versionadded:: 3.0.0
.. versionchanged:: 4.0.0
:maintainer: <<EMAIL>>
:configuration: This module requires Azure Resource Manager credentials to be passed v... |
<gh_stars>1-10
// Source : https://leetcode.com/problems/single-number/
// Author : <NAME>
/**
* @param {number[]} nums
* @return {number}
*/
var singleNumber = function(nums) {
var ans = 0;
for(var i = 0, len = nums.length; i < len; i++)
ans ^= nums[i];
return ans;
};
|
<reponame>navikt/diasight<filename>apps/frontend/src/components/summary/utils/update-composition.ts
import {
BundleTypeKind,
Bundle_RequestMethodKind,
IBundle,
IComposition,
ICondition,
IReference,
IResourceList,
} from "@ahryman40k/ts-fhir-types/lib/R4";
import { SummaryChange } from "../..... |
<gh_stars>0
from django.contrib import admin
from mptt.admin import MPTTModelAdmin
from taggit.models import Tag as TaggitTag
from collective_blog.models import Blog, Post, Membership, Comment, Tag
from s_markdown.admin import MarkdownAdmin
admin.site.unregister(TaggitTag)
@admin.register(Blog)
class BlogAdmin(Ma... |
from pypy.objspace.std.model import registerimplementation, W_Object
from pypy.objspace.std.register_all import register_all
from pypy.objspace.std.stringobject import W_AbstractStringObject
from pypy.objspace.std.stringobject import W_StringObject
from pypy.objspace.std.unicodeobject import delegate_String2Unicode
fro... |
<filename>nanowar-webwork2/src/java/org/nanocontainer/nanowar/webwork2/PicoActionProxyFactory.java
/*****************************************************************************
* Copyright (C) NanoContainer Organization. All rights reserved. *
* ------------------------------------------------------------... |
# Register server to Spacewalk
bash 'spacewalk_registration' do
user 'root'
code <<-EOH
rpm -Uvh http://yum.spacewalkproject.org/2.6-client/RHEL/7/x86_64/spacewalk-client-repo-2.6-0.el7.noarch.rpm
rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install rhn-client-to... |
#!/bin/bash
set -e
set -x
build_release() {
export GOOS=$1
export GOARCH=$2
mkdir -p $RELEASE_DIR/lmsasm-$TRAVIS_TAG-$GOOS-$GOARCH
cd $RELEASE_DIR/lmsasm-$TRAVIS_TAG-$GOOS-$GOARCH
go build github.com/ev3dev/lmsasm/lmsasm
go build github.com/ev3dev/lmsasm/lmsgen
cp $TRAVIS_BUILD_DIR/LICENSE... |
override func awake(withContext context: Any?) {
if let sksFile = Bundle.main.url(forResource: "YourSpriteKitScene", withExtension: "sks") {
let scene = try? NSKeyedUnarchiver.unarchiveTopLevelObjectWithData(Data(contentsOf: sksFile)) as? SKScene
if let skScene = scene {
spriteKitScene.p... |
# Generated by Django 3.0.2 on 2020-01-16 10:50
from django.db import migrations
from papermerge.core.utils import get_sql_content
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.RunSQL(
get_sql_content('01_trigger... |
;(function(win){
if(!/洋葱数学$/.test(document.title)){
window.location.href = 'http://yangcong345.com';
return;
}
if('YangCongHelper' in win){
win.YangCongHelper.run();
}else{
$.ajax({
url: 'https://gist.githubusercontent.com/song940/40c90eb8f25368b0895a/raw/yangcong-helper.js',
error: function(err){
... |
<filename>benchmark_dataloader.py
import torch
from torch.utils.data import Dataset, DataLoader, random_split
from torchvision import transforms
import os
import cv2
from cv2 import resize, GaussianBlur, findHomography, warpPerspective
import numpy as np
from random import random
class Dataloader(Dataset) :
def ... |
package com.hapramp.ui.activity;
import android.app.ProgressDialog;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNu... |
<reponame>open-risk/numpymatrix
# This is a sample Python script using numpymatrix, illustrating the deprecated API
import numpymatrix as npm
import numpy as np
# the old matrix API
A = npm.matrix([[1, 2], [3, 4]])
# the new API
B = np.array([[1, 2], [3, 4]])
# identical
print(A)
print(B)
# transpose OK
print(A.T)
... |
<gh_stars>0
# Copyright 2019 Microsoft Corporation
#
# 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 ... |
<gh_stars>0
import { join } from "path";
import { existsSync, readFileSync, writeFileSync } from "fs";
/**
* Get the serverless object from package.json, serverless.config.js and .serverlessrc
* @param path Path to serverless package (default is current path)
*/
export function getServerlessConfig(path: string = pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.