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 |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 1,316 | 3.453125 | 3 | [
"MIT"
] | permissive | # element 阅读知识点储备
## node 知识
### fs.resolve()
### fs.readFileSync()
### fs.writeFile()
### os.EOL
表示当前操作系统的行末标志。 `window` 系统为 `\r\n`; `linux` 系统上为 `\n`
## npm 包
### postcss.parse 一个 css 语法解析器
### json-templater/string 字符串替换
`json-templater/string` 是一个字符串替换的方法, 他接受2个参数,分别为为字符串模板、模板中需要替换的变量 `key` 组成的对象, 使用方法为
... |
Java | UTF-8 | 13,547 | 2.5 | 2 | [] | no_license | package view;
import controller.DbUtils;
import java.util.ArrayList;
import model.User;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel... |
JavaScript | UTF-8 | 5,290 | 2.75 | 3 | [] | no_license | var Objet = function () {
this.room;
this.x = 0;
this.y = 0;
this.cx = 0;
this.cy = 0;
this.rx = 0;
this.ry = 0;
this.dx = 0;
this.dy = 0;
this.radius = 1;
this.rapport = 1;
this.acceleration = 1;
this.positions = []; //{timestamp, x, y}
}
Objet.prototype.setCoordin... |
Markdown | UTF-8 | 860 | 3.015625 | 3 | [] | no_license | # Getting-and-cleaning-Data-
The course proyect include a script called run_analysis.R, and after loading the data set "UCI HAR Dataset" the following steps were performed:
1. Merges the training and the test sets to create one data set.
2. Extracts only the measurements on the mean and standard deviation for each mea... |
Python | UTF-8 | 2,126 | 3.265625 | 3 | [] | no_license | #import RPi.GPIO as GPIO #Importamos la libreria RPi.GPIO
import time #Importamos time para poder usar time.sleep #Importamos time para poder usar time.sleep
import random
class Comunicador(object):
def __init__(self, pinBase, pinLateral):
self.servoBase = pinBase
se... |
PHP | UTF-8 | 5,548 | 2.5625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
//added
use DB;
use Carbon\Carbon;
# Include the Autoloader (see "Libraries" for install instructions)
use Mailgun\Mailgun;
use Mail;
use App\User;
use App\Winners;
class testController ex... |
Java | UTF-8 | 2,527 | 2.859375 | 3 | [] | no_license | package optics.raytrace.sceneObjects;
import math.Vector3D;
import optics.raytrace.core.SceneObject;
import optics.raytrace.core.Studio;
import optics.raytrace.core.SurfaceProperty;
/**
* A ray-trajectory cone made from simpler ray trajectories
*/
public class SimplerRayTrajectoryCone extends RayTrajectoryCone
{
... |
C++ | UTF-8 | 676 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string line;
int iCase = 0;
while(true) {
getline(cin, line);
int n;
sscanf(line.c_str(), "%d", &n);
if (n == 0)
break;
vector<string> v(n);
... |
JavaScript | UTF-8 | 996 | 2.671875 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | var sessionName ;
var sessionUser;
function check_user()
{
var check = window.sessionStorage.getItem("has_logged_in");
if(check==null)
{
console.log("you haven't Logged in!")
}
else{
window.location.replace("http://vigneashsundar.in/post");
}
}
function check_user_... |
Java | UTF-8 | 618 | 2.265625 | 2 | [] | no_license | package l2r.gameserver.network.serverpackets;
import gr.sr.network.handler.ServerTypeConfigs;
public class ExNevitAdventEffect extends L2GameServerPacket
{
private final int _timeLeft;
public ExNevitAdventEffect(int timeLeft)
{
_timeLeft = timeLeft;
}
@Override
protected void writeImpl()
{
switch (Serv... |
Python | UTF-8 | 1,972 | 2.75 | 3 | [
"MIT"
] | permissive | import streamlit as st
from .fixed_params import emoji_text_dict
def main(
# Case 1:
mean_mRS_treated_case1,
mean_mRS_change_case1,
mean_util_treated_case1,
mean_util_change_case1,
case1_time_to_ivt,
case1_time_to_mt,
# Case 2:
mean_mRS_treated_... |
Markdown | UTF-8 | 3,243 | 2.625 | 3 | [] | no_license | ---
title: “营养又美味”的金属“汉堡”
date: 2020-11-09T18:10:02+08:00
tags:
- 金属
categories:
- 新闻
abbrlink:
---
来源:中科院之声
汉堡由面包、蔬菜、肉饼和芝士堆叠而成,因美味且提供丰富的营养成为了人们重要的食物形式之一。其中,面包提供了碳水化合物,蔬菜贡献了丰富的维生素,肉饼提供了蛋白质,而芝士则含有大量的脂肪。因此,这小小的汉堡满足了我们人类日常所需的各项营养物质。

canvas = Canvas(root, width=size, height=size)
canvas.pack()
a = [[0,1,2], [3,4], [6], [5,7,8], [9]]
points = []
h = size / (len(a) + 1)
pos_y = size - h
for i in range(len(a)):
w = size / (len(a[i]) + 1)
pos_x = w
p = []
for j in range(len(a[i])):
... |
Java | UTF-8 | 6,077 | 1.84375 | 2 | [] | no_license | package com.fh.entity.bo;
/**
* Created by Administrator on 2016/11/3 0003.
*/
public class AmountRecordBo {
private String token;
private int eid;
private int member_id;
private int uid;
private int type;
private String date;
private float amou... |
JavaScript | UTF-8 | 100 | 2.65625 | 3 | [] | no_license | var arrProm = [Promise.resolve('a'), Promise.resolve('b')];
Promise.all(arrProm).then(console.log); |
Java | UTF-8 | 10,351 | 1.9375 | 2 | [] | no_license | package adhd.sirikan.pimpicha.adhdform;
import android.graphics.Color;
import android.icu.util.Calendar;
import android.support.annotation.IdRes;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import andro... |
Markdown | UTF-8 | 2,371 | 3.359375 | 3 | [] | no_license | ---
layout: surf
name: empathy
title: What is Empathy?
permalink: /emxpathy
published: false
description: >
"Humanity's future depends on empathy" - Stephen Hawking
image: https://chaz.co/assets/images/empathy_houses.jpg
---
# **Empathy**
The best way to understand something is to approach it from many different... |
C++ | UTF-8 | 1,849 | 3.203125 | 3 | [] | no_license | //============================================================================
// Name : p0105.cpp
// Author : Zhengwei
// Version :
// Copyright : Your copyright notice
// Description : string compression
//============================================================================
#include <iostre... |
Ruby | UTF-8 | 1,365 | 2.546875 | 3 | [] | no_license | class TestPassage < ApplicationRecord
belongs_to :user
belongs_to :test
belongs_to :current_question, class_name: "Question", optional: true
before_save :before_save_set_current_question
PASSING_SCORE = 85
def completed?
current_question.nil?
end
def accept!(answer_ids)
self.correct_question... |
Python | UTF-8 | 389 | 3.0625 | 3 | [] | no_license | from typing import List
class Solution:
def change(self, amount: int, coins: List[int]) -> int:
dp = [0] * (amount + 1)
dp[0] = 1
for i in coins:
for j in range(amount+1):
if j - i >= 0 and dp[j-i] > 0:
dp[j] += dp[j-i]
return dp[amou... |
PHP | UTF-8 | 553 | 2.609375 | 3 | [] | no_license | <?php
use Illuminate\Database\Seeder;
class FolloweesTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$users = \App\Models\User::all();
foreach ($users as $user)
{
$followees = $users->random(10)... |
Python | UTF-8 | 220 | 3.390625 | 3 | [] | no_license | """ e-Judge """
def main():
""" The box """
number_square = int(input())
number_dokjun = "* " * number_square
square = ((number_dokjun + "\n") * (number_square-1) + number_dokjun)
print(square)
main() |
Python | UTF-8 | 21,402 | 3.34375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import copy
import logging
from vector import (Vector3D, baseVectors, baseDirections, rotx, roty, rotz,
multiply, mirror_yz, mirror_zx, mirror_xy)
logging.basicConfig(format='%(levelname)s:%(name)s: %(message)s',
level=logging.WARNING)
logger = logging... |
Python | UTF-8 | 153 | 3.109375 | 3 | [
"MIT"
] | permissive | # https://programmers.co.kr/learn/courses/30/lessons/12944
def soultion(arr):
sum = 0
for i in arr:
sum += i
return(sum / len(arr))
|
Java | GB18030 | 2,222 | 2.34375 | 2 | [] | no_license | package com.blacknife.mobliesafe.activity;
import com.blacknife.mobliesafe.R;
import com.blacknife.mobliesafe.db.dao.AddressDao;
import android.app.Activity;
import android.os.Bundle;
import android.os.Vibrator;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import andro... |
Java | UTF-8 | 1,091 | 4 | 4 | [] | no_license | package unit_testing;
/**
* @author Mpatziakoudi Katerina
* Applied Software Engineering
* Unit Testing Assignment
* April 2018
*/
public class MyMath {
/**Performs a division between two numbers and returns the result.
* Zero denominator cause an {@link IllegalArgumentException}
* @param num the integer ... |
Python | UTF-8 | 2,005 | 2.8125 | 3 | [] | no_license | #** This line is 79 characters long. The 80th character should wrap. ***\
#imports:
import os, re
import json
import warnings
import codecs
import pdfplumber
#define:
class extractor(object):
def __init__(self, filePath):
self.filePath = filePath
def extract(self, pageNumber, percents):
... |
C++ | UTF-8 | 1,507 | 4.09375 | 4 | [] | no_license | /* Question 1:
* The Fibonacci numbers sequence, Fn, is defined as follows:
* F1 is 1, F2 is 1, and Fn = Fn-1 + Fn-2 for n = 3, 4, 5, ...
* In other words, each number is the sum of the previous two numbers. The first 10 numbers
* in Fibonacci sequence are: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55
* Note: Background of Fi... |
Ruby | UTF-8 | 388 | 3.65625 | 4 | [
"MIT"
] | permissive | story = "Once upon a time in a land far, far away..."
p story[5, 4]
#output:
#upon
p story.slice(5,4)
#output:
#upon
p story[-7, 5]
# output:
# away.
puts puts
p story[27..39]
# output:
# far, far away
p story.slice(27..39)
# output:
# far, far away
p story[27...39]
# output:
# far, far awa
p story[32..1000]
# ... |
Markdown | UTF-8 | 665 | 3 | 3 | [] | no_license | # ch4-`String`类型
`String`类型
* 被分配在堆上, 因此可以存储编译时未知的字符串
* 在运行时可以改变字符串
* 创建
* `String::from(string_literal)`
# C: Derivable Traits派生特征
`derive`属性
* 在有`derive`注解的类型上, 生成给定特征的默认实现的代码
以下是标准库中所有可以用于`derive`的特征
## `Debug`: 用于程序员输出
* 作用: 能够在格式化字符串中使用调试格式; 用`{:?}`表示某个值使用调式格式
* 意义: 为了调试, 允许打印某个类型的实例, 使得在程序执行时能... |
Python | UTF-8 | 2,456 | 2.890625 | 3 | [] | no_license |
import os.path
import sys
import json
from PIL import Image, ExifTags
from datetime import datetime
import shutil
from calendar import month_name
import argparse
def get_date(filename):
image_exif = Image.open(filename)._getexif()
if image_exif:
# Make a map with tag names
exif = {ExifTags.TAGS... |
Rust | UTF-8 | 297 | 2.84375 | 3 | [
"Apache-2.0"
] | permissive | use futures::{self, executor};
async fn move_block() {
let my_string = "Hello".to_string();
let f = async move {
println!("{}", my_string);
};
// 必须要f.await,否则不会执行完线程就结束
f.await
}
fn main() {
executor::block_on(move_block());
}
|
C++ | WINDOWS-1252 | 1,316 | 3.265625 | 3 | [] | no_license | #pragma once
std::string clear_the_text(std::string data)
{
std::string data_ptr;
for (int i = 0; i < data.length(); i++)
{
if (data[i] >= '' && data[i] <= '' || data[i] >= '' && data[i] <= '')
{
data_ptr += data[i];
}
}
boost::to_lower(data_ptr, std::locale(".1251"));
boost::replace_all(data_ptr, "",... |
Markdown | UTF-8 | 2,756 | 3.1875 | 3 | [] | no_license | # Laravel Passwordless Login
### A simple, safe magic login link generator for Laravel
[](https://packagist.org/packages/grosv/laravel-passwordless-login)
[:
__slots__ = ('code', 'is_builtin', '_is_date_format')
def __init__(self, code):
self.code = code
self.is_builtin = False
self._is_date_format = None... |
PHP | UTF-8 | 454 | 2.609375 | 3 | [
"MIT"
] | permissive | <?php
/**
* Created by PhpStorm.
* User: cesar
* Date: 11/04/17
* Time: 09:35
*/
namespace Api\Repositories;
use Api\Entities\Login;
use Doctrine\ORM\EntityRepository;
/**
* Class LoginRepository
* @package Api\Repositories
*/
class LoginRepository extends EntityRepository
{
/**
* @param Login $logi... |
Java | UTF-8 | 569 | 2.171875 | 2 | [] | no_license | package com.griddynamics.appiumexample.screens;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.pagefactory.AndroidFindBy;
public class ItemDetailsScreen extends AddItemScreen {
@AndroidFindBy(id = "delete_item")
private An... |
Java | UTF-8 | 2,848 | 2.140625 | 2 | [] | no_license | package com.techelevator.fbn.controller;
import java.time.LocalDate;
import javax.servlet.http.HttpSession;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind... |
C | UTF-8 | 2,150 | 3.46875 | 3 | [] | no_license | /*
* Função para remover uma locadora baseada no id.
* A remoção é feita no arquivo arqFisicoLocadoras.
*/
#include "libLocadoras.h"
void removerLocadora(char arqFisicoLocadoras[], int idLocadora){
FILE *arqLocadora = fopen(arqFisicoLocadoras, "r+b");
Locadora tmp;
int verificadorLocadora = 0;
//Verifica ... |
C# | UTF-8 | 3,196 | 2.953125 | 3 | [] | no_license | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="Status.cs" company="Gorba AG">
// Copyright © 2011-2014 Gorba AG. All rights reserved.
// </copyright>
// -----------------------------------------------------------------------... |
Java | UTF-8 | 2,625 | 2.5 | 2 | [] | no_license | package com.spring_boot_backend.product.adapter.in.stub;
import com.spring_boot_backend.product.application.ports.in.ProductRepository;
import com.spring_boot_backend.product.domain.Product;
import java.util.*;
import static java.util.stream.Collectors.toList;
public class ProductRepositoryMemory implements Product... |
Python | UTF-8 | 1,143 | 2.625 | 3 | [
"MIT"
] | permissive | """
Train Model
"""
import datetime
from fl33t.exceptions import InvalidTrainIdError
from fl33t.models.base import BaseModel
from fl33t.models.mixins import (
ManyBuildsMixin,
ManyFleetsMixin
)
# pylint: disable=no-member
class Train(BaseModel, ManyFleetsMixin, ManyBuildsMixin):
"""
The fl33t Trai... |
C++ | GB18030 | 1,169 | 3.5625 | 4 | [] | no_license | /*Accepted
1
ԭϤmap ʹãͼ쳣
˼·
mapkeyӦֵۼӼ
õ-------------------------36~39(ҪϤ)
ע⣺
1mapúʵ֣ѾkeyȻ˳
2mapӼֵԿֱ multinomial[y] = x;
3ۼӿԲøֵ0----------------32
*/
#include<iostream>
#include<map>
using namespace std;
static map<int,int> multinomial;
void group() {
int line = 2;
while (true)
{
if (line <= 0)break;
int x ... |
Markdown | UTF-8 | 52,819 | 3.15625 | 3 | [] | no_license | ---
author:
name: "Hector Mu\xF1oz"
picture: 110313
body: "I, as most mexicans have family working in the United States, so I decided
to make this post as a mean to support them asking all north american typophiles
to reject and help to stop the HR 4437 bill.\r\n\r\nThere are about 41 million hispanic
inmigra... |
C# | UTF-8 | 1,454 | 2.921875 | 3 | [] | no_license | using System;
using System.IO;
using System.Net;
using System.Xml.Serialization;
namespace Comercialon.Classes
{
public static class Cep
{
public static Xmlcep CepRetornado { get; set; }
public static Xmlcep Obter(string cep)
{
string[] dados = new string[7];
Ht... |
Swift | UTF-8 | 1,407 | 3.015625 | 3 | [] | no_license | //
// Copyright (C) 2015 About Objects, Inc. All Rights Reserved.
// See LICENSE.txt for this example's licensing information.
//
import Foundation
let Unknown = "Author Unknown"
public class Book: ModelObject
{
enum Keys: String {
case Title = "title"
case Year = "year"
case Author = "aut... |
Java | UTF-8 | 1,552 | 2.6875 | 3 | [] | no_license | package bgu.spl.mics.application.services;
import bgu.spl.mics.MicroService;
import bgu.spl.mics.application.messages.*;
import bgu.spl.mics.application.passiveObjects.*;
/**
* InventoryService is in charge of the book inventory and stock.
* Holds a reference to the {@link Inventory} singleton of the store.
* This... |
JavaScript | UTF-8 | 837 | 2.6875 | 3 | [] | no_license | export const betDescFormat = (betType, betAmount, gameData) => {
let rValue = new String();
if (betType === "HOME") {
rValue =
gameData.homeAbbreviation +
(betAmount == 0
? " Moneyline"
: betAmount > 0
? " +" + betAmount
: " " + betAmount);
} else if (betType === "... |
Java | UTF-8 | 4,066 | 2.203125 | 2 | [] | no_license | package com.howbuy.trade.dto;
/**
* 好买交易DTO
* @author LuanYi
*/
public class TradeDTO {
//交易id
private Integer tradeId;
//与custId字段关联
private Integer tradeCustId;
//基金代码
private String fundCode;
//购买金额
private String amount;
//委托号
private String contractNo;
//基金简称
priv... |
Java | UTF-8 | 698 | 2.828125 | 3 | [] | no_license | package com.day0209;
import java.util.Scanner;
public class SWEA_5688_D3_세제곱근을찾아라 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
sc = new Scanner(src);
int T = sc.nextInt();
for(int t = 1; t<= T; t++){
long result = -1;
long... |
C# | UTF-8 | 1,744 | 3.328125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace actividad3_SentenciasControl
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("MENU DE OPCIONES");
Console.WriteLine("");
... |
PHP | UTF-8 | 1,729 | 3.046875 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* Date: 2/19/2019
* Time: 9:19 AM
*/
namespace App\Kernel;
class Connection
{
private $host;
private $dbName;
private $user;
private $password;
/** @var mysqli */
private $connection;
public function __construct($host, $dbName, $user, $password = '')
... |
Python | UTF-8 | 245 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/1/29 11:45
# @Author : LiChao
# @File : C-4.12.py
def mutiply_m_n(m,n):
if m == 1:
return n
if n==1:
return m
return mutiply_m_n(m,n-1)+m
result=mutiply_m_n(8,7)
print(result) |
C# | UTF-8 | 4,517 | 2.828125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Components
{
class Program
{
static void Main(string[] args)
{
//This is an example of a testing code that you should run for all the gates that you create
//Create a gate
... |
C# | UTF-8 | 1,949 | 2.734375 | 3 | [] | no_license | using System.Configuration;
using System.Data.SqlClient;
using System.Threading;
using System.Windows.Forms;
namespace AttachedMode.Services_HomeWork2
{
public class CreatedDB
{
public static void Create()
{
ConnectionStringSettings settings = ConfigurationManager.ConnectionStrings... |
Java | UTF-8 | 8,143 | 2.625 | 3 | [
"MIT"
] | permissive | package com.jnape.palatable.lambda.adt.hlist;
import com.jnape.palatable.lambda.adt.Maybe;
import com.jnape.palatable.lambda.adt.hlist.HList.HCons;
import com.jnape.palatable.lambda.adt.product.Product3;
import com.jnape.palatable.lambda.functions.Fn1;
import com.jnape.palatable.lambda.functions.builtin.fn2.Into;
impo... |
Java | UTF-8 | 5,777 | 2.09375 | 2 | [] | no_license | package rmhub.mod.trafficlogger.service;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockit... |
Java | UTF-8 | 1,036 | 1.992188 | 2 | [] | no_license | package com.hackathon_sg.sg_hackathon_lendingAppRest;
import java.sql.Date;
import org.springframework.stereotype.Component;
public class UserVO {
private Integer user_id;
private String userName;
private String email;
private String contact_no;
private Date dob;
private String password;
public Integer ... |
Java | UTF-8 | 4,346 | 2.828125 | 3 | [] | no_license | package scxml2svg.svgcomposer;
import org.w3c.dom.*;
import java.util.List;
import scxml2svg.scxmlmodel.State;
import scxml2svg.scxmlmodel.FinalState;
import scxml2svg.scxmlmodel.HistoryState;
import scxml2svg.scxmlmodel.ParallelState;
import scxml2svg.scxmlmodel.Transition;
/**
* Layout that represe... |
Python | UTF-8 | 2,089 | 2.640625 | 3 | [
"BSD-3-Clause"
] | permissive | from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import treeano
def to_shared_dict(network):
network.build()
if not network.is_relative():
network = network[network.root_node.name]
vws = network.find_vws_in_subtree(is_shared=True)
name_to... |
Java | UTF-8 | 508 | 1.890625 | 2 | [] | no_license | package com.tangchaoke.electrombilechargingpile.thread;
import okhttp3.Call;
public abstract class MApiResultCallback {
public void inProgress(float progress){};
public abstract void onSuccess(String result);//获取成功
public abstract void onFail(String response);//联网成功,返回的不是成功数据。eg 注册时已存在
public abstract... |
Markdown | UTF-8 | 14,458 | 2.78125 | 3 | [] | no_license | # Spark Cluster in Docker / Docker Swarm
This part is to deploy a spark cluster using docker swarm. Implemented in following steps.
1. Deploy spark cluster in docker containers
2. Deploy spark cluster in docker swarm (VM)
3. Using NFS to do the file sharing in all docker machines.
4. Submit and run tasks
5. Support st... |
Python | UTF-8 | 282 | 3.4375 | 3 | [] | no_license | # 09_flush.py
import time
f = open('infos.txt', 'w')
f.write('hello')
f.flush() # 强制清空缓冲区
# for i in range(10000):
# f.write('helloooooo')
# time.sleep(0.01)
print("程序开始睡觉...zzz")
time.sleep(15)
print("程序睡醒了,继续执行")
f.close() |
Java | UTF-8 | 1,723 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | package org.robotics.car.examples;
/*
* Copyright 2016 Autonomous Open Source Project
*
*
* 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/license... |
Shell | UTF-8 | 521 | 3.59375 | 4 | [
"MIT"
] | permissive | #!/bin/bash
prog=tomcat
JAVA_HOME=${JAVA_HOME}
export JAVA_HOME
CATALANA_HOME=${CATALANA_HOME}
export CATALINA_HOME
case "$1" in
start)
echo "Starting Tomcat..."
$CATALANA_HOME/bin/startup.sh
;;
stop)
echo "Stopping Tomcat..."
$CATALANA_HOME/bin/shutdown.sh
;;
restart)
echo "Stopping Tomc... |
TypeScript | UTF-8 | 523 | 2.734375 | 3 | [] | no_license | import {Beer, Drink, Wine} from './Drink';
import {Garlic, Onion, Vegetable} from './Vegetable';
export interface RecipeFactory {
create(): Vegetable;
pick(): Drink;
}
export class OnionRecipeFacotry implements RecipeFactory {
public create(): Vegetable {
return new Onion();
}
public pick(): Drink {
... |
Go | UTF-8 | 282 | 3.296875 | 3 | [] | no_license | package two_sum
import "fmt"
func twoSum(nums []int, target int) []int {
for k, v := range nums {
for j := k + 1; j < len(nums); j++ {
if v+nums[j] == target {
return []int{k, j}
}
}
}
return nil
}
func main() {
a := twoSum([]int{3, 2, 4}, 6)
fmt.Println(a)
}
|
C | ISO-8859-1 | 1,044 | 3.859375 | 4 | [] | no_license | #include<stdio.h>
#include "fonctions_TP3.h"
void Ecriture(int tab[], int n)
{
int i;
for(i = 0; i < n; i++)
{
printf("%d ", tab[i]);
}
printf("\n");
}
/** On se sert du tableau construit. On sait que 2 est premier.
Puis pour chaque case, on part de la case precedente... |
Python | UTF-8 | 362 | 3.875 | 4 | [] | no_license | # create HTML List
items = ['first string', 'second string']
html_str = "<ul>\n"
for i in range(len(items)):
html_str += "<li>" + items[i] + "</li>\n"
html_str += "</ul>"
print(html_str)
print()
# Udacity Solution
html_str1 = "<ul>\n"
for item in items:
html_str1 += "<li>{}</li>\n".format(item)... |
PHP | UTF-8 | 701 | 2.671875 | 3 | [] | no_license | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePastQuestionsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('past_questions', function(Blueprint $table)
{
$table->increments('id'... |
PHP | UTF-8 | 2,667 | 2.546875 | 3 | [
"MIT"
] | permissive | <?php
return [
'issuer' => env('PASSPORT_ISSUER', 'passport'),
/*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the... |
Python | UTF-8 | 12,775 | 2.625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn import Parameter
import torch.nn.functional as F
from torch import tanh, sigmoid
from torch.nn.utils.rnn import pad_sequence,pack_padded_sequence,pack_sequence,pad_packed_sequence
class Encoder(nn.Module):
"""
Encoder class for Pointer-Net
"""
def __ini... |
Ruby | UTF-8 | 1,275 | 2.671875 | 3 | [] | no_license | require 'rails_helper'
RSpec.describe Competition do
describe 'relationships' do
it {should have_many(:entries)}
it {should have_many(:teams).through(:entries)}
end
before(:each) do
@competition1 = Competition.create!(name: 'Big Bowl', location: 'Atlanta', sport: 'Soccer')
@competition2 = Compet... |
Java | UTF-8 | 3,526 | 2.140625 | 2 | [] | no_license | package com.zte.html5.sysman.roleresource;
import java.util.*;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.a... |
Java | UTF-8 | 2,528 | 2.71875 | 3 | [] | no_license | package com.lucevent.newsup.backend.utils;
import com.lucevent.newsup.data.util.News;
import com.lucevent.newsup.data.util.NewsArray;
import com.lucevent.newsup.data.util.Site;
import com.lucevent.newsup.data.util.SiteLanguage;
import com.lucevent.newsup.data.util.Tags;
import java.io.IOException;
import javax.servl... |
PHP | UTF-8 | 3,845 | 2.703125 | 3 | [
"MIT"
] | permissive | <?php
class Kohana_Migration_Column {
protected $name;
protected $type;
protected $traits;
protected $size;
protected $default;
protected $null;
protected $comment;
//:float, :decimal, :time, :date, :binary, :boolean.
protected static $types = array(
'string' => array(
'type' => 'VARCHAR(... |
Java | UTF-8 | 663 | 2.484375 | 2 | [] | no_license | package br.com.server_rmi;
import java.rmi.Naming;
import java.rmi.Remote;
import java.rmi.registry.LocateRegistry;
import br.com.calculator.Calculator;
import br.com.calculator.CalculatorImpl;
public class CalculatorServer implements Remote {
public CalculatorServer(){
try {
Calculator calc... |
Python | UTF-8 | 26,222 | 2.734375 | 3 | [] | no_license | #! /usr/bin/env python
#
# Copyright 2018 (c) Pointwise, Inc.
# All rights reserved.
#
# This sample Python script is not supported by Pointwise, Inc.
# It is provided freely for demonstration purposes only.
# SEE THE WARRANTY DISCLAIMER AT THE BOTTOM OF THIS FILE.
#
"""
This module provides a wrapper around TCP comm... |
C | UTF-8 | 205 | 3.625 | 4 | [] | no_license | #include<stdio.h>
int main()
{
int n,n1;
printf("enter the number:");
scanf("%d",&n);
printf("nearest greatest number is");
n=n-1;
n1=pow(2,n);
printf("the power of number is %d",n1);
return 0;
}
|
Python | UTF-8 | 3,345 | 3.5 | 4 | [] | no_license | # class Mammals:
# def __init__(self, name, habitat, food, properties):
# self.name = name
# self.habitat = habitat
# self.food = food
# self.properties = properties
# def eat(self, food):
# res = "{0.name} поел(а) {1}".format(self, food)
# print(res)
# class Cat(Mammals):
# def say(self):... |
Java | UTF-8 | 746 | 3.09375 | 3 | [] | no_license | import java.util.Scanner;
public class Main
{
public static void main (String args[])
{
Robot Codsworth = new Robot("Codsworth", 100);
Drone Drone1 = new Drone("Drone 1", 100, 5);
IronMan IronMan = new IronMan("Iron Man", 100, 10);
Codsworth.TurnOn();
Drone1.TurnOn();
IronMan.TurnOn();... |
Java | UTF-8 | 4,790 | 2.484375 | 2 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.sg.superherosightingsspringmvc.service;
import com.sg.superherosightingsspringmvc.dao.SightingDao;
import com.sg.superhero... |
Java | UTF-8 | 446 | 1.617188 | 2 | [] | no_license | package com.l9e.transaction.service;
import java.util.List;
import java.util.Map;
import com.l9e.transaction.vo.AreaVo;
public interface CommonService {
public String query();
/**
* 获取省份
* @return
*/
public List<AreaVo> getProvince();
/**
* 获取城市
* @return
*/
public List<AreaVo> getCity(St... |
Markdown | UTF-8 | 5,053 | 3.03125 | 3 | [
"MulanPSL-2.0",
"LicenseRef-scancode-mulanpsl-2.0-en",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ---
---
---
title: 三
---
米哈伊尔·伊万内奇拿着信回到书房时,公爵坐在打开的写字台前,戴着眼镜和眼罩,蜡烛也罩上了罩子,他把拿着文件的手伸得远远的,摆着几分得意的架势读着自己的文件(他称之为书面意见),这些文件应当在他死后呈交皇上。
米哈伊尔·伊万内奇进去时,他正回忆着当初起草此刻在朗读的这些文件的那个时代而热泪盈眶。他从米哈伊尔·伊万内奇的手里接过信,放进口袋里,又把文件放好,于是叫来了早在等候的阿尔帕特奇。
他有一张纸片,上面记着需要在斯摩棱斯克办的事,阿尔帕特奇等在门口,于是公爵在他身旁踱来踱去,开始发出指示。
“首先是信笺,听着,要八刀,这个样子的;要裁口喷金……这是样品,务必要和它一样;... |
Java | UTF-8 | 389 | 2.28125 | 2 | [] | no_license | package ch.ltouroumov.heig.amt.project1.api.dto;
public class CreateUserDTO extends UserDTO {
private String password;
public CreateUserDTO(){
super();
}
public CreateUserDTO(String username){
super(username);
}
public String getPassword() { return this.password; }
publ... |
JavaScript | UTF-8 | 758 | 2.625 | 3 | [] | no_license | const escape = require('../utils/reEscape');
const { prefix } = require('../config');
const JsonFileManager = require('../utils/JsonFileManager');
const re = new RegExp(`^${escape(prefix)}setweight (\\d+(\\.\\d+)?)$`);
module.exports = {
cmdRe: re,
description: `\`${prefix}setweight <weight>\` - sets your current we... |
Python | UTF-8 | 503 | 3.0625 | 3 | [] | no_license | import logging
'''
列表合并成一个字符串
'''
logging.basicConfig(
level=logging.DEBUG,
format="\033[34m[%(asctime)s] [%(filename)s] (%(levelname)s-第%(lineno)d行)\n%(message)s\033[0m"),
def tostr(self):
if type(self) == list:
#print("OK")
s = ""
#logging.info("OK")
for i in self:
... |
C# | UTF-8 | 4,464 | 2.609375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using YetAnotherTwitchBot.Interfaces;
using YetAnotherTwitchBot.Models;
namespace YetAnotherTwitchBot.Services
{
public class ExecutiveOrderService : IExecutiv... |
Java | UTF-8 | 627 | 2.6875 | 3 | [] | no_license | package jspbook.ch14;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LogTest {
private static final Logger LOG = LoggerFactory.getLogger(LogTest.class);
public static void main(String[] args) {
LOG.trace("main()");
String msg = "Hello Log";
// Logger logger = LoggerFactory.getLogger(Log... |
TypeScript | UTF-8 | 523 | 2.953125 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | "use strict";
export default class ImageLink {
title: string;
altText: string;
uri: string;
constructor(title: string, altText: string, uri: string) {
this.title = title;
this.altText = altText;
this.uri = uri;
}
static create(title: string, uri: string): ImageLink {
... |
C | UTF-8 | 2,555 | 2.90625 | 3 | [] | no_license | /******************************************************************************
* This is the main application for the project, it repuses most of the
* code from the test applikations
*****************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <tim... |
Python | UTF-8 | 722 | 4.65625 | 5 | [] | no_license | def fn(a, b):
print(a, b)
# 实参:
# 1.位置实参: 按位置先后进行传参,a, b不能被颠倒位置进行传参,a永远比b先接受受值
fn(10, 20)
fn(20, 10)
a = 100
b = 200
fn(a, b)
fn(b, a)
#传参两种方式: 实参名 | 实参值
# 2. 关键字参数: 指名道姓进行传参, a,b能被颠倒位置进行传参,名字指向谁,就是谁接受值
c = 1000
fn(a = 10, b = c)
fn(b = 20, a = 10)
# 传参两种方式: 形参名 = 实参名 | 形参名 = 实参值
# 结合传参
def func(a, b, c):
... |
PHP | UTF-8 | 915 | 2.640625 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models\Surveys;
use Illuminate\Database\Eloquent\Model;
use App\Traits\ModelScopes;
class Target extends Model
{
use ModelScopes;
public $timestamps = false;
protected $fillable = [
'age',
'gender',
];
//jobs테이블 targets테이블 N-N (중간테이블 job_target)
publi... |
Shell | UTF-8 | 1,357 | 3.28125 | 3 | [
"MIT-0",
"LicenseRef-scancode-proprietary-license"
] | permissive | #!/usr/bin/env bash
GROUP_ID=$1
if [ -f "/greengrass/config/group-id.txt" ]; then
GROUP_ID=$(cat /greengrass/config/group-id.txt)
fi
if [ -z "$GROUP_ID" ]; then
echo "Group ID required";
exit 1
fi
REGION=$(cat /greengrass/config/region.txt)
THING_NAME=$(cat /greengrass/config/thing-name.txt)
CREDENTIAL_PROVID... |
PHP | UTF-8 | 1,064 | 2.515625 | 3 | [] | no_license | <?php
/**
* Part of flower project.
*
* @copyright Copyright (C) 2018 ${ORGANIZATION}.
* @license __LICENSE__
*/
namespace Flower\View\sakuras;
use Windwalker\Core\DateTime\Chronos;
use Windwalker\Core\View\HtmlView;
/**
* The SakurasHtmlView class.
*
* @since __DEPLOY_VERSION__
*/
cl... |
Python | UTF-8 | 1,634 | 2.640625 | 3 | [
"MIT"
] | permissive | from docx import Document
from docx.shared import Inches
from docx.opc.constants import RELATIONSHIP_TYPE as RT
def save_link():
document = Document()
document.add_heading('Document Title', 0)
p = document.add_paragraph('A hyperlink paragraph having some ')
p.add_run('bold').bold = True
p.add_ru... |
C# | UTF-8 | 978 | 2.5625 | 3 | [] | no_license | using DnDTool2.Model;
using DnDTool2.View;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace DnDTool2.ViewModel
{
public class MonsterManualVM : ViewModel
{
private O... |
Java | UTF-8 | 1,800 | 2.265625 | 2 | [] | no_license | package org.drools.workbench.screens.guided.rule.client.editor.validator;
import org.drools.workbench.models.datamodel.rule.CompositeFactPattern;
import org.drools.workbench.models.datamodel.rule.IPattern;
import org.drools.workbench.models.datamodel.rule.RuleModel;
import org.drools.workbench.screens.guided.rule.clie... |
C# | UTF-8 | 3,886 | 3.53125 | 4 | [] | no_license | using System;
namespace InfiniteLanguageDFA
{
/**
*
*
* Testing the DFS algorithm
*
*
*/
class TestDFS
{
Node[] DFA;
public TestDFS(Node[] d)
{
this.DFA = d;
}
//Old method used to test DFAs before the File Converter ... |
Java | UTF-8 | 1,907 | 2.046875 | 2 | [] | no_license | package main.project.admin.board.dao;
import java.util.HashMap;
import java.util.List;
import javax.inject.Inject;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;
import main.project.admin.board.vo.AdminBoardNoticeVO;
@Repository("adminIBoardNoticeDAO")
public class ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.