text stringlengths 1 1.05M |
|---|
<gh_stars>0
import BigNumber from "bignumber.js";
export const ZERO = new BigNumber(0);
export const TEN = new BigNumber(10);
export const DEFAULT_DECIMALS = TEN.pow(18);
export const MAX_UINT256 = new BigNumber(2).pow(256).minus(1);
|
import logging
logger = logging.getLogger(__name__)
class ChainOfTransfiguration(object):
"""
A chain of responsibility implementation that channel through a series of transifgurations. One may depend
on previous step with respect to Context
"""
_chain = []
_context = {}
def __init__(s... |
# This script is designed to be included in your ~/.bashrc or equivalent file loaded on bash startup.
# Retrieves the size on disk value in bytes for the working directory.
alias dirsize=GetDirectorySize
function GetDirectorySize()
{
find . -type f -exec ls -l {} \; | awk '{sum += $5} END {print sum}'
}
|
<reponame>Swordce/client-master
package com.lepao.ydcgkf.ui;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import com.just.agentweb.AgentWeb;
import com.just.agentweb.DefaultWebClient;
impo... |
def repeatString(string, num):
return string * num
result = repeatString("xyz", 3)
print(result) |
<filename>src/client/components/materialapp.tsx
// Core react imports
import * as React from 'react';
// Material Imports
import * as Material from '@material-ui/core';
import * as Icons from '@material-ui/icons';
import {withStyles, MuiThemeProvider} from '@material-ui/core/styles';
import * as MuiColors from '@mater... |
/**
* @file A content script that is injected in https://0.facebook.com/* iframes
* @author <NAME> <<EMAIL>>
*/
const ZeroWorker = {}
ZeroWorker._pageDate = Date.now(); // important for updating
ZeroWorker._pageLink = window.location.toString(); // caching
ZeroWorker._addMeta = function _addMeta(obj) {
obj._page... |
#!/bin/bash
python3 -W ignore::RuntimeWarning shapement_.py "/dybfs2/nEXO/fuys/EXO-200/shape_agreement/2019_0vbb/Phase2/162_10_182_173_indE_DNN_v2/data/small_tag_mc_data/tag_mc_SourceS5_Th228_px2550_py39_pz100_ml.h5" \
"/dybfs2/nEXO/fuys/EXO-200/shape_agreement/2019_0vbb/Phase2/162_10_182_173_indE_DNN_v2/data/tag_r... |
<filename>src/sentry/static/sentry/app/icons/iconPrint.tsx
import React from 'react';
import SvgIcon from './svgIcon';
type Props = React.ComponentProps<typeof SvgIcon>;
const IconPrint = React.forwardRef(function IconPrint(
props: Props,
ref: React.Ref<SVGSVGElement>
) {
return (
<SvgIcon {...props} ref={... |
#!/usr/bin/env bash
# Copyright 2018 The TensorFlow Probability 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... |
package io.digitalstate.camunda.client.externaltask.models.failure;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jacks... |
<gh_stars>1-10
package net.zomis.monopoly.model;
public class GameActionResult {
private final boolean ok;
private final String message;
public GameActionResult(boolean ok, String message) {
this.ok = ok;
this.message = message;
}
public String getMessage() {
return messa... |
import React from "react"
import {
ScriptDefinitionDetails,
WorkspaceDefinition,
} from "../../types/settings"
import {
ScriptProcessor,
ScriptArgument,
ScriptOutputLine,
} from "../../types/scripts"
import { createProcessor } from "../../services/scripts/scriptInitializer"
import { initArgumanets } from "../... |
package io.github.mynametsthad.helpfulutilsbotline.core;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
public class ShoppingList {
public long createdTimestamp;
public String name;
public List<ShoppingListElement> elements = new ArrayList<>();
publi... |
def calculator(nums):
result = nums[0]
for i in range(1, len(nums)):
if nums[i] == '+':
result += nums[i + 1]
elif nums[i] == '-':
result -= nums[i + 1]
elif nums[i] == '*':
result *= nums[i + 1]
else:
result /= nums[i + 1]... |
#include <stdio.h>
#include <string.h>
int isPalindrome(char str[])
{
int l = 0;
int h = strlen(str) - 1;
while (h > l)
{
if (str[l++] != str[h--])
{
return 0;
}
}
return 1;
}
int main()
{
char str[20];
scanf("%s", str);
if (isPalindrome(str))... |
<filename>main.cpp<gh_stars>0
#define WINVER 0x0500
#include <windows.h>
//#include <commctrl.h>
#include <stdio.h>
//#include "resource.h"
#include <iostream>
//#include "powrprof.h"
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
INPUT ip;
ip.type = INPUT_... |
curl -v -d '{"messages":1000, "threads":2, "sidecarUrl":"http://127.0.0.1:8080/publish"}' -H "Content-Type: application/json" -X POST http://localhost:8090/test |
chmod 0640 /etc/ftpusers /etc/vsftpd.ftpusers /etc/vsftpd/ftpusers 2>/dev/null |
import { Link, graphql, useStaticQuery } from "gatsby"
import React from "react"
import "./styles.scss"
const Navbar = () => {
const data = useStaticQuery(graphql`
query {
site {
siteMetadata {
title
author
}
}
}
`)
return (
<nav>
<div>
<... |
<filename>src/main/tmdb/directives/money.js
/**
*
*/
define( [ 'angular', 'tmdb/partials/money/MoneyController'],
function(angular, MoneyController) {
"use strict";
return function() {
return {
transclude: true,
replace: true,
controll... |
<filename>include/kiwaku/allocator/heap_allocator.hpp
//==================================================================================================
/**
KIWAKU - Containers Well Made
Copyright 2020 <NAME>
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
**... |
<filename>public/10.js
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[10],{
/***/ "./node_modules/@babel/runtime/helpers/extends.js":
/*!********************************************************!*\
!*** ./node_modules/@babel/runtime/helpers/extends.js ***!
\******************************************... |
echo "========================= virtualenv version ============================"
echo "virtualenv --version"
virtualenv --version
printf "\n\n"
declare -a versions=('python2.7' 'python3.5' 'pypy' 'pypy3')
for version in "${versions[@]}"
do
echo "============ Setting up Virtual Environment for $version ========... |
#include <fstream>
#include "MnvH1DToCSV.h"
#include <string>
#include <iostream>
// function to dump histograms to CSV files
namespace PlotUtils{
void MnvH1DToCSV(PlotUtils::MnvH1D *hist, std::string name, std::string directory = "./", double scale=1.0, bool fullprecision, bool syserrors){
std:... |
<filename>src/scripts/actions/genres.js<gh_stars>0
import {
GENRES_LOADING,
GENRES_LOAD_SUCCESS,
GENRES_LOAD_ERROR,
GENRE_TOGGLE
} from "./constants";
import { fetchGenres } from "../services/api";
const genresLoading = payload => ({
type: GENRES_LOADING,
payload
});
const genresLoadSuccess =... |
<filename>packages/sorted-set/tests/functions/has.ts
import test from 'ava';
import { SortedSetStructure, has } from '../../src';
import { fromStringArray } from '../test-utils';
const values = ['A', 'B', 'C', 'D', 'E'];
let set: SortedSetStructure<string>;
test.before(() => {
set = fromStringArray(values);
});
tes... |
/**
*
*/
package exam1;
/**
* @author Justin
*
*/
import java.io.PrintWriter;
import java.util.Arrays;
/**
* A simple command-line program to average long values.
*/
public class Average {
public static void main(String[] args) throws Exception {
PrintWriter pen = new PrintWriter(System... |
/* eslint-disable no-underscore-dangle */
/* eslint-disable no-void */
/*
* Forked from vue-bundle-renderer v0.2.10 NPM package
*/
const { extname } = require('path');
const requireFromApp = require('../helpers/require-from-app');
const jsRE = /\.js(\?[^.]+)?$/;
const jsModuleRE = /\.mjs(\?[^.]+)?$/;
const cssRE = ... |
from .core.urls import *
from .slack.urls import *
from .ui.urls import
|
<reponame>ttarce1612/hotel_book
const Hotel = require("../models/HotelModel");
const apiResponse = require("../helpers/apiResponse");
const _ = require('lodash')
var mongoose = require("mongoose");
mongoose.set("useFindAndModify", false);
exports.hotelList = [
function (req, res) {
try {
let... |
#!/bin/bash
FILES=$(git status --porcelain | egrep -v '^\?\?')
if [ "$FILES" != "" ]
then
echo "Working Directory not clean"
echo $FILES
exit 1
fi
|
#!/bin/bash -eu
cmd="$1"
function running_as_root
{
test "$(id -u)" = "0"
}
function secure_mode_enabled
{
test "${SECURE_FILE_PERMISSIONS:=no}" = "yes"
}
containsElement () {
local e match="$1"
shift
for e; do [[ "$e" == "$match" ]] && return 0; done
return 1
}
function is_readable
{
# this co... |
const path = require('path');
const fs = require('fs');
const SSI = require('node-ssi');
/**
* 返回处理html的中间件
* @param {[type]} webpackDevMiddlewareInstance [description]
* @param {[type]} options [description]
* @return {[type]} [description]
*/
module.exports = ... |
#!/bin/sh
set -e
set -x
ISTIO_VERSION=1.2.4
NS=istio-system
# Helm auto completion:
source <(helm completion bash)
echo 'source <(helm completion bash)' >> ~/.bashrc
echo "Download istio (version $ISTIO_VERSION)"
curl -L https://git.io/getLatestIstio | ISTIO_VERSION="$ISTIO_VERSION" sh -
cd istio-"$ISTIO_VERSION"
... |
<filename>packages/playwright/src/screenplay/questions/Selected.ts
import {
Answerable,
AnswersQuestions,
Question,
UsesAbilities,
} from '@serenity-js/core';
import { formatted } from '@serenity-js/core/lib/io';
import {
ElementHandleAnswer,
} from '../../answerTypes/ElementHandleAnswer';
import {... |
package play.libs.ws.ahc
import org.specs2.mock.Mockito
import org.specs2.mutable._
class AhcWSRequestSpec extends Specification with Mockito {
"AhcWSRequest" should {
"should respond to getMethod" in {
val client = mock[AhcWSClient]
val request = new AhcWSRequest(client, "http://example.com", /*m... |
import UIKit
import RxCocoa
import RxSwift
class ViewController: UIViewController {
private let disposeBag = DisposeBag()
private let searchBar = UISearchBar()
private let tableView = UITableView()
override func viewDidLoad() {
super.viewDidLoad()
setupUI()
bi... |
<filename>spec/notification_hub/envelope/fallback_spec.rb
require 'spec_helper'
RSpec.describe NotificationHub::Envelope::Fallback do
subject { NotificationHub::Envelope::Fallback.new(messages: [], options: {}) }
it { is_expected.to be_kind_of(NotificationHub::Envelope::Base) }
it { expect(subject.strategy).to e... |
<filename>alg_climbing_stairs_three.py
"""Climbing Stairs.
How many paths up a stair of say 100 steps if the child jumps 1, 2 or 3 steps?
F(n) = F(n - 1) + F(n - 2) + F(n - 3)
- F(0) = 1 # Stay put.
- F(1) = 1 # Take 1-step leap.
- F(2) = 2 # Take 2 1-step leaps or 1 2-step leap.
Remark: This is just like a varia... |
import React, { useState } from 'react';
import firebase from 'firebase';
function App() {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const handleSubmit = async (e) => {
e.preventDefault();
try {
const db = firebase.firestore();
await db.collection('users'... |
#!/bin/sh
/usr/bin/getent group trellis || /usr/sbin/groupadd -r trellis
/usr/bin/getent passwd trellis || /usr/sbin/useradd -r -g trellis -d /opt/trellis -m -s /bin/false trellis
|
<reponame>JasonLiu798/javautil
package com.atjl.dbservice.mapper.biz;
import com.atjl.dbservice.api.domain.DataBaseConfig;
import com.atjl.dbservice.api.domain.DataCoverteConfig;
import com.atjl.dbservice.api.domain.DataCpConfig;
import com.atjl.dbservice.api.domain.SearchCondBase;
import com.atjl.common.domai... |
#!/usr/bin/env sh
# generated from catkin/cmake/template/setup.sh.in
# Sets various environment variables and sources additional environment hooks.
# It tries it's best to undo changes from a previously sourced setup file before.
# Supported command line options:
# --extend: skips the undoing of changes from a previou... |
echo 'Building C'
build=`gcc -O0 -g3 -Wall -c ../*.c main.c`
create=`gcc -O0 -g3 -Wall -o test_c.exe otpuri.o cotp.o crypt.o main.o -lcrypto -lm`
echo $build $create
|
#!/usr/bin/env bash
set -eo pipefail
if [[ -z "${GCLOUD_SERVICE_KEY}" ]]; then
echo >&2 "ERROR :: environment variable GCLOUD_SERVICE_KEY not set"
exit 1
fi
if [[ -z "${GOOGLE_PROJECT_ID}" ]]; then
echo >&2 "ERROR :: environment variable GOOGLE_PROJECT_ID not set"
exit 1
fi
# Update gcloud sdk components
# g... |
"use strict";function goTest(){window.location.href="/test"}
//# sourceMappingURL=index.min.js.map
|
/*
* StorageOS API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.4.0-alpha
* Contact: <EMAIL>
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/
package api
// AttachType The attachment type of a volume. \"ho... |
# -*- coding: utf-8 -*-
from .conf import COMMAND_SEPARATOR, ARGS_SEPARATOR, commands_map
def parse(program):
""" Парсинг программы в стековом коде (преобразование в список команд): простой split строк """
commands = program.split(COMMAND_SEPARATOR)
command_classes = []
for command in commands:
... |
SCRIPT_DIR=$(dirname "$0")
TEST_ANSWER=112
TEST_INPUT_FILE=$SCRIPT_DIR/input_test.txt
MAIN_INPUT_FILE=$SCRIPT_DIR/input_1.txt
echo "TEST: Running on $TEST_INPUT_FILE. Expected result: $TEST_ANSWER"
python3 $SCRIPT_DIR/main.py --verbosity DEBUG $TEST_INPUT_FILE
echo "MAIN: Running on $MAIN_INPUT_FILE"
python3 $SCRIPT_... |
"""Base revision for SQL-backed event log storage
Revision ID: 567bc23fd1ac
Revises:
Create Date: 2019-11-21 09:59:57.028730
"""
# pylint: disable=no-member
# alembic dynamically populates the alembic.context module
import sqlalchemy as sa
from alembic import op
from sqlalchemy import Column
from sqlalchemy.engine... |
<filename>src/edu/washington/cse/instrumentation/analysis/utils/IOAnalysis.java
package edu.washington.cse.instrumentation.analysis.utils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.... |
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class TraditionalWordCountApp {
public static void main(String[] args) {
SortedMap<String, Integer> counts = new TreeMap<>();
Pattern wordPattern = ... |
package io.github.vampirestudios.obsidian.minecraft.obsidian;
import io.github.vampirestudios.obsidian.api.obsidian.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import n... |
<?php
$timestamp = $_GET['timestamp'];
if(empty($timestamp)) {
echo json_encode(["error" => "Please provide a valid UNIX timestamp."]);
die();
}
$date = date("Y-m-d H:i", $timestamp);
echo json_encode(["date" => $date]);
?> |
#!/bin/bash
set -e
QUAYDIR=${QUAYDIR:-"/"}
cd $QUAYDIR
echo "[Local Dev] - Downloading AWS IP Ranges..."
curl -fsSL https://ip-ranges.amazonaws.com/ip-ranges.json -o util/ipresolver/aws-ip-ranges.json
echo "[Local Dev] - Building Front End..."
mkdir -p $QUAYDIR/static/webfonts && \
mkdir -p $QUAYDIR/static/f... |
var express = require('express');
var app = express();
var path = require('path');
var fs = require('fs');
var request = require('request');
var bodyParser = require('body-parser');
// Translate var for our real time translation
const Translate = require('@google-cloud/translate');
// Firebase cloud message service
... |
import re
# Function to validate phone number format
def validate_phone_number(phone):
pattern = re.compile(r'^\d{3}-\d{3}-\d{4}$')
return bool(pattern.match(phone))
# Function to prompt user for input and validate
def get_user_input(prompt, validation_func):
while True:
user_input = input(prompt)... |
#!/bin/bash
#***************************************************************
# optimize document images / photos to have better OCR results *
# and minimized PDF file size *
#***************************************************************
echo
echo "# runninig pre-process to optimiz... |
#! /usr/bin/env bash
set -exu
cd "$(dirname "`readlink -f "$0"`")"/..
for p in */ ; do (
set -xeu
[[ ! -f $p/configure.ac ]] ||
[[ $p = m4-common ]] || continue
cd $p
if [[ -d m4 ]] ; then
[[ ! -d .git ]] || git rm -r m4
rm -rf m4
fi
[[ -d .git ]] || continue
git remote remove m... |
package com.udacity.pricing;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.udacity.pricing.domain.price.Price;
import com.udacity.pricing.domain.price.PriceRepository;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.... |
<gh_stars>0
import p5 from "p5";
import { ParamNum, Color, rgbToHSB } from "./modules/param";
import { StillSketch } from "./modules/sketch";
/* 参考元
巴山竜来, 数学から創るジェネラティブアート, 技術評論社
https://gihyo.jp/book/2019/978-4-297-10463-4
*/
type EuclidRect1Params = {
ratio: ParamNum;
ratio2: ParamNum;
thr: ParamNum;
li... |
#first import the libraries
import folium
import pandas
data = pandas.read_csv("C:\GitHub\Python_Scripts\WebmapsWithFolium\Crimes_2015_Reduced.csv")
#data.columns - to return all columns
#then create list from columns - "Longitude" is a column name
lon = list(data["Longitude"])
lat = list(data["Latitude"])
ptype =... |
<filename>exercises/city_temperature_prediction.py
import IMLearn.learners.regressors.linear_regression
from IMLearn.learners.regressors import PolynomialFitting
from IMLearn.utils import split_train_test
import numpy as np
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import plotly... |
func generateWords(string: String) -> [String] {
if string.count == 0 {
return []
}
if string.count == 1 {
return [String(string.first!)]
}
var words = [String]()
let firstChar = string.first!
let remainChars = String(string.dropFirst())
let remainWords = generateWords(s... |
<reponame>kyledecot/hard_cider
# frozen_string_literal: true
RSpec.describe HardCider::CLI do
before do
stub_request(:get, %r{api\.appstoreconnect\.apple\.com/v1/apps})
.to_return(body: fixture('apps.json'))
stub_request(:get, %r{api\.appstoreconnect\.apple\.com/v1/builds})
.to_return(body: fixtu... |
import tensorflow as tf
# Define constants for data preprocessing
SEQ_LENGTH = 300
VOCAB_SIZE = 5000
# Define model architecture
model = tf.keras.Sequential([
tf.keras.layers.Embedding(VOCAB_SIZE, 16),
tf.keras.layers.LSTM(64),
tf.keras.layers.Dense(1, activation='sigmoid')
])
# Compile the model
model.... |
source get_model_specific_info.sh
python3 cell_generate_data.py \
--model_name ${MODEL_NAME}
|
<gh_stars>10-100
# Generated by Django 3.1.1 on 2020-10-01 20:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('letters', '0014_remove_letter_ordering'),
]
operations = [
migrations.AlterField(
model_name='documenttype',
... |
let path = require("path");
module.exports = function(app) {
app.get("/", (req, res) => {
res.render("index");
})
app.get("/legislature", (req, res) => {
res.render("legislature");
})
app.get("/about", (req, res) => {
res.render("about");
})
app.get("/media", (req, res) => {
res.render("media... |
import string
def remove_all_punctuations(text):
punctuations = [char for char in text if char in string.punctuation]
for punc in punctuations:
text = text.replace(punc, '')
return text
text = "Hey there, what's up!"
result = remove_all_punctuations(text)
print(result) |
#!/bin/sh
# CYBERWATCH SAS - 2017
#
# Security fix for USN-2833-1
#
# Security announcement date: 2015-12-15 00:00:00 UTC
# Script generation date: 2017-01-01 21:05:02 UTC
#
# Operating System: Ubuntu 15.04
# Architecture: i686
#
# Vulnerable packages fix on version:
# - firefox:43.0+build1-0ubuntu0.15.04.1
#
# L... |
<gh_stars>0
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {... |
/*
* This is the image processing thread. It takes images from the webcam and uses
* an analysis algorithm to separate out the backboard targets. It has a method to return
* an array of coordinates for the processed targets. The thread runs at the minimum priority
* as to reduce lag in the robot.
*
* It w... |
from .posts import (
Post
)
from .comments import (
Comment
)
__all__ = ['Post', 'Comment']
|
/* eslint-disable no-console */
import React from 'react';
import { Card, ComboBox, Option } from 'belle';
export default React.createClass({
getInitialState() {
return { comboValue: 'te' };
},
_handleChange(newValue) {
this.setState({ comboValue: newValue });
},
render() {
const valueLink = ... |
#!/bin/bash
set -e
cd $BASEDIR/$1
./gradlew clean build
./gradlew check
|
import { pipe } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
export const select = function(..._cb: Function[]) {
const args: any = [...arguments];
return pipe(
map((state = {}) => args.reduce((acc, selector) => selector(acc), state)),
distinctUntilChanged()
);
};
|
<gh_stars>1-10
/* GENERATED FILE */
import { html, svg, define } from "hybrids";
const PhLockLaminated = {
color: "currentColor",
size: "1em",
weight: "regular",
mirrored: false,
render: ({ color, size, weight, mirrored }) => html`
<svg
xmlns="http://www.w3.org/2000/svg"
width="${size}"
... |
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: tendermint/privval/types.proto
package privval
import (
fmt "fmt"
crypto "github.com/arcology-network/consensus-engine/proto/tendermint/crypto"
types "github.com/arcology-network/consensus-engine/proto/tendermint/types"
_ "github.com/gogo/protobuf/gogo... |
<reponame>tadashi-aikawa/todoistoggl
import * as Axios from 'axios';
import {stringify} from 'query-string';
import Sync from '../../models/api/todoist/Sync';
// Proxyを経由するため開発中はURLが異なる
// デバッグでelectron-dev-serverを使う際にCORSに引っかかるため
const baseURL = 'https://todoist.com/API/v7/';
const fetchSync = async(token: string): ... |
#!/bin/bash
set -eu
set -o pipefail
OX_INSTALL_DIRECTORY=${OX_INSTALL_DIRECTORY?="Orchestra SDK directory (OX_INSTALL_DIRECTORY) not set!"}
TOOLBOX_PATH=${TOOLBOX_PATH?="BART directory (TOOLBOX_PATH) not set!"}
export CC=${CC:=gcc-4.8}
export CXX=${CXX:=g++-4.8}
VERBOSE=${VERBOSE:=0}
mkdir -p build
pushd build
cm... |
package com.netcracker.ncstore.exception.general;
/**
* General exception for any action ended with not found.
* Web services should throw this exception when wrapping exceptions from business services.
*/
public class GeneralPermissionDeniedException extends RuntimeException {
public GeneralPermissionDeniedExc... |
/// <reference types="node" />
import { inspect, InspectOptions } from "util";
import { MultiError } from "verror";
import VError = require("verror");
interface CustomInspectOptions extends InspectOptions {
stylize(s: string, style: string): string;
}
interface HasCustomInspect {
[inspect.custom]?(depth: number... |
# Given a string, find the length of the longest substring without repeating characters.
import unittest
from hamcrest import assert_that, equal_to
class Solution:
def lengthOfLongestSubstring(self, s):
m = set()
max = 0
i = 0
for c in s:
if c in m:
i =... |
function mergeSortedArrays(arr1, arr2) {
let mergedArray = [];
let arr1Item = arr1[0];
let arr2Item = arr2[0];
let i = 1;
let j = 1;
if (arr1.length === 0) {
return arr2;
}
if (arr2.length === 0) {
return arr1;
}
while (arr1Item || arr2Item) {
if (arr2I... |
<reponame>NYCMOTI/open-bid
class DefaultDateTime
HOUR = "13".freeze
MINUTE = "00".freeze
attr_reader :dc_time
def initialize(time = Time.current)
@dc_time = DcTimePresenter.new(time).convert
end
def convert
@_converted ||= dc_time.change(hour: HOUR, min: MINUTE, sec: 0)
end
def hour
conv... |
#!/usr/bin/bash
# Will exit the Bash script the moment any command will itself exit with a non-zero status, thus an error.
set -e
BUILD_PATH=$1
OPENEXR_VERSION=${REZ_BUILD_PROJECT_VERSION}
# We print the arguments passed to the Bash script.
echo -e "\n"
echo -e "==============="
echo -e "=== INSTALL ==="
echo -e "==... |
#!/bin/bash
set -x
exec &> /tmp/cloud-init.log
apt-get update
apt-get install -y apt-transport-https \
ca-certificates curl gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/... |
<reponame>eddie4941/servicetalk
/*
* Copyright © 2019 Apple Inc. and the ServiceTalk project 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/license... |
#!/bin/bash
# simple script to creat backups of the bety database. This script will
# create a copy of the datbase daily, weekly, monthly and yearly. The
# files will be called:
# - bety-d-X, daily backup, where X is the day of the month.
# - bety-w-X, weekly backup, where X is the week number in the year
# - bety-m-X... |
#ifndef _LCOM_I8254_H_
#define _LCOM_I8254_H_
#include <lcom/lcf.h>
/** @defgroup i8254 i8254
* @{
*
* Constants for programming the i8254 Timer. Needs to be completed.
*/
#define TIMER_FREQ 1193182 /**< @brief clock frequency for timer in PC and AT */
#define TIMER0_IRQ 0 /**< @brief Timer 0 IRQ line */
#defin... |
GPU_ID=1
EVERY=1000
MODEL=LstmGateModel
MODEL_DIR="../model/frame_level_lstm_gate_distillchain_v2_model"
EVAL_DIR="../model/frame_level_lstm_gate_distillchain_v2_model"
start=0
DIR="$(pwd)"
for checkpoint in $(cd $MODEL_DIR && python ${DIR}/training_utils/select.py $EVERY); do
echo $checkpoint;
if [[ $checkpoint -g... |
<reponame>NYCMOTI/open-bid
class SkillPresenter
attr_reader :skill
def initialize(skill)
@skill = skill
end
def name
skill.name
end
def evaluated_auction_count
SkillQuery.new(skill).evaluated_auction_count
end
def accepted_auction_count
SkillQuery.new(skill).accepted_auction_count
... |
#!/bin/sh
set -e
set -u
set -o pipefail
function on_error {
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the... |
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, n) for (int i = a; i < n; i++)
#define repe(i, a, n) for (int i = a; i <= n; i++)
#define pb push_back
typedef vector<int> VI;
//header
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int t;
string s;
cin >> t;
rep(i, 0, t)
{
cin >> ... |
#include "Paralysis.hpp"
Paralysis::Paralysis(int rounds)
: m_rounds(rounds)
{}
std::vector<std::pair<phazeType, Involve>> Paralysis::operator()(std::weak_ptr<Character> self,
std::weak_ptr<Character> enemy) {
noused(self);
int time = m_rou... |
const fs = require('fs');
const zlib = require('zlib');
const gunzip = zlib.createGunzip();
let inp = fs.createReadStream('test.zip');
let out = fs.createWriteStream('test_unzipped.zip');
inp
.pipe(gunzip)
.pipe(out); |
BINS="bin/home-data:bin/home-init:bin/home-new:bin/home-run"
DEPS="gitlab.com/shellm/doc"
# BASH_COMPLETIONS="cmp/home.comp.bash"
# ZSH_COMPLETIONS="cmp/home.comp.zsh"
SHELLM_LIBS="lib/home.sh"
|
class Combination:
def __init__(self, n_max, mod=10**9+7):
# O(n_max + log(mod))
f = 1
self.mod = mod
self.factorials = factorials = [f]
for i in range(1, n_max + 1):
f *= i % mod
factorials.append(f)
f = pow(f, mod - 2, mod)
self.invs... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.