text stringlengths 1 1.05M |
|---|
const fs = require("fs");
const os = require("os");
// const path = require("path");
const chalk = require("chalk");
const ora = require("ora");
const request = require("request");
// const simpleGit = require("simple-git");
const dns = require("dns");
var CliTable = require("cli-table");
// var CLIEngine = require("es... |
from typing import List
def findMaxPathSum(triangle: List[List[int]]) -> int:
n = len(triangle)
# Start from the second last row and move upwards
for i in range(n - 2, -1, -1):
for j in range(i + 1):
# For each element, find the maximum sum path from that element to the bottom
... |
/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, {useContext} from 'react';
import Link from '@docusaurus/Link';
import DocusaurusContext from '@docusaurus/context';
imp... |
import hashlib
def verify_admin_session(admin_session_token, admin_token_hash, admin_name, stored_admin_token_hash):
try:
# Verify the session token by comparing its hash with the stored hash
hashed_session_token = hashlib.sha256(admin_session_token.encode()).hexdigest()
if hashed_session_t... |
/// <reference path="../exceptionless.ts" />
module exceptionless.error {
export class DashboardViewModel extends ViewModelBase {
private _navigationViewModel: NavigationViewModel;
projectId = ko.observable<string>('');
currentTabHash = ko.observable<string>('');
installDate = ko.o... |
require("dotenv").config({
path: `.env.${process.env.NODE_ENV}`,
})
module.exports = {
plugins: [
{
resolve: "gatsby-plugin-google-gtag",
options: {
trackingIds: [process.env.GA_TRACKING_ID],
pluginConfig: {
head: true,
},
},
},
"gatsby-plugin-react-h... |
def get_distance(p1, p2):
x1, y1 = p1
x2, y2 = p2
return ((x2 - x1)**2 + (y2 - y1)**2)**0.5
print(get_distance((1,1), (9,9))) |
<gh_stars>0
#!/usr/bin/env python
"""Setup file for bumbleestatus bar to allow pip install of full package"""
# -*- coding: utf8 - *-
from setuptools import setup
import versioneer
with open('requirements/base.txt') as f:
INSTALL_REQS = [line for line in f.read().split('\n') if line]
# Module packages
def read_mo... |
<filename>7-assets/_SNIPPETS/bryan-guner-gists/_JAVASCRIPT/isDir.js<gh_stars>0
import fs from 'fs';
fs.readdir( './', {
withFileTypes: true
}, ( err, files ) => {
if ( err ) {
console.error( err )
return
}
console.log( 'files: ' )
files.forEach( file => {
// the `isDirectory` met... |
<reponame>oskar-taubert/pydca
from __future__ import absolute_import, division
import unittest
import os
import glob
from pydca.fasta_reader import fasta_reader
from .input_files_path import InputFilesPath
class TestCase(unittest.TestCase):
def setUp(self):
"""
"""
self.__rna_msa_file = Inpu... |
import math
import re
import numpy as np
def prime(n):
if n == 2:
return True
if n % 2 == 0 or n <= 1:
return False
sqrt = int(math.sqrt(n)) + 1
for d in range(3, sqrt, 2):
if n % d == 0:
return False
return True
#print(prime(31))
def sortWords(path):
ret... |
module.exports = {
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint', 'import', 'react-hooks', 'jest'],
extends: [
'plugin:react/recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:import/typescript',
'plugin:jest/recommended',
],
parserOptions: {
... |
<filename>cmd/diplomat/internal/field_searcher.go
package internal
import (
"github.com/tony84727/diplomat/pkg/reflecthelper"
"reflect"
)
// FieldSearcher is used for search field of a reflect type
// with "navigate" tag
type FieldSearcher struct {
value reflect.Value
}
func (f FieldSearcher) Search(name string... |
#!/usr/bin/env bash
set -e
source $(dirname "$0")/common.sh
source $(dirname "$0")/config.sh
# generate clients
CLIENT_GEN_BASE=kubevirt.io/client-go/generated
rm -rf ${KUBEVIRT_DIR}/staging/src/${CLIENT_GEN_BASE}
# KubeVirt stuff
swagger-doc -in ${KUBEVIRT_DIR}/staging/src/kubevirt.io/client-go/apis/snapshot/v1alp... |
/*
* Copyright (c) CERN 2013-2015
*
* Copyright (c) Members of the EMI Collaboration. 2010-2013
* See http://www.eu-emi.eu/partners for details on the copyright
* holders.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*... |
import pandas as pd
from rasa_nlu.training_data import load_data
from rasa_nlu.config import RasaNLUModelConfig
from rasa_nlu.model import Trainer
#read in the data
data = pd.read_csv('survey_data.csv')
#prepare the training data
training_data = load_data('survey_data.json')
#configure the model
config = RasaNLUMode... |
#!/bin/bash
# This script is used by the auto-gke-pvc-snapshots container to take snapshots
# of all the Google PVC disks attached to the Origin cluster.
if [ -z "${DAYS_RETENTION}" ]; then
# Default to 14 days
DAYS_RETENTION=14
fi
gcloud compute disks list --filter='description:* AND description~kubernetes.io/c... |
const timestamp: string = new Date()
.toUTCString()
.slice(5)
.replaceAll(" ", "-");
module.exports = {
preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel",
transform: {
"^.+\\.vue$": "vue-jest",
},
testMatch: ["**/*.test.{j,t}s", "**/*.spec.{j,t}s"],
verbose: true,
/** Generate /c... |
<reponame>slimbeek6/Employee-Directory-SL
import React, { createContext, useReducer, useContext } from "react";
const EmployeeContext = createContext({
id: "",
name: "",
img: "",
phone: "",
email: "",
dob: ""
});
const { Provider } = EmployeeContext;
function reducer (state, action) {
swi... |
# Install pre-requisites
sudo apt update && sudo apt install -y wget curl sudo git gnupg gnupg1 gnupg2 unzip zip
# Install Go
GO_PACKAGE=go1.15.6.linux-amd64.tar.gz
wget https://dl.google.com/go/$GO_PACKAGE
export GOROOT=$PWD/go-install
export GOPATH=$PWD/go-workspace
echo "export GOPATH=\"$GOPATH\"" >> ~/.bashrc
mk... |
<filename>app/src/block/tests/services/block.service.spec.ts
import { Test, TestingModule } from '@nestjs/testing';
import { BlockService } from '../../services/block.service';
import { getModelToken } from '@nestjs/mongoose';
import { Query, Model } from 'mongoose';
import { BlockInterface } from '../../interfaces/blo... |
/*
* Copyright (c) Open Source Strategies, Inc.
*
* Opentaps is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Openta... |
import sqlite3
# create an in-memory SQLite3 library database
db_connection = sqlite3.connect(':memory:')
cursor = db_connection.cursor()
# Create a table called 'books'
cursor.execute('''CREATE TABLE books
(title text, author text, publisher text, year int)''')
db_connection.commit()
# Create a se... |
package weixin.report.model;
import java.util.Date;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.poi.excel.annotation.Excel;
import weixin.util.DataDictionaryUtil.FlowType;
/**
* @author parallel_line
* @version 2016年9月26日 下午9:01:11
*/
public class MerchantCharge implements java.io.Seri... |
/*
* Copyright (c) 2006-2015 <NAME> <<EMAIL>>,
* 2006-2009 <NAME> <<EMAIL>>,
* 2015 <NAME> <<EMAIL>>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all co... |
<reponame>msaglJS/msagl-js
// A priority queue based on the binary heap algorithm
export class BinaryHeapPriorityQueue {
// indexing for A starts from 1
_heap: number[]
// array of heap elements
_reverse_heap: number[]
// the map from [0,..., n-1] to their places of heap
// the array of priorities
_p... |
#!/bin/bash
if [ -z "$MAMBO_PATH" ]; then
MAMBO_PATH=/opt/ibm/systemsim-p8/
fi
if [ -z "$MAMBO_BINARY" ]; then
MAMBO_BINARY="/run/pegasus/power8"
fi
if [ ! -x "$MAMBO_PATH/$MAMBO_BINARY" ]; then
echo 'Could not find executable MAMBO_BINARY. Skipping hello_world test';
exit 0;
fi
if [ -n "$KERNEL" ]... |
<filename>docs/html/structCatch_1_1Matchers_1_1StdString_1_1EqualsMatcher.js
var structCatch_1_1Matchers_1_1StdString_1_1EqualsMatcher =
[
[ "EqualsMatcher", "structCatch_1_1Matchers_1_1StdString_1_1EqualsMatcher.html#ab740f1fb2310e9fe3fed5134d4c7e4c8", null ],
[ "match", "structCatch_1_1Matchers_1_1StdString_1... |
<gh_stars>1-10
from django.forms import ModelForm
from .models import Post, Comment
from loginsignup.utils import getBeaverInstance
class PostForm(ModelForm):
class Meta:
model = Post
exclude = ["likes", "posted_on", "post_creator"]
def checkPost(self, request):
if self.is_valid():
... |
<reponame>mdavidsaver/yascaif<gh_stars>1-10
package yascaif.cli;
import java.util.List;
import yascaif.CA;
public interface Command {
public void process(CA ca, List<String> PVs);
}
|
#!/bin/bash
#
# Copy files to the bastion
# Prepare the bastion to configure the rest of the VMs
#
#
BASTION_HOST=${BASTION_HOST:-bastion.${OCP3_BASE_DOMAIN}}
INSTANCE_FILES="instance_hosts.sh ch4.8.3*_all.sh ch4.8.4_*.sh"
scp -i ${OCP3_KEY_FILE} ${INSTANCE_FILES} cloud-user@${BASTION_HOST}:
ssh -i ${OCP3_KEY_FILE} ... |
<reponame>bogdanbebic/InverseSquareRoot
var searchData=
[
['inv_5fsqrt',['inv_sqrt',['../namespaceinv__sqrt.html',1,'']]],
['inverse_5fsqrt_2ecpp',['inverse_sqrt.cpp',['../inverse__sqrt_8cpp.html',1,'']]],
['inverse_5fsqrt_2eh',['inverse_sqrt.h',['../inverse__sqrt_8h.html',1,'']]]
];
|
<filename>plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryMetadata.java
/*
* 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... |
#!/bin/sh
set -o errexit
set -o pipefail
set -o nounset
set -o xtrace
celery -A flyrig.taskapp worker -l INFO
|
SELECT AVG(CountBooksRead)
FROM (
SELECT COUNT(OrderID) AS CountBooksRead
FROM Orders
WHERE DATEDIFF (YEAR, OrderCreatedDate, CURDATE()) <= 1
GROUP BY CustomerID) As booksRead |
<reponame>mattwigway/analysis-ui
import {Button, Flex, Heading, Text} from '@chakra-ui/react'
import get from 'lodash/get'
import {useDispatch, useSelector} from 'react-redux'
import {
fetchTravelTimeSurface,
setIsochroneFetchStatus
} from 'lib/actions/analysis'
import {abortFetch} from 'lib/actions/fetch'
import ... |
<gh_stars>0
# Standard library
import logging
import os
import re
import socket
from argparse import ArgumentParser
from shutil import copyfile, rmtree
# Third-party
import git
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.management import BaseCommand, Comma... |
#!/bin/bash
GAME="packerfactorio.zip"
echo "Starting server with savefile: ${GAME}"
if [ ! -f ./save/${GAME} ]
then
echo "Save not found, creating new map"
./bin/x64/factorio --create ./save/packerfactorio.zip
fi
./bin/x64/factorio --start-server ./save/${GAME} \
--server-settings ./config/server-settings.jso... |
#!/bin/bash
set -xeou pipefail
GOPATH=$(go env GOPATH)
REPO_ROOT=$GOPATH/src/github.com/kubedb/mysql
source "$REPO_ROOT/hack/libbuild/common/lib.sh"
source "$REPO_ROOT/hack/libbuild/common/kubedb_image.sh"
DOCKER_REGISTRY=${DOCKER_REGISTRY:-kubedb}
IMG=mysql-tools
DB_VERSION=8.0.3
TAG="$DB_VERSION"
OSM_VER=${OSM_... |
/**
* @typedef {Object} Rate
*
* @property {string} currency
* @property {number} buy
* @property {number} cell
*/
/**
* @typedef {Object} NumberSeparators
*
* @property {string} thousands
* @property {string} decimals
*/
|
#! /usr/bin/env sh
set -o nounset
set -e
echo "Running 2.0.0 data migrations"
echo "Remove duplicate past status"
bin/rake remove_duplicate_past_status
echo "fix OTF service associtaions"
bin/rake fix_otf_service_associations
echo "remove invalid identities"
bin/rake data:remove_invalid_identities
echo "Replace arm ... |
<filename>app/components/answer-tile.js<gh_stars>1-10
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
upvote(answer) {
var params = {
score: answer.get('score') + 1
};
this.sendAction('updateAnswer', answer, params);
},
downvote(answer) {
var... |
import random
import string
def generate_verification_code(length):
code = ''.join(random.choices(string.ascii_letters + string.digits, k=length))
return code |
LONG_SCRIPT_NAME=$(basename $0)
SCRIPT_NAME=${LONG_SCRIPT_NAME%.sh}
# Variable initialization, to avoid crash
CRITICAL_ERRORS_NUMBER=0 # This will be used to see if a script failed, or passed
status=""
forcedstatus=""
SUDO_CMD=""
[ -r $CIS_ROOT_DIR/lib/constants.sh ] && . $CIS_ROOT_DIR/lib/constants.sh
[ -r $CIS_ROOT... |
#!/bin/sh
set -e
curl -s http://localhost:8081/posts/clearCache -o /dev/null
curl -s http://localhost:8081/posts/MSG001 -o /dev/null -w "%{time_starttransfer}s\n"
curl -s http://localhost:8081/posts/MSG001 -o /dev/null -w "%{time_starttransfer}s\n"
|
#include "gtest/gtest.h"
#include "ScaFES_Communicator.hpp"
#include "ScaFES_Buffer.hpp"
namespace ScaFES_test
{
/*******************************************************************************
******************************************************************************/
/**
* Test class for the class 'Buffer'.
... |
import { ECSClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../ECSClient";
import { ListTaskDefinitionFamiliesRequest, ListTaskDefinitionFamiliesResponse } from "../models/models_0";
import { Command as $Command } from "@aws-sdk/smithy-client";
import { Handler, MiddlewareStack, HttpHandlerOptions a... |
/* **** Notes
Convert.
//*/
# define CAR
# include "../../../incl/config.h"
signed(__cdecl cv_l(signed char(*di_tbl),signed char(*si_tbl),signed char(*di),signed char(*si))) {
/* **** DATA, BSS and STACK */
auto signed i,r;
auto signed short flag;
/* **** CODE/TEXT */
if(!di_tbl) return(0x00);
if(!si_tbl) return(... |
/*
* @Author: dang
* @Date: 2021-04-08 16:16:02
* @LastEditTime: 2021-10-19 15:26:22
* @LastEditors: Please set LastEditors
* @Description: A worm
* @FilePath: \iot_gxhy_reservoirdam_web\src\api\base.js
*/
import request from '@/utils/request'
// 获取行政区
export const BASE_API_6 = process.env.VUE_APP_BASE_API_6 // ... |
import random
def generate_password(length):
if length < 8:
return None
password = ""
# Generate a random string with 1 uppercase, 1 lowercase and 1 digit
while True:
# Generate a random string with the specified length
password = ''.join(random.choices(string.asci... |
<filename>app/src/main/java/com/example/android/miwok/NumbersFragment.java
package com.example.android.miwok;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import andr... |
const { MessageEmbed } = require("discord.js");
const regions = require("../../data/regions.json");
module.exports = {
name: "guildRegionUpdate",
/**
* @param {import("discord.js").Client} bot
* @param {import("discord.js").Guild} guild
* @param {string} oldRegion
* @param {string} newRegion
*/
as... |
while true; do
echo 23;
sleep 1000;
done |
#!/usr/bin/env bash
docker build -t cc.momas/momas-mospider:1.0 .
|
import { logging } from 'protractor';
export class JourneySearchResponse
{
OutwardOpenPureReturnFare : JourneyResponse[];
SingleOutward : JourneyResponse[];
SingleReturn : JourneyResponse[];
JourneyReturnTimeDetails : JourneyReturnTimeDetails[];
JourneyFareBreakups : JourneyFareBreakups[];
}
... |
<filename>lib/backend/syncersv1/bgpsyncer/bgpsyncer.go
// Copyright (c) 2017-2018 Tigera, Inc. All rights reserved.
// 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.apac... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0016_auto_20160608_1535'),
]
operations = [
migrations.CreateModel(
name='form',
fields=[
... |
/*
Copyright 2012 Two Toasters, LLC
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 ... |
import theme from '@nuxt/content-theme-docs'
export default theme({
target: "static",
docs: {
primaryColor: '#0080FF'
},
content: {
markdown: {
remarkPlugins: [
"remark-emoji",
"@fec/remark-a11y-emoji"
]
}
},
components: true
})
|
import base64
def validateAndProcessSignature(ProjectId, SigContent, SigId, SigPurpose, SigType, CertificateType, Document, File):
# Validate input parameters
if not isinstance(ProjectId, str):
return "Error: ProjectId should be a string."
if not isinstance(SigContent, str):
return "Error: ... |
module Kudzu
class Agent
class Reference < Kudzu::Model::Base
include Kudzu::Model::Link
attr_accessor :url, :title
end
end
end
|
#!/usr/bin/env bash
set -e
resolve_link() {
$(type -p greadlink readlink | head -1) "$1"
}
abs_dirname() {
local cwd="$(pwd)"
local path="$1"
while [ -n "$path" ]; do
cd "${path%/*}"
local name="${path##*/}"
path="$(resolve_link "$name" || true)"
done
pwd
cd "$cwd"
}
PREFIX="$1"
if [ -z "... |
import { SET_CURRENT_BOARD } from '../../actions/types';
const currentBoard = (state = null, action) => {
const { type, payload: boardId } = action;
switch (type) {
case SET_CURRENT_BOARD:
return boardId;
default:
return state;
}
};
export default currentBoard;
|
<filename>OpenRobertaParent/WedoInterpreter/jsGenerated/node_modules/interpreter.interpreter.js<gh_stars>1-10
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (t... |
def lcs(s1, s2):
m = len(s1)
n = len(s2)
L = [[0 for x in range(n+1)] for x in range(m+1)]
for i in range(m+1):
for j in range(n+1):
if i == 0 or j == 0:
L[i][j] = 0
elif s1[i-1] == s2[j-1]:
L[i][j] = L[i-1][j-1] + 1
else:... |
# coding: UTF-8
require "spec_helper"
describe Warden::Protocol::PingRequest do
subject(:request) do
Warden::Protocol::PingRequest.new
end
it_should_behave_like "wrappable request"
it 'has class type methods' do
expect(request.class.type_camelized).to eq('Ping')
expect(request.class.type_undersc... |
<gh_stars>0
package praesentation;
import java.awt.Dimension;
import java.awt.Font;
import java.util.Iterator;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import modell.Fassade;
import steuerung.Hauptsteuerung;
import steuerun... |
#!/bin/bash -f
#*********************************************************************************************************
# Vivado (TM) v2018.2 (64-bit)
#
# Filename : rd_data_fifo.sh
# Simulator : Mentor Graphics ModelSim Simulator
# Description : Simulation script for compiling, elaborating and verifying the pro... |
def bfs(graph, start):
"""
Implement an iterative Breadth-first search (BFS) algorithm.
Args:
graph (dict): The graph representing the connections
start (str): The given start node
Returns:
list: The visited nodes in order
"""
# Keep track of all visited nodes
visited = []
# Keep track of nodes to be check... |
package utils
import (
"fmt"
"strings"
)
// Run doc
type Run struct {
Profile *ProfileConf
ProfilePath string
OutputDir string
CmdDir func(string, string, string, bool)
Verbosity bool
}
func (r *Run) runCmdOnDir(cmd string, cmdDesc string, cmdDir string) {
baseCmd := strings.Split(cmd, " ")[0]
... |
import hashlib
from Crypto.PublicKey import RSA
from Crypto.Signature import pkcs1_15
from Crypto.Hash import SHA256
class RSAAlgorithm(AbstractSigningAlgorithm):
def __init__(self, hash_fun: object) -> None:
self.hash_fun = hash_fun
def sign(self, data: bytes) -> bytes:
key = RSA.generate(204... |
// Copyright 2007, 2008 The Apache Software Foundation
//
// 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... |
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Images from './components/Images';
class App extends Component{
render(){
return(
<div>
This is the React App
<Images />
</div>
);
}
}
ReactDOM.render(<App />, document.getElementById('root'));
|
import React from "react";
function SearchForm() {
return (
<form class="form-inline">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"/>
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
... |
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
</head>
<body>
<h2>Login</h2>
<form>
<input type="email" id="input_email" placeholder="Email">
<input type="password" id="input_password" placeholder="Password">
<button type="button" onclick="handleClick()">Login</button>
</fo... |
import Game from "/src/game";
let canvas = document.createElement("canvas");
let context = canvas.getContext("2d");
canvas.width = 350;
canvas.height = 500;
document.body.appendChild(canvas);
let game = new Game(canvas);
let lastTime = 0;
function gameLoop(timestamp){
let deltaTime = timestamp - lastTime;
... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 ludovicRoucoux
*
* 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
* to us... |
<filename>editors/src/main/java/org/museautomation/ui/editors/suite/SetDataIdAction.java
package org.museautomation.ui.editors.suite;
import org.museautomation.core.suite.*;
import org.museautomation.ui.extend.actions.*;
/**
* @author <NAME> (see LICENSE.txt for license details)
*/
class SetDataIdAction extends Und... |
import java.util.List;
import java.util.Map;
public class SmsStaffAmountStatisticsResult implements Serializable {
private List<String> amountCat;
public int calculateTotalSmsAmount(SmsStaffAmountStatisticsResult result, Map<String, Integer> smsAmounts) {
int totalSmsAmount = 0;
for (String ca... |
public boolean isPalindrome(String str) {
int n = str.length();
for (int i = 0; i < n/2; i++)
if (str.charAt(i) != str.charAt(n-i-1))
return false;
return true;
} |
<filename>src/include/wctype.h
#pragma once
/* Wide character classification and mapping utilities <wctype.h>
This file is part of the Public Domain C Library (PDCLib).
Permission is granted to use, modify, and / or redistribute at will.
*/
#include "j6libc/cpp.h"
#include "j6libc/int.h"
#include "j6libc/wint_t... |
<filename>services/api/src/utils/__tests__/csv.js
const mongoose = require('mongoose');
const { csvExport } = require('../csv');
const { dedent: d } = require('../string');
const user = {
firstName: 'John',
lastName: 'Doe',
};
const complex = {
user,
status: 'active',
address: {
city: 'Baltimore',
s... |
<gh_stars>1-10
"""
Repository of test pipelines
"""
from dagster import (
Int,
ModeDefinition,
PipelineDefinition,
PresetDefinition,
repository,
resource,
solid,
)
from dagster.utils import file_relative_path
def define_empty_pipeline():
return PipelineDefinition(name="empty_pipeline"... |
#!/bin/bash
# install needed dependencies
sudo apt-get update
sudo apt-get install \
build-essential pkg-config libc6-dev m4 g++-multilib \
autoconf libtool ncurses-dev unzip git python python-zmq \
zlib1g-dev wget curl bsdmainutils automake
# zcashBitcore
cd
git clone https://github.com/bitzec/bit... |
<reponame>VerdaPegasus/FarmersDelight
package vectorwing.farmersdelight.client.renderer;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecr... |
package com.lilithsthrone.game.inventory.clothing;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.lilithsthrone... |
// https://www.codechef.com/OCT19A/problems/MSV
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
int N = 1000000;
vi d;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int t, n;
cin >> t;
while (t--) {
cin >> n;
vi a(n);
d = vi(N+1);
for (int i... |
<filename>Calligraphy/src/com/jinke/calligraphy/app/branch/CalliPointsImpl.java
package com.jinke.calligraphy.app.branch;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
... |
#!/bin/bash
docker node ls | grep Down | awk '{print $1}' | xargs docker node rm
|
import React from 'react';
import Img from 'gatsby-image';
import styles from './StaffProfile.module.css';
const StaffProfile = ({ image, name, title, description}) => {
return (
<div className={styles.container}>
<Img fixed={image} />
<p className={styles.nameTitle}>{name}<br/>{ti... |
#!/bin/bash
# This script help with heartbeat and silences synchronization.
#
# Whenever a cluster is know to have issues, a silence is created in https://github.com/giantswarm/silences repository.
# In some cases this silence might apply to the whole cluster,
# when this is the case heartbeat in Opsgenie for the corr... |
<reponame>GoldenPedro/java-deployshoppingcart
package com.lambdaschool.shoppingcart.config;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.con... |
package com.ootterskog.apps;
import org.dom4j.tree.AbstractEntity;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Customer extends AbstractEntity {
@Id
private String id;
private String firstname, lastname, email;
}
|
#!/bin/bash
# ...env
mkdir -p /$PROJECT/.env
source /usr/local/bin/virtualenvwrapper.sh
mkvirtualenv $PROJECT
pip install -r /tmp/requirements.txt
|
<filename>src/main/java/de/tub/cit/slist/bdos/util/SerializerHelper.java
package de.tub.cit.slist.bdos.util;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
impo... |
<gh_stars>100-1000
package com.sun.javafx.scene.control.skin;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.control.Control;
import com.sun.javafx.scene.control.MultiplePropertyChangeListenerHandler;
import javafx.scene.control.SkinBase;... |
package demo.dso.auth;
import org.noear.solon.core.handle.Context;
import org.noear.solon.core.handle.Result;
import org.noear.solon.validation.Validator;
/**
* @author noear 2021/3/10 created
*/
public class AuthValidator implements Validator<Auth> {
public static final AuthValidator instance = new AuthValidat... |
#!/bin/bash
# Terraform Scaffold
#
# A wrapper for running terraform projects
# - handles remote state
# - uses consistent .tfvars files for each environment
##
# Set Script Version
##
readonly script_ver="1.6.1";
##
# Standardised failure function
##
function error_and_die {
echo -e "ERROR: ${1}" >&2;
exit 1;
};... |
public class Percolation {
private int M;
private WeightedQuickUnionUF gridUF;
private boolean[][] gridOC;
public Percolation(int N) {
if(N <= 0) {
throw new java.lang.IllegalArgumentException();
}
M = N;
// create ,N*N+2 components
gridUF = new Weigh... |
import * as React from 'react';
import Typography from '@material-ui/core/Typography';
import DialogTitle from '@material-ui/core/DialogTitle';
import DialogActions from '@material-ui/core/DialogActions';
import DialogContent from '@material-ui/core/DialogContent';
import Button from '@material-ui/core/Button';
import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.