language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
C | UTF-8 | 2,382 | 2.53125 | 3 | [] | no_license | /*
* pwmdriver.c
*
* Created by Tobias Gall <toga@tu-chemnitz.eu>
* Based on Adafruit's python code for PCA9685 16-Channel PWM Servo Driver
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Founda... |
Java | UTF-8 | 721 | 2.40625 | 2 | [] | no_license | package com.zerobank.stepdefinitions;
import com.zerobank.pages.PayBillsPage;
import io.cucumber.java.en.When;
import java.util.Map;
public class AddNewPayee {
@When("creates new payee using following information")
public void creates_new_payee_using_following_information(Map<String,String> payeeInfo) {
... |
Java | UTF-8 | 2,227 | 2 | 2 | [] | no_license | package com.afiperu.ui.fragment;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import com.afiperu.AfiAppComponent;
import com.afiperu.R;
import com.afiperu.common.BaseFragment;
import com.afiperu.common.BasePresenter;
import com.afiperu.component.DaggerDocumentComponent;
import c... |
Markdown | UTF-8 | 1,482 | 2.515625 | 3 | [] | no_license | ### Helper for teaching universal remotes custom codes.
Normally, a remote controle is used to create a lirc configuratiomn file by using `irrecord`. The project provides the tools for doing the reverse. Create a config file manually, then, teach the codes to a universal remote control.
### 1. Hardware
- Nodemcu
-... |
Python | UTF-8 | 2,010 | 3.84375 | 4 | [] | no_license | #!/usr/bin/python3
# text.py by Barron Stone
# This is an exercise file from Python GUI Development with Tkinter on lynda.com
from tkinter import *
#create top level window
root = Tk()
#create text box
text = Text(root, width = 40, height = 10)
text.pack()
#wraps text and ends at the nearst word
text.confi... |
Python | UTF-8 | 4,235 | 3.234375 | 3 | [] | no_license | import nltk
nltk.download('gutenberg')
from nltk.corpus import gutenberg
from nltk import bigrams, trigrams
from collections import Counter, defaultdict
import random
class ngram:
model = defaultdict(lambda: defaultdict(lambda: 0))
cur_index=0
def __init__(self, wordlist):
self.wordlist=list(wordl... |
TypeScript | UTF-8 | 648 | 2.65625 | 3 | [] | no_license | import { start, push, pull, stop, Callbag } from './callbag';
describe('start(talkback)', () => {
it('returns a start identifiable signal', () => {
const talkback = (() => null) as Callbag;
expect(start(talkback).isStart).toBe(true);
});
});
describe('createPush(value)', () => {
it('returns a push ident... |
C# | UTF-8 | 3,064 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logger.Log4Net;
namespace Common.Logger
{
public interface ILogger
{
/// <summary>
/// Log debug message
/// </summary>
/// <param name="message"> ... |
JavaScript | UTF-8 | 472 | 4.09375 | 4 | [] | no_license | // https://codingdojo.org/kata/FizzBuzz/
for (let i = 1; i <= 50; i++) {
let m = ""
if (i % 3 === 0) { m += "Fizz" }
if (i % 5 === 0) { m += "Buzz" }
if (m === "") { m = i}
console.log(m)
}
function fizzbuzz(x) {
let m = ""
if (x % 3 === 0) { m += "Fizz" }
if (x % 5 === 0) { m += "Buzz... |
Markdown | UTF-8 | 5,724 | 2.796875 | 3 | [] | no_license |
# Transformers on Bounded Dyck Languages
Code for ACL 2021 paper [Self-Attention Networks Can Process Bounded Hierarchical Languages](https://arxiv.org/abs/2105.11115)
## Getting started
* Install the required packages.
```
pip install -r requirements.txt
```
* Evaluate different positional encoding schemes (Figur... |
JavaScript | UTF-8 | 4,292 | 3.234375 | 3 | [] | no_license |
//Access children of a node
var bodyChildren = document.body.children;
console.log(bodyChildren);
//To see the ul children
var ulChildren = document.querySelector('ul');
console.log(ulChildren);
//add a new child to the body
//Html selctor pointing out
var h1 = document.querySelector('h1');
var p =... |
Python | UTF-8 | 1,302 | 3.46875 | 3 | [] | no_license | import csv
from collections import Counter
with open("height-weight.csv", newline="")as f:
reader=csv.reader(f)
file_data = list(reader)
file_data.pop(0)
newData = []
for i in range(len(file_data)):
n = file_data[i][1]
newData.append(float(n))
#mean
a = len(newData)
total = 0
for x in newData:
t... |
Java | UTF-8 | 9,253 | 2.203125 | 2 | [
"Apache-2.0"
] | permissive | package com.youran.generate.pojo.po;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.youran.common.constant.ErrorCode;
import com.youran.common.exception.BusinessException;
import com.youran.generate.pojo.dto.MetaMtmEntityFeatureDTO;
import java.util.List;
import java.util.Objects;
/**
* 多对多关联关系
*
... |
Java | UTF-8 | 436 | 1.851563 | 2 | [] | no_license | package com.practice.springboot;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HeloController4 {
// @RequestMapping("/")
public ModelAndView index(ModelAndView mav){
mav.setViewName("index2");
mav.addObject("msg", "current data");... |
Markdown | UTF-8 | 2,422 | 2.578125 | 3 | [] | no_license | # [Champiurns](http://www.reddit.com/r/twitchplayspokemon/comments/2belbz/tppbb_16_champiurns/)
## by [/u/SlowpokeIsAGamer](http://www.reddit.com/user/SlowpokeIsAGamer)
**===Hall of Fame===**
**Chloe**: I can't believe it, we actually made it....
**Voices**: So Jimmy never made it here after all....
**Chloe**: Wha... |
C | UTF-8 | 1,898 | 2.90625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* extract.c :+: :+: :+: ... |
Java | ISO-8859-7 | 566 | 2 | 2 | [] | no_license | package com.xinlan.sheering;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
/**
*
* @author Administrator
*
*/
public class Demo {
/**
* @param args
*/
public static void main(String[] args) {
LwjglApplicatio... |
Java | UTF-8 | 219 | 2.46875 | 2 | [] | no_license | package pers.qiyan.parkinglot;
public enum VehicleSize {
Large(1),
Compact(0);
private final int size;
VehicleSize(int i) {
size = i;
}
public int size(){
return size;
}
}
|
PHP | UTF-8 | 3,789 | 2.609375 | 3 | [] | no_license | <?php
class kvstore_filesystem extends kvstore_abstract implements kvstore_base
{
public $header = '<?php exit(); ?>';
function __construct($prefix)
{
$this->prefix= $prefix;
$this->header_length = strlen($this->header);
$dir_data = dirname(__FILE__).'/../../../kvdata';
... |
Markdown | UTF-8 | 743 | 3.265625 | 3 | [] | no_license | # Dishes Form
A react.js form sending a POST request to the server with a created food type.
This project was a recruitment task.
## How to use the project:
Fill the input fields with data as suggested in placeholders. Write the name of your dish, the preparation time needed to cook it, select a dish type out of 3 (pi... |
JavaScript | UTF-8 | 892 | 2.734375 | 3 | [] | no_license |
import Immutable from 'immutable';
export default function ImmutableCompare (nextProps,nextState) {
const thisProps = this.props || {},
thisState = this.state || {},
is = Immutable.is;
nextProps = nextProps || {};
nextState = nextState || {};
if (Object.keys(thisProps).length !==
... |
Java | UTF-8 | 397 | 1.734375 | 2 | [] | no_license |
package com.myself.security;
public interface SecurityConstants {
/**
* 登录用户
*/
public final static String LOGIN_USER = "user";
/**
* 操作
*/
public final static String OPERATION_SAVE = "save";
public final static String OPERATION_EDIT = "edit";
public final static String OPERATION_VIEW = "vie... |
C# | UTF-8 | 3,361 | 2.6875 | 3 | [] | no_license | using LightCycleClone.GameObjects.World;
using LightCycleClone.Util;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LightCycleClone.GameObjects.Character
{
public class Player : TileObject
{
p... |
Go | UTF-8 | 677 | 3.4375 | 3 | [] | no_license | package main
import (
"github.com/gogo/protobuf/proto"
"log"
"sort"
)
type Person struct {
Age *uint64
}
func main() {
persons := []*Person{
{
Age: proto.Uint64(1),
},
{
Age: proto.Uint64(123),
},
}
mapper := make(map[int]*Person)
mapper[1] = &Person{Age: proto.Uint64(1),}
log.Printf("mapper ... |
Java | UTF-8 | 96 | 1.710938 | 2 | [] | no_license | package step8_03_atm3.copy1;
public class Account1 {
String number;
int money;
}
|
SQL | UTF-8 | 7,717 | 3.140625 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.6.6deb4
-- https://www.phpmyadmin.net/
--
-- Client : localhost:3306
-- Généré le : Jeu 28 Septembre 2017 à 11:11
-- Version du serveur : 5.7.19-0ubuntu0.17.04.1
-- Version de PHP : 7.0.22-0ubuntu0.17.04.1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40... |
Markdown | UTF-8 | 2,675 | 3.328125 | 3 | [] | no_license | # NSDate 和測試的那些小事
純粹筆記一下,遇到的問題
<!-- more -->
最近在處理日期資料,寫了測試要驗證日期是否正確,於是就碰到兩的問題:
- 要怎麼驗證 `NSDate` object?
- 知道怎麼驗證了,怎麼時間就差這麼一些,測試沒過?
# 怎麼驗證 `NSDate`
之前有寫過一篇有關於 XCTAssert 的文章 - [XCTest Assertions 及其種類]({{site.url}}/2014/07/10/xctest-assertions/) 有列出有哪些 XCTAssert 可以用,於是就要從這邊挑一個出來用。
上網找了找資料,其實只要取得 NSDate 物件的 timesta... |
JavaScript | UTF-8 | 204 | 2.78125 | 3 | [] | no_license | /* Manejo de data */
// esta es una función de ejemplo
// puedes ver como agregamos la función a nuestro objeto global window
const example = () => {
return 'example';
};
window.example = example;
|
Python | UTF-8 | 469 | 3.265625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf8 -*-
class Animal(object):
def run(self):
print("动物跑......")
class Dog(Animal):
def run(self):
print("狗狗跑.....")
class Car(Animal):
def run(self):
print("汽车跑.....")
if __name__ == '__main__':
f1 = Animal() # 没有发生多态
f1.r... |
TypeScript | UTF-8 | 971 | 3.53125 | 4 | [
"MIT"
] | permissive |
// TODO unused. Delete?
export class BitStream {
public readonly data: Uint8Array;
public readonly bitCount: number;
public bitIndex: number = 0;
public startBits: number = 0;
constructor(data: Uint8Array) {
this.data = data;
this.bitCount = data.length*8;
}
public readByt... |
Python | UTF-8 | 539 | 3.984375 | 4 | [] | no_license | # sekwencja jest np. lista czy tez ciag znakow, krotka
def przeciecie_sekwencji(S1, S2):
S3 = []
for i in S1:
if i in S2:
S3.append(i)
return S3
def suma_sekwencji(S1, S2):
S3 = []
# wszystkie elementy pierwszej sekwencji
for i in S1:
if i not in S3:
S3.append(i)
for i in S2:
if i not in S1 and i ... |
C++ | UTF-8 | 850 | 3.828125 | 4 | [] | no_license | //https://practice.geeksforgeeks.org/problems/check-if-tree-is-isomorphic/1
// Return True if the given trees are isomotphic. Else return False.
bool isIsomorphicUtil(Node* root1,Node* root2)
{
if(!root1 && !root2)
{
return true;
}
if(!root1 || !root2)
{
return false;
}
if(... |
C++ | GB18030 | 3,886 | 3.421875 | 3 | [] | no_license | #include<iostream>
#include<stack>
using namespace std;
typedef char ElemType;
struct ThreadNode{
ElemType data;
int ltag,rtag;
ThreadNode *lchild,*rchild;
};
void CreateThreadNode(ThreadNode *&b,char *str){
stack<ThreadNode*> s;
ThreadNode *p;
b = NULL;
int k,j = 0;
char ch = str[j];
while(ch ... |
Python | UTF-8 | 1,490 | 2.75 | 3 | [] | no_license | import sqlite3
import os
import shutil
conn=sqlite3.connect("Record_database.db")
def re():
print('Creating database...')
try:
conn.execute("create table Record_TVL (name varchar(20) default '-', age varchar(10) default '-', file_no varchar(20) not null, doe varchar(20) default '-', sex varch... |
Python | UTF-8 | 413 | 3.140625 | 3 | [] | no_license | class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
from sets import Set
nums = Set()
while n not in nums:
if n == 1:
return True
nums.add(n)
s = str(n)
n = 0
... |
C# | UTF-8 | 2,001 | 2.71875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace ffn_site.Models.Dal
{
public class ClubDal : IDal<Club>
{
private ffn_siteEntities bdd;
public ClubDal()
{
bdd = new ffn_siteEntities();
}
public int Add(Club o... |
Ruby | UTF-8 | 1,854 | 2.890625 | 3 | [
"MIT"
] | permissive | # read file name from the cli params
file_name = ARGV[0]
# Get contents of the file
contents = IO.read(file_name)
# List of all conversion passed to gsub,
# @matcher: RegEx or String
# @replacement: String
conversions = [
# STUBS
{matcher: /(\S+?).stubs\(\s*?(:.+?)\)/, replacement: 'allow(\1).to receive(\2)'}, #... |
PHP | UTF-8 | 4,698 | 2.921875 | 3 | [] | no_license | <?php
namespace outputs;
use GameOfLife\Board;
use GameOfLife\outputs\Png;
use Icecave\Isolator\Isolator;
use PHPUnit\Framework\TestCase;
use Ulrichsg\Getopt;
class PngTest extends TestCase
{
public function testOutputWithoutColors()
{
$field = new Board(5, 5);
$field->setBoardValue(2, 2, 1);... |
Java | UTF-8 | 1,790 | 2.359375 | 2 | [] | no_license | package pl.mmprogr.library.controller.book;
import org.springframework.stereotype.Controller;
import pl.mmprogr.library.model.book.Book;
import pl.mmprogr.library.model.book.BookBuilder;
import pl.mmprogr.library.model.user.User;
import pl.mmprogr.library.service.book.BookService;
import pl.mmprogr.library.view.Borrow... |
Python | UTF-8 | 4,078 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
class ValueLog():
"""Implemements a key/value aggregating dictionary log with optional
grouping/precision and custom aggregation modes"""
def __init__(self):
self.log_values = {}
def log(self, key, val, agg="mean", scope="get", group=None,
precision=None):
... |
Markdown | UTF-8 | 2,840 | 2.734375 | 3 | [] | no_license | ---
title: 'Comparison of four workflows for structural variants identification'
date: '2022-01-28'
slug: project-comparison-of-four-workflows-for-structural-variants-identification
categories:
- Open 2022
- Open Flexible Timeline
tags:
- 2022
thumbnailImagePosition: left
thumbnailImage: https://github.com/CU-... |
JavaScript | UTF-8 | 1,338 | 2.671875 | 3 | [] | no_license | const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const WorkoutSchema = new Schema({
day: {
type: Date,
default: Date.now
},
exercises: [
{
type: Schema.Types.ObjectId,
ref: "Exercise"
}
],
totalDuration: {
type: Number
},
totalWeight: {
type: Number
},
totalDistanc... |
Markdown | UTF-8 | 1,027 | 4.21875 | 4 | [] | no_license | ## Reverse a Linked List (in Ruby!)
### Prompt ###
Your task is to reverse a linked list using Ruby.
*Examples:*
Given the Linked List:
```3 -> 4 -> 6 -> 12 -> 33 -> 34 ```
return:
```34 -> 33 -> 12 -> 6 -> 4 -> 3```
Given the Linked List:
```0 -> 2 -> 5 -> 5 -> 6```
return:
```6 -> 5 -> 5 -> 2 -> 0```
###... |
TypeScript | UTF-8 | 1,433 | 3.546875 | 4 | [] | no_license | var nodeFetch = require('node-fetch');
// let fn: () => string = () => {
// console.log('It has been 5 seconds');
// return 'test';
// }
// const val: string = fn();
// setTimeout(fn, 5000);
// // console.log(val);
// // const afn = async () => {
// // const res = await fetch('https://api.fungenerators.c... |
Markdown | UTF-8 | 1,750 | 2.78125 | 3 | [
"Apache-2.0"
] | permissive | ### 快速运行指南
想要使用 Cloud Kernel,您既可以运行预编译的二进制内核包,也可以从源码编译内核。请注意我们提供的默认内核配置文件是为阿里云 ECS 实例定制的版本,如果您想要将内核运行于非 ECS 平台上,您需要自行打开相关的内核模块开关并且重新编译内核。
### 1 运行预编译二进制内核包(推荐)
首选方案是从 YUM 源安装:
- 第一步,新建一个 YUM 仓库文件:
```
sudo vim /etc/yum.repos.d/alinux-2.1903-plus.repo
```
- 第二步,填入 repo 信息:
```
[plus]
name=Alibaba Cloud Linux 2.19... |
Swift | UTF-8 | 3,963 | 3.125 | 3 | [] | no_license | //: [Previous](@previous)
/*:
A lot of times, the Mark 1 would grind to a halt soon after starting - and there was no user-friendly error message.
Once, it was because a moth had flown into the machine - that gave us the term "bug", indicating an error on the code, and "debugging", correcting it.
But most of ... |
Python | UTF-8 | 389 | 3.765625 | 4 | [] | no_license | def main():
numero = aux = int(input("Digite um número: "))
produto = numero
while True:
if numero != 0:
numero -= 1
if numero != 0:
produto *= numero
elif produto == 0:
produto = 1
elif numero == 0: break
print(f'{aux} fator... |
Markdown | UTF-8 | 5,633 | 2.921875 | 3 | [] | no_license | ---
layout: post
title: "Speaking Out Against Religion"
date: 2007-01-01 21:51
comments: true
sharing: true
footer: true
permalink: /2007/01/speaking-out-against-religion
categories: [Religion]
tags: [atheism, commentary, Religion]
---
<p>One of the points that seems to come up a lot in atheist commentaries is the fact... |
C# | UTF-8 | 4,127 | 3.53125 | 4 | [
"MIT"
] | permissive | using System;
namespace SGL
{
/// <summary>
/// Represent an ellipse defined by an origin point and two radii (along the X and Y axes).
/// </summary>
public class Ellipse : IEquatable<Ellipse>
{
/// <summary>
/// The center of the ellipse.
/// </summary>
public Poi... |
JavaScript | UTF-8 | 1,257 | 2.5625 | 3 | [] | no_license | import React from 'react';
import PropTypes from 'prop-types';
import TimeStat from './component';
const onIntervalHOC = (propFunc, interval) => Component =>
class OnInterval extends React.Component {
constructor(props) {
super(props);
this.state = propFunc(props);
}
componentWillMount() {
... |
PHP | ISO-8859-1 | 1,006 | 2.734375 | 3 | [] | no_license | <?php
class Videos extends ModuloDB {
public function Videos( $cod = '' ) {
$this->tabela = "site_videos";
$this->tituloModulo = 'VDEOS';
$this->chave = 'VideoID';
$this->ModuloDB();
if ( $cod )
$this->configDb($cod);
}
function getCampos( $camposRequisitados = array('VideoID', 'Titu... |
C++ | UTF-8 | 635 | 3.8125 | 4 | [] | no_license | //// Happy number : sum of the digit with squrt iteratively. Return T/F whether sum is 1 / infinite loops.
//// Tags : [math]
//// [Easy]
#include <iostream>
using namespace std;
// 01, my code recursive solution : time O(n), space O(1)
bool isHappy(int n){
int sqrtsum = 0, next = n;
while( next ){
in... |
Java | UTF-8 | 2,630 | 3.140625 | 3 | [] | no_license | import java.io.*;
import java.util.*;
public class Main {
public static void solution(int[] arr, int vidx, int n, int k, int[] subsetSum, int conessf, ArrayList < ArrayList < Integer >> ans) {
//write your code here
if (vidx == arr.length) {
if (conessf == k) {
//if s... |
Java | UTF-8 | 3,032 | 2.890625 | 3 | [] | no_license | package fr.carbonit.treasuremap.data;
import fr.carbonit.treasuremap.exception.MapFileException;
import fr.carbonit.treasuremap.map.component.Component;
import fr.carbonit.treasuremap.map.Map;
import fr.carbonit.treasuremap.map.component.character.Moveable;
import fr.carbonit.treasuremap.map.component.character.comman... |
JavaScript | UTF-8 | 617 | 2.515625 | 3 | [] | no_license | var jwt = require('jwt-simple');
var secret = 'ONSHOPCHANAKALK';
exports.createtoken = function(req,res) {
var payload = { name: req.name, email:req.email,isseller:req.isseller, date:Date.now()};
var token = jwt.encode(payload, secret,'HS512');
return token;
}
exports.isv... |
Markdown | UTF-8 | 4,699 | 3.5 | 4 | [] | no_license | ## Week Two - Module 2 Recap
Fork or re-pull this respository. Answer the questions to the best of your ability. Try to answer them with limited amount of external research. These questions cover the majority of what we've learned this week (which is a TON - YOU are a web developer!!!).
Note: When you're done, submit... |
Java | UTF-8 | 8,153 | 2.28125 | 2 | [] | no_license | package com.example.todoapp.Activities;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import android.app.AlarmManager;
import android.app.DatePickerDialog;
import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android... |
C# | UTF-8 | 1,273 | 3.046875 | 3 | [
"MIT"
] | permissive | using System;
using Discord.Rest;
using Discord.WebSocket;
namespace Discord
{
/// <summary>
/// Contains extension methods for abstracting <see cref="IRole"/> objects.
/// </summary>
internal static class RoleAbstractionExtensions
{
/// <summary>
/// Converts an existing <see cre... |
Java | UTF-8 | 1,160 | 2.28125 | 2 | [] | no_license | package org.vermeg.bookstore.service;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.vermeg.bookstore.interfaces.AchatInterface;
import org.vermeg.bookstore.model.Achat;
... |
Python | UTF-8 | 553 | 3.5625 | 4 | [] | no_license | """
Substring search
input: string s, pattern p
output: index i,j st. s[i,j]=p
Test.py
"""
from BruteSearch import Solution
Object=Solution()
fp=open("test_data.txt")
data=fp.readlines()
Input=[]
Output=[]
for line in data:
string,pattern,index=line.split(' ')
Input.append([string,pattern])
Output.append(int(inde... |
Python | UTF-8 | 2,417 | 4.3125 | 4 | [] | no_license | # https://leetcode-cn.com/problems/replace-words/
"""
在英语中,我们有一个叫做 词根(root)的概念,它可以跟着其他一些词组成另一个较长的单词——我们称这个词为 继承词(successor)。
例如,词根an,跟随着单词 other(其他),可以形成新的单词 another(另一个)。
现在,给定一个由许多词根组成的词典和一个句子。你需要将句子中的所有继承词用词根替换掉。
如果继承词有许多可以形成它的词根,则用最短的词根替换它。
你需要输出替换之后的句子。
示例 1:
输入: dict(词典) = ["cat", "bat", "rat"]
sente... |
Python | UTF-8 | 34,406 | 3.015625 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | '''This module simulate a river-valley system based on user inputs.
Usage:
python3 riverbuilder <path.to.input.txt> <outputFolderName>
path.to.input.txt -- Absolute or relative path to an input file that contains
all parameters needed to build a river.
outputFolderName -- Name of the folder that o... |
Shell | UTF-8 | 1,519 | 3.1875 | 3 | [] | no_license | #!/bin/bash
set -e
cd "${BUILD_PATH}"
echo '-- Building espeak from source...'
mkdir -p espeak
pushd espeak
cat <<eof > PKGBUILD
# Maintainer:
pkgname=espeak
pkgver=1.48.04
pkgrel=1
pkgdesc="Text to Speech engine for good quality English, with support for other languages"
arch=('armv6h')
url="http://espeak.sourceforg... |
Python | UTF-8 | 5,158 | 2.6875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"GPL-3.0-only"
] | permissive | # -*- coding: utf-8 -*-
# Copyright 2019 United Kingdom Research and Innovation
# Copyright 2019 The University of Manchester
#
# 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
#
# htt... |
Python | UTF-8 | 1,657 | 2.859375 | 3 | [] | no_license | import os
import time
import busio
import digitalio
import board
import adafruit_mcp3xxx.mcp3008 as MCP
from adafruit_mcp3xxx.analog_in import AnalogIn
import RPi.GPIO as GPIO
from bluedot import BlueDot
from signal import pause
spi = busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
cs = digitalio.Digital... |
Markdown | UTF-8 | 398 | 2.796875 | 3 | [] | no_license | ---
title: Quantity queries.
date: 2015-06-03 21:35 UTC
tags:
- css
- media queries
---
I enjoyed [Heydon Pickering]'s well-written explanation of a
clever technique for media-query-like "breakpoints" for, say,
"[more than six paragraphs][article]," or "fewer than three elements."
[article]: http://alistapart.com/art... |
Python | UTF-8 | 3,661 | 2.859375 | 3 | [] | no_license | from PIL import Image
from PIL import ImageOps
from numpy import pi, mgrid, exp, square, zeros, ravel, dot, uint8
from itertools import product
import math
import numpy as np
import random
from scipy.ndimage import gaussian_filter
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from skimage ... |
Python | UTF-8 | 243 | 3.328125 | 3 | [] | no_license | import turtle as t
def koch(t, order, size):
if order == 0:
t.forward(size)
else:
for angle in [60, -120, 60, 0]:
koch(t, order-1, size/3)
t.left(angle)
ordr = 1
siz = 100
kch = koch(t,ordr,siz)
|
C# | UTF-8 | 644 | 2.59375 | 3 | [
"MIT"
] | permissive | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
class ChangePausedStateOnEvent : ActivateOnEvent {
enum PauseType : byte {
Pause,
Unpause,
TogglePause
}
[Header("Event Specifics")]
[SerializeField] private PauseType m_pauseType;
protected override void OnActivate() {
swi... |
C++ | UTF-8 | 558 | 2.640625 | 3 | [] | no_license | // Program to find nth Fibbonaci No
// Link : https://practice.geeksforgeeks.org/problems/nth-fibonacci-number/0
#include<bits/stdc++.h>
#define LL long long
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define elif else if
#define FORA(x,arr) for(auto &x:arr)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NU... |
Markdown | UTF-8 | 2,464 | 3.953125 | 4 | [
"MIT"
] | permissive | # Black Jack written in Python
This is a simulation of a game of blackjack. It involves features such as choosing to pick up another card, deciding not to pick up a card and end your turn, (both using input). A winner is recognised and an ace being either a 1 or an 11 is there but doesn't work very well.
I am hoping t... |
Python | UTF-8 | 159 | 3.40625 | 3 | [] | no_license | theAnswer = 42
fortyTwo = ['life,', 'the universe,', 'and everything!']
if theAnswer == 42:
print('The meaning of')
for x in fortyTwo:
print x |
Java | UTF-8 | 3,445 | 2.453125 | 2 | [] | no_license | package com.neusoft.abclife.productfactory.test;
import java.io.IOException;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.h... |
C# | UTF-8 | 3,264 | 3.515625 | 4 | [
"MIT"
] | permissive | using System;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
//setup vars
string appName = "Number Guesser";
string appVersion = "1.0.0";
string appAuthor = "Shuonan";
//change text color
Console... |
C# | UTF-8 | 3,217 | 3.125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Projekt
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
... |
Java | UTF-8 | 423 | 1.914063 | 2 | [] | no_license | package com.forumdev.demo.Service.ServiceInterface;
import com.forumdev.demo.Model.Comment;
import com.forumdev.demo.Model.Post;
import java.util.List;
public interface CommentServiceInterface
{
Comment save(Comment s);
Comment editComment(Comment comment);
void deleteComment(Comment comment);
Intege... |
Markdown | UTF-8 | 19,088 | 3.015625 | 3 | [] | no_license | # 应用编程接口
## API蓝本结构
|-practice_flask_blog
|-app/
|- api
|- __init__.py
|- users.py
|- posts.py
|- comments.py
|- authentication.py
|- errors.py
|- decorators.py
1. app/api/\_\_i... |
Python | UTF-8 | 2,103 | 3.671875 | 4 | [] | no_license | #linear fitting.py
#生成服从一维正态分布的随机数(离散值),使用最小二乘法进行曲线拟合,并梯度下降法求取极值。
#导入2d图形库 matplotlib 数学函数库numpy mah
import numpy as np
import matplotlib.pyplot as plt
import math
#生成20个待测试的服从标准正态分布随机数并且打印在图像上
X = np.arange(-5, 5, 0.1)
Z = [1/math.sqrt(2*math.pi)*math.exp(-x**2/2) for x in X]
Y = np.array([np.random.nor... |
SQL | UTF-8 | 86 | 2.59375 | 3 | [] | no_license | SELECT DISTINCT ShipCity FROM Orders
WHERE DATEDIFF(DAY, OrderDate , ShippedDate) > 10 |
SQL | UTF-8 | 2,901 | 3.90625 | 4 | [
"MIT"
] | permissive | set serveroutput on
declare
v_stno BARORDER.studentno%type:='&Enter_Student_Number'; --STUDENT NUMBER
v_rmno BARORDER.delivertoroom%type:=&Enter_Room_Number; --ROOM NUMBER
v_itemname ORDERITEM.itemname%type:='&Enter_Item_Name'; --ITEM NAME
v_quantity ORDERITEM.quantity%type:=&Enter_Item_Quantity; --ITEM QUA... |
Java | UTF-8 | 455 | 2.046875 | 2 | [
"MIT"
] | permissive | package com.packt.modern.api.aop;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @author : github.com/sharmasourabh
* @project : Chapter02 - Modern API Development with Spring and Spring Boot
* ... |
Python | UTF-8 | 3,812 | 2.8125 | 3 | [] | no_license | import socket
import sys
import time
import urllib.parse as urlparse
from http.server import BaseHTTPRequestHandler, HTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000
def loadMap():
board = open(sys.argv[2],"r")
spaces = board.read().split("\n")
Matrix = [["_" for x in range(10)] for y in range(10)]
... |
Python | UTF-8 | 309 | 3.4375 | 3 | [
"MIT"
] | permissive | from random import *
seed()
x = []
for i in range(0, 10):
x.append(randint(0, 100))
def inorder(x):
i = 0
j = len(x)
while i + 1 < j:
if x[i] > x[i + 1]:
return False
i += 1
return True
def bogo(x):
while not inorder(x):
shuffle(x)
return x
|
C | UTF-8 | 434 | 2.859375 | 3 | [] | no_license | /*
item.h: header file for the Item
CS411 Lab #:4
Name: Kevin Sahr
Date: February 21, 2017
*/
#ifndef ITEM_H
#define ITEM_H
#define MAX_ITEM_NAME_LEN 30
typedef struct
{
int id;
char name[MAX_ITEM_NAME_LEN + 1];
float price;
} Item;
/*** Item function prototypes ***/
Item* createItem(in... |
JavaScript | UTF-8 | 8,766 | 2.734375 | 3 | [
"MIT"
] | permissive | $(document).ready(function(){
// Reattach the reply form as last element of the article the user want's to answer
// and update the form action URL so the answer is really associated with that message.
// We also hide the answer link and focus the textarea for the message. Note that first
// all answer links are sh... |
Java | UTF-8 | 53,411 | 2.078125 | 2 | [] | no_license | package com.huazhu.application.cms.wechat.event.entity;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class CustomerInfoExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public CustomerInfoExample() {
... |
C# | UTF-8 | 1,889 | 3.046875 | 3 | [] | no_license | using System;
using NetworkCommsDotNet;
using NetworkCommsDotNet.Connections;
using NetworkCommsDotNet.Connections.TCP;
using Protocol;
using System.Threading;
namespace Client
{
class Client
{
Network net;
Display print;
public void Connect()
{
net = new Network()... |
Python | UTF-8 | 316 | 3.234375 | 3 | [
"MIT"
] | permissive | from math import factorial
instr = [1.00e+06, 6.00e+07, 3.60e+09, 8.64e+10, 2.59e+12, 3.15e+13, 3.15e+15]
def fctorial(instr):
number = []
for i in instr:
n = 0
f = 1
while f <= int(i):
f = factorial(n)
n += 1
number.append(n-2)
return number
|
Java | UTF-8 | 5,593 | 2.34375 | 2 | [] | no_license | package cn.hehe9.persistent.dao;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
i... |
Java | UTF-8 | 9,717 | 1.96875 | 2 | [] | no_license | package com.example.todolist.Main.Today;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.GridLayoutManager... |
C++ | UTF-8 | 4,924 | 2.53125 | 3 | [
"MIT"
] | permissive | #include <vector>
#include <iterator>
#include <algorithm>
template<typename T>
void readoutART(Layer<T> layer, int numEpisode, std::vector< std::vector<double> >& output)
{
output.resize(layer.x.size());
for(unsigned int i=0; i<layer.x.size();i++)
{
output[i].resize(layer.weight[i][numEpisode].size()/2);
for... |
PHP | UTF-8 | 378 | 3.03125 | 3 | [] | no_license | <?php
namespace App;
class Logger
{
public static function message($context, $message = '')
{
if (is_string($context)) {
$message = $context;
$context = null;
}
if (strpos($message, "\n") !== false) {
$message .= "\n" . $message;
}
echo date('[Y-m-d H:i:s]') . (is_object($context) ? (' [' . $c... |
Java | UTF-8 | 6,455 | 1.664063 | 2 | [
"MIT",
"Apache-2.0"
] | permissive | /**
* Copyright 2018-2019 Amazon.com,
* Inc. or its affiliates. All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
package com.apollographql.apollo.internal.cache.normalized;
import com.apollographql.apollo.api.GraphqlFragment;
import com.apollographql.apollo.api.Operation;
import com.apollographql.... |
Java | UTF-8 | 6,948 | 2.046875 | 2 | [] | no_license | /*
* Created by JFormDesigner on Wed Mar 15 14:12:19 MSK 2017
*/
package client.reporter;
import java.awt.*;
import java.awt.event.*;
import java.io.IOException;
import java.util.*;
import java.util.List;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import client.component.WaitingDialog;
import cli... |
Java | UTF-8 | 1,984 | 2.296875 | 2 | [] | no_license | package booking;
import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Http... |
C# | UTF-8 | 935 | 2.75 | 3 | [
"MIT"
] | permissive | using System;
using System.Linq;
using System.Linq.Expressions;
using AMKsGear.Architecture;
namespace AMKsGear.Core.Linq
{
public static class QueryableExtensions
{
#region OrderByEx
public static IOrderedQueryable<TEntity> OrderByEx<TEntity, TKey>(
this IQueryable<TEntity> querya... |
TypeScript | UTF-8 | 2,967 | 2.71875 | 3 | [] | no_license | import { Request, Response } from 'express';
import pool from '../database'
class SeccionesController{
public async list (req: Request, res: Response): Promise<void>{
const Secciones = await pool.query('SELECT * FROM Secciones')
res.json(Secciones);
}
public async getOne (req: Request, res... |
Markdown | UTF-8 | 2,093 | 4.28125 | 4 | [
"MIT"
] | permissive | ---
layout: post
permalink: lc0919
---
## 919. Complete Binary Tree Inserter
完全二叉树是一种二叉树,其中除了可能的最后一层外,每一层都被完全填满,并且所有节点都尽可能靠左。
设计一种算法,将新节点插入到完整的二叉树中,并在插入后保持完整。
实现 CBTInserter 类:
CBTInserter(TreeNode root) 用完整二叉树的根初始化数据结构。
int insert(int v) 将 TreeNode 插入到值为 Node.val == val 的树中,使树保持完整,并返回插入的 TreeNode 的父节点的值。
TreeN... |
Python | UTF-8 | 7,538 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 13 19:37:13 2019
@author: lz
"""
import time
import multiprocessing
import click
import universal_functions as uf
class mp:
"""
Multiprocess object, can know which processes are running and which are waiting.
func = function to multipr... |
Python | UTF-8 | 1,027 | 3.21875 | 3 | [] | no_license | # coding=utf-8
# 플로이드 풀이
def solution(n, m, price):
INF = int(1e9)
graph = [[INF] * n for _ in range(n)]
for i in range(m):
a, b, c = price[i]
graph[a - 1][b - 1] = min(graph[a - 1][b - 1], c)
# print(graph)
# 시작 도시와 도착 도시가 같은 경우
for i in range(n):
graph[i][i] = 0
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.