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 |
|---|---|---|---|---|---|---|---|
C# | UTF-8 | 2,359 | 3.609375 | 4 | [
"MIT"
] | permissive | using System;
using System.Collections.Concurrent;
namespace Matcher
{
/// <summary>
/// A wrapper for optional results.
/// </summary>
public class Option<T>
{
public Option()
{
HasValue = false;
}
public Option(T value)
{
_value = ... |
Java | UTF-8 | 19,161 | 3.125 | 3 | [] | no_license | import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.ParseException;
import java.util.InputMismatchException;
import java.util.Scanner;
import javax.swing.JButton;
import javax.swing.JFrame;
import ja... |
SQL | UTF-8 | 8,251 | 2.9375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | -- phpMyAdmin SQL Dump
-- version 4.8.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Waktu pembuatan: 26 Nov 2019 pada 11.22
-- Versi server: 10.1.37-MariaDB
-- Versi PHP: 7.2.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHAR... |
Python | UTF-8 | 1,838 | 3.96875 | 4 | [] | no_license | """ Recursive tree
root label
branch (also a tree)
leaf : tree with zero branches
nodes: each location of the tree
"""
#Tree abstraction
"""
>>>tree(3,[tree(1),
tree(2,[tree(1),
tree(1)])])
[3,[1],[2,[1],[1]]]
"""
#constructor
def tree(label, branches=[]): #b... |
Java | UTF-8 | 892 | 2.546875 | 3 | [] | no_license | package com.test.controller;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
public class SessionMockController extends HttpServlet {
@Override
protected void doGe... |
Java | UTF-8 | 618 | 3.796875 | 4 | [] | no_license | package org.geeks.strings;
import java.util.HashSet;
import java.util.Set;
public class MinimumIndexedChar {
public static void main(String[] args) {
String str = "geeksforgeeks";
String pat = "set";
minIndexChar(str, pat);
}
public static void minIndexChar(String str, String pat) {
Set<Character>... |
Python | UTF-8 | 3,268 | 2.984375 | 3 | [] | no_license | # --coding=utf8--
# TODO:input
cluster_num = 2
v_num = 60
filename = "vector"+ str(v_num) +".txt"
########################################################################
import math
import numpy
from numpy.random import random
import scipy
import sklearn
##############################################################... |
Python | UTF-8 | 1,758 | 4.21875 | 4 | [] | no_license | '''
In mathematics, a matrix (plural matrices) is a rectangular array of numbers. Matrices have many applications in programming, from performing transformations in 2D space to machine learning.
One of the most useful operations to perform on matrices is matrix multiplication, which takes a pair of matrices and produc... |
Markdown | UTF-8 | 3,738 | 3.453125 | 3 | [] | no_license | # Introduction
The shell is a program that enables us to send commands to the computer and receive output. It is also referred to as the terminal or command line.
You need to download some files to follow this lesson:
1. Download [data-shell.zip](data/data-shell.zip ':ignore') and move the file to your Desktop.
2. U... |
Python | UTF-8 | 4,099 | 4.40625 | 4 | [] | no_license | # 3.6 Animal Shelter: An animal shelter, which holds only dogs and cats, operates
# on a strcitly "first in, first out" basis. People must adopt either the
# "oldest" (based on arrival time) of all animals at the shelter, or they
# can select whether they would prefer a dog or a cat (and will receive the
# oldest anima... |
Python | UTF-8 | 881 | 3.40625 | 3 | [] | no_license | class Solution:
def searchRange(self, nums, target):
res = [-1,-1]
if not nums:
return res
left = 0
right = len(nums) - 1
while left < right:
mid = (left+right) // 2
if nums[mid] >= target:
right = mid
... |
C# | UTF-8 | 419 | 2.6875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Events
{
public class CarEventArgs : EventArgs {
public string Message { get; }
public double CurrentFuel { get; }
public CarEventArgs(string message, double curren... |
TypeScript | UTF-8 | 422 | 2.640625 | 3 | [] | no_license | export interface Contact {
_id?: string
name: string
email: string
phone: string
move: any
coins: number
imgUrl: string
}
// export class Contact {
// constructor(public _id?: string, public name: string = '', public email: string = '', public phone: string = '') {
// }
// ... |
Markdown | UTF-8 | 6,362 | 3.5 | 4 | [] | no_license | # 上午作业
1. 抄写一份Hello.java放到当前路径下,编译运行Hello.java,请记录打开终端开始到程序运行期间所有输入的终端命令
- javac Hello.java 进行编译
- 生成以.class为后缀名的文件
- 输入java Hello运行文件
2. 将编译生成的Hello.class文件删除,编辑Hello.java将class后面的名称修改为test,然后编译Hello.java文件
- 生成的class文件名是什么
- 请尝试使用java运行编译后的文件,应该输入什么命令
- 生成的文件名叫test.class
- 输入java test
3. 保持上一题的状态,编辑Hel... |
Java | UTF-8 | 623 | 3.171875 | 3 | [] | no_license | package com.boundary;
/**
* utility for printing bit patterns
*/
public class BitPrint {
public static String fmt(long bits) {
StringBuilder sb = new StringBuilder();
long mask = 1L<<63;
for(int i = 1; i <= 64; i++) {
if((mask & bits) == mask)
sb.append("1");
else
sb.append(... |
PHP | UTF-8 | 1,993 | 2.625 | 3 | [] | no_license | <?php
#Usage php pulse.php
system('clear');
require "header.php";
$list = file_get_contents("list.txt");
$urls = explode("\n", $list);
$count = count($urls);
$passwd = "dana-na/../dana/html5acc/guacamole/../../../../../../../etc/passwd?/dana/html5acc/guacamole/";
$hosts = "dana-na/../dana/html5acc/guacamole/.... |
Markdown | UTF-8 | 6,612 | 2.6875 | 3 | [] | no_license | ---
title: hyde
description: a stateful, jekyll-friendly cms parser for javascript build pipelines. it's a beast!
tags:
- jekyll
- hyde
- ember
- ember-cli
- broccoli
- nodejs
---
## Intro
- This site _([https://anulman.com/www.aidans.computer](https://anulman.com/www.aidans.computer))_
- Auto-builds & de... |
C# | UTF-8 | 3,328 | 2.828125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
namespace EveryDay.Calc.Webcalc.Repository
{
public class BaseRepository<T> : IRepository<T> where T : class
{
protected string connectionString = @"Data Source=(LocalDB... |
PHP | UTF-8 | 1,656 | 2.796875 | 3 | [] | no_license | <?php
// change type of the page
header('Content-type: image/jpeg') ;
if (isset($_GET['source']))
{
$source = $_GET['source'] ;
// create new watermark image from existing image logo.jpg
$watermark = imagecreatefrompng ('logo.png');
$watermark_height = imagesy ($watermark) ;
$watermark_width = imagesx ($waterma... |
Java | UTF-8 | 6,399 | 1.804688 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* 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 a... |
Shell | UTF-8 | 10,574 | 4.25 | 4 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | #!/usr/bin/env bash
# Create a new directory and enter it
function mkd() {
mkdir -p "$@" && cd "$_";
}
# Create a .tar.gz archive, using 'zopfli', 'pigz' or 'gzip' for compression
function targz() {
local tmpFile="${@%/}.tar";
tar -cvf "${tmpFile}" --exclude=".DS_Store" "${@}" || return 1;
size=$(
... |
Ruby | UTF-8 | 1,771 | 3.3125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | def begins_with_r(tools)
tools.all?{ |tool| tool.start_with?("r") }
end
def contain_a(array)
array_with_a = []
array.each do |string|
if string.include? "a"
array_with_a.push(string)
end
end
return array_with_a
end
def first_wa(array)
array.each do |element|
if elemen... |
PHP | UTF-8 | 829 | 2.78125 | 3 | [] | no_license | <?php
use Illuminate\Database\Seeder;
use App\Domain\Model\Documents\Passive\Language;
class LanguagesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// https://github.com/caouecs/Laravel-lang
// https://www.loc.gov... |
Markdown | UTF-8 | 2,681 | 2.9375 | 3 | [] | no_license | # README
## usersテーブル
| column | type | options |
|:--------------------:|:------:|:-------------------------:|
| nickname | string | null: false |
| email | string | null: false, unique: true |
| encrypted_password | string | null: false ... |
C | UTF-8 | 255 | 2.765625 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
int main(void)
{
char filename[233];
char tmp[233];
FILE *fp;
scanf("%s",filename);
fp = fopen(filename,"r");
rewind(fp);
printf("\n");
while(!feof(fp))
{
fgets(tmp,233,fp);
printf("%s",tmp);
}
printf("\n");
return 0;
} |
Markdown | UTF-8 | 7,352 | 2.609375 | 3 | [] | no_license | ---
description: "How to Prepare Award-winning Spiced Cake/Cupcakes #Christmas Baking Contest"
title: "How to Prepare Award-winning Spiced Cake/Cupcakes #Christmas Baking Contest"
slug: 2113-how-to-prepare-award-winning-spiced-cake-cupcakes-christmas-baking-contest
date: 2020-07-04T21:03:40.747Z
image: https://img-glob... |
PHP | UTF-8 | 3,162 | 2.796875 | 3 | [] | no_license | <?php
/**
* @file
* Contains the MembershipEntityType class.
*/
/**
* Defines a membership type.
*/
class MembershipEntityType extends Entity {
public $id;
public $label;
public $type;
public $description;
public $weight;
public $data;
/**
* Default constructor for membership types.
*
* ... |
Java | UTF-8 | 264 | 2.375 | 2 | [] | no_license | package Controler;
import DAO.UsuarioDAO;
import DAO.UsuarioDAOImpl;
import Entidade.Usuario;
public class UsuarioControl {
private UsuarioDAO usuarioDAO = new UsuarioDAOImpl();
public void adicionarUsuario(Usuario u) {
usuarioDAO.adicionar(u);
}
}
|
Java | UTF-8 | 1,591 | 2.34375 | 2 | [] | no_license | package org.lightadmin.boot.administration;
import org.lightadmin.api.config.AdministrationConfiguration;
import org.lightadmin.api.config.builder.EntityMetadataConfigurationUnitBuilder;
import org.lightadmin.api.config.builder.FieldSetConfigurationUnitBuilder;
import org.lightadmin.api.config.builder.PersistentFieldS... |
JavaScript | UTF-8 | 185 | 3.390625 | 3 | [] | no_license | const getFilteredArray = (arr, callback) => {
let res = [];
forEach(arr, function(val){
if(callback(val)){
res.push(val);
}
})
return res;
}; |
C++ | UTF-8 | 4,578 | 3.28125 | 3 | [] | no_license | /*
+-----------------------------------------------------------------------+
| C++ Code BFS & DFS |
+-----------------------------------------------------------------------+
| Copyright (c) 2013 - 2014, CILAB. All rights reserved. |
+--------------------... |
Java | UTF-8 | 489 | 2.421875 | 2 | [] | no_license | package thesis.core.uav.dubins;
import thesis.core.common.WorldCoordinate;
public class PathSegment
{
private WorldCoordinate start;
private WorldCoordinate end;
public PathSegment()
{
start = new WorldCoordinate();
end = new WorldCoordinate();
}
public double pathLength()
{
r... |
PHP | UTF-8 | 1,046 | 2.890625 | 3 | [] | no_license | <?php
echo "<pre>\n";
$contenido = file_get_contents('mi-archivo.txt');
var_dump($contenido);
file_put_contents('mi-archivo.txt', "Juanito Pastrana was here\n");
// Falla intencionalmente
$contenido = file_get_contents('archivo-no-existente.md');
var_dump($contenido);
echo __FILE__ . "\n\n";
echo "Mi archivo: " .... |
Python | UTF-8 | 603 | 3.25 | 3 | [] | no_license | import random
import math
# The dorms, each of which has two available spaces
dorms=['Zeus','Athena','Hercules','Bacchus','Pluto']
# People, along with their first and second choices
prefs=[('Toby', ('Bacchus', 'Hercules')),
('Steve', ('Zeus', 'Pluto')),
('Karen', ('Athena', 'Zeus')),
('Sarah', (... |
Ruby | UTF-8 | 1,370 | 3.46875 | 3 | [] | no_license | class SpaceShip
attr_accessor :x, :y
def initialize(settings)
@x = settings[:x] || 10
@y = settings[:y] || 10
@moving_left = @moving_right = false
@speed = 2
end
def tick(args)
self.draw args
end
def draw(args)
args.outputs.sprites << [
@x, @y,
64, 64,
image
... |
Java | UTF-8 | 1,012 | 3.390625 | 3 | [] | no_license | package com.practice.solid.ocp;
import java.util.List;
public class Demo {
public static void main(String[] args) {
Product p1 = new Product("Apple", Color.RED, Size.MEDIUM);
Product p2 = new Product("Bottle", Color.BLUE, Size.LARGE);
Product p3 = new Product("Leaf", Color.GREEN, Size.SMALL);
... |
JavaScript | UTF-8 | 4,897 | 2.578125 | 3 | [] | no_license | /**
* Get the brand that corresponds with the hostname.
*
* @param {function(string)} copilotHostname - called with the desired Copilot hostname
* @param {function(string)} tabHostname - called with the hostname of the current tab URL
*
*/
let brandsPromise;
function getBrandFromHostname(copilotHostname, tabHost... |
Python | UTF-8 | 284 | 3.75 | 4 | [
"MIT"
] | permissive | Code:
a = int(input())
if a == 0:
print(0)
else:
fib_prev, fib_next = 0, 1
n = 1
while fib_next <= a:
if fib_next == a:
print(n)
break
fib_prev, fib_next = fib_next, fib_prev + fib_next
n += 1
else:
print(-1) |
C# | UTF-8 | 1,457 | 2.6875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace Assets.Scripts.NData
{
[System.Serializable]
public class Request<T>
{
[SerializeField]
private T m_Data;
[SerializeField]
priv... |
C++ | UTF-8 | 1,209 | 2.953125 | 3 | [] | no_license | #include "camera.hpp"
#include "exp/constants.hpp"
namespace Exp
{
namespace Game
{
auto Camera::instance() noexcept -> Camera&
{
static Camera camera;
return camera;
}
void Camera::add_usertype(sol::state_view state)
{
if (state[Lua::Usertypes::Game::CAMERA].get_type() == s... |
Java | UTF-8 | 965 | 2.234375 | 2 | [] | no_license | package com.example.alexdriedger.pianotime;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWri... |
C++ | UTF-8 | 1,421 | 2.75 | 3 | [] | no_license | //
// Created by Student on 27/04/17.
//
#ifndef JIMP_EXERCISES_PESEL_H
#define JIMP_EXERCISES_PESEL_H
#include <string>
using std::string;
namespace academia {
class Pesel {
public:
Pesel(const string &pesel): pesel_(pesel){
validatePESEL(pesel_);
};
private:
string p... |
C++ | UTF-8 | 740 | 3.296875 | 3 | [] | no_license | /*
* 07_array_vec.cpp
*
* author : Sreejith S
* email : echo $(base64 -d <<< NDQ0bGhjCg==)@gmail.com
* date : Sat 26 Aug 2017 05:52:10 IST
* ver :
*
*/
#include <iostream>
#include <vector>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int n{};
cin >> n;
std::v... |
PHP | UTF-8 | 4,309 | 2.71875 | 3 | [] | no_license | <?php
include_once 'Database.php';
include_once 'forgotpassprocess.php';
if(isset($_POST['verify'])){
function validate($cdata){
$cdata = trim($cdata);
$cdata = stripslashes($cdata);
$cdata = htmlspecialchars($cdata);
return $cdata;
}
$new_pass = validate ($_POST[... |
Ruby | UTF-8 | 739 | 3.5625 | 4 | [] | no_license |
# abstract_class
class Report
def initialize
@title = "html report title"
@text = [
'report line 1',
'report line 2',
'report line 3'
]
end
def output_report
output_start
output_body
output_end
end
def output_start
end
def output_body
@text.each do |line... |
Markdown | UTF-8 | 1,288 | 2.578125 | 3 | [] | no_license | # build
Русский текст смотри ниже.
The tool for automatic compilation C++ source code. Presented in open soure, licence TDB.
To build the tool in linux you need to run compile.sh scrtipt.
To build it manualy:
g++ *.cpp -o build -g -Wall -std=c++1y
How you use it:
* Copy binary file "build" and config file "build.c... |
Python | UTF-8 | 8,384 | 2.671875 | 3 | [] | no_license | import sys, argparse, matplotlib, os
from matplotlib import pyplot as plt
from collections import defaultdict
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import matplotlib.ticker as mticker
# INPUT : - reference sequence (cryptogene)
# - alignments in TAF format
# - ... |
Go | UTF-8 | 798 | 3.59375 | 4 | [] | no_license | // Package geometry provides simple primitives for 2D geometry.
package geometry
import "math"
type vector struct {
x, y float64
}
func (a vector) add(b vector) vector {
return vector{a.x + b.x, a.y + b.y}
}
func (a vector) subtract(b vector) vector {
return vector{a.x - b.x, a.y - b.y}
}
func (a vector) scale(... |
Python | UTF-8 | 425 | 3.796875 | 4 | [] | no_license | def alphabet_position(letter):
if letter.isupper():
letter = ord(letter) - ord('A')
elif letter.islower():
letter = ord(letter) - ord('a')
return letter
def rotate_character(char, rot):
if char.isalpha:
charp = alphabet_position(char)
code = (((rot + charp) % 26) + ord('... |
Java | UTF-8 | 832 | 3.46875 | 3 | [] | no_license | package sabotage.core.commands;
import java.util.ArrayList;
import sabotage.core.Player;
import sabotage.core.cards.Card;
public class DiscardCommand implements Command {
private Player player;
private Card card;
private ArrayList<Card> hand;
/***
* A command for when a player discards a card.
* Also al... |
Markdown | UTF-8 | 1,753 | 3.84375 | 4 | [] | no_license | # 037-sudoku-solver
## Question {#question}
[https://leetcode.com/problems/sudoku-solver/description/](https://leetcode.com/problems/sudoku-solver/description/)
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character`'.'`.
You may assume that there will be on... |
Java | UTF-8 | 360 | 3.140625 | 3 | [] | no_license | public class FactorialTrailingZeroes{
public int trailingZeroes(int n) {
int count = 0;
for(long i = 5; i <= n; i*=5)
count += (int)(n/i);
return count;
}
public static void main(String args[]){
FactorialTrailingZeroes ftz= new FactorialTrailingZeroes();
System.out.p... |
Python | UTF-8 | 1,098 | 3.21875 | 3 | [] | no_license | import random
import numpy as np
from numba import jit
# def generateDiceThrows(maxRounds):
# # return __normal(maxRounds)
# # return __normalWithSixes(maxRounds)
# return __higherThrowPropability(maxRounds)
# @jit(nopython=True)
def roll():
# return random.randint(1, 6)
return (random.choices([1... |
Markdown | UTF-8 | 2,906 | 2.546875 | 3 | [] | no_license | [toc]
# XGBoost
## 1. 西班牙数据集
train index: [6426, 10427] train_len: 4000
test index: [14389, 15390] test_len: 1000
- **输入特征:**
```python
'wind_speed', 'sin(wd)', 'cos(wd)', 【t期】
'wind_speed-1', 'sin(wd)-1','cos(wd)-1', 'wind_power-1'【t-1期】
```
- **输出:**wind_power
### 1.1 寻找最大深度
max_depth = 2
<img src="/Users... |
C++ | UTF-8 | 9,375 | 2.859375 | 3 | [] | no_license | #include "../include/tracks_controller.h"
#include <time.h>
//----------------------------------------------------------------
t_tracks_controller::t_tracks_controller(void) {
if (connect()) {
printf("Connected to tracks...\n");
}
if (setup()) {
printf("Tracks setup complete...\n");
}
}
//---------... |
JavaScript | UTF-8 | 814 | 2.578125 | 3 | [] | no_license | // Write your Character component here
import React, {useState} from 'react';
import {
Card, CardText, CardBody,
CardTitle, CardSubtitle, Button,
} from 'reactstrap';
import Stats from './Stats'
function Character(props){
const {data, bounty} = props
const [fadeIn, setFadeIn] = useState(false);
... |
Go | UTF-8 | 5,516 | 2.875 | 3 | [] | no_license | package services
import (
"time"
"github.com/cs3305-team-4/api/pkg/database"
"github.com/google/uuid"
"gorm.io/gorm"
)
//contains the information on a single review and what accounts it is connected to
type Review struct {
database.Model
Rating int `gorm:"not null;check:rating >= 0; check:rating <= 5;"`
C... |
Java | UTF-8 | 2,808 | 2.203125 | 2 | [] | no_license | package org.forwork.config;
import org.forwork.controller.member.CustomAccessDeniedHandler;
import org.forwork.controller.member.CustomAuthFailureHandler;
import org.forwork.controller.member.CustomLoginSuccessHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Co... |
Java | UTF-8 | 2,670 | 1.992188 | 2 | [] | no_license | package com.test.material.supitsara.materialnavigationtest;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;
import... |
C++ | UTF-8 | 1,952 | 3.0625 | 3 | [] | no_license | #ifndef DBC_RWMUTEX_H
#define DBC_RWMUTEX_H
#include <pthread.h>
class RwMutex {
public:
class ReadLock {
public:
explicit ReadLock(RwMutex& mutex):m_isLock(false), m_mutex(mutex) {
lock();
}
~ReadLock() {
if(m_isLock) {
... |
Python | UTF-8 | 6,282 | 2.5625 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#from argparse import ArgumentParser
import os
import git
import shutil
import json
import midwife
import pkg_resources as pr
#parser = argparse.ArgumentParser()
#parser.parse_args()
def ask(label, default, escape = False):
if label == '':
return None
if defa... |
Java | UTF-8 | 350 | 3.0625 | 3 | [] | no_license | import java.util.Random;
public class FileIO {
public FileIO(){
}
public int generateIOBurst(){
Random r = new Random();
int cycles = r.nextInt(50) + 1;
for(int i=0;i<cycles;i++){
//IO operations
}
System.out.println("File IO "+ cycles+ " cycles performed");
... |
JavaScript | UTF-8 | 2,684 | 2.8125 | 3 | [] | no_license | var student;
var studentID;
function addStudent() {
database = firebase.database();
var user = firebase.auth().currentUser.uid;
var ref = database.ref("users/" + user + "/class");
student = document.getElementById("addClass").value;
if(student != ""){
var data = {
student: studen... |
PHP | UTF-8 | 3,956 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use Illuminate\Support\Str;
use App\Models\Token;
use Illuminate\Http\Request;
use function GuzzleHttp\Promise\all;
class ApiTokenController extends Controller
{
function createAPIToken(Request $request)
{
$rules = [
"name" => "required",
];... |
Python | UTF-8 | 1,868 | 2.671875 | 3 | [] | no_license | import numpy as np
from qfin.models.model import Model
class HestonModel(Model):
name = "HESTON"
labels = "KAPPA", "RHO", "V0", "VBAR", "XI"
bounds = [
(1e-5, np.inf), # KAPPA -- mean-reversion
(-1, 1), # RHO -- correlation
(1e-5, np.inf), # V0 ... |
Java | UTF-8 | 2,620 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | package com.codernauti.sweetie.geogift;
public class GeogiftVM {
public final static int MESSAGE_GEOGIFT = 0;
public final static int PHOTO_GEOGIFT = 1;
public final static int HEART_GEOGIFT = 2;
private String mKey;
private String mUserCreator;
private int mType;
private String mTitle;
... |
PHP | UTF-8 | 2,961 | 2.546875 | 3 | [] | no_license | <?php
namespace App\Http\Controllers;
use App\Employee;
use App\Http\Requests\EmployeeRequest;
use Exception;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\File;
use Symfony\Component\HttpFoundation\Response;
class EmployeeController extends Controller
{
/**
* Show the form for creati... |
Java | UTF-8 | 237 | 1.90625 | 2 | [] | no_license | package cw17;
public class MyThread extends Thread{
@Override
public void run() {
for(int i=0;i<50;i++){
Cw17.print10();
// System.out.println(i+" ");
}
}
}
|
JavaScript | UTF-8 | 1,457 | 2.953125 | 3 | [
"MIT"
] | permissive | $(document).ready(function () {
var submit = $("#login-btn");
var usernameInput = $("#username-input");
var passwordInput = $("#password-input");
submit.on("click", function (event) {
event.preventDefault();
var userData = {
username: usernameInput.val().trim(),
password: passwordInput.val(... |
C++ | UTF-8 | 2,263 | 3.296875 | 3 | [] | no_license | #ifndef UTIL_H
#define UTIL_H
#include <cmath>
#include <vector>
#include <algorithm>
#include <graph.h>
#include <point.h>
double distanceBetweenVertices(const Vertex *a, const Vertex *b){
double x_distance = fabs(a->x() - b->x());
double y_distance = fabs(a->y() - b->y());
return sqrt(x_distance*x_dis... |
JavaScript | UTF-8 | 2,782 | 2.75 | 3 | [] | no_license | const initialState = {
ads: [],
favoriteItems: [],
loading: true,
error: null,
filter: 'all',
sort: 'new',
loadLimit: 12,
priceInterval: {
minValue: '',
maxValue: ''
},
search: ''
};
const updateArray = (array, item, idx) => {
if (array.find(({id}) => id === item.id) =... |
PHP | UTF-8 | 18,664 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use App\Models\Agent;
use App\Models\Supervisor;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use App\Mail\RegisterationMail;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use App\Models\User;
use A... |
Rust | UTF-8 | 4,140 | 3.0625 | 3 | [
"MIT"
] | permissive | //! A tiny HTTP/1.1 server framework.
//!
//! # Examples
//!
//! ```
//! use std::io::{Read, Write};
//! use std::net::TcpStream;
//! use std::thread;
//! use std::time::Duration;
//! use bytecodec::bytes::Utf8Encoder;
//! use bytecodec::null::NullDecoder;
//! use fibers::{Executor, Spawn, InPlaceExecutor};
//! use fib... |
Java | UTF-8 | 1,196 | 2.34375 | 2 | [
"MIT"
] | permissive | package com.binance.api.client.domain.market;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import xyz.tsst.billions.cryptocurrency.CYYOrder;
/**
* An order book entry co... |
Java | UTF-8 | 841 | 2.421875 | 2 | [] | no_license | package com.naxanria.nom.tile;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
public abstract class BaseTileEntityTicking extends BaseTileEntity implements ITickableTileEntity
{... |
Python | UTF-8 | 779 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python
import argparse
import os
import subprocess
import ConfigParser
# parse the arguments
parser = argparse.ArgumentParser(description="create a bootable disk image for beaglebone black")
parser.add_argument('--input', required=True)
parser.add_argument('--config', required=True)
parser.add_argument('-... |
Java | UTF-8 | 17,617 | 1.921875 | 2 | [] | no_license | package com.pyzzalab.ddmsoundboard;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.media.MediaPlayer;
import android.supp... |
JavaScript | UTF-8 | 3,986 | 2.59375 | 3 | [] | no_license | import React,{useState,useEffect} from "react";
import 'bootstrap/dist/css/bootstrap.min.css'
import './stylesheet.css'
import { useParams } from "react-router-dom";
import firebase from "firebase";
const UserDetails = ({props}) => {
// const {id:id} =useParams()
console.log('users', props)
const [data,se... |
Java | UTF-8 | 7,876 | 2.15625 | 2 | [] | no_license | package com.example.android.instaline;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.gli... |
Python | UTF-8 | 5,399 | 3.203125 | 3 | [] | no_license | import pygame
import random
pygame.init()
SCREEN_WIDTH = SCREEN_HEIGHT = 400
SCREEN = pygame.display.set_mode((SCREEN_WIDTH,SCREEN_HEIGHT))
pygame.display.set_caption("15 Puzzle")
clock = pygame.time.Clock()
WHITE = (255,255,255)
BLACK = (0,0,0)
def check_validity_of_board(board):
empty_index= board.ind... |
Ruby | UTF-8 | 2,601 | 2.578125 | 3 | [] | no_license | #!/usr/local/bin/macruby
# cf. https://gist.github.com/245402/8a52e988c2e65be7e497850085034835aa6aaea2
#
framework 'Cocoa'
class StatusBar
def self.set_menu_items
@year = Time.now.year.to_s
@title = 'Troll-o-matic'
@author = 'nate'
@about = ["Troll-o-matic\nbendable pliers, inc.\n#{@year}", @author, "... |
Markdown | UTF-8 | 1,613 | 2.78125 | 3 | [
"MIT"
] | permissive | <h1 align="center">
<img alt="data-mining-logo" src="assets/logo.png" width="200px" />
</h1>
<div align="center">
<h1>
Data-Mining
</h1>
<h3>
Data-Mining é uma aplicação de mineração de dados que usa o fluxo de processo CRISP-DM. <br />
</h3>
</div>
<p align="center">“Sua única limitação é você mesmo... |
C++ | UTF-8 | 468 | 2.625 | 3 | [] | no_license | // 應啦幹
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
vector<pair<LL, LL>> A;
int main()
{
LL N, a, cnt=0;
cin >> N;
A.resize(2*N);
for(LL i=0; i<2*N; ++i) {
cin >> a;
A[i] = make_pair(a, i);
}
sort(A.begin(), A.end());
cnt += A[0].second + A[1].second;
... |
Java | UTF-8 | 810 | 2.171875 | 2 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | package com.alibaba.json.bvt.bug;
import org.junit.Assert;
import junit.framework.TestCase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
public class Bug_for_agapple_2 extends TestCase {
public void test_bug() throws Exception {
DbMediaSource obj = new DbMediaSource();
... |
Java | UTF-8 | 5,865 | 1.953125 | 2 | [] | no_license | /**
* @created 2015-03-07
* @author gideon mw jones.
*/
package uk.ac.aber.gij2.olandroid.view;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import an... |
Java | UTF-8 | 768 | 1.875 | 2 | [] | no_license | package com.cobble.takeaway.dao;
import java.util.List;
import com.cobble.takeaway.pojo.weixin.WxAuthorizerInfoPOJO;
import com.cobble.takeaway.pojo.weixin.WxAuthorizerInfoSearchPOJO;
public interface WxAuthorizerInfoMapper {
int insert(WxAuthorizerInfoPOJO wxAuthorizerInfoPOJO) throws Exception;
int update(WxAut... |
Markdown | UTF-8 | 35,860 | 2.84375 | 3 | [] | no_license | <p data-nodeid="8554" class="">第 39 课时介绍了持续集成,本课时接着介绍如何实现持续部署,持续部署从容器镜像开始,把应用所有的微服务部署在云平台上。当有新的容器镜像被发布之后,持续部署负责更新应用。对于微服务架构的应用来说,持续部署需确保相互独立的各个微服务可以协同工作;对于多个微服务相互协作的场景,需要在持续部署的环境上进行测试。本课时介绍的持续部署的实现方式,不限定于特定的云平台,只需要有能够正常访问的 Kubernetes 集群即可。</p>
<p data-nodeid="8555">每个微服务都需要独立部署,包括服务本身,以及服务依赖的支撑服务等。在这些支撑服务中,有些是微服务独有的,比如... |
Python | UTF-8 | 121 | 3.4375 | 3 | [] | no_license | def zfill(string, width):
if len(string) < width:
return ("0" * (width - len(string))) + string
else:
return string |
C | UTF-8 | 1,068 | 3.484375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | /*
* local implementation of strlcpy(), for machines that don't have it.
*/
#include <stdio.h>
#include <string.h>
size_t
strlcpy(char *dest, char *src, size_t len)
{
if ( src == 0 || dest == 0 || len == 0 ) return 0;
strncpy(dest, src, len);
dest[len-1] = 0;
#if AAIIEE
fprintf(stderr, "strlcp... |
Markdown | UTF-8 | 412 | 3.328125 | 3 | [] | no_license | # Python100
把Python知识点整理成100道习题,知识点来自两本书:Python基础教程(第3版)和流畅的Python,以后会定期加入更多的习题,大家帮忙点个赞哈,点赞越多,更新越快~
## 怎么将字符列表转为字符串
用 join 方法,合并序列的元素
```
>>> l = ['Python', 'Circle', 'is', 'ok']
>>> j = ' '.join(l)
>>> j
'Python Circle is ok'
```
|
C++ | UTF-8 | 1,010 | 3 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<sstream>
#include<fstream>
using namespace std;
typedef long long ll;
ll getVal(ll r, ll n){
return (2*r+4-3 + 2*r+4*n-3)*n/2;
}
ll calc(ll r, ll t){
ll start = 1;
ll end = 2;
while(start<end){
ll endVal = getVal(r,... |
Ruby | UTF-8 | 2,816 | 3.109375 | 3 | [] | no_license | # Aufgabe a06_4
# Team ChillyCrabs
# Author:: Lennart Draeger
# Author:: Robert Gnehr
require 'set'
require_relative 'partner2'
# Stores street, street number, postal code, city and country of an address, as
# well as its residetns. All changes to the residents also get applied to their
# corresponding obje... |
TypeScript | UTF-8 | 309 | 2.8125 | 3 | [
"MIT"
] | permissive | /**
* @file Required
* @author Cuttle Cong
* @date 2018/4/8
* @description
*/
import Reason from './Reason'
export default class Message extends Reason {
constructor(public humanMessage: string) {
super()
this.humanMessage = humanMessage
}
toHumanMessage() {
return this.humanMessage
}
}
|
Markdown | UTF-8 | 642 | 2.953125 | 3 | [] | no_license | # MazeMeander
You are the mouse. Can you find all the cheeses?
This was my first large web game to teach myself Javascript and JQuery. (I was a sophomore at the time and so I didn't have great coding practices when I created this game)
It is a game where you are a mouse trying to collect all of the cheeses in a clas... |
Shell | UTF-8 | 168 | 2.96875 | 3 | [] | no_license | #!/bin/bash
function cf_outputs_get {
key="$1"
echo $(jq -r ".[] | select(.OutputKey == \"$key\").OutputValue" ./temp/outputs.json | sed -e 's/^"//' -e 's/"$//')
} |
C | UTF-8 | 224 | 3.28125 | 3 | [] | no_license | #include<stdio.h>
#include<math.h>
#define PI (3.141592653589793)
int main()
{
float sade = 0.0;
printf("Anna ympyran sade: ");
scanf_s("%f", &sade);
printf("Ympyran pinta-ala on %.2lf ", PI*sade*sade);
return 0;
} |
Markdown | UTF-8 | 895 | 3.71875 | 4 | [] | no_license |
| [English](README_EN.md) | 简体中文 |
# [485. 最大连续 1 的个数](https://leetcode-cn.com/problems/max-consecutive-ones/)
## 题目描述
<p>给定一个二进制数组, 计算其中最大连续 1 的个数。</p>
<p> </p>
<p><strong>示例:</strong></p>
<pre>
<strong>输入:</strong>[1,1,0,1,1,1]
<strong>输出:</strong>3
<strong>解释:</strong>开头的两位和最后的三位都是连续 1 ,所以最大连续 1 的个数是 3.
</pre... |
Python | UTF-8 | 982 | 2.8125 | 3 | [] | no_license | def closestNumber(a, b, x):
if b == 1:
count = a
count1 = a
c = a
else:
count = pow(a,b)
count1 = count
c = count1
if b <0 and a != 1:
return 0
elif b<0 and a == 1 or x == 1:
return 1
while True:
if count%x == 0:
break
count = count - 1
while True:
if count1%x == 0:
break
count1 = c... |
C++ | UTF-8 | 421 | 3.28125 | 3 | [] | no_license | // https://leetcode.com/problems/powx-n/#/description
class Solution {
public:
double myPow(double x, int n)
{
if(n < 0) return 1.0/pPow(x, (long)(-1)*n);
return pPow(x, n);
}
double pPow(double x, long n)
{
if(!n) return 1.0;
if(n&1) return x*pPow(x, n-1);
e... |
JavaScript | UTF-8 | 517 | 2.90625 | 3 | [
"MIT"
] | permissive | 'use strict'
var rotate = require('../gamut/rotate')
var scale = require('../scale/scale')
/**
* Get all modes of a scale
*
* @name scale.modes
* @function
* @param {Array} scale - the scale
* @param {Array} all the modes of the scale
*
* @example
* var modes = require('music.kit/scale/modes')
* modes('C D ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.