language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 876 | 2.734375 | 3 | [] | no_license | package com.bookstore.utility;
import java.security.SecureRandom;
import java.util.Random;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Component;
@Component
public interface SecurityUtility {
pub... |
JavaScript | UTF-8 | 1,963 | 2.875 | 3 | [] | no_license | const { extractStoryID } = require('./story-controller-utils');
/**
* Processes a story slug from the path
* - injects req.context.pathStory property on success
* @requires req.storySlug: the slug to exchange
* @requires req.context.models DB models
* @param {Request} req Request object
* @param {Response} res R... |
Java | UTF-8 | 1,163 | 3.984375 | 4 | [] | no_license | package javatutorials;
public class StaticAndNonStaticConcept {
//Global variable:scope of global variable
String name="Tom";//Non Static Global Variable will be available across all the functions with same consitions
static int age=25;//Static Global Variable
public static void main(String[] args) {
//... |
JavaScript | UTF-8 | 1,926 | 2.78125 | 3 | [
"MIT"
] | permissive | // 正则验证
export function isvalidUsername(str) {
return true;
// const validMap = ['admin', 'editor']
// return validMap.indexOf(str.trim()) >= 0
}
// 合法uri
export function validateURL(textval) {
/* eslint max-len: 0 */
const urlRegex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4... |
C++ | UTF-8 | 723 | 2.78125 | 3 | [] | no_license | #ifndef _NOTE_H_
#define _NOTE_H_
class Note {
private:
double Id;
double Balance;
public:
Note(void);
Note(double id);
Note(double id, double summ);
~Note(void);
void Push(double summ);
bool Pop(double summ);
double GetBalance(void);
Note& operator =(Note& note);
friend bool operator ==(Note& note1, Not... |
C++ | UTF-8 | 747 | 3.328125 | 3 | [] | no_license | //
// euler10.cpp
//
//
// Created by José Miguel Molina Arboledas on 06/05/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include <iostream>
using namespace std;
unsigned int n = 2;
unsigned int primesum = 0;
bool isPrime(int number);
int main(void) {
while (n < 2000000) {
i... |
Go | UTF-8 | 413 | 3.015625 | 3 | [] | no_license | package main
import (
"design-pattern/singleton-pattern/service/one"
"design-pattern/singleton-pattern/service/three"
"design-pattern/singleton-pattern/service/two"
)
func main() {
for i := 0; i < 10; i++ {
oneService := one.GetInstance()
oneService.PrintSomething()
twoService := two.GetInstance()
twoSe... |
Swift | UTF-8 | 10,269 | 2.515625 | 3 | [] | no_license |
import AVFoundation
import AudioToolbox
import VideoToolbox
struct IOID {
let from: String
let to: String
let sid: String // session unique ID
let gid: String // io group (audio + video) ID
init(_ from: String, _ to: String, _ sid: String, _ gid: String) {
self.from = from
... |
JavaScript | UTF-8 | 4,044 | 2.515625 | 3 | [] | no_license | /* global WaveSurfer:false */
const recorderRecordElm = document.querySelector('[data-recorder-record]')
const recorderPauseElm = document.querySelector('[data-recorder-pause]')
const recorderResumeElm = document.querySelector('[data-recorder-resume]')
const recorderStopElm = document.querySelector('[data-recorder-sto... |
Swift | UTF-8 | 185 | 2.9375 | 3 | [] | no_license | let person = "Swift Programmer"
var greeting = "Hello, "
greeting + person
greeting = "Hi there, "
greeting + person
var newline: String
newline = "\n"
greeting + newline + person
|
Markdown | UTF-8 | 2,424 | 3.078125 | 3 | [] | no_license | # PHP Slim 4 Basic restful API
[](https://www.codacy.com/gh/ajsevillano/api.uniondistribuidora.com/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ajsevillano/api.uniondistribuidora.com&utm_campaign=Badge_Grade)... |
JavaScript | UTF-8 | 2,350 | 2.625 | 3 | [] | no_license | /**
* Created by x on 11/16/16.
*/
// ACCEPTANCE TEST
/**
* Setup test suit configuration
*/
var chai = require('chai'),
should = chai.should,
expect = chai.expect,
Promise = require('bluebird'),
request = require('superagent-promise')(require('superagent'), Promise),
chaiAsPromised = require(... |
C++ | UTF-8 | 2,732 | 2.734375 | 3 | [
"BSD-3-Clause-Clear"
] | permissive | //
// Created by tao on 19-1-17.
//
#include <unordered_map>
#include "common_includes.h"
#include "time_gap.hpp"
TEST(test_test, 1) {
std::map<int, int> typeMapRef;
size_t threadGap = 100;
for (int i = 0; i < 1024; ++i) {
typeMapRef[i] = i;
}
using IteratorType = decltype(typeMapRef)::iterator;
auto ... |
Python | UTF-8 | 1,321 | 2.609375 | 3 | [] | no_license | from flask import Flask,url_for,redirect,render_template
from url2list import ListConverter
from jsonify_resp import JSONResponse
app = Flask(__name__)
#将自定义的响应类赋值给当前的app,从而替换响应类
app.response_class=JSONResponse
#将新建的转换器类型加入内建类型中
app.url_map.converters['list']=ListConverter
@app.route('/')
def index():
return re... |
C++ | UTF-8 | 840 | 3.1875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> &A){
sort(A.begin(), A.end());
int candidate = *A.begin();
int count = 1;
int max_cand;
int max_count = 0;
for (vector<int>::iterator it = A.begin()+1; it != A.end(); it++){
if (*... |
JavaScript | UTF-8 | 4,272 | 3.75 | 4 | [] | no_license | // Troll Game Project 7/22/2020
"use strict";
// Set up an evemt listener for the button to trigger the game
document.getElementById("button").addEventListener("click", trollBattle);
// Function to run the game
function trollBattle(){
// Initial prompt question for the user stored in a variable
var action = windo... |
Java | UTF-8 | 1,867 | 3 | 3 | [] | no_license | /**
* Copyright (c) 1999-2007, Fiorano Software Technologies Pvt. Ltd. and affiliates.
* Copyright (c) 2008-2015, Fiorano Software Pte. Ltd. and affiliates.
*
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Fiorano Software ("Confidential Information"). You
* shall... |
C++ | UTF-8 | 451 | 2.6875 | 3 | [] | no_license | #include "Prof.h"
/****************************/
/* class Prof : public User */
/****************************/
// constructor for professor user
Prof::Prof(std::string name, std::string favoriteJoke) :
User(YELLOW, name, "Favorite joke: " + favoriteJoke)
{
}
// returns string with user type
std::string Prof::getU... |
Java | UTF-8 | 862 | 2.5 | 2 | [] | no_license | package com.cheng.springbatch.xml;
import java.util.Date;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.stereotype.Component;
/**
* @author chengchenrui
* @version Id: XMLProcessor.java, v 0.1 2017.2.28 10:37 chengchenrui Exp $$
*/
@Component("xMLProcessor")
public class XMLProce... |
Java | UTF-8 | 7,684 | 2 | 2 | [] | no_license | package com.augmentify.DataModule.Objects.User;
import android.content.Context;
import android.net.Uri;
import android.util.Log;
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.J... |
Python | UTF-8 | 2,691 | 4 | 4 | [] | no_license | # Aditya Srivastava, CS1, 10/19/16 ; system.py
# This class allows multiple bodies in a given list to be drawn and move by using the Body class and its methods
from cs1lib import *
from body import Body
from math import *
class System:
def __init__(self, body_list):
self.body_list = body_list # body ... |
Markdown | UTF-8 | 2,797 | 3.359375 | 3 | [
"MIT"
] | permissive | ---
title: FAQ
path: /faq/
index: 12
---
### Why is there a blue outline around my element?
You may notice a blue outline around your reference element. The blue outline is
called a focus ring; it lets keyboard users know which element on the page is
currently in focus. Tippy adds an attribute to the element so that ... |
Markdown | UTF-8 | 1,015 | 3.796875 | 4 | [] | no_license | # Python Dev Notes
## Lists vs Tuples
* Tuples are more lightweight and usually preferable when data becomes static.
* The `list.append` function over-allocates space to the list (the assumption is that one append is the precursor of many appends). Therefore, it's possible to grow lists to be much larger than intende... |
Python | UTF-8 | 437 | 3.734375 | 4 | [] | no_license | def cut_slices(target_list, a=0, b='', c=1):
# 如果b未赋值 则设置为数组长度
if b == '':
b = len(target_list)
result_list = [] # 切片后的数组
step = 0 # 步数
for x in range(a, b):
# 防止下标越界
if(x < len(target_list) and step % c == 0):
result_list.append(target_list[x])
step += 1
print(result_list)
target_list = ['a', '... |
Java | UTF-8 | 1,312 | 3.8125 | 4 | [] | no_license | package playingcard;
import java.util.Random;
/**
*
* @author Marios Christodoulou
*/
public class Pack {
PlayingCard[] cards = new PlayingCard[52];
public int counter = 0;
/**
* Constructs a pack of 52 cards. Sorted by suit Clubs, Diamonds, Hearts,
* Spades. Sorted ascending.
*/
p... |
Markdown | UTF-8 | 2,414 | 2.640625 | 3 | [] | no_license | Mobile Tencent Analytics (MTA) is professional mobile App statistics and analysis tool for popular smartphone platforms and HTML5 Apps. Developers can easily embed it into statistics SDKs to monitor Apps in an all-round way, keep track of product performances in real time, and gain a precise insight into user behaviors... |
Python | UTF-8 | 736 | 3.46875 | 3 | [] | no_license | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return a boolean
def getDepth(self, root):
if root == None:
return 0
el... |
C++ | UTF-8 | 823 | 2.640625 | 3 | [] | no_license | #include "servos.h"
Servo armservo;
Servo damper1;
Servo damper2;
void init_arm_servo() {
armservo.attach(SENSOR_ARM_PIN);
}
void lower_arm_servo() {
armservo.attach(SENSOR_ARM_PIN);
armservo.write(ARM_ZERO_POSITION);
//pinMode(SENSOR_ARM_PIN, INPUT);
}
void raise_arm_servo() {
armservo.attach(... |
Java | UTF-8 | 1,128 | 1.71875 | 2 | [
"Apache-2.0"
] | permissive | package com.hacknife.loginsharepay.impl.login;
import android.support.v7.app.AppCompatActivity;
import com.hacknife.loginsharepay.impl.BaseLoginShare;
import com.sina.weibo.sdk.auth.WbAuthListener;
import com.tencent.mm.opensdk.modelmsg.SendAuth;
import com.tencent.tauth.IUiListener;
/**
* author : Hacknife
* e-m... |
Markdown | UTF-8 | 1,173 | 2.625 | 3 | [] | no_license | ---
title: "'The Machine Stops'"
format: "book"
category: "f"
yearReleased: "1909"
author: "E.M. Forster"
---
An early dystopia, in which Earth's future population, now living underground, has become slave to, and is beginning to worship, the Machine; a rebel discovers freedom above ground, but although those alread... |
Java | UTF-8 | 742 | 2.078125 | 2 | [] | no_license | import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.WindowManager;
/**
* Created by lixindong on 25/7/16.
*/
public class RunInShell extends AnA... |
Ruby | UTF-8 | 5,510 | 2.84375 | 3 | [
"BSD-3-Clause",
"BSD-2-Clause-Views"
] | permissive | #!/usr/bin/env ruby
require 'open3'
require 'curses'
JQQ_VERSION = "0.0.1"
FILE_Y = 0
EXPR_Y = 1
OUTPUT_Y = 2
CSI_UP = 'A'
CSI_DOWN = 'B'
CSI_RIGHT = 'C'
CSI_LEFT = 'D'
KEY_BACKSPACE = 127
KEY_CTRL_A = 1
KEY_CTRL_D = 4
KEY_CTRL_E = 5
KEY_CTRL_K = 11
KEY_CTRL_U = 21
KEY_ENTER = 10
KEY_ESCAPE = 27
KEY_LEFT_BRACKET =... |
Python | UTF-8 | 2,380 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Auther : liou
import math
import torch
from torch import nn
import torch.nn.functional as F
from .utils import clones
def attention (query, key, value, mask = None, dropout = None) :
"""attention模型
输出为:softmax (q * k / d_k^0.5) * v
d_k为词向量维度。
这个公式与乘性attention计算方式的唯一不同就在于使... |
C++ | UTF-8 | 1,792 | 2.515625 | 3 | [
"MIT"
] | permissive | #include "transport.h"
#include <zmq.h>
#include <leveldb/env.h>
#include <sstream>
#include <iostream>
Transport::Transport(InQueue* q_in_, OutQueue* q_out_, leveldb::Logger* logger_)
: packer(&buffer)
, logger(logger_)
, q_in(q_in_)
, q_out(q_out_){
}
bool Transport::recv_next(Message* message){
... |
Markdown | UTF-8 | 5,478 | 2.953125 | 3 | [] | no_license | # Spring-Boot Camel Narayana Quickstart
This quickstart uses Narayana TX manager with Spring Boot and Apache Camel on Openshift to test 2PC/XA transactions with a JMS resource (ActiveMQ) and a database (PostgreSQL).
The application uses a *in-process* recovery manager and a persistent volume to store transaction logs... |
Java | UTF-8 | 1,687 | 4 | 4 | [] | no_license | package dp;
/**
801. Minimum Swaps To Make Sequences Increasing
We have two integer sequences A and B of the same non-zero length.
We are allowed to swap elements A[i] and B[i]. Note that both elements are in the same index position in their
respective sequences.
At the end of some number of swaps, A and B ar... |
Java | UTF-8 | 377 | 2.671875 | 3 | [] | no_license | package com.bobsystem.structural.decorator;
import com.bobsystem.structural.decorator.interfaces.IPainter;
public class BluePainter
extends Painter {
public BluePainter() {
}
public BluePainter(IPainter paint) {
super(paint);
}
@Override
public void paint() {
System.ou... |
C++ | UTF-8 | 9,135 | 2.953125 | 3 | [
"MIT"
] | permissive | #include <iostream>
#include <functional>
#include <numeric>
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
using namespace std;
using namespace std::placeholders;
using Line = vector<char>;
using Lines = vector<Line>;
template<typename DestinationType>
auto transformAll = [](const auto& source, con... |
C# | UTF-8 | 753 | 2.515625 | 3 | [] | no_license | using System;
using System.Linq;
using System.Xml.Linq;
namespace Adapter.Classes
{
class PlikConverter
{
public XDocument GetXML()
{
var xDocument = new XDocument();
var xElement = new XElement("Producenci");
var xAttributes = DaneProducenta.GetData()
... |
Markdown | UTF-8 | 3,205 | 3.015625 | 3 | [] | no_license | ---
ID: 344
post_title: 'RHCSA – Copying files from one server to another using SCP'
author: sher
post_excerpt: ""
layout: post
permalink: >
https://codingbee.net/tutorials/rhcsa/rhcsa-copying-files-from-one-server-to-another-using-scp
published: true
post_date: 2015-04-06 00:00:00
---
<h2>Overview</h2>
By the ... |
C++ | UTF-8 | 2,473 | 2.796875 | 3 | [] | no_license | /***************************************************************************************************************
A class which are able to show stack of methods and position of executing.
It will assist developers tracing the code without gdb.
Author: Ireul Lin
*********************************************************... |
C# | UTF-8 | 3,114 | 2.78125 | 3 | [] | no_license | using System;
using System.Reflection;
using System.Text;
using System.Runtime.Serialization;
namespace exception_test
{
class Program
{
static void ExceptionTest0()
{
try
{
Console.WriteLine("try: {0}", MethodBase.GetCurrentMethod().Name);
... |
Python | UTF-8 | 1,463 | 3.71875 | 4 | [] | no_license | # import some function in modules
from sys import argv
from cs50 import get_string
# kecheck function
def key_check(text):
for i in text:
if str.isalpha(i):
pass
else:
return False
return True
# shift function to keep track of the case
def shift(char):
if str.isup... |
C++ | UHC | 1,127 | 2.890625 | 3 | [] | no_license | /*
¥: 2020-01-06
з: DFS
TIP: visited 迭 ʴ DFS
*/
#include <iostream>
#pragma warning (disable: 4996)
using namespace std;
int R, C;
char board[22][22] = { 0 };
//int visited[22][22] = { 0 };
int check[200] = { 0 };
int move_x[4] = { 0, 0, 1, -1 };
int move_y[4] = { 1, -1, 0, 0 };
int max_depth = 1;
void dfs(int x, ... |
Java | UTF-8 | 3,148 | 2.375 | 2 | [] | no_license | package uk.co.rbs.openbanking.servicedesk.services;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.*;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.messag... |
Ruby | UTF-8 | 4,899 | 2.515625 | 3 | [
"MIT"
] | permissive | # frozen_string_literal: true
class NoResponseService < Polist::Service
def call; end
end
class BasicService < Polist::Service
def call
success!(a: 1)
end
end
class ServiceWithForm < BasicService
class Form < Polist::Service::Form
attribute :a, :String
attribute :b, :Integer
attribute :c, :St... |
JavaScript | UTF-8 | 7,054 | 3.15625 | 3 | [] | no_license |
// определяем число ли это или нет
function isNumeric(n)
{
return !isNaN(parseFloat(n)) && isFinite(n);
// Метод isNaN пытается преобразовать переданный параметр в число.
// Если параметр не может быть преобразован, возвращает true, иначе возвращает false.
// isNaN("12") // false
}
... |
Markdown | UTF-8 | 1,117 | 2.578125 | 3 | [] | no_license | # Article L138-5
Les entreprises visées à l'article L. 138-1 sont tenus d'adresser à l'Agence centrale des organismes de sécurité sociale les
éléments nécessaires en vue de la détermination de la progression du chiffre d'affaires réalisé au cours de chaque trimestre
civil, avant le dernier jour du deuxième mois suivan... |
JavaScript | UTF-8 | 1,670 | 2.90625 | 3 | [] | no_license | /** @jsx React.DOM */
var MovieBox = React.createClass({displayName: "MovieBox",
getInitialState: function() {
return {data: []};
},
componentDidMount: function() {
$.ajax({
url: this.props.url,
dataType: 'json',
cache: false,
success: function(data) {
this.setState({data:... |
Java | UTF-8 | 4,381 | 2.390625 | 2 | [] | no_license | package porsius.nl.topo.data;
import android.content.Context;
import android.location.Location;
import android.os.Handler;
import android.webkit.JavascriptInterface;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
import porsius.nl.topo.create.EditMapActivity;
/**
* Created by linda... |
C++ | UTF-8 | 2,134 | 3.0625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <queue>
#include "Maze.h"
typedef std::pair<int, int> Coord;
const Coord NOWHERE(-1, -1);
const int dirLin[4] = { -1, 0, 1, 0 };
const int dirCol[4] = { 0, 1, 0, -1 };
void find_exit(Maze& maze, Coord source)
{
/* Pentru a reconstitui drumul, vom folosi o matrice de... |
C++ | UTF-8 | 211 | 2.890625 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int n=6;
int fact,i;
fact = 1;
for(i=1;i<=n;i++)
{
fact = fact*i;
cout<<"Fact "<<fact;
}
cout<<"\n Final result :"<<fact;
return 0;
}
|
Java | UTF-8 | 514 | 1.882813 | 2 | [] | no_license | package com.lzit.dao;
import java.util.ArrayList;
import java.util.Date;
import com.lzit.entity.Cart;
import com.lzit.entity.Orders;
public interface OrdersDao {
public ArrayList<Orders> showOrders(String username);
public void insertOrders(String buydate,double totalprice,String orderstate,
String username... |
Java | UTF-8 | 571 | 2.828125 | 3 | [] | no_license | package ProjectOneEngine;
import java.util.Random;
public class RandomPlayer implements Player{
public Move getMove(GameState state){
Random rand = new Random();
boolean done = false;
PlayerID cur_player = state.getCurPlayer();
Move rand_move = null;
while ( ! done ){
int bin = rand.nextI... |
Python | UTF-8 | 1,009 | 2.890625 | 3 | [
"MIT"
] | permissive | import abc
import numpy as np
from .viewport import Viewport
from .window import Window
from cairo import Context
from geometry import hpt
class DrawContext:
def __init__(self, viewport: Viewport, win: Window, ctx: Context):
self.viewport = viewport
self.win = win
self.ctx = ctx
def v... |
Python | UTF-8 | 2,815 | 2.71875 | 3 | [] | no_license | import unittest
from patients_line import PatientsLine
from patient import Patient
class TestPatientsLine(unittest.TestCase):
def test_empty_line(self):
line = PatientsLine()
self.assertEqual(0, line.get_plus_patients_length())
self.assertEqual(0, line.get_minus_patients_length())
... |
PHP | UTF-8 | 1,281 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | <?php
/**
Copyright 2012-2013 Brainsware
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 agre... |
Python | UTF-8 | 3,547 | 3.265625 | 3 | [] | no_license | import pandas as pd
import datetime as datetime
def read_data(path):
df = pd.read_csv(path)
print("Reading CSV file...")
df = df.drop('Date', 1)
df['Date'] = [datetime.datetime.strptime(d[0:18], "%Y-%m-%d %H:%M:%S") for d in df["Rounded_Date"]]
df['Day'] = [datetime.datetime.date(d) for d in df["Date"]]
d... |
C++ | UTF-8 | 12,681 | 2.984375 | 3 | [] | no_license | /**
* Title: Market
* Author: Tonia Sanzo
* Date: 6/9/21
*
* Game manages the game entities (npcs, rugs, etc.)
*/
#include "PCH.h"
#include "Game.h"
#include "ThreadSafeRNG.h"
// Constructor
Game::Game()
{
sdl = nullptr;
mLoading = true;
mInitSuccess = true;
mCurrLoadingFrame = 0;
}
// Loads the gam... |
Shell | UTF-8 | 3,103 | 3.546875 | 4 | [] | no_license | alias dm=docker-machine;
dmenv() {
eval $(docker-machine env $1);
}
dms() {
_machine_data="$(docker-machine ls --format='{{.Name}} {{.URL}} {{.Active}}')"
_ssh_machine=(${_machine_data}) # cheating to get first name from list
_manager_url=$(docker info --format="{{range .Swarm.RemoteManagers}} {{.Addr}} {{end}}" ... |
Python | UTF-8 | 3,790 | 2.65625 | 3 | [] | no_license | """
Tools to estimate the uncertainty of the COSMOS shear estimates
"""
import numpy as np
import sys
sys.path.append('../shear/')
from read_shear_catalog import read_shear_catalog
sys.path.append('../shear/param_estimation/')
from tools import bootstrap_resample
def bootstrap_catalog(catalog_file, N_bootstraps, dth... |
Java | UTF-8 | 1,028 | 1.8125 | 2 | [] | no_license | /**
* This class was generated by the VisualAge for Java Access Bean SmartGuide.
* Warning: Modifications will be lost when this part is regenerated.
*/
package com.hps.july.persistence;
public interface LeaseMRCntPriorAccessBeanData {
public java.lang.Short getPriority() throws java.rmi.RemoteException, ... |
Markdown | UTF-8 | 1,389 | 3.421875 | 3 | [
"BSD-3-Clause"
] | permissive | ---
title: databank.clip
---
# `databank.clip` ^^(+databank)^^
{== Clip all time series in databank to a new range ==}
## Syntax
outputDatabank = databank.clip(inputDatabank, newStart, newEnd)
#### Input Arguments
__`inputDatabank`__ [ struct | Dictionary ]
>
> Input databank whose time series (of the mat... |
Ruby | UTF-8 | 465 | 3.796875 | 4 | [] | no_license | string = "hello world"
length = string.length
i = 0
# j = 0
first_word = []
# while i < length do (my code)
# while string[j] != ' '
# first_word << string[j]
# j+=1
# end
# i+=1
# end
# Others code
until string[i] == ' '
first_word << string[i]
i += 1
end
# first_word.each do |... |
PHP | UTF-8 | 649 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
namespace InetStudio\BannersPackage\Groups\Events\Back;
use Illuminate\Queue\SerializesModels;
use InetStudio\BannersPackage\Groups\Contracts\Models\GroupModelContract;
use InetStudio\BannersPackage\Groups\Contracts\Events\Back\ModifyItemEventContract;
/**
* Class ModifyItemEvent.
*/
class ModifyItemEvent im... |
Swift | UTF-8 | 3,385 | 3.328125 | 3 | [
"ECL-2.0",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | //
// Occupancy.swift
// bm-persona
//
// Created by Shawn Huang on 4/17/20.
// Copyright © 2020 RJ Pimentel. All rights reserved.
//
import UIKit
enum OccupancyStatus {
case high
case medium
case low
func badge() -> TagView {
let badge = TagView()
badge.translatesAutoresizing... |
Python | UTF-8 | 658 | 3.796875 | 4 | [] | no_license | """rank=[1,2,3,4,5,6,7,8,9,10,11,12,13]
suite=["h","s","d","c"]
cards=list(zip(rank,suite))
#populate the card list
card=[]
for ranks in rank:
cards=cards+[(ranks,suite[0]),(ranks,suite[1]),(ranks.suite[2])]
print(cards)
"""
class card():
suit_names = ['Clubs', 'Diamonds', 'Hearts', 'Spades']
rank_names = [None, ... |
Java | UTF-8 | 2,069 | 1.992188 | 2 | [] | no_license | package com.timss.ptw.bean;
import com.yudean.itc.annotation.UUIDGen;
import com.yudean.itc.annotation.UUIDGen.GenerationType;
import com.yudean.mvc.bean.ItcMvcBean;
/**
* '
*
* @title: 标准操作票操作项bean
* @description: {desc}
* @company: gdyd
* @className: SptoInfo.java
* @author: gucw
* @createDate: 2015年7月9日
... |
Python | UTF-8 | 723 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri May 22 11:55:42 2020
@author: Reuben
"""
import unittest
from npsolve import utils
class Test_Util_Containers(unittest.TestCase):
def test_get_dict(self):
d = utils.get_dict('test')
self.assertTrue(isinstance(d, dict))
self.assertTrue(d... |
C++ | UTF-8 | 2,857 | 3.21875 | 3 | [] | no_license | #include <vector>
/**
* This function splits the input sequence or set into one or more equivalence classes and
* returns the vector of labels - 0-based class indexes for each element.
* predicate(a,b) returns true if the two sequence elements certainly belong to the same class.
*
* The algorithm is described in ... |
C | UTF-8 | 6,805 | 2.875 | 3 | [] | no_license | /*
* Para compilar: mpicc stringWord_OMPI.c -o stringWord_OMPI -Wall
* Para rodar: mpirun -np 10 stringWord_OMPI ../input/shakespe.txt
* No cluster: time mpirun -np 10 -machinefile machinefile.xmen stringWord_OMPI ../input/shakespe.txt
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h... |
C# | UTF-8 | 15,433 | 2.5625 | 3 | [] | no_license | using System.Collections.Generic;
using SecureDataCleanerLibrary;
using SecureDataCleanerLibrary.Models;
using SecureDataCleanerLibrary.Models.Enums;
using Xunit;
namespace SecureDataCleanerLibraryTests
{
public class HttpHandlerTests
{
[Fact]
public void HttpHandler_Process_BookingcomHttpResu... |
Java | UTF-8 | 350 | 1.804688 | 2 | [
"MIT"
] | permissive | package com.wyt.labinformationmanagementsystem.model.db;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
@Data
@ToString
@NoArgsConstructor
@Accessors(chain = true)
public class Admin {
private Integer admId;
private String admUsername;
pr... |
Java | UTF-8 | 2,397 | 2.21875 | 2 | [] | no_license | package com.gradezilla.dao.entity;
// Generated Oct 6, 2015 7:42:06 PM by Hibernate Tools 3.2.2.GA
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
/**
* Role generated by hbm2java
*/
@Entity
@Table(name="Role"
,schema="dbo"
,catalog="SchoolApp"
)
public class Role implements ja... |
Markdown | UTF-8 | 2,206 | 4.0625 | 4 | [] | no_license | # two-sum-ii-input-array-is-sorted
[https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/](https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/)
```
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
The funct... |
C++ | UTF-8 | 596 | 3.140625 | 3 | [] | no_license | #pragma once
#include <chrono>
class Timer final
{
private:
Timer() : delta_time_ms(0.0f) { Initialize(); };
~Timer() = default;
public:
static Timer* Get() { static Timer instance; return &instance; }
const bool Initialize()
{
previous_time = std::chrono::high_resolution_clock::now();
return true;
}
con... |
Java | UTF-8 | 5,998 | 1.664063 | 2 | [] | no_license | package com.ailk.openbilling.persistence.imsxdr.entity;
import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAccessType;
import com.ailk.easyframe.web.common.annotati... |
C# | UTF-8 | 1,226 | 2.75 | 3 | [] | no_license | using System.Collections.Generic;
using System.Linq;
using ColorSoft.Web.Data;
using ColorSoft.Web.Data.Models;
namespace ColorSoft.Web.Queries.Users
{
public class GetUserByUsernameQuery : IGetUserByUsernameQuery
{
private readonly IDatabaseProvider _connection;
public GetUserByUsernameQuery... |
Python | UTF-8 | 964 | 3.25 | 3 | [] | no_license | begin_y = 25.8
end_y = 6
begin_x = 14.1
end_x = 22.8
def convert_coord(degree, convert):
#converted = degree + ((convert * 16.67) / 1000)
converted = (convert * 16.67) / 1000
return converted
converted_begin_y = convert_coord(17, begin_y)
converted_end_y = convert_coord(17, end_y)
converted_begin_x = c... |
C# | UTF-8 | 728 | 2.890625 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Timer : MonoBehaviour
{
public double initialTime;
private double restTime { get; set; }
// Start is called before the first frame update
void Start()
{
restTime = initialTime;
}
void init... |
PHP | UTF-8 | 5,565 | 2.546875 | 3 | [] | no_license | <?php
namespace Krixon\SamlClient\Login;
use Krixon\SamlClient\Exception\InvalidRelayState;
use Krixon\SamlClient\Protocol\Binding;
use Krixon\SamlClient\Protocol\Instant;
use Krixon\SamlClient\Protocol\NameIdPolicy;
use Krixon\SamlClient\Protocol\RequestedAuthnContext;
use Krixon\SamlClient\Protocol\RequestId;
use K... |
Python | UTF-8 | 848 | 3.3125 | 3 | [] | no_license | import sys
import math
def get_arg(arg: str, operations: list) -> int:
if arg.startswith("$"):
return calc_cell(int(arg[1:]), operations)
else:
return int(arg)
def calc_cell(i: int, operations: list) -> int:
operation_name, arg1, arg2 = operations[i]
if operation_name == "VALUE":
... |
Python | UTF-8 | 374 | 3.0625 | 3 | [] | no_license | from math import gcd # 유클리드 호제법도 좋지만 간결하게 풀기 위해 math.gcd
from itertools import combinations # 손으로 구해본 후 조합을 이용해서 풀어야겠다고 판단
TC = int(input())
for _ in range(TC):
sm = 0
arr = [int(x) for x in input().split()]
for a,b in combinations(arr[1:],2):
sm += gcd(a,b)
print(sm) |
C++ | UTF-8 | 2,100 | 2.640625 | 3 | [] | no_license | #include "FirstIncludes.h"
#include <stdlib.h>
#include <memory>
#include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
#include "MemoryDebug.h"
using namespace std;
#include "BasicTypes.h"
#include "OSservices.h"
#include "Str.h"
using namespace KKU;
#include "Sipper... |
JavaScript | UTF-8 | 542 | 2.71875 | 3 | [] | no_license | function getMinIndex(list, rest, comp) {
let minInd = rest
for (let i = rest + 1; i < list.length; ++i) {
if (comp(list[i], list[minInd]) < 0) {
//if (list[i] < list[minInd]) { // string compare
minInd = i
}
}
return minInd
}
function selSort(list, comp) {
let copy = [...list]
let lsize ... |
C++ | UTF-8 | 757 | 3.28125 | 3 | [] | no_license | #include<iostream>
#include<vector>
using namespace std;
int a[10];
void quicksort(int left,int right);
int main(int argc,char *argv[])
{
srand(time(NULL));
cout<<argv[1]<<endl;
cout<<"随机生成数字为:";
for(int &i:a)
{
i = rand()%100;
cout<<i<<" ";
}
cout<<endl;
quicksort(0,9);
cout<<"排完序后数字为:";
for(int i: a)
... |
Java | UTF-8 | 561 | 2.203125 | 2 | [] | no_license | // djm pooled, from above
public float getMetric() {
switch(m_count) {
case 0:
assert (false);
return 0.0f;
case 1:
return 0.0f;
case 2:
return MathUtils.distance(m_v1.w, m_v2.w);
case 3:
case3.set(m_v2.w).subLocal(m_v1.w);
... |
TypeScript | UTF-8 | 361 | 2.828125 | 3 | [] | no_license | import { Pergunta } from './pergunta';
/**
* Representa o Jogo com perguntas respondidas,
* nome do jogador e pontos conquistados
*/
export class Jogo {
public id: string;
public player_name: string;
public score = 0;
public questions: Pergunta[] = [];
constructor(nomeJogador: string) {
... |
Java | UTF-8 | 1,532 | 4.21875 | 4 | [] | no_license | package array;
/**
* 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。
*
* 如果你最多只允许完成一笔交易(即买入和卖出一支股票),设计一个算法来计算你所能获取的最大利润。 输入: [7,1,5,3,6,4] 输出: 5 解释:
* 在第 2 天(股票价格 = 1)的时候买入,在第 5 天(股票价格 = 6)的时候卖出,最大利润 = 6-1 = 5 。 注意利润不能是 7-1 = 6,
* 因为卖出价格需要大于买入价格。
*
* 输入: [7,6,4,3,1] 输出: 0 解释: 在这种情况下, 没有交易完成, 所以最大利润为 0。
*
* 注意你不能在买入股票前卖出股... |
Python | UTF-8 | 321 | 3.21875 | 3 | [] | no_license | import serial, time
arduino = serial.Serial('COM4', 9600, timeout=.1)
time.sleep(2) #give the connection a second to settle
arduino.write(str(3))
while True:
data = arduino.readline()
if data:
print data.rstrip('\n') #strip out the new lines for now
# (better to do .read() in the long run for this reason
... |
JavaScript | UTF-8 | 6,640 | 2.625 | 3 | [] | no_license | import React, { Component } from 'react';
import styled, { keyframes } from "styled-components";
import Loading from './Loading';
import Loading2 from './Loading2'
class AI extends Component {
constructor(){
super()
this.state = {
listen: false,
visable: true,
pageOne: true,
showLoader: true
}... |
Java | UTF-8 | 2,746 | 1.835938 | 2 | [] | no_license | package com.chd.hrp.hpm.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;
import org.springframework.dao.DataAccessException;
import com.chd.base.SqlMapper;
import com.chd.hrp.hpm.entity.AphiEmpBonusAudit;
/**
*
* @Title.
* ... |
Java | UTF-8 | 2,185 | 2.875 | 3 | [] | no_license | package edu.ohiou.dynamic;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import javax.swing.JPanel;
import javax.swing.tree.DefaultMutableTreeNode;
import edu.ohiou.mfgresearch.labimp.spacesearch.BlindSearcher;
import edu.ohiou.mfgresearch.labimp.spacesearch.DefaultSpaceState;
import edu.o... |
C# | UTF-8 | 2,988 | 2.8125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace _19110430_NguyenVanPhu_Day01
{
public partial class AddStudentForm : Form... |
Markdown | UTF-8 | 1,463 | 3.953125 | 4 | [] | no_license | # Parsing boolean options in Python
## Introduction
Python has the module argparse to parse command line options.
I had some difficulty figuring out how to parse boolean options.
I hope this page helps others like me who also want to parse boolean options.
## The Code
```
#!/usr/bin/env python
import argparse
if __n... |
Java | UTF-8 | 342 | 2.796875 | 3 | [] | no_license | package main.java.Leetcode.DP.Easy;
public class NumArray {
int dp[];
public NumArray(int[] nums) {
dp = new int[nums.length + 1];
dp[0] = 0;
for (int i = 1; i <= nums.length; i++)
dp[i] = dp[i-1] + nums[i-1];
}
public int sumRange(int i, int j) {
return dp[... |
Markdown | UTF-8 | 2,959 | 3.03125 | 3 | [] | no_license | ## 欧拉降幂
#### $a^b\equiv \begin{cases} a^{b\%\phi(p)}~~~~~~~~~~~gcd(a,p)=1\\ a^b~~~~~~~~~~~~~~~~~~~gcd(a,p)\neq1,b<\phi(p)\\ a^{b\%\phi(p)+\phi(p)}~~~~gcd(a,p)\neq1,b\geq\phi(p) \end{cases}~~~~~~~(mod~p)$
## 逆元递推
#### $inv[i] = (p - p / i) * inv[p \%i]\%p,inv[1] = 1$
p 为奇质数
## lucas定理
#### $C_{n}^m\%p = (C_{n/p}^{... |
Swift | UTF-8 | 1,262 | 2.90625 | 3 | [] | no_license | //
// ActivityViewModel.swift
// Alpha
//
// Created by Garrett Head on 12/9/20.
// Copyright © 2020 Garrett Head. All rights reserved.
//
import Foundation
import UIKit
class ActivityViewModel {
var name : String
var color : UIColor
var icon : UIImage
var progress : Double
var remaining ... |
C# | UTF-8 | 7,586 | 3.6875 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
namespace _11ArrayManipulator_myV
{
class Program
{
static void Main(string[] args)
{
List<int> integersList = Console.ReadLine().Split().Select(int.Parse).ToList();
string commands = Console.ReadLine();... |
Python | UTF-8 | 680 | 4.40625 | 4 | [] | no_license | #This is a program that determines what grade you get fom an exam mark.
loop = True
CUT_A = 90
CUT_B = 70
CUT_C = 50
#This code ask for their mark
mark = int(input("Enter your exam mark "))
if mark <=100 and mark >=0:
loop = False
#This code sets a boundary of the possible exam mark.
while loop == True:
mark... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.