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 | 1,451 | 2.734375 | 3 | [] | no_license | #include <iostream>
using namespace std;
unsigned int tree[40000000];
unsigned int lazy[40000000];
struct segment
{
unsigned int l,r;
};
long update(int node, segment nint, segment range, int val)
{
//cout << node << endl;
if(range.l<=nint.l && nint.r<=range.r)
{
lazy[node] += val;
return tree[node] + lazy[n... |
C# | UTF-8 | 1,899 | 2.625 | 3 | [] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using HerosDB;
using HerosWeb.Models;
namespace HerosWeb.Controllers
{
public class SuperHeroController : Controller
{
private readonly ISuperHeroRepo _repo;
//the argument for thi... |
TypeScript | UTF-8 | 7,187 | 2.71875 | 3 | [] | no_license | class JunkGenerator {
private assets : AssetsManager = new AssetsManager();
private minNumber = 1;
private maxNumber = 9;
private counter = 0;
private updateTimout = 60;
private minPositionY = 185;
private maxPositionY = 215;
private minPositionX ... |
C++ | UTF-8 | 319 | 3.25 | 3 | [] | no_license | #include<iostream>
#include<string>
#include<algorithm>
#include<list>
using namespace::std;
int main()
{
list<string> lis{ "Pratice ", "makes ", "perfect." };
auto co1 = count(lis.cbegin(), lis.cend(), "make");
auto co2 = count(lis.cbegin(), lis.cend(), "makes ");
cout << co1 << " " << co2 << endl;
return 0;
} |
Markdown | UTF-8 | 679 | 2.53125 | 3 | [] | no_license | # Crypto Communism
`crypto-communism` is a service to seize your bourgeois bitcoins in exchange of presenting you and the all the proletarian ears around, the glorious anthem of the Motherland! Can I hear a _Ура_?
## How to install
First clone the repository and go to its folder with:
```sh
git clone https://github.... |
Java | UTF-8 | 4,437 | 2.890625 | 3 | [] | no_license | package Actors;
import java.io.Serializable;
import java.util.Calendar;
import Media.PhysicalMedia;
import Utilities.*;
/**
* This class deals with the librarian and stores all the information about them.
*
*/
public class Librarian implements Serializable{
private String ID;
private String FirstName;
private... |
Java | UTF-8 | 424 | 3.3125 | 3 | [] | no_license | import java.util.*;
import java.math.*;
public class No373 {
public static void main(String[] args) {
// 標準入力から読み込む際に、Scannerオブジェクトを使う。
Scanner s = new Scanner(System.in);
long a = s.nextLong();
long b = s.nextLong();
long c = s.nextLong();
long d = s.nextLong();
... |
Markdown | UTF-8 | 2,216 | 2.828125 | 3 | [
"MIT"
] | permissive | # chetcd
Config-helpers for etcd. The aim is to have some common etcd-client use cases wrapper in an elegant API.
## Dir watcher
A dir watcher will simply watch a (directory) key recursively. We can attach key observers to receive these changes via native golang channels.
A typical usage would be if we have a direc... |
Java | UTF-8 | 725 | 2.28125 | 2 | [] | no_license | package br.com.michelmilezzi.DemoApp.domain;
import java.math.BigDecimal;
import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.cla... |
Markdown | UTF-8 | 9,113 | 2.59375 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Password strength with NLP
date: 2016-11-13 14:27:25
categories: Metis
---
**Latent Semantic Analysis re-imagined**
[Account takeover](http://www.darkreading.com/endpoint/anatomy-of-an-account-takeover-attack/a/d-id/1324409) attacks are [incredibly lucrative](http://www.trendmicro.com/clou... |
Java | UTF-8 | 1,545 | 3.515625 | 4 | [] | no_license | package Pieces;
import Chess.Move;
import Chess.Player;
/***********************************************************************
* This Class handles all operations for the queen chess piece
* @author Troy Madsen and Grant Postma
* @version 1.0
************************************************************... |
C++ | UTF-8 | 299 | 2.609375 | 3 | [] | no_license | #include <math.h>
double sum()
{
float e=1e-4;
float rez = 0;
float si = 0;
int k = 0;
int sign = 1;
do
{
k++;
si = 1./(k * k * k);
rez += sign*si;
sign *= -1;
} while (si >= e);
double a = round(rez*10000)/10000;
return a;
}
|
C | GB18030 | 1,522 | 3.5 | 4 | [] | no_license | /*
룺10
1 7 5 10 13 15 10 5 16 8
7
迪ʼҡ start=begin x=1Ȼ
17 start=up x=2 75½ start=down x=3 510 start=up x=4
1013ޱ仯 1315ޱ仯 510½ start=down x=5
105½ޱ仯 516 start=up x=6 168½ start=down x=7
*/
#include<stdio.h>
int main(... |
C++ | GB18030 | 938 | 3.515625 | 4 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
//һһʱ临ӶΪO(n), ռ临ӶΪO(1)㷨жǷΪĽṹ
//һͷָA뷵һboolֵǷΪĽṹ֤Сڵ900
struct ListNode {
int val;
struct ListNode *next;
};
bool chkPalindrome(ListNode* A) {
ListNode* fast, *slow;
if (A == NULL || A->next == NULL)
{
return true;
}
fast = slow = A;
while (fast->next && fa... |
C# | UTF-8 | 725 | 3.4375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace fizzBuzz {
class Program {
static void Main(string[] args) {
//challenge input
FizzBuzz(20);
FizzBuzz(100);
}
/// <summary>
... |
Java | UTF-8 | 238 | 2.390625 | 2 | [] | no_license | package izgledaplikacije;
public class Global{
private static int index = 0;
public static int getVar(){
return Global.index;
}
public static void setVar(int var){
Global.index = var;
}
} |
C# | IBM852 | 2,955 | 2.65625 | 3 | [] | no_license | using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using System.Threading;
using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;
namespace ChickenCoopAutomation
{
/// <summary>
/// Allows to receive infrared data using a receiver like TSOP312
/// </summary>
public class ... |
C | UTF-8 | 1,019 | 2.53125 | 3 | [] | no_license | /*
This example project demonstrates the usage of the AVR ADC noise reduction.
The project is based on the ATMega324PB Xplained Pro.
*/
#include <asf.h>
#include <avr/sleep.h>
#define NOISE_REDUCTION 1
volatile uint8_t adc_buffer_count;
volatile uint16_t adc_buffer[100];
ISR(ADC_vect) {
adc_buffer[adc_buffer_count... |
C | UTF-8 | 347 | 3.703125 | 4 | [] | no_license | #include <stdio.h>
int main(int argc, char *argv[])
{
int n, i, resto;
do
{
printf("Inserisci un numero > 1 : ");
scanf("%d", &n);
} while (n < 2);
i = n - 1;
do
{
resto = n % i;
if (resto == 0)
{
printf("Il numero non è primo\n");
return 0;
}
i = i - 1;
} while (i > 1);
printf("Numero... |
C# | UTF-8 | 1,556 | 2.6875 | 3 | [] | no_license | using System;
using System.ComponentModel.DataAnnotations;
namespace DigitalCoolBook.App.Models.TeacherViewModels
{
public class TeacherRegisterModel
{
[Required]
[EmailAddress]
public string Email { get; set; }
[Required]
[DataType(DataType.Password)]
public s... |
Ruby | UTF-8 | 1,785 | 3.765625 | 4 | [] | no_license | require_relative './ai_player'
class Game
# ::deal_in_players is a factory method that:
# 1) Takes in an array of cards
# 2) deals cards in an alternating pattern & creates 2 AIPlayers
# 3) return instance of Game
def self.deal_in_players(deck)
deck = []
deck2 =[]
deck1 = true
Card.all_cards.... |
Java | UTF-8 | 4,057 | 2.046875 | 2 | [] | no_license | package com.android.audiorecorder.ui.activity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import com.android.audiorecorder.R;
import com.android.audiorecorder.dao.PersonalNewsDao;
im... |
C++ | UTF-8 | 333 | 3 | 3 | [] | no_license | /* isalpha example */
#include <stdio.h>
#include <ctype.h>
#include<conio.h>
int main ()
{
int i=0;
char str[]="C++";
while (str[i])
{
if (isalpha(str[i])) printf ("character %c is alphabetic\n",str[i]);
else printf ("character %c is not alphabetic\n",str[i]);
i++;
}
getch();
r... |
Python | UTF-8 | 6,555 | 2.515625 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, session
from flask_mysqldb import MySQL
import MySQLdb.cursors
import pymysql.cursors
import os
import re
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.fr... |
Shell | UTF-8 | 186 | 3.40625 | 3 | [] | no_license | #!/bin/bash
user_exist()
{
for i in `more -1 /etc/passwd`
do
var1=$i
var2=${var1%%\:*}
if [ $var2==$1 ]
then
echo "The User Exists..!"
exit
fi
done
echo "No User Found..!!"
}
user_exist
|
Java | UTF-8 | 1,152 | 2.234375 | 2 | [] | no_license | package com.backend.cash.controller;
import com.backend.cash.model.User;
import com.backend.cash.modelDTO.UserDTO;
import com.backend.cash.service.interfaces.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.Response... |
Java | UTF-8 | 53,740 | 1.929688 | 2 | [] | no_license | package org.javenstudio.cocoka.graphics;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
import android.annotation.TargetApi;
import android.graphics.Bitma... |
PHP | UTF-8 | 243 | 3.015625 | 3 | [] | no_license |
<?php
class Person{
public static $question=array();
public static think(){
sleep(5);
return true;
}
public static answer(){
echo "success";
}
}
$ret=Person::think();
if($ret){
Person::answer();
}else{
echo "answer error";
}
?> |
Java | UTF-8 | 6,641 | 1.75 | 2 | [] | no_license | package com.aohuan.detail.mine;
import java.util.ArrayList;
import java.util.List;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickList... |
Java | UTF-8 | 1,587 | 2.546875 | 3 | [] | no_license | package com.example.routemap.domain;
import java.util.Date;
public class InfoMarker {
private String type;
private String description;
private String level;
private Date date;
private String author;
private double latitude;
private double longitude;
public InfoMarker() { }
publ... |
Java | UTF-8 | 2,392 | 2.125 | 2 | [] | no_license | package com.costar.model;
import com.alibaba.fastjson.annotation.JSONField;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "sys_notice")
@GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
public class SysNot... |
SQL | UTF-8 | 2,421 | 3.078125 | 3 | [] | no_license | -- --------------------------------------------------------
-- Host: 127.0.0.1
-- Server version: 10.5.5-MariaDB - mariadb.org binary distribution
-- Server OS: Win32
-- HeidiSQL Version: 11.0.0.5919
-- ------------------------------------------------... |
C# | UTF-8 | 4,322 | 2.625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text.Json;
using Terminal.Gui;
using StackExchange.Redis;
namespace Redis_TUI
{
class Program
{
static List<string> listOfNames = new List<string>();
static List<string> secondList = new List<string>();
static ListView lis... |
Python | UTF-8 | 136 | 3.21875 | 3 | [] | no_license | number_of_boyfriend = 5
if number_of_boyfriend:
print("Idihh.. dia playboy")
print("Jumlah pacarnya ada", number_of_boyfriend)
|
JavaScript | UTF-8 | 384 | 2.546875 | 3 | [] | no_license | import * as actionTypes from '../actionTypes';
const initialState = {};
const kudosReducer = (state=initialState, action) => {
switch (action.type) {
case actionTypes.FETCH_USER_SUCCESS:
return {
...state,
...action.payload.kudos
};
default:... |
Java | UTF-8 | 3,255 | 2.703125 | 3 | [] | no_license | package Controller;
import View.Apresentacao;
import static java.lang.Thread.sleep;
public class SimulacaoJogo {
private String casa;
private int ratingCasa;
private int golosCasa;
private String fora;
private int ratingFora;
private int golosFora;
Apresentacao apresentacao;
public S... |
Java | UTF-8 | 338 | 1.546875 | 2 | [] | no_license | package backend.domain;
import lombok.*;
import java.io.Serializable;
@NoArgsConstructor
@AllArgsConstructor
@Data
@ToString
@Builder
public class AccuracyHelper implements Serializable {
private String username;
private Long method;
private Long songId;
private double[] e;
privat... |
C# | UTF-8 | 2,816 | 3.078125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets;
using CommunicationLibrary;
namespace BullChatPrototype
{
public enum Status
{
Offline = 0,
Connecting = 1,
Failed = 2,
Connected = 3
... |
Python | UTF-8 | 584 | 3.65625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
import math
Cv=int(input('digite o numero de pontos do C:'))
Ce=int(input('digite o numero de empates do C:'))
Cs=int(input('digite o saldo de gols de C:'))
Fv=int(input('digite o numero de pontos do F:'))
Fe=int(input('digite o numero de empates do F:'))
Fs=int(input('digite o saldo de gols de ... |
Markdown | UTF-8 | 761 | 2.65625 | 3 | [
"MIT"
] | permissive | ---
layout: default
title: Error - 00000
description: A description of the error with code 00000, and some trouble shooting steps.
section: errors
---
# {{ page.title }}
{{ page.description }}
## What is the cause of this issue?
This issue usually occurs when MDOQ is unable to connect to the MDOQ Connector on the ins... |
Python | UTF-8 | 83 | 3.28125 | 3 | [] | no_license | a=input("enter the number")
mul=1
for i in range(1,a+1):
mul=mul*i
print mul
|
Markdown | UTF-8 | 1,114 | 3.0625 | 3 | [] | no_license | # 传参
- 序
> 我们在开发脚本过程中,少不了会给执行的脚步传递参数 ,就好比我写一个文件复制的脚步,我需要动态传递我需要复制的文件路径和复制后存放的路径,要不然没用一次就改一次代码就太不人性化了。
- 实例
- 比我写了个脚本名为:006_shell_params.sh
```code shell
#获取参数
echo "获取执行脚本名称:$0"
echo "获取第一个参数:$1"
echo "获取第二个参数:$2"
echo "参数个数:$#"
echo "全部参数:$*"
```
- 执行结果
;
void *threadFuc(voi... |
Markdown | UTF-8 | 2,889 | 3 | 3 | [] | no_license | ## Goal
A common 3D game uses to have models (3D also) created by designers/modellers on software like [3DS Max](http://www.autodesk.es/products/3ds-max/overview) or [Blender](https://www.blender.org/). Models are exported in known formats so can be read from game engines. One of those formats is [FBX](https://en.wiki... |
Java | UTF-8 | 582 | 1.976563 | 2 | [] | no_license | package com.scuse.mapper;
import com.scuse.entity.Candidate;
import java.util.List;
import org.springframework.stereotype.Repository;
@Repository
public interface CandidateMapper {
int insert(Candidate record);
int insertSelective(Candidate record);
Candidate selectByToken(String token);
Candidate ... |
PHP | UTF-8 | 795 | 2.609375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models\Scrum;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Sprint_Model_Team_Model extends Model
{
protected $table = 'sprint_team';
protected $fillable = ['sprint_id', 'team_id','state', 'sprint_... |
PHP | UTF-8 | 610 | 2.796875 | 3 | [] | no_license |
<!DOCTYPE html>
<html>
<body>
<?php
$server = "localhost";
$user = "kguo";
$pwd = "17417174";
$db = "kguo_1";
$conn = new mysqli($server, $user, $pwd, $db);
if($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql_select = "SELECT * FROM Video";
if($res = $conn->query($sql_selec... |
Java | UTF-8 | 683 | 3.421875 | 3 | [] | no_license | package JavaCore4.File;
import java.io.File;
public class FileDemo2 {
public static void main(String[] args) {
File dir = new File("G:\\Person");
dir.mkdir(); //directory will be created
String dirlocation = dir.getAbsolutePath(); //get the directory p... |
Python | UTF-8 | 1,228 | 3.09375 | 3 | [] | no_license | import numpy as np
class Q_Learner:
def __init__(self, world, epsilon=0.4, alpha=0.1, gamma=1):
self.world = world
self.epsilon = epsilon
self.alpha = alpha
self.gamma = gamma
self.q_matrix = dict()
for x in range(world.height):
for y in range(world.wid... |
C++ | UTF-8 | 1,123 | 2.546875 | 3 | [] | no_license | #include"ANN.h"
using namespace ml;
ANN::ANN()
{
ann = ANN_MLP::create();
}
ANN::~ANN()
{
;
}
void ANN::setLayerSize(Mat layerSize)
{
if(ann != NULL)
{
ann->setLayerSizes(layerSize);
}
return;
}
void ANN::setTrainMethod(ml::ANN_MLP::TrainingMethods trainMethod)
{
if(ann != NULL)
{
ann->setTrainMethod(t... |
JavaScript | UTF-8 | 453 | 2.875 | 3 | [] | no_license | // Mapbox API Key
MAPBOX_API_KEY = "pk.eyJ1IjoibWVsbHVzYnJhbmRvbiIsImEiOiJja3FzcXQ0bG4ycWFrMm9tdmN3bmNxZHd3In0.zp0RMIIVSgMBMW_E-JycrQ";
// The endpoint used for fetching data from geocoding
MAPBOX_ENPOINT = "https://api.mapbox.com/geocoding/v5/mapbox.places";
// Sets the API call to use postcodes for retrieving data fr... |
C++ | UTF-8 | 2,786 | 3.578125 | 4 | [] | no_license | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
class Vehicle
{
public:
virtual double getCapacity()const
{
return capacity;
}
virtual double getExpense()const
{
return expense;
}
virtual double getNumPassengers()const
{
return numPassengers;
}
virtual double getMaxSpeed()const
... |
Python | UTF-8 | 1,283 | 3.28125 | 3 | [
"MIT"
] | permissive | import sys
from copy import deepcopy
from itertools import chain, product
def parse_seats(instream):
return [list(iter(l.strip())) for l in instream if l.strip()]
def find_adjacent(r, c, seats):
candidates = [(r + rd, c + cd) for (rd, cd) in product([-1, 0, 1], [-1, 0, 1]) if (rd, cd) != (0, 0)]
return... |
Markdown | UTF-8 | 166,985 | 3.125 | 3 | [] | no_license | [toc]
# 5 SWIG 基础知识
This chapter describes the basic operation of SWIG, the structure of its input files, and how it handles standard ANSI C declarations. C++ support is described in the next chapter. However, C++ programmers should still read this chapter to understand the basics. Specific details about each tar... |
Java | UTF-8 | 7,779 | 2.09375 | 2 | [] | no_license | package com.myproject.controller;
import com.myproject.exception.UserException;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.sp... |
Java | UTF-8 | 621 | 2.0625 | 2 | [] | no_license | package com.kingdee.constants;
/**
* Response code for Json result
*
* @author code
*/
public abstract class AbstractRespCode {
public static final String OK = "0";
public static final String FAILED = "-1";
/**
* 图形验证码不匹配
*/
public static final String CAPTCHA_MISMATCH = "-2";
/**
... |
Java | UTF-8 | 1,728 | 3.65625 | 4 | [] | no_license | package src;
/**
* La classe CelluleEtatMort représente l'état d'une cellule morte.
* Implémente l'interface CelluleEtat
* @see CelluleEtat
*
* @author Mathilde MOTTAY
*/
public class CelluleEtatMort implements CelluleEtat {
// Instance unique de l'état mort d'une cellule
private sta... |
Java | UTF-8 | 2,057 | 2.375 | 2 | [] | no_license | package asadyian.zahra.digitallibrary.service;
import asadyian.zahra.digitallibrary.controller.model.ItemOption;
import asadyian.zahra.digitallibrary.controller.model.attachmenttype.AttachmentTypeRequest;
import asadyian.zahra.digitallibrary.controller.model.attachmenttype.AttachmentTypeResponse;
import asadyian.zahra... |
JavaScript | UTF-8 | 6,248 | 2.703125 | 3 | [] | no_license | const now = new Date().getMonth();
console.log(now);
let monthes = document.querySelectorAll('.monthes li'),
years = document.querySelectorAll('.years li ');
let currentMonthSpan = document.querySelector('.current-month');
let currentFilterData = {
month: now,
year: new Date().getFullYear(),
};
let aviableM... |
Java | GB18030 | 1,004 | 2.609375 | 3 | [] | no_license | package com.czd.shopping.pojo;
/**
* @author MyEclipse Persistence Tools
* pojoǺڿʹɹ
* ɹ
* bean
*/
public class Category {
private Integer cid;
private String ctype;
private Boolean chot;
private Integer aid;
public Category() {
super();
}
public Category(String ctype, Boolean chot, Integer aid) {
sup... |
C | UTF-8 | 1,506 | 2.53125 | 3 | [] | no_license | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
Python | UTF-8 | 142 | 3.890625 | 4 | [] | no_license | def factorial(x):
s = 1
if x == 0:
return s
for i in range(1, x + 1):
s = s * i
return s
print(factorial(20)) |
Java | UTF-8 | 9,191 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | /*
* Copyright (c) 2012-2020 Snowflake Computing Inc. All rights reserved.
*/
package net.snowflake.client.jdbc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import net.snowflake.client.core.SFSession;
i... |
JavaScript | UTF-8 | 11,308 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | const util = require('util');
const assert = require('assert');
const ui = require('cliui');
const cli_table = require('cli-table3');
// colors array: [dark, med, light]
const colors_red = ['\x1B[2;31m', '\x1B[1;31m', '\x1B[1;91m'];
const colors_blue = ['\x1B[2;34m', '\x1B[1;34m', '\x1B[38;5;104m'];
const colors_yello... |
Python | UTF-8 | 2,676 | 2.796875 | 3 | [] | no_license | import ast
import csv
matrix = [[0]*28 for x in range(2000,2017)]
porcentagem = [[0]*28 for x in range(2000,2017)]
for ano in range(2000,2017):
dados = open('Resultado/CerradoMT'+str(ano)+'.txt').readlines()
linha = dados[-1].replace('\n','')
linha = linha[linha.index('{'):linha.index('}')+1]
dic = ast.literal_ev... |
Python | UTF-8 | 289 | 3.6875 | 4 | [] | no_license |
def stringPermutations(s):
if len(s) == 0:
return []
if len(s) == 1:
return [s]
output = []
for i in range(len(s)):
start = s[i]
remainderStr = s[:i] + s[i + 1:]
for p in stringPermutations(remainderStr):
output.append([start] + p)
return output
|
C++ | UTF-8 | 1,512 | 3.171875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode* Merge(ListNode* pHead1, ListNode* pHead2)
{
if(pHead1 && pHead2) {
List... |
C | UTF-8 | 5,945 | 3.140625 | 3 | [
"MIT"
] | permissive | //
// Created by Shaotien Lee on 2020/9/13.
//
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "kdTree.h"
#include "pointFunctions.h"
#include "dictFunctions.h"
/* get x coordinate from input */
double getX(char* buffer) {
double x = 0;
char* xStr = NULL;
int i = 0;... |
Java | UTF-8 | 3,239 | 2.765625 | 3 | [] | no_license | package com.yuki.servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.Enumeration;
/*
* @title HttpServletRequest学习测试
*
... |
Python | UTF-8 | 2,360 | 2.703125 | 3 | [
"Apache-2.0"
] | permissive | import json
import sqlite3
import random
import string
def get(dic):
connection = sqlite3.connect('database.db')
cursor = connection.cursor()
result = cursor.execute('select * from ' + dic['table'] + ' where id == ?', [dic['id']])
items = []
for row in result:
item = dict(zip([d[0] for d in cursor.de... |
JavaScript | UTF-8 | 8,982 | 2.6875 | 3 | [
"MIT"
] | permissive | const fs = require('fs');
const schemas = require('./schemas.js')();
const sfoHeaderSchema = schemas.create('SFOHeader', [{
name: "magic",
type: "raw",
size: 4
},{
name: "version",
type: "raw",
size: 4
}, {
name: "keyTableOffset",
type: "int32"
}, {
name: "dataTableOffset",
type... |
Python | UTF-8 | 3,855 | 2.9375 | 3 | [] | no_license | """
Capstone Project. Code for testing basics.
Author: David Mutchler, based on work by Dave Fisher and others.
READ and RUN this module but ** DO NOT MODIFY IT. **
Fall term, 2018-2019.
"""
# Austin module
import rosebotics_new as rb
import time
import ev3dev.ev3 as ev3
def main():
""" Runs tests. ""... |
Markdown | UTF-8 | 5,315 | 3.265625 | 3 | [
"MIT"
] | permissive | ---
layout: page
title: Loading Fonts
parent: cpp_manual
next: input
---
TrueType and OpenType fonts can be loaded into RmlUi by the application. RmlUi has no default font, so at least one font must be loaded before text can be rendered.
To load a font, call one of the `Rml::LoadFontFace()` functions. The simplest of... |
JavaScript | UTF-8 | 802 | 3.5 | 4 | [] | no_license | const calculation = (leftSet, rightSet, acc) => {
[...leftSet].forEach(left => {
[...rightSet].forEach(right => {
acc.add(left + right);
acc.add(left - right);
acc.add(left * right);
if (right !== 0)
acc.add(Math.floor(left / right))
})
})
}
const solution = (N, number) => {... |
C++ | UTF-8 | 26,923 | 2.515625 | 3 | [] | no_license | #include "StdAfx.h"
#include "OrderBook.h"
const std::string OrderBook::logName = "OrderBook";
OrderBook::OrderBook(Stock* stock, TraderManager* traderManager, bool perfAnalytics)
{
_threshold = 0.01;
_stock = stock;
_ruleManager = new RuleManager();
_traderManager = traderManager;
_openPrice = stock->getLastPri... |
Java | UTF-8 | 2,865 | 2.3125 | 2 | [] | no_license | package org.cargo.controller;
import org.apache.log4j.Logger;
import org.cargo.bean.Page;
import org.cargo.bean.transportation.Transportation;
import org.cargo.exception.DaoException;
import org.cargo.properties.MappingProperties;
import org.cargo.service.TransportationService;
import javax.servlet.http.HttpServletRe... |
Java | UTF-8 | 2,719 | 2.484375 | 2 | [] | no_license | package com.glenwood.kernai.ui.abstraction;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import com.glenwood.customExceptions.EntityInstantiationError;
import com.glenwood.kernai.data.abstract... |
JavaScript | UTF-8 | 915 | 2.578125 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"CC0-1.0"
] | permissive | const path = require('path')
const fs = require('fs')
const electron = require('electron')
const userDataPath = (electron.app || electron.remote.app)
.getPath('userData')
function getAllTemplatesFiles() {
if (!fs.existsSync(`${userDataPath}/templates`)) createTemplateDirectory()
return fs
.readdirSync(`${... |
Swift | UTF-8 | 2,522 | 2.8125 | 3 | [] | no_license |
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var toDos: [String] = []
@IBOutlet weak var uiTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
uiTableView.delegate = self
uiT... |
JavaScript | UTF-8 | 325 | 3.59375 | 4 | [] | no_license | // 哈希函数
function hashFunc(str, max) {
let hashCode = 0
for (let i = 0; i < str.length; i++) {
hashCode = 37 * hashCode + str.charCodeAt(i)
}
return hashCode % max
}
console.log(hashFunc('abc', 7))
console.log(hashFunc('mma', 7))
console.log(hashFunc('ddd', 7))
console.log(hashFunc('eee', 7)) |
Markdown | UTF-8 | 3,617 | 2.953125 | 3 | [] | no_license | # Midterm Presentation
By Pelle Jacobs, June 26th, 2017
Promoted by prof. Jochen De Weerdt and supervised by Vytautas Karalevicius
---
# Small revision of focus point
- instead of focusing on decentralized data storage with blockchain systems
- more interesting 'how concept of replacing a previously thought indisp... |
Java | UTF-8 | 4,599 | 3.96875 | 4 | [] | no_license | package array;
/**
* @author :DengSiYuan
* @date :2019/10/15 20:53
* @desc : 8.字符串转换整数
* 【题目】
* 请你来实现一个 atoi 函数,使其能将字符串转换成整数。首先,该函数会根据需要丢弃无用的开头空格字符,直到寻找到第一个非空格的字符为止。
* 当我们寻找到的第一个非空字符为正或者负号时,则将该符号与之后面尽可能多的连续数字组合起来,作为该整数的正负号;假如第一个非空
* 字符是数字,则直接将其与之后连续的数字字符组合起来,形成整数。
* 该字符串除了有效的整数部分之后也可能会存在多余的字符,这些... |
Java | UTF-8 | 2,368 | 2.515625 | 3 | [] | no_license | package com.lvdi.ruitianxia_cus.util;
import java.io.File;
import java.io.IOException;
import com.ab.util.AbLogUtil;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.text.TextUtils;
/**
*
* 类的详细描述:
*
* @author XuBiao
* @version 1.0.1
* @time ... |
C | UTF-8 | 2,287 | 2.828125 | 3 | [] | no_license | #ifndef _MAN_COM_TRANSPORT_H_
#define _MAN_COM_TRANSPORT_H_
// START WINDOWS VERSION
#include <windows.h>
typedef UINT16 uint16_t;
// END WINDOWS VERSION
typedef enum {
MAN_COM_STREAM_TRANSPORT_TCP = 0,
MAN_COM_STREAM_TRANSPORT_MIPIO = 1,
MAN_COM_STREAM_TRANSPORT_PIPE = 2,
} ManComTransport... |
Markdown | UTF-8 | 1,502 | 2.890625 | 3 | [
"MIT"
] | permissive | # Frogger Arcade Game
## Table of Contents
* [Install](#install)
* [Instructions](#instructions)
* [Contributing](#contributing)
* [License](#license)
* [Improvements](#improvements)
## Install
```
Ensure you have moved to a location in your directory where you want to copy the project via, "cd":
$ Git Clone https:/... |
Java | UTF-8 | 302 | 2.40625 | 2 | [] | no_license | package DesignPattern.SingletonPrototype;
/*����ʽ������*/
public class JackSingleton
{
private static final JackSingleton jackSingleton = new JackSingleton();
private JackSingleton()
{
}
public synchronized static JackSingleton getInstance()
{
return jackSingleton;
}
}
|
Python | UTF-8 | 8,301 | 3.1875 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
import math
class BlockingSystem():
def __init__(self, n, serviceTimes):
self.n = n
self.availUnits = [True] * n
self.queueTime = [0] * n
self.rejectedCustomers = 0
self.serviceTimes = serviceTimes
self.custome... |
Markdown | UTF-8 | 1,011 | 3.609375 | 4 | [] | no_license | ---
author: djaigo
title: 单调栈
categories:
- data_structure
date: 2023-07-28 15:22:58
tags:
---
单调栈(monotone-stack)是指栈内元素(栈底到栈顶)都是(严格)单调递增或者单调递减的。
如果有新的元素入栈,栈调整过程中 *会将所有破坏单调性的栈顶元素出栈,并且出栈的元素不会再次入栈* 。由于每个元素只有一次入栈和出栈的操作,所以 *单调栈的维护时间复杂度是O(n)* 。
单调栈性质:
1\. 单调栈里的元素具有单调性。
2\. 递增(减)栈中可以找到元素左右两侧比自身小(大)的第一个元素。
我们主要使用第二条性质,该... |
Java | UTF-8 | 4,558 | 2.859375 | 3 | [] | no_license | import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
public class Main {
static class Reader
{
final private int BUFFER_SIZE = 1 << 16;
private DataInputStream din;
private byte[] buffer;
private int bufferPointer, bytesRead;
... |
Java | UTF-8 | 3,165 | 3.15625 | 3 | [] | no_license | package model;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import bo.Aluno;
import jdbc.ConnectionFactory;
public class AlunoDAO {
public void create(Aluno aluno) {
... |
Java | UTF-8 | 431 | 3 | 3 | [
"MIT"
] | permissive | import java.io.*;
//用字节流复制D盘aaa到E盘xxx
public class APP02 {
public static void main(String[] args) throws IOException {
FileInputStream fir=new FileInputStream("D:\\aaa.txt");
FileOutputStream fow=new FileOutputStream("E:\\xxx.txt");
int a=0;
while ((a=fir.read())!=-1){
f... |
JavaScript | UTF-8 | 876 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive | const array = ['y', 'z', 'e', 'p', 't', 'g', 'm', 'k']
/**
* Mets en forme les nombres: 75000 > 75k
* @param { number } num
* @returns { string }
*/
const form = function (num) {
if (typeof num !== 'number') throw TypeError('Invalid argument')
let [value, y] = [num, 0]
for (let i = 24; i > 0; i = i - 3) {
i... |
Java | UTF-8 | 677 | 2 | 2 | [] | no_license | package com.assocaition.management.module.statistical.service.serviceimpl;
import com.assocaition.management.module.statistical.dao.StatisticalMapper;
import com.assocaition.management.module.statistical.service.StatisticalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframewo... |
Java | UTF-8 | 1,107 | 4.125 | 4 | [] | no_license | package xceptionsInJava;
public class UnCheckedExceptions {
/*
UnChecked Exception :-> Are the Exceptions that are not checked at Compile time but are checked at Run Time. This means, even your
program is throwing an Unchecked Exception and even it is not handled by user, it won't give a compilation error.
... |
Java | UTF-8 | 746 | 1.78125 | 2 | [] | no_license | package com.lichto.modtest.reference;
/**
* Created by Noah Lichtenstein on 6/19/2016.
*/
public final class Names
{
public static final class Blocks
{
public static final String FLAG = "flag";
}
public static final class Items
{
public static final String LEAF = "leaf";
}
... |
C | WINDOWS-1252 | 1,105 | 3.234375 | 3 | [] | no_license | # include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main ()
{
char number1[1000] = "\0";
char number2[1000] = "\0";
int num1[1000] = {0};
int num2[1000] = {0};
int num3[1000] = {0};
int length1 = 0, length2 = 0, length = 0;
int i = 0, j = 0;
//for (i=0;i<1000;i++) printf("num1 = %d num... |
C# | UTF-8 | 843 | 2.6875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAttack : MonoBehaviour
{
Camera _camera;
void Start()
{
_camera = Camera.main;
}
// Update is called once per frame
void Update()
{
if(Input.GetMouseButtonUp(0))
{
... |
C | UTF-8 | 2,983 | 3.890625 | 4 | [] | no_license | /*
* tokenizer.c
* Written by Zack Colello and Anna Genke
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "tokenizer.h"
char *indexPointer; //to be used to track where tokens are in the second argument.
/*
* * TKCreate creates a new TokenizerT object for a given set of separator
* * ch... |
C++ | UTF-8 | 1,496 | 3.828125 | 4 | [] | no_license | /******************************************************************************/
/*
* Question: #109 Convert Sorted List to Binary Search Tree
* Given a singly linked list where elements are sorted in ascending order, convert it to a heigh balanced BST.
*/
/**************************************************************... |
C# | UTF-8 | 1,566 | 3.8125 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CrackingCodingInterviews
{
/*
* Implemen t a method t o perform basi c string compression using the counts
* of repeated characters. For example, the string aabcccccaaa would be... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.