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
292
2.0625
2
[]
no_license
package com.petbackend.api.service; import java.util.List; import java.util.Optional; import com.petbackend.api.model.PetType; public interface PetTypeService { PetType save(PetType type); Optional<PetType> findById(Long id); void remove(PetType type); List<PetType> getPetTypes(); }
Python
UTF-8
445
4.3125
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- length_feet = int(input("What is the length of the room in feet? ")) width_feet = int(input("What is the width of the room in feet? ")) square_feets = length_feet * width_feet square_meters = square_feets * 0.09290304 print(f"You entered dimensions of {length_feet} feet ...
C++
GB18030
348
2.78125
3
[]
no_license
#ifndef _ENTITY_H #define _ENTITY_H class BassGameEntity { public: BassGameEntity(int id) { SetID(id); } int GetiID() const { return m_ID; } void SetID(int val) { m_ID = val; m_iNextValidID = m_ID + 1; } protected: private: int m_ID; static int m_iNextValidID; // һЧ }; #endif //_ENT...
Python
UTF-8
1,852
2.640625
3
[]
no_license
import re from lxml import etree class HtmlParser: def parser(self, response): items = [] try: tree = etree.HTML(response.text) house_list = tree.xpath('//ul[@id="house-lst"]/li') for house in house_list: title = ''.join(house.xpath('./div[2]/h2/a...
Python
UTF-8
8,624
2.96875
3
[ "MIT" ]
permissive
"""Shift amount activity for the simulation.""" import numpy as np import openclsim.core as core from .base_activities import GenericActivity class ShiftAmountActivity(GenericActivity): """ ShiftAmountActivity Class forms a specific class for shifting material from an origin to a destination. It deal...
Shell
UTF-8
406
2.953125
3
[ "MIT" ]
permissive
#!/usr/bin/env bash -x ## For testing APP_VERSION="v1000" APP_ENVIRONMENT="default" [ -z "$APP_ENVIRONMENT" ] && echo "APP_ENVIRONMENT is not set" && exit 1 [ -z "$APP_VERSION" ] && echo "APP_VERSION is not set" && exit 1 helm version || exit 1 if [[ "$DEBUG" == "true" ]]; then DEBUG_MODE=" --dry-run --debug " f...
C++
UTF-8
2,438
2.640625
3
[]
no_license
#pragma once /* AWind.h - Arduino window library support for Color TFT LCD Boards Copyright (C)2016 Andrei Degtiarev. All right reserved You can always find the latest version of the library at https://github.com/AndreiDegtiarev/AWind This library is free software; you can redistribute it and/or modify it under the...
Markdown
UTF-8
663
2.609375
3
[]
no_license
<h1>ISports-C</h1> <h3>What is this project?</h3> <p>This is a simple real-time chat application built using Firebase Authentication and Firestore.</p> <p>Built it mostly to use as a starting-point for other applications that have a real-time chat portion.</p> <h3>Application features:</h3> <ol> <li>Register ne...
Markdown
UTF-8
9,611
3.953125
4
[ "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
# Chapter 9 - Insertion sort is another sorting algorithm. Like bubble sort and selection sort its worst-case time is O(n2),but it has a different best-case. When the values are already nearly sorted, insertion sort runs in O(n). - Quick sort, as its name would suggest, is one of the faster sorting algorithms. The...
Markdown
UTF-8
1,464
3.078125
3
[]
no_license
In R, if you want to convert a string representing an integer in base 16 to an integer, then you can simply use <code>as.integer</code> as long as you prefix the string with "0x". Here's an example: <pre> as.integer("0x4d2") [1] 1234 </pre> Originally, I had posted the following excerpt from <code>as.hexmode</code> ...
Shell
UTF-8
1,589
3.78125
4
[]
no_license
#!/bin/sh # # mfscgiserv MooseFS CGI monitor service # # chkconfig: 345 93 07 # # description: MooseFS CGI server # # processname: mfscgiserv # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. if is_yes "${NETWORKING}...
Python
UTF-8
142
2.921875
3
[]
no_license
'''Remove duplicates from list ''' from collections import OrderedDict def distinct(seq): return list(OrderedDict.fromkeys(seq).keys())
TypeScript
UTF-8
851
2.96875
3
[]
no_license
import * as t from "io-ts"; export class ValidationError extends Error {} export type IoErrors = { [key: string]: [string, string] }; export function getIoErrors(errors: t.Errors): IoErrors { return Object.fromEntries( errors.map(error => [ error.context .map(({ key }) => key) .filter(key...
TypeScript
UTF-8
1,150
2.546875
3
[]
no_license
import { Controller, Body, Delete, Param, Put, Get, Post } from '@nestjs/common'; import { OAuthLogin } from '../auth/decorators/oAuthLogin.decorator'; import { InputTag } from './interfaces/tag.dto'; import { TagService } from './tag.service'; @Controller('tags') export class TagController { constructor(public rea...
C
UTF-8
348
3.3125
3
[]
no_license
#include<stdio.h> #include<string.h> main() { char b[100]; int i; printf("\n enter the string:"); gets(b); for(i=0;i<=strlen(b);i++) { if((b[i]=='a')||(b[i]=='e')||(b[i]=='i')||(b[i]=='o')||(b[i]=='u')||(b[i]=='A')||(b[i]=='E')||(b[i]=='I')||(b[i]=='O')||(b[i]=='U')) { printf("\n yes"); } else { printf("...
C++
UTF-8
382
4.03125
4
[]
no_license
#include <iostream> #include <string> using namespace std; template <typename T, typename P> void print_bigger(T a, P b) { sizeof a > sizeof b ? cout << a : cout << b; } int main() { //Create a function template that takes 2 different typenames, and prints out //which one is stored in more bytes from then i...
Markdown
UTF-8
801
2.84375
3
[]
no_license
# Charset Auto Select Simple extension to reopen files in the correct charset (sad that I need to build this) ## How it works: The idea is to change de vscode settings file with the correct encoding, and then reopens de file with the charset output from ``` file -bi ${filename} | awk '{print toupper($0)}' | cut -...
Python
UTF-8
563
2.890625
3
[]
no_license
# Header """ Programme pour jeu du Pendu Réalisé par Adrien Corsetti et Quentin Melero le 01/12/2020 Fini """ # Importation des bibliothèques nécessaires from Fonction import jeu_du_pendu, mot_aleatoire # Fonction principale score_max = 0 # Initialisation du score maximum de l'utilisateur qui n'a pas encore jo...
Rust
UTF-8
1,269
2.703125
3
[ "MIT" ]
permissive
use std::fs; use std::io; use std::path::{Path, PathBuf}; use ansi_term::Colour::*; use toml::{map::Map, Value}; use crate::internal::handlers::utils::{exec_on_home, git_clone, is_dir, is_empty, CloneArgs}; pub fn init() -> bool { let dot_monkey: &Path = Path::new(".monkey"); let base_path: PathBuf = exec_on...
Java
UTF-8
325
2.578125
3
[]
no_license
package javatuning.ch3.teststr.split.junit; import org.junit.Test; public class StringSplitFunctionTest { @Test public void testSplit() { String str = "a;b,c:d"; String re[] = str.split("[;|,|:]"); for (String s : re) { System.out.println(s); } } ...
Java
UTF-8
32,776
1.945313
2
[]
no_license
package edu.missouri.chenglab.ClusterTAD; import java.awt.FlowLayout; import java.awt.event.WindowEvent; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import...
Java
UTF-8
2,143
1.679688
2
[]
no_license
package zte.net.ecsord.params.zb.vo.orderattr; import java.io.Serializable; import com.ztesoft.net.annotation.ZteSoftCommentAnnotationParam; public class Resources implements Serializable{ @ZteSoftCommentAnnotationParam(name="附加产品编码",type="String",isNecessary="Y",desc="SubProCode:附加产品编码") private String Resources...
C#
UTF-8
963
3.140625
3
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Security.Cryptography; namespace loginscreen { public class Hash { public string CriptografarSenha(string senha) { var valorCodificado = Encoding.UTF8.Ge...
JavaScript
UTF-8
4,988
2.546875
3
[ "MIT" ]
permissive
var fs = require('fs'); var util = require('util'); var mongodb = require('mongodb'); var MongoClient = require('mongodb').MongoClient; assert = require('assert'); // Connection url var url = 'mongodb://localhost:27017/BlackHawk'; // Inserts many documents var insertEvent = function(info, db, callback) { // Get ...
C#
UTF-8
4,050
3.640625
4
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CodeExercise.BFS { class CloneGraph { /// <summary> /// 133 Clone Graph /// https://leetcode.com/problems/clone-graph/description/ /// /// Clon...
TypeScript
UTF-8
399
3.09375
3
[ "MIT" ]
permissive
export function createSimpleSelector<TSource, TResult>( sourceReader: () => TSource, transformer: (source: TSource) => TResult, ): () => TResult { let source: TSource | undefined; let result: TResult | undefined; return () => { const _source = sourceReader(); if (_source !== source) { result = ...
C++
GB18030
4,285
2.8125
3
[]
no_license
#ifndef _MAIN_CPP_ #define _MAIN_CPP_ #include "Define.h" #include "string.h" #include "stdio.h" #include "windows.h" #include "SearchEngine.h" //ȫֱ MapType map; //¼Ϣ MoveType bestMove; //صз int ourcolor; //¼ҷɫ int posx[8] = {0,0,3,3,6,6,9...
C#
UTF-8
2,392
3.4375
3
[]
no_license
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /*************************************************** * 章节: 11泛型和委托 11.5 例题-多播委托 * 题目: * 1) * 要点: * 1)委托对象可以使用"+"运算符进行合并 * 2)"-"运算符可用于从合并委托中移除组件委托 * 3)只有相同类型的委托可被合并 * ...
Python
UTF-8
504
2.75
3
[]
no_license
# https://leetcode.com/problems/maximum-product-of-splitted-binary-tree/submissions/ def max_roduct(root): result = total = 0 def dfs_sum(node): if not node: return 0 left = dfs_sum(node.left) right = dfs_sum(node.right) result = max(result, left * ...
Markdown
UTF-8
1,856
2.609375
3
[ "MIT" ]
permissive
# Exemplos AdvPL REST Este repositório contém um conjunto de implementações de serviços REST em AdvPL cautelosamente comentados com o objetivo de servir de referência à construção de novas aplicações e auxiliar no aprendizado das características dessa tecnologia. Os exemplos estão ordenados por complexidade e nomeado...
Java
UTF-8
7,320
2.5
2
[]
no_license
package com.mmall.component; import com.google.common.base.Strings; import com.google.common.io.ByteStreams; import org.apache.commons.io.output.TeeOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.core.annotation.Order; import org.springframe...
Ruby
UTF-8
6,479
3.140625
3
[]
no_license
# == Schema Information # # Table name: stops # # id :integer not null, primary key # name :string # # Table name: routes # # num :string not null, primary key # company :string not null, primary key # pos :integer not null, primary key # stop_id :inte...
Python
UTF-8
438
2.53125
3
[]
no_license
import sys import heapq, math from itertools import zip_longest, permutations, combinations, combinations_with_replacement from itertools import accumulate, dropwhile, takewhile, groupby from functools import lru_cache from copy import deepcopy N = int(input()) cnt = 0 ans = 1 for i in range(1, N + 1): x = i ...
C++
UTF-8
2,643
2.890625
3
[ "CC-BY-4.0" ]
permissive
/************************************************************************ * Description: Test for a 28BYJ-48 stepper motor * Developer: Uri Leal * Board: Arduino Nano/Uno * I/O pins: D5-D8 * Motor step sequence: 2 coils at time * * GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 * Copyright (C) 2007 Free Software F...
Java
UTF-8
5,042
3.703125
4
[]
no_license
/*CS230 Final Project *CourseTable.java *Meher Vohra, Remi Kobayashi, Rosanne Hu * 28/11/16 * * Created by Rosanne Hu * * This class is what makes the actual schedule, it takes section objects * from the priorityqueue in coursepriority and inputs them into the Schedule(Hastable) * based on availibility. ...
C
UTF-8
214
4.09375
4
[]
no_license
#include <stdio.h> /** *main - printing the alphabet from a through z *Return: The returned value is 0. */ int main(void) { char i; for (i = 'a'; i <= 'z'; i++) putchar(i); putchar('\n'); return (0); }
C++
UTF-8
852
2.671875
3
[]
no_license
/*************************************************** * Copyright (c) 2020 Roee Xu. All Rights Reserved **************************************************** * File: 1408.cpp * Author: roeexu * Date: 2020-06-24 15:47:16 * Brief: ****************************************************/ bool cmp(string& x, string&...
JavaScript
UTF-8
943
2.625
3
[ "MIT" ]
permissive
function openlogin() { document.getElementById('mylogin').style.display = "block"; } function closelogin(){ document.getElementById('mylogin').style.display = "none"; } function openregis() { document.getElementById('myregis').style.display = "block"; } function closeregis(){ document.getE...
Java
UTF-8
1,235
2.734375
3
[]
no_license
package fr.eurecom.clouds.zklab; import java.io.IOException; import java.util.concurrent.TimeUnit; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Level; import org.apache.log4j.Logger; public class Process { private static final String GROUP_NAME = "group07"; // <----- CHANGE THIS...
Shell
UTF-8
487
2.765625
3
[ "Apache-2.0" ]
permissive
TERMUX_PKG_HOMEPAGE=https://curlie.io/ TERMUX_PKG_DESCRIPTION="The power of curl, the ease of use of httpie" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="1.7.1" TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=git+https://github.com/rs/curlie TERMUX_PKG_BUILD_IN_SRC=true TERMUX_PKG_AUTO_UPDATE=tr...
Java
UTF-8
762
2.03125
2
[]
no_license
package com.zyun.api.auth; import com.zyun.model.auth.request.LoginRequest; import com.zyun.model.auth.response.JwtResult; import com.zyun.model.auth.response.LoginResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import javax.servlet.http.HttpServletRequest; /** * @ClassName Au...
TypeScript
UTF-8
828
2.53125
3
[]
no_license
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable({ providedIn: 'root' }) export class NewsApiService { api_key = 'fc8e98b1afcf4a65a0f684da2acd9585'; constructor(private http:HttpClient) { } // Prepare our left-side menu with some news resources. in...
JavaScript
UTF-8
1,294
2.75
3
[]
no_license
'use strict'; function getNextPlayerId(players, currentId) { var ind = players.indexOf(_.findWhere(players, { id: currentId })); return (ind + 1) % players.length; } angular.module('tonk') .controller('GameCtrl', ['$scope', 'deck', 'HAND_SIZE', function($scope, Deck, HAND_SIZE) { $scope.deck = new Deck(); $scop...
Java
UTF-8
825
2.25
2
[]
no_license
package com.xiaohu.blog.jpa.blog; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; import java.util.List; @Controller pub...
C++
UTF-8
343
2.96875
3
[]
no_license
#include<iostream> #include<fstream> using namespace std; int main(){ fstream new_file; new_file.open("random_file_write.txt", ios::out); if(!new_file) { cout<<"File creation failed"; } else{ cout<<"New file created "; new_file<<"Hey I am learning c++ file handling"; new_file.close();...
Python
UTF-8
425
3.015625
3
[]
no_license
#coding:utf-8 """ 2019.03.14.Thur <쿼드 트리> 분할정복 문제. """ a=[] def dnq(n, i, j): if n==1: return a[i][j] def main(): n=int(input()) for i in range(n): a.append(input()) print(a[1]) for i in range(n): temp=a[i] a[i]=[] for j in range(n): ...
Java
UTF-8
352
3.875
4
[]
no_license
public class MyExp { int base; int exp; public MyExp(int a, int b) { this.base = a; this.exp = b; } int getValue() { int res = 1; for(int i = 0; i < exp; i++) res = res * base; return res; } public static void main(String[] args) { MyExp number1 = new MyExp(2, 3); System.out.println("2의 3승 = ...
C++
UTF-8
948
3.875
4
[]
no_license
/* Binary Tree Preorder Traversal Given a binary tree, return the preorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,2,3]. Note: Recursive solution is trivial, could you do it iteratively? */ /** * Definition for binary tree * struct TreeNod...
C++
UHC
676
3.015625
3
[]
no_license
#include "stdafx.h" #pragma warning(disable:4996) #define _CRT_SECURE_NO_WARNINGS void main() { char a = 65; // ƽŰڵ 'A' char b = 'A'; // Ǹ鼭 char b 65; ڵ ˴ϴ. printf("%d\n%d\n", a, b); printf("%c\n%c\n", a, b); // %c ƽŰڵ忡 õǴ ڸ ش char c = '8'; printf("%c\n%d\n", c, c); for (int a = 0; a < 26; a++)...
C++
UTF-8
732
2.5625
3
[]
no_license
// 执行用时 : // 0 ms // , 在所有 C++ 提交中击败了 // 100.00% // 的用户 // 内存消耗 : // 6.5 MB // , 在所有 C++ 提交中击败了 // 100.00% // 的用户 class Solution { public: int uniquePaths(int m, int n) { vector<vector<int>> dp(m,vector<int> (n,1)); for(int i = 0;i < m;i++){ for(int j = 0;j < n;j++){ if(i >=...
C++
UTF-8
807
2.671875
3
[]
no_license
//By lxfly2000 #ifndef __SDL_PxString_H__ #define __SDL_PxString_H__ namespace ASCII_px_6x8 { extern const unsigned ch_count; extern const int px_count_horizonal, px_count_vertical; //绘制单个字符的点阵 //字符不存在返回 -1, 否则为 0 extern int DrawPxChar(SDL_Renderer *renderer, unsigned ch, int x, int y, int pxsize); //绘制点阵字符串 ...
Python
UTF-8
7,969
3.03125
3
[ "MIT" ]
permissive
import numpy as np from .abstract import Array _FULLARRAY_HANDLED_FUNCTIONS = {} class FullArray(Array): """A array filled with a given value. The array may be empty or all missing values. .. versionadded:: 3.14.0 """ def __init__( self, fill_value=None, dtype=None, ...
Java
UTF-8
1,354
3.359375
3
[]
no_license
public class LC11ContainerWater { public int maxArea(int[] height) { int[][] heights_s = new int[height.length][2]; for (int i = 0; i < height.length; i++) { System.out.println(height[i]); heights_s[i][0]=i; heights_s[i][1]=height[i]; } for (int i = 0; i < height.length - 1; i++) { ...
Java
UTF-8
1,782
2.234375
2
[]
no_license
package org.vtb.edu.controllers; import lombok.AllArgsConstructor; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.vtb.edu.database.dto.Product; import org.vtb.edu.database.dto.User; import org.vtb.edu.service.ProductSe...
Python
UTF-8
13,197
2.828125
3
[]
no_license
import os import sys import csv import datetime import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as dates from tkinter import * from pathlib import Path from stonks_sorter import stonks_sorter class stonks_visualizer(): def __init__(self): #Initialize vars self.rootDir = P...
Swift
UTF-8
1,782
2.796875
3
[]
no_license
// // LoadingView.swift // Loodos // // Created by Doğan akdeniz on 1.05.2021. // import UIKit final class LoadingView: UIView { // MARK: - Private Variables private var parentView: UIView! private var activityIndicator: UIActivityIndicatorView! // MARK: - Initialization Methods init(parentView: UIVie...
C
UTF-8
1,730
2.515625
3
[ "Apache-2.0" ]
permissive
#ifndef __CLI_USAGE__ #define __CLI_USAGE__ static const char USAGE[] = R"( Usage: skafos (setup|init|auth)... skafos init [<name>] [--org <org_name>] [--template <template_name>] [--master] skafos templates [--update] [--search <search_term>] skafos env [<key>] [--set <value>] [--delete] skafos cr...
PHP
UTF-8
2,021
2.59375
3
[ "MIT" ]
permissive
<?php namespace bestelServer\Http\Controllers; use bestelServer\winkel; use bestelServer\winkelItem; use bestelServer\bestellingen; use bestelServer\bestelItems; use Illuminate\Http\Request; class klantenController extends Controller { public function index() { $winkels = Winkel::all(); return ...
Python
UTF-8
3,316
3.265625
3
[]
no_license
# Spyder (Python) - Code C073 import matplotlib.pyplot as plt import numpy as np from numpy import arange,vstack,argmin,asarray from numpy.random import normal,random from warnings import catch_warnings, simplefilter from scipy.stats import norm from sklearn.gaussian_process import GaussianProcessRegressor ...
C++
UTF-8
319
3.203125
3
[]
no_license
#include<iostream> #include<conio.h> using namespace std; int fact (int n) { if (n ==1) { return 1; } else { return n* fact(n-1); } } int main() { int factorial = fact(6); cout << "Factorial is = " << factorial << endl; getch(); }
Shell
UTF-8
1,954
3.515625
4
[]
no_license
#!/bin/bash set -e # Params # - Config file # - Map file version="1.2" unique=e09f3rp9ac09ajjrw3r09aemriwelkm if [ $# -le 1 ]; then echo "Usage: parse.sh <config.json> <action-map-file>" exit 1 fi kv_map=$(cat $2 | jq -c '.key_value' | sed "s/\"\././g; s/\"\,/,/g; s/\"\}/}/g") kv_query="$kv_map | to_entr...
Python
UTF-8
218
3
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri Sep 4 22:38:40 2020 @author: 16509 """ def times3(var1): return var1*3 seq1to10=[1,2,3,4,5,6,7,8,9,10] newseq=[item*3 for item in seq1to10] print(newseq)
JavaScript
UTF-8
6,868
2.8125
3
[ "MIT" ]
permissive
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.jsonp = factory()); }(this, function () { 'use strict'; /** * object check method * ...
Python
UTF-8
4,604
2.75
3
[]
no_license
#!/usr/bin/env python from __future__ import division from math import sqrt import pickle, os from uncertainties import ufloat try: from pyutils.nums import roundPair except ImportError: import sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)),'../..')) from pyutils.nums impor...
Markdown
UTF-8
1,710
2.65625
3
[]
no_license
--- layout: post title: "Introspection" date: 2015-04-12 08:56:20 +0000 comments: true categories: Ruby --- ### http://www.leighhalliday.com/ruby-introspection-metaprogramming #### What data am I working on? ```ruby puts spitty.inspect #<Alpaca:0x007fd849166808 @name="Spitty", @birthdate=#<Date: 1984-11-11 ((2446016j...
Ruby
UTF-8
7,909
3.15625
3
[ "MIT" ]
permissive
module Ramaze module Logger ## # A logger that rotates log files based on the current date. Log files are # named after the date on which they were created. If the date changes a new # log file is used. # # In order to use this logger you'll have to specify a base directory for # all log f...
C++
UTF-8
1,279
3.8125
4
[]
no_license
/* Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ? k ? BST's total elements. Follow up: What if the BST is modified (insert/delete operations) often and you need to find the kth smallest frequently? How would you optimize ...
Python
UTF-8
2,073
2.859375
3
[ "MIT" ]
permissive
import validators class RequestError(Exception): pass class Request(object): def __init__(self, parameters=None): if parameters is None: self.parameters = [] else: self.parameters = parameters self.errors = [] self.global_errors = [] self.is_b...
Python
UTF-8
729
3.703125
4
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Tue May 12 18:48:10 2020 @author: Christopher Cheng """ # By setting a new variable and casting the dictionary into a list form, # Can make a new copy of it artists = ["monet", "picasso"] painters = list(artists) painters.append("van gogh") # If list, can also use .copy() fun...
Java
UTF-8
16,419
2.375
2
[]
no_license
package Dc.app.Sampleboot; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.io.File; import java.io.Fi...
Markdown
UTF-8
809
3.390625
3
[]
no_license
最长连续队列 问题分类:动态规划 难度:困难 使用数据结构:unordered_map 时间复杂度: O(n) 解析:本题使用了散列的思想 ``` class Solution { public: int longestConsecutive(vector<int>& nums) { int ans=0; unordered_map<int,int> m; for(int i=0;i<nums.size();i++){ if(m.count(nums[i])) continue; int left...
Java
UTF-8
13,663
1.640625
2
[]
no_license
package technician.ifb.com.ifptecnician; import android.annotation.SuppressLint; import android.app.Activity; import android.app.PendingIntent; import android.app.ProgressDialog; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter...
Java
UTF-8
4,383
3.703125
4
[]
no_license
package com.dsa.linkedlists; import java.util.NoSuchElementException; public class LinkedList { private class Node { private int value; private Node next; private Node(int value){ this.value = value; } } private Node first; private Node la...
Markdown
UTF-8
1,638
3.90625
4
[ "MIT" ]
permissive
--- layout: article title: "[Python][學習]function? method?" key: 20180927 tags: python --- 學東西就是要越學越深入,才會知道自己以前理解的觀點是對是錯,也可以慢慢了解設計者的想法以及定義。 先看看這兩個東西的定義 ` function —— A series of statements which returns some value to a caller. It can also be passed zero or more arguments which may be used in the execution of the b...
C
UTF-8
1,887
3.203125
3
[]
no_license
#include "unp.h" //include appropriate header file(s) for in-built socket functions #include <time.h> //required to calculate date and time int main(int argc, char **argv) { int listenfd, connfd; //socket IDs; one for the listening socket and one for the connected socket struct sockaddr_in servaddr; //address st...
Markdown
UTF-8
2,352
3.546875
4
[ "MIT" ]
permissive
StreamReaderSeeker ================== [![Build Status](https://travis-ci.org/PawelStroinski/StreamReaderSeeker.svg?branch=master)](https://travis-ci.org/PawelStroinski/StreamReaderSeeker) Two extension methods of `StreamReader` allowing to `GetPosition` and then to `Seek` back to that position. Furthermore, position c...
Python
UTF-8
3,115
2.515625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import os import sys import argparse import shutil import enum import cv2 from common import get_filenames, read_json, write_json class KeyStatus(enum.IntEnum): QUIT = 113 UNDO = 117 OK = 106 FAIL = 102 REMOVE = 100 def parse_arguments(argv): parser = argparse.Argum...
Java
ISO-8859-13
2,240
2.8125
3
[]
no_license
package ProfesorOAK; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class Conexion { private static String url= "jdbc:mysql://localhost:3306...
Java
UTF-8
623
2.953125
3
[]
no_license
package com.example.stacktest; /** * 测试 */ public class Test { public static void main(String[] arg){ SequenceStack<Integer> stack1 = new SequenceStack<Integer>(3); SequenceStack<Integer> stack2 = new SequenceStack<Integer>(); System.out.println(stack2.length()); stack2.push(10);...
C++
UTF-8
611
3.171875
3
[ "Apache-2.0" ]
permissive
#include "stl.h" class Solution { public: int threeSumClosest(vector<int>& nums, int target) { sort(nums.begin(), nums.end()); int res = nums[0] + nums[1] + nums[2]; for (int i = 0; i < nums.size(); i++) { if (i > 0 && nums[i] == nums[i - 1]) continue; int left = i + 1; int right = nums.size() - 1; w...
Java
UTF-8
841
2.046875
2
[]
no_license
package ru.alexgryaznov.flproject.web; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.repository.CrudRepository; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import ru.alexgryaznov.flproject...
Python
UTF-8
566
3.03125
3
[]
no_license
import math, copy, re, hashlib import itertools as it def part_1(data): res = 0 for i in data: res += i print(res) print('END OF PART1') return def part_2(data): res = 0 d = {0:1} maxi = len(data) i = 0 while True: res += data[i] try: d[res] break except: d[res] = 1 i = (i + 1) % maxi ...
Shell
UTF-8
2,477
3.265625
3
[]
no_license
#!/bin/sh m_files=( $(find ./${PRODUCT_NAME} -name '*.m') ) lines=0 ifs=0 unsign=0 for i in ${m_files[@]}; do lines=$(( $lines + $(wc -l < $i) )) ifs=$(( $ifs + $(sed -n -e '/^[ \t]*if[ \t]*(/p' $i | wc -l) )) unsign=$(( $unsign + $(sed -n -e '/^[ \t]*\/\//p' $i | wc -l) )) unsign=$(( $unsign + $(grep -c ^$ $i) )) do...
JavaScript
UTF-8
362
2.515625
3
[ "MIT" ]
permissive
import {exec} from "child_process"; /** * @param {string} command * @returns {Promise<void>} */ export default (command) => new Promise((resolve) => { console.log(`\u001b[34m${command}\u001b[0m`) const child = exec(command, {env: process.env}); child.stderr.on("data", data => console.error(data.toString...
Java
UTF-8
1,808
2.921875
3
[]
no_license
package cn.edu.gduf.netserver.util; /** * 分页工具类 * @author hsg * 2015/01/22 */ public class PageUtil { /** * 上一页下一页 * @param totalNum * @param currentPage * @param pageSize * @param type * @return */ public static String getUpAndDownPage(int totalNum, int currentPage, int pageSize, int type){ int...
Ruby
UTF-8
5,643
2.75
3
[]
no_license
require 'active_model' class ChildBenefitTaxCalculator include ActiveModel::Validations attr_reader :adjusted_net_income_calculator, :adjusted_net_income, :children_count, :starting_children, :tax_year NET_INCOME_THRESHOLD = 50000 TAX_COMMENCEMENT_DATE = Date.parse('7 Jan 2013') TAX_YEARS = { "201...
Java
UTF-8
2,734
1.9375
2
[]
no_license
package com.yc.bean; import java.io.Serializable; public class Message extends CommonBean implements Serializable { private static final long serialVersionUID = -3042360926416388190L; private Integer mid; private String content; private Integer mweight; private String createtime; private Integer f...
C++
UTF-8
2,155
2.578125
3
[ "MIT" ]
permissive
// Simple example for EffectMixer. Mixers let you run multiple effects, and they // handle concurrent rendering on multiple CPU cores. #include "lib/effect_runner.h" #include "lib/effect_mixer.h" #include "lib/tinydir.h" #include "video.h" #include "particle_trail.h" #include "rings.h" int main(int argc, char **argv...
TypeScript
UTF-8
4,019
2.78125
3
[]
no_license
import { CurrentSchedule, Variable } from '../models'; import {SoftConstraint} from '../types'; import { SchedulerContextData } from '.'; export const getVariablePicker = (pickingMethod: string, data: { schedulerContextData: SchedulerContextData }): VariablePicker => { switch(pickingMethod) { case 'first-unAssig...
Python
UTF-8
305
2.859375
3
[]
no_license
while True : fr = open("pid_K.txt", "r") lines = fr.readlines() Theta = int(lines[0]) KP = int(lines[1]) KI = int(lines[2]) KD = int(lines[3]) print("Theta : %d" %Theta) print("KP : %d" %KP) print("KI : %d" %KI) print("KD : %d" %KD) print("-------------")
JavaScript
UTF-8
7,188
2.953125
3
[]
no_license
// ------ updates progress bar and filter buttons $(document).on('updateProgress', function(){ //count missions var number_undone = $('.mission-undone .circle-mid').length var number_wait = $('.mission-wait .circle-mid').length var number_done = $('.mission-done .circle-mid').length var number_...
C++
UTF-8
1,010
3.65625
4
[]
no_license
#include"stack.h" void stackInit(stackI *stackP, int maxSize) { stackElementsI *newContents; /*Allocate memory in heap to hold the contents*/ newContents = (stackElementsI*) malloc(sizeof(stackElementsI)*maxSize); if(newContents == NULL) { fprintf(stderr,"Insufficiant memory to allocate stack"); exit(1); ...
Python
UTF-8
170
3.828125
4
[]
no_license
# The while loop runs as long as or while, a certain conditional is true. current_number = 1 while current_number <= 5: print(current_number) current_number += 1
Java
UTF-8
3,080
2.65625
3
[]
no_license
package animal.editor.graphics; import java.awt.Point; import java.awt.Polygon; import java.awt.event.ActionListener; import java.awt.event.ItemListener; import java.beans.PropertyChangeListener; import animal.editor.Editor; import animal.editor.graphics.meta.FillablePrimitiveEditor; import animal.graphics.PTGraphicO...
Ruby
UTF-8
3,662
2.53125
3
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CC0-1.0", "LicenseRef-scancode-free-unknown" ]
permissive
# Copyright 2016 Matt Wrock <matt@mattwrock.com> # # 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 la...
Java
UTF-8
513
2.09375
2
[]
no_license
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package cz.fi.muni.pa165.serviceImpl; import cz.fi.muni.pa165.api.dto.MissionDTO; import cz.fi.muni.pa165.api.dto.RoleDTO; /** * * @author Filip */ public class NewMain { /** * @param args the command line...
Python
UTF-8
107
3.28125
3
[]
no_license
num = float(raw_input()) chocolates = 1 while num >= 2.0: num /= 2 chocolates *= 4 print chocolates
SQL
UTF-8
3,270
3.015625
3
[ "Apache-2.0", "BSD-3-Clause", "ISC", "MIT", "LicenseRef-scancode-unicode", "LGPL-2.0-or-later", "EPL-1.0", "Classpath-exception-2.0", "GPL-1.0-or-later", "CC-BY-SA-3.0", "CPL-1.0", "LicenseRef-scancode-generic-cla", "SAX-PD", "EPL-2.0", "LicenseRef-scancode-free-unknown", "CC-PDDC", ...
permissive
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
Java
UTF-8
1,347
3.984375
4
[]
no_license
package IO常用类库.File类的使用; import java.io.File; import java.util.Scanner; /** * @author : S K Y * @version :0.0.1 */ public class ListAllFileDemo { public static void main(String[] args) { //设置任意一个目录的路径,而后将这个目录中所有文件的信息都进行打印输出处理 //可以采用递归的方法来实现 Scanner scanner = new Scanner(System.in); ...
C++
UTF-8
618
3.046875
3
[]
no_license
#ifndef EASYFIND_HPP #define EASYFIND_HPP #include <iostream> #include <algorithm> #include <vector> #include <list> class NotFoundException : public std::exception { virtual const char* what() const throw() { return "Not found"; } }; template <template <class, class> class Container> typename Container<int, std:...