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 | 1,950 | 1.898438 | 2 | [] | no_license | package cn.kingtous.diplomagenerator.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.roundwidg... |
Ruby | UTF-8 | 1,079 | 3.828125 | 4 | [
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | def admin_login(username, password)
if username == "ADMIN" && password == "12345"
return "Access granted"
elsif username == "admin" && password == "12345"
return "Access granted"
else
return "Access denied"
end
end
def hows_the_weather(temperature)
if temperature.to_i < 40
return "It\'s b... |
C | UTF-8 | 525 | 2.90625 | 3 | [] | no_license | // gcc -o tlink -g -W -Wall tlink.c
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
static void
die(const char *str)
{
perror(str);
exit(2);
}
int
main(int argc, char *argv[])
{
assert(argc ... |
Java | UTF-8 | 3,027 | 3.46875 | 3 | [] | no_license | import java.util.Scanner;
import java.io.*;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.chart.LineChart;
import javafx.scene.chart.NumberAxis;
import javafx.scene.chart.XYChart;
import javafx.scene.chart.XYChart.Series;
import javafx.stage.Stage;
/**
* The Life Time LineChar... |
JavaScript | UTF-8 | 4,398 | 2.59375 | 3 | [
"MIT"
] | permissive | import React, { Component, PropTypes as T } from 'react'
import shadowEqual from 'react-addons-shallow-compare'
import cNames from 'classnames'
import validator from 'validator'
import any from 'lodash/collection/any'
import all from 'lodash/collection/all'
import reduce from 'lodash/collection/reduce'
import forEach f... |
SQL | UTF-8 | 1,858 | 3.625 | 4 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | DROP TABLE IF EXISTS indexed_table;
CREATE TABLE indexed_table
( `tm` DateTime,
`log_message` String,
INDEX log_message log_message TYPE tokenbf_v1(4096, 2, 0) GRANULARITY 1
) ENGINE = CnchMergeTree ORDER BY (tm) SETTINGS index_granularity_bytes = 50, min_index_granularity_bytes = 40;
SYSTEM START MERGES in... |
Java | UTF-8 | 4,878 | 2.359375 | 2 | [] | no_license | /**
*
*/
package com.googlecode.brainfuck4j;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import com.google.code.brainfuck4j.model.brainfuck.BrainfuckFactory;
import com.google.code.brainfuck4j.model.brainfuck.Instruction;
import c... |
Go | UTF-8 | 848 | 3.46875 | 3 | [] | no_license | package day06
import "fmt"
type banks []int
func (b banks) max() (int, int) {
maxIdx := 0
max := b[0]
for i := 1; i < len(b); i++ {
if b[i] > max {
max = b[i]
maxIdx = i
}
}
return maxIdx, max
}
func (b banks) redistribute() {
idx, val := b.max()
b[idx] = 0
idx = (idx + 1) % len(b)
for ; val > ... |
Markdown | UTF-8 | 1,148 | 3.640625 | 4 | [] | no_license | ---
title: leetCode-7-整数反转
date: 2021-04-29 19:45:18
tags:
- 算法
---
*原题链接:👉:[整数反转](https://leetcode-cn.com/problems/reverse-integer/)*
题目描述:
1. 给你一个 32 位的有符号整数 x ,返回将 x 中的数字部分反转后的结果。
2. 如果反转后整数超过 32 位的有符号整数的范围 [−231, 231 − 1] ,就返回 0。
3. 假设环境不允许存储 64 位整数(有符号或无符号)
示例:
```
输入:x = 123
输出:321
```
示例:
```
输入:x = -123
输... |
Ruby | UTF-8 | 825 | 3.140625 | 3 | [
"MIT"
] | permissive | t = gets.to_i
i = 0
while i < t do
g = gets.to_i
j = 1
while j <= g do
inp = gets.chomp
inps = inp.split()
i = inps[0].to_i # 1 means all head 2 tail
n = inps[1].to_i # number of rounds
q = inps[2].to_i # 1 head 2 tail
if q == 1
if... |
Java | UTF-8 | 958 | 1.914063 | 2 | [
"Apache-2.0"
] | permissive | package org.kestra.core.models.listeners;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import io.micronaut.core.annotation.Introspected;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.kestra.core.models.executions.Ex... |
Python | UTF-8 | 29,338 | 2.703125 | 3 | [
"MIT"
] | permissive | """
Particular class of two intersections traffic network
@author: Romain Michelucci
"""
import configparser
import logging
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import seaborn as sns
import time
from envs.env import PhaseMap, PhaseSet, TrafficSimulator
im... |
C# | UTF-8 | 824 | 3.046875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WFSample1
{
/// <summary>
/// Базовый класс космических объектов
/// </summary>
class SpaseObject
{
protected Point Pos;
protected Poi... |
Java | UTF-8 | 8,426 | 2.453125 | 2 | [] | no_license | package com.implemica.CurrencyConverter.controller;
import com.implemica.CurrencyConverter.model.ConvertStep;
import com.implemica.CurrencyConverter.model.State;
import com.implemica.CurrencyConverter.model.User;
import com.implemica.CurrencyConverter.service.BotService;
import org.slf4j.Logger;
import org.slf4j.Logge... |
Python | UTF-8 | 1,796 | 2.984375 | 3 | [] | no_license | _users = {
'paul': {
'name': 'Pavel Okopnyi',
'fav_categories': 'Ужасы',
'own_books': 'book184637'
},
'igor': {
'name': 'Igor Novikov',
'fav_categories': 'Научная фантастика',
'own_books': 'book407836'
},
'boris': {
'name': 'Boris Ivanov',
... |
Python | UTF-8 | 538 | 2.703125 | 3 | [
"MIT"
] | permissive | import discord
import json
bot = discord.Bot()
with open("conf.json", "r") as conf:
data = json.load(conf)
token = data["token"]
pref = data["pref"]
# Slash Commands
@bot.slash_command()
async def hello(ctx, name: str = None):
name = name or ctx.author.name
await ctx.respond(f"Hello {name}!")
# ... |
PHP | UTF-8 | 200 | 2.59375 | 3 | [] | no_license | <?php
if (!isset ($_GET['suc'])) {
$suc = 0;
} else {
$suc = $_GET['suc'];
}
if ($suc == 1) {
echo "Thank you for your message!</br> Your message was send on: ", date("F j, Y, g:i a");
} |
JavaScript | UTF-8 | 2,441 | 2.5625 | 3 | [] | no_license | const { prompt } = require('inquirer')
require('console.table')
const mysql = require('mysql2')
const db = mysql.createConnection({
host: 'localhost',
user: 'root',
password: '621120?Jfjjfz',
database: 'employee_db'
})
const Questions = require('../index')
const Managers = () => {
const viewManagers = () =... |
Java | UTF-8 | 10,355 | 2.109375 | 2 | [] | no_license | // License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.testutils;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.Statement;
import org.openstreetmap.... |
Python | UTF-8 | 1,486 | 3.078125 | 3 | [] | no_license | from uwimg import (
clamp_image,
copy_image,
copy_image_bounds,
hsv_to_rgb,
load_image,
rgb_to_grayscale,
rgb_to_hsv,
save_image,
scale_image,
set_pixel,
shift_image,
)
# 1. Getting and setting pixels
im = load_image("data/dog.jpg")
for row in range(im.h):
for col in ran... |
Java | UTF-8 | 395 | 1.765625 | 2 | [] | no_license | package com.eximbay.okr.dto.division;
import com.eximbay.okr.entity.*;
import lombok.*;
import javax.validation.constraints.*;
@Data
public class RemoveDivisionMemberFormDto {
@NotNull
private Division division;
@NotNull
private Member member;
@NotBlank
private String applyBeginDate;
@Not... |
C++ | UTF-8 | 915 | 3.71875 | 4 | [] | no_license | /**
* Two threads chopping vegetables
*/
#include <iostream>
#include <thread>
#include <chrono>
#include <stdio.h>
using namespace std;
bool chopping = true;
void vegetable_chopper(const char *name)
{
uint32_t vegetable_count = 0;
while (chopping) {
vegetable_count++;
}
/* "cout" gives ... |
C# | UTF-8 | 1,686 | 2.8125 | 3 | [] | no_license | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Barfood : MonoBehaviour {
public Queue<GameObject> foodQ = new Queue<GameObject>(); //holds food that cant fit on bar
public List<GameObject> foodSpawn;
public List<GameObject> barfood = new List<GameObject>();
public Lis... |
Markdown | UTF-8 | 2,008 | 2.578125 | 3 | [] | no_license |
# Madrid NLP Meetup Session: Challenges in Transfer Learning for NLP
This repository contains the material about "Challenges in Transfer Learning for NLP" event. In this Meetup we are going to experiment different sentences representation related with Transfer Learning in NLP models for the task of **Semantic Textual... |
JavaScript | UTF-8 | 520 | 3.90625 | 4 | [] | no_license | var list = [
'sun',
'mon',
'tue',
'wed',
'thu',
'fri',
'sat'
];
var length = list.length;
//traversing
console.log('traversing : ');
for (let i = 0; i < length; i++) {
console.log('Element of '+i+' is '+ list[i]);
}
//reversing
console.log('reversing : ');
for (let i = length-1; i > ... |
Markdown | UTF-8 | 4,053 | 3.0625 | 3 | [] | no_license | ## Following is explanation regarding the implementation of each item.
**1) Demonstrates the usage of ngOnChanges, @Ouput() and @Input()**
@Input and @Output are used throughout the application. E.g. a _DataListComponent_ that shows all registrations and rates lists has _cols_ and _data_ inputs. Also, in _NavbarComp... |
Java | UTF-8 | 2,919 | 3.625 | 4 | [
"Apache-2.0"
] | permissive | package com.github.max0961.model.util;
import java.util.*;
public class BinaryHeap<T extends Comparable<T>> {
protected static final int DEFAULT_CAPACITY = 10;
protected T[] items;
protected int size;
@SuppressWarnings("unchecked")
public BinaryHeap() {
items = (T[]) new Comparable[DEFAUL... |
Python | UTF-8 | 1,325 | 4.40625 | 4 | [] | no_license | # [Problem1] Calc 계산기
# 클래스 Calc는 method로 두 수를 더해주는 add, 두 수를 빼주는 sub,
# 두 수를 곱해주는 mul, 두 수를 나눠주는 div를 가지고 있습니다.
# method는 값을 반환합니다.
# 기본값이 0일 때 div을 실행하면 error가 발생하므로 "0은 분모로 올수 없습니다"를 print해주세요.
# 또한, div에서 값이 반환되어지는 값이 정수(Integer)일 때는 int 타입으로 반환해주세요
# 편의상 예시는 표시하지 않고,
# 결과는 앞에 >>>표시로 하겠습니다.
class Calc :
num ... |
Markdown | UTF-8 | 2,539 | 2.84375 | 3 | [] | no_license | # cifra-de-cesar
Segundo o Wikipedia, criptografia ou criptologia (em grego: kryptós, “escondido”, e gráphein, “escrita”) é o estudo e prática de princípios e técnicas para comunicação segura na presença de terceiros, chamados “adversários”. Mas geralmente, a criptografia refere-se à construção e análise de protocolos ... |
JavaScript | UTF-8 | 705 | 3.015625 | 3 | [
"MIT"
] | permissive | //show the spinner
function showSpiner(clicked_btn) {
clicked_btn.prop('disabled', true);
clicked_btn.find('img').removeClass('hide_spinner');
}
//hide the spinner by adding hide_spinner class
function hideSpinner(clicked_btn) {
clicked_btn.prop('disabled', false);
clicked_btn.find('img').addClass('hid... |
Java | UTF-8 | 125 | 1.828125 | 2 | [] | no_license |
package zooproject.abstraction;
import zooproject.abstraction.Eatable;
public abstract class Animal implements Eatable{
}
|
C# | UTF-8 | 2,294 | 2.984375 | 3 | [] | no_license |
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CSharpReadJSON
{
class Program
{
static void Main(string[] args)
{
... |
Markdown | UTF-8 | 393 | 2.734375 | 3 | [] | no_license | # `%nin%`: The "Not In" Operator %nin%, negation of [`match`](match.html)
## Usage
```r
... %nin% NA
```
## Arguments
Argument |Description
------------- |----------------
```...``` | see %in% details in [`match`](match.html)
## Value
a logical vector
## Seealso
[`match`](match.html)
## Ex... |
C# | UTF-8 | 455 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DP_composite
{
public abstract class Binaire : Expression
{
protected Expression op1;
protected Expression op2;
public Binaire(Expression _op1, Expression _op2)
... |
Java | UTF-8 | 755 | 1.90625 | 2 | [] | no_license | package xyz.hhjian.lib.entity.domain;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;
import xyz.hhjian.lib.entity.enums.BookStatusEnum;
/**
* <p>图书类</p>
*
* @author <a href="mailto:hhjian.top@qq.com">h... |
Java | UTF-8 | 3,419 | 1.984375 | 2 | [] | no_license | package com.fsquare.shopping.service;
import com.liferay.portal.service.ServiceWrapper;
/**
* Provides a wrapper for {@link ShoppingOrderService}.
*
* @author Brian Wing Shun Chan
* @see ShoppingOrderService
* @generated
*/
public class ShoppingOrderServiceWrapper implements ShoppingOrderService,
ServiceWra... |
Markdown | UTF-8 | 1,083 | 2.59375 | 3 | [
"MIT"
] | permissive | django-nomnom
=============
A generic importing tool for the Django admin site.
Developed with
--------------
* Python 2.7.x
* Django 1.4.x
Installation & Setup
--------------------
pip install django-nomnom
After installation add 'nomnom' to your INSTALLED_APPS setting:
INSTALLED_APPS = (
...
'... |
Java | UTF-8 | 108 | 2.125 | 2 | [] | no_license | package org.strategy.staticproxy;
/**
* 抽象接口
*/
public interface IPlayGame {
void play();
}
|
JavaScript | UTF-8 | 553 | 3.1875 | 3 | [] | no_license | console.log(document)
function pestPrice(goo, bob, cheep) {
var goo = document.getElementById("goombas").value;
var bob = document.getElementById("bob-ombs").value;
var cheep = document.getElementById("cheep-cheeps").value;
gooPrice = parseInt(goo) * 5;
bobPrice = parseInt(bob) * 7;
cheepPrice ... |
Markdown | UTF-8 | 2,973 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | # fluent-plugin-events
Use the [Fluentd](https://fluentd.org/) input plugin to watch Kubernetes events from the Kubernetes API Server.
### Events
To customize fields for events edit the provided (`fluentd-sumologic.yaml`) file by specifying the fields in the `events` plugin `@type` parameter. The following example h... |
Java | UTF-8 | 2,465 | 2.84375 | 3 | [] | no_license | package com.lwhtarena.netty.groupchat;
import io.netty.bootstrap.Bootstrap;
import io.netty.channel.*;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.string.StringDecoder;
import io.netty.ha... |
Python | UTF-8 | 1,761 | 4 | 4 | [] | no_license | #-----------------------------------------
#Playing with statistics in dataframes and testing out predictions with Linear Regression
#v.1 2020/2/7
#Armani Chien
#------------------------------------------
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import math
i... |
Python | UTF-8 | 5,040 | 3.234375 | 3 | [] | no_license | import pprint as pp
import dataretrieving as dr
import PartOne as po
import os
# TODO: remember to remove all the prints except for the printing of the results!
dataset_dir = "../datasets/"
"""
MAIN IDEA:
I can calculate the pagerank for each category and then linearly sum their weighted values.
Each o... |
C | UTF-8 | 12,375 | 3.453125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NAMELEN 64
#define BUFSIZE 100
struct play{
int user_id;
int artist_id;
int playcount;
struct play *next;
};
void print_play(struct play *p);
void print_plays(struct play *p);
struct play *create_play(int id, int artist_id, int playc... |
Go | UTF-8 | 2,712 | 2.859375 | 3 | [] | no_license | package log
import (
"fmt"
"os"
"strings"
"time"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var (
Levels = []string{"debug", "info", "warn", "error"}
)
func fileLevels(level string) (levels []string) {
for i, l := range Levels {
if l == level {
return Levels[i:]
}
}
panic(fmt.Sprintf("level %s ... |
C | UTF-8 | 1,554 | 2.546875 | 3 | [] | no_license | inherit "/std/room";
#include "mail.h"
void create()
{
set_short("the post office");
set_long("You're in the local post office.\n"+
"Commands are: read, mail and from.\n" );
add_property("silence_please");
}
void send_mail(string to,string subject,string body)
{
object o,oo;
string from;
mixed *mail,*t... |
C++ | UTF-8 | 1,075 | 2.625 | 3 | [] | no_license |
#include <iostream>
#include <string>
#include "Sentence.h"
#include "Global.h"
#include "Util.h"
#include "Search/Manager.h"
using namespace std;
void temp();
int main(int argc, char** argv)
{
//temp();
Fix(cerr, 3);
Global &global = Global::InstanceNonConst();
global.timer.start("Starting...");
glo... |
Markdown | UTF-8 | 30,735 | 3.109375 | 3 | [] | no_license | # 2019-09-16 Meeting with J. Casey Hammond
### J. Casey Hammond:
Your [prayer](https://twitter.com/audreyt/status/767953441746411524) was very touching.
### Audrey Tang:
It’s also my job description.
### J. Casey Hammond:
Your job description?
### Audrey Tang:
That’s right.
### J. Casey Hammond:
Did you write this... |
Java | UTF-8 | 2,317 | 2.109375 | 2 | [] | no_license | package com.rjkj.cf.bbibm.kjds.product.appcategory.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.active... |
Java | UTF-8 | 6,177 | 2.34375 | 2 | [] | no_license | package com.taedison.helmy;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.voll... |
C++ | UTF-8 | 2,658 | 3.46875 | 3 | [] | no_license | /*!
Custom exceptions for the bship engine
*/
#ifndef EXCEPTIONS_HPP
#define EXCEPTIONS_HPP
#include <iostream>
#include <exception>
#include <string>
namespace bship{
class bship_exception;
class index_exception;
class illegal_move_exception;
}
/*!
@class bship_exception
@brief Custom ex... |
C++ | UTF-8 | 473 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <stdio.h>
int getch();
void ungetch(int);
static int stack [1000];
static int *top = NULL;
int getch()
{
int ch;
if(top == NULL)
{
ch = getchar ();
return ch;
}
if(top == stack)
{
ch = *top;
top = NULL;
}
else
{
ch = *top;
--top;
}
return ch;
}
void ungetch (in... |
Java | UTF-8 | 9,602 | 2.5 | 2 | [] | no_license | import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
impor... |
Shell | UTF-8 | 668 | 2.640625 | 3 | [] | no_license | #!/bin/bash
cd /opt
#java installation
wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.rpm
#start the java
rpm -ivh jdk-8u131-linux-x64.rpm
# install tomcat
wget https://mirrors.estointernet.i... |
Markdown | UTF-8 | 972 | 3.265625 | 3 | [] | no_license | # React Native Component Viewer
This is a simple template app that lets you view a single component in isolation, centered on the phone screen. Only tested in Android, but should work for IOS. Contributions to test for IOS are welcome.
Useful for:
- People who want to test the look and feel of individual components i... |
PHP | UTF-8 | 13,956 | 2.65625 | 3 | [] | no_license | <?php
require_once File::build_path(array('model','Model.php'));
class ModelAccueil
{
private $idAccueil;
private $nomAccueil;
private $descAccueil;
private $url1;
private $url2;
private $url3;
public function getIdAccueil() {return $this->idAccueil;}
... |
TypeScript | UTF-8 | 3,683 | 2.84375 | 3 | [] | no_license | import { ArHttp, Feedback } from "../services";
import { Config } from "../config/config";
import { AxiosRequestConfig } from 'axios';
import { withCookies, Cookies } from 'react-cookie';
export interface IAuthentication {
isAuth: boolean,
userName: string,
token: string,
token_type: string
};
export... |
TypeScript | UTF-8 | 357 | 2.703125 | 3 | [] | no_license |
export class CategoryDto {
name: string;
description: string;
isActive: boolean;
id: string;
constructor(initialValues: Partial<CategoryDto> = {}) {
if (initialValues) {
for (const key in initialValues) {
if (initialValues.hasOwnProperty(key)) {
this[key] = initialValues[key];... |
Python | UTF-8 | 1,174 | 3.875 | 4 | [] | no_license | # 병합정렬
# 순서가 뒤죽박죽인 배열이 있을 때 정렬하기 위해 분할과 정복방식을 이용한다
# 1. 데이터를 절반씩 나누어 끝까지 갔다가(분할했다가)
# 2. 다시 절반씩 합치면서 그 안에서 정렬한다.(정복한다)
def merge_sort(arr):
if len(arr) <= 1:
return arr
# 재귀함수를 이용해서 끝까지 분할
mid = len(arr) // 2
left = merge_sort(arr[:mid])
right = merge_sort(arr[mid:])
i = 0
j = 0
... |
C# | UTF-8 | 9,980 | 2.703125 | 3 | [
"Unlicense"
] | permissive | using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
namespace DatagenSharp
{
/// <summary>
/// Top level class for data generation
/// </summary>
public sealed class GenerateData
{
public GenerateChain chain = new GenerateChain();
pu... |
Java | UTF-8 | 227 | 2.546875 | 3 | [] | no_license | package pkg;
public class PublicClass1 {
public static void hello() {
System.out.println("Hello from PublicClass1");
}
public static void bye() {
System.out.println("Bye from PublicClass1");
}
} |
Java | UTF-8 | 40,957 | 1.585938 | 2 | [] | no_license | package fr.vivicoubar.onyxffa;
import fr.vivicoubar.onyxffa.commands.*;
import fr.vivicoubar.onyxffa.duels.ArenaManager;
import fr.vivicoubar.onyxffa.duels.DuelListener;
import fr.vivicoubar.onyxffa.duels.DuelManager;
import fr.vivicoubar.onyxffa.events.sumo.CommandsSumo;
import fr.vivicoubar.onyxffa.events.sumo.SumoE... |
JavaScript | UTF-8 | 1,127 | 3.140625 | 3 | [] | no_license | class Toolbar{
constructor(btnIds){
//btnIds must be a list of id's of existing buttons
this._btnIds = btnIds
this._buttons = []//actual domnodes will be stored here
this.init()
this._active = null
}
init(){
let len = this._btnIds.length
for (let i = ... |
Java | UTF-8 | 5,930 | 2.109375 | 2 | [
"Apache-2.0"
] | permissive | package org.jifeihu.smartshed.adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android... |
Markdown | UTF-8 | 1,081 | 2.703125 | 3 | [] | no_license | # Express API with Database
This app is build with **Node.js, Express.js, mongoDB and mongoose**. I am learning how to create API. This my first time in backend world. I shall update this codebase as I learn more.
---
## Contributors
_Contributors to this project :_
| username | ... |
Java | UTF-8 | 3,695 | 2.765625 | 3 | [
"MIT"
] | permissive | package com.sbk.callerid.service;
import com.sbk.callerid.model.CallerId;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
impo... |
Python | UTF-8 | 18,257 | 3.546875 | 4 | [] | no_license | from collections import deque
#***************************
# Solution summary:
# - Create a deque representing the coords (row,col) of the route the train track takes (piece by piece). Each element in the deque is a tuple. One route-deque for each train.
# - As the train moves around the track, ROTATE the deques ... |
Python | UTF-8 | 202 | 3.359375 | 3 | [] | no_license | data = input().split()
products = {}
for index in range(0, len(data), 2):
current_product = data[index]
quantity = data[index + 1]
products[current_product] = int(quantity)
print(products) |
C++ | UTF-8 | 2,999 | 3.453125 | 3 | [] | no_license | #include <cstdio>
struct Node {
int val;
int height;
Node* left;
Node* right;
Node(int v, Node* l=0, Node* r=0, int h=0)
: val(v), left(l), right(r), height(h)
{}
};
int getHeight(Node* root) {
if (root == 0) {
return 0;
}
else {
return root->height;
}
}
int max(int v1, int v2) {
return ((v1 > v2) ... |
Java | UTF-8 | 22,933 | 1.640625 | 2 | [] | no_license | package com.example.madcampproject2;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import android.Manifest;
import... |
PHP | UTF-8 | 492 | 2.65625 | 3 | [] | no_license | <?php
/*
Yes, randomly generated image, very simple code.
If you use it please credit to fedekiller.
*/
header ("Content-type: image/gif");
$string = htmlspecialchars(strip_tags(stripslashes($_GET['code'])), ENT_QUOTES);
$image = @imagecreate (50,15) ;
$black = imagecolorallocate ($image, 0, 0, 0);
$white = imagecolor... |
Python | UTF-8 | 554 | 2.84375 | 3 | [] | no_license | import random,time
COL,ROW=30,30
init=lambda:[[random.randint(0,1) for j in range(ROW)] for i in range(COL)]
neig=lambda c,x,y:sum([c[(x+i+COL)%COL][(y+j+ROW)%ROW] for j in [0,1,-1] for i in [0,1,-1]][1:])
nexT=lambda c:[[1 if neig(c,i,j)==3 else (c[i][j] if neig(c,i,j)==2 else 0) for j in range(ROW)] for i in range(CO... |
Shell | UTF-8 | 1,611 | 3.453125 | 3 | [] | no_license | #!/bin/bash
set -e
echo "Installing Lattice - Diego Cell"
LATTICE_DIEGO_CELL_BUILD_PATH=$1
if [ -z "$LATTICE_DIEGO_CELL_BUILD_PATH" ]; then
LATTICE_DIEGO_CELL_BUILD_PATH='.'
fi
install_dependencies() {
echo "Installing Dependencies..."
pushd /tmp
SHADOW_TAR_OBJECT_ID="8f17023f-2a94-4d98-a737-dd... |
Markdown | UTF-8 | 294 | 2.84375 | 3 | [
"MIT"
] | permissive | # Free Thrower
Training a neural network to shoot basketball free throws consistantly.
## Initial plan:

# Results
We can see that the "Shooters" learn to shoot the basketballs to the right, but not too strong to overshoot the hoop.
 |
Java | UTF-8 | 253 | 2.40625 | 2 | [] | no_license | package TowerDefense;
public class ImageObject extends GameEntity {
public ImageObject(String path) {
super(path);
}
/*
public void setLayoutPosition(int x, int y) {
setLayoutX(x);
setLayoutY(y);
}
*/
}
|
Python | UTF-8 | 1,632 | 2.515625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import pytest
def assert_instrument_response(device, query, data):
response = device.query(query)
assert response == data, "%s, %r == %r" % (device.resource_name, query, data)
@pytest.mark.parametrize(
"resource",
[
"ASRL1::INSTR",
"GPIB0::8::INSTR",
"... |
Java | UTF-8 | 3,339 | 2.5 | 2 | [] | no_license | package avishkar2k17.com.tpo;
import android.util.Log;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java... |
C | UTF-8 | 1,976 | 3.515625 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "deque.h"
p_deque criar_deque() {
p_deque deque = malloc(sizeof(Deque));
deque->ini = NULL;
deque->fim = NULL;
return deque;
}
void destruir_lista_rec(p_no lista) {
if (lista == NULL) return;
destruir_lista_rec(lista->prox);
free(lista);
}
v... |
Python | UTF-8 | 198 | 2.6875 | 3 | [] | no_license | #coding=utf-8
'''
Created on 2015年3月19日
@author: asus
'''
import re
#u不能掉
f=u"我"
b=re.findall(ur"[\u4e00-\u9fa5]+",f)
if b==[]:
print "不是中文"
else:
print "是中文"
|
Markdown | UTF-8 | 714 | 2.859375 | 3 | [] | no_license | ### 支持中文,文字转图片,支持自动断行,加阴影
#### 使用说明
```
composer require turbo-text2image
```
```php
use Turbo\text2Image\text2Image;
// 指定容器宽高
$width = 800;
$height = 600;
// 当不指定宽时,将不自动断行
// 当指定高时,文字超出部分将不会显示
$image = new text2Image($width, $height);
$text = <<<MSG_EOF
<?php
// Set the enviroment variable for GD
putenv('GDFONTP... |
C# | UTF-8 | 1,420 | 2.765625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using TarefaWeb.Models;
namespace TarefaWeb.Controllers
{
public class TarefasController : ApiController
{
public List<Tarefa> Get()
{
using(TarefaMode... |
Python | UTF-8 | 624 | 3.515625 | 4 | [] | no_license | #Recursion Set
# search
def search(array, query):
if array == []:
return False
if array [0] == query:
return True
return search(array[1:], query)
# is_palindrome
def is_palindrome(str):
if len(str) <=1:
return True
if str [0] != str[-1]:
return False
retur... |
Java | UTF-8 | 3,442 | 2.265625 | 2 | [] | no_license | package com.example.demo.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.CloseStatus;
import org.springframework.web.socket.WebSocketHandler;
import org.s... |
Java | UTF-8 | 3,178 | 3.15625 | 3 | [] | no_license | package util;
import config.Constants;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.List;
public class FileUtils {
private FileUtils() {
}
/**
* Returns the desktop directory path of... |
Java | UTF-8 | 366 | 2.078125 | 2 | [] | no_license | package xlxacidxlx.datmod.item;
import xlxacidxlx.datmod.base.Item;
import xlxacidxlx.datmod.creativetab.CreativeTabs;
/**
* Created by Acid on 10/26/2016.
*/
public class EmeraldiDust extends Item {
/**
* Constructs the Emeraldi Dust
*/
public EmeraldiDust() {
super("Emeraldi Dust");
setCreativeTab(Crea... |
Java | UTF-8 | 2,832 | 2.4375 | 2 | [
"Apache-2.0"
] | permissive | package com.theah64.pigeon.utils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by theapache64 on 14/9/16,6:07 P... |
Markdown | UTF-8 | 864 | 2.609375 | 3 | [] | no_license |
# TaskGroups2.Add Method (Project)
Der **TaskGroups2** -Auflistung hinzugefügt ein **[Group2](a7a61fa4-e752-006e-a47e-03987b04f01c.md)** -Objekt.
## Syntax
_Ausdruck_. **Add**( ** _Name_**, ** _FieldName_** )
_Ausdruck_ Ein Ausdruck, der ein **TaskGroups2** -Objekt zurückgibt.
### Parameter
|**Name**|**Er... |
C++ | UTF-8 | 928 | 2.984375 | 3 | [
"MIT"
] | permissive | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int N = nums.size();
int l = 0;
int s = 0;
int ans = -1;
for (; l<N and s<x; l++) {
s += nums[l];
}
if (s == x) ans = l;
l-... |
Java | UTF-8 | 5,485 | 2.1875 | 2 | [
"MIT"
] | permissive | package com.qxcmp.spider;
import com.qxcmp.core.init.QxcmpInitializer;
import com.qxcmp.spider.event.AdminSpiderFinishEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationCon... |
Java | UTF-8 | 3,339 | 2.640625 | 3 | [] | no_license |
package br.com.hotel;
import java.util.ArrayList;
import java.util.Date;
import br.com.clientes.Conta;
import br.com.clientes.Hospede;
/**
*
* @author Igor Silva & Savio Silva
*
*/
public class Reserva { //antiga class Hospedagem
private int codigo;
private Date dataEntrada;
private Date dataSa... |
Java | UTF-8 | 365 | 2.546875 | 3 | [] | no_license | package code.gui;
public final class TopLeftFrame {
private int width;
private int height;
public int getWidth() {
return width;
}
public void setWidth(int _width) {
width = _width;
}
public int getHeight() {
return height;
}
public void setHeight(int ... |
Markdown | UTF-8 | 3,191 | 3.15625 | 3 | [] | no_license | ### 外媒:人们主要认知问题是过度自信 而非缺乏自信`龘龘龘`
http://www.chinanews.com/gj/2014/05-19/6185085.shtml
- 女性往往太缺乏自信。
>作者认为几乎从来都看不到任何由自信心不足造成的问题,但是每天都会看到过度自信造成的问题,自己也会制造这种问题。
>>很多最近的心理学研究也显示,人们主要的认知问题是过度自信而非缺乏自信。
>>>数不胜数的实验,显示出人们会多么频繁地做出自信但错误的结论。
- 研究表明,人们惯于过度表扬自己的优点、为自己的缺点开脱,于是人们就可以过高地评价自己。
多数人都自以为诚实,但实际上,如果时机合适,多数人常会在小问题上作弊。
- 人们应该如何向更... |
Python | UTF-8 | 6,062 | 2.578125 | 3 | [] | no_license | from zplot import *
def guess_interval(x):
import math
div = int(10**(int(math.log10(x))-1))
return max(2, int(x)/5/div*div)
def ceil_and_interval(x):
interval = guess_interval(x)
return int(math.ceil(x/interval)*interval), interval
def producer():
t = table('plot2.data', separator=',')
# ack... |
Python | UTF-8 | 1,635 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from time import sleep
import requests
from dev.models import *
# run migration (adding, removing or changing your DB)
try:
db.execute_sql("ALTER TABLE schools ADD COLUMN latitude DECIMAL(9, 6)")
db.execute_sql("ALTER TABLE schools ADD COLUMN longitude DECIMAL(9, 6)")
except:
pr... |
Swift | UTF-8 | 2,449 | 3.4375 | 3 | [
"MIT"
] | permissive | import Foundation
// https://leetcode.com/problems/path-sum-ii
class Solution {
func pathSum(_ root: TreeNode?, _ targetSum: Int) -> [[Int]] {
return findPath(root, targetSum, [Int](), [[Int]]())
}
private func findPath(_ root: TreeNode?, _ sum: Int, _ path: [Int], _ paths: [[Int]]) -> [[Int]... |
Java | UTF-8 | 6,358 | 2.390625 | 2 | [] | no_license | package com.trc202.CombatTagListeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
//import org.bukkit.event.entity.EntityDamageEvent;
//import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerJoinEvent;
imp... |
Python | UTF-8 | 1,024 | 4.0625 | 4 | [] | no_license | #calculate number of elements in an array using recursive
def lenArr(lst):
if lst == []:
return 0
else:
return 1 + lenArr(lst[1:])
print (lenArr([1,3,4,2,4]))
#calculate sum of an array
def arrSum(lst):
if lst == []:
return 0
elif len(lst) == 1:
return lst[0]
else:
return lst[0] + arrSum(lst[1:])
pr... |
TypeScript | UTF-8 | 2,007 | 2.796875 | 3 | [
"CC0-1.0"
] | permissive | import Loader from './Loader';
import StyleChange from '../Interfaces/StyleChange';
import KeyframeChange from '../Interfaces/KeyframeChange';
class LoaderFacebook extends Loader {
transform(size: string, color: string) {
const newSizeInt = parseInt(size, 10);
const keyFrame0top = newSizeInt * 0.1;
const... |
Python | UTF-8 | 1,007 | 2.78125 | 3 | [] | no_license | '''
Created on Jan 17, 2014
@author: alessioferrari
'''
from ModelIndex import ModelIndex
from RequirementsModel import WORD_STRING, STEM_STRING, GOAL_STRING
class ModelIndexManager(object):
'''
This class stores a set of ModelIndexes and calls one index or the
other according to the type of query that i... |
Swift | UTF-8 | 357 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | //
// JSONAdapter.swift
// TMDBCore
//
// Created by Guilherme Rambo on 20/06/16.
// Copyright © 2016 Guilherme Rambo. All rights reserved.
//
import Foundation
import SwiftyJSON
public protocol JSONAdaptable {
init?(json: JSON)
}
class JSONAdapter<M where M:JSONAdaptable> {
class func adapt(json: J... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.