language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 1,947 | 2.296875 | 2 | [] | no_license | package org.wecancodeit.reviewsitefullstack;
import static java.util.Arrays.asList;
import java.util.Collection;
import java.util.HashSet;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToMany;
import j... |
JavaScript | UTF-8 | 1,033 | 2.59375 | 3 | [
"MIT"
] | permissive | import PropTypes from 'prop-types';
const CategoryDataPrepForChart = (categories = [], isRevenue) => {
let categoryData = [];
let amountSign = 1
categories = categories.filter((category) => {
if (isRevenue) {
return category.transaction_summary.count > 0 && category.transaction_summar... |
Java | UTF-8 | 2,494 | 2.125 | 2 | [] | no_license | package com.myideaway.coupon.model.user.service.biz;
import android.content.Context;
import com.myideaway.coupon.model.user.service.remote.UserRSChangePassword;
import com.myideaway.easyapp.core.service.BizService;
import org.json.JSONObject;
/**
* Created with IntelliJ IDEA.
* User: duanchang
* Date: 13-12-2
* T... |
C | UTF-8 | 563 | 3.171875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
void handler(int sig){
printf("signum %d\n",sig );
}
int main(void){
struct sigaction sg;
memset(&sg,0,sizeof(struct sigaction));
sg.sa_handler=handler;
if(sigaction(SIGINT,&sg,NULL) == -1){... |
Java | UTF-8 | 1,232 | 2.984375 | 3 | [] | no_license | package com.company;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.FileReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) {
Gson g = new GsonBuilder().create();
Node root = g.fromJson(new InputStreamReader(Main.class.g... |
C# | UTF-8 | 1,420 | 2.546875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class Ball : MonoBehaviour
{
public static event Action<Ball> OnBallDeath;
public static event Action<Ball> OnLightningBallEnable;
public static event Action<Ball> OnLightningBallDisable;
private Sprite... |
C++ | UTF-8 | 832 | 2.515625 | 3 | [] | no_license | #include "stdafx.h"
#include "blockReader.h"
using namespace boost::interprocess;
blockReader::blockReader(const string &path, int byteBlockSize):
byteBlockSize_(byteBlockSize),
file_(path.c_str(), read_only),
fileSize_(boost::filesystem::file_size(path)),
blockCount_(int(fileSize_ / byteBlockSize) + (fileSiz... |
C# | UTF-8 | 5,295 | 3.453125 | 3 | [] | no_license | using System;
namespace CodeCamp1
{
class Bai_1
{
// Bien luu gia tri giai thua
public long fact = 1;
public void bai_1()
{
try
{
Console.Write("Nhap mot so nguyen (n) vao day: ");
int num = Convert.ToInt32(Console.ReadL... |
Ruby | UTF-8 | 1,292 | 4.15625 | 4 | [] | no_license | # 1042. 字符统计(20)
# 请编写程序,找出一段给定文字中出现最频繁的那个英文字母。
# 输入格式:
# 输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。
# 输出格式:
# 在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统计时不区分大小写,输出小写字母。
# 输入样例:
# This is a simple TEST. There ARE numbers and other symbols 1&2&3...........
# 输出样例:
# e 7
cla... |
Python | UTF-8 | 2,124 | 2.75 | 3 | [] | no_license | import json
import pytest
from battleforcastile_match_recorder import create_app, db
from battleforcastile_match_recorder.models import Match, Turn
@pytest.fixture(scope='function')
def test_client():
flask_app = create_app('testing_config.py')
# Flask provides a way to test your application by exposing th... |
Java | UTF-8 | 2,693 | 2.375 | 2 | [] | no_license | package core.ui.overlays;
import java.awt.geom.Rectangle2D;
import java.util.LinkedList;
import org.lwjgl.opengl.GL11;
import core.Camera;
import core.Theater;
import core.network.packets.ChatPacket;
import core.setups.Stage;
import core.ui.InputBox;
import core.utilities.keyboard.Keybinds;
import core.utilities.tex... |
Python | UTF-8 | 696 | 3.875 | 4 | [] | no_license | import math
"""This is another primality test, but this is based off of the fact that any prime
number can be represented by 6k +- 1, where k is an integer. It's runtime is O(sqrt(n))"""
def isPrime(n):
#first get the corner cases
if n <= 1:
return False
elif n == 2 or n == 3:
return True
... |
C++ | UTF-8 | 1,315 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive | /*
Bézier Curves
Problem 363
The curve is constructed as follows:
On the segments P0P1, P1P2 and P2P3 the points Q0,Q1 and Q2 are drawn such that P0Q0/P0P1=P1Q1/P1P2=P2Q2/P2P3=t (t in [0,1]).
On the segments Q0Q1 and Q1Q2 the points R0 and R1 are drawn such that
Q0R0/Q0Q1=Q1R1/Q1Q2=t for the same value of t.
... |
Python | UTF-8 | 625 | 5.15625 | 5 | [] | no_license | # Write a Python program that will assign values to three variables and print them.The first variable should contain the string “Python”, the second should contain the integer 10, and the third should contain the floating point value 1000.0.
# Prompt user for a number
number_str = input("Enter a number: ")
# Store the... |
C# | UTF-8 | 4,470 | 2.703125 | 3 | [] | no_license | using System;
using System.Linq;
using System.Threading.Tasks;
using WeightLossTrackerData.Constants;
using WeightLossTrackerData.Entities;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace WeightLossTrackerData.DataContext
{
public class SeedData
{
private static User... |
Java | UTF-8 | 6,572 | 1.585938 | 2 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-unknown"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
* "License"); you may not ... |
Java | UTF-8 | 5,165 | 2.65625 | 3 | [] | no_license | package be.ehb.progproject2.eatee.db.dao;
import be.ehb.progproject2.eatee.entity.CustomSandwich;
import be.ehb.progproject2.eatee.entity.request.SandwichBody;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
public class CustomSandwichDAO extends BaseDAO {
public int createCustom(int custo... |
Java | UTF-8 | 87 | 1.507813 | 2 | [] | no_license | package net.fengyu.orderdemo.tcc;
public enum OrderStatus {
PAYED,
UPDATING
}
|
Java | UTF-8 | 751 | 2.25 | 2 | [] | no_license | package org.sa46.team09.cab.services;
/**
* @author Jason and NNH(A0180529B) SA46T9
* 2018 06 13
*/
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.sa46.team09.cab.models.User;
import org.sa46.... |
Python | UTF-8 | 855 | 2.984375 | 3 | [] | no_license | #!/bin/python3
import math
import os
import random
import re
import sys
import bisect
# Complete the triplets function below.
def triplets(a, b, c):
a=list(set(a))
b=list(set(b))
c=list(set(c))
a.sort()
b.sort()
c.sort()
ret=0
for bb in b:
ret+=bisect.bisect_ri... |
TypeScript | UTF-8 | 1,262 | 2.625 | 3 | [] | no_license | import Joi from 'joi'
import { Validator, RespostaValidacao } from '@/presentation/protocols'
import { PagamentoModel, EfetivacaoBoletoModel } from '@/domain/models'
import { ehPagamento } from '@/infra/helpers'
export class JoiValidatorAdapter implements Validator {
validar (dados: PagamentoModel | EfetivacaoBoleto... |
Markdown | UTF-8 | 36,949 | 2.984375 | 3 | [] | no_license | <br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
A Decrease font size.<br/>
A Reset font size.<br/>
A Increase font size.<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
In the world where he had originally come from, Ravovifard, the evil god of release, was the weakest kind of god, of equal rank to Fid... |
Markdown | UTF-8 | 909 | 2.640625 | 3 | [
"MIT"
] | permissive | QA is a question & answer engine
=================================
QA is a open source question & answer engine based on symfony2.
In early develope stage, you can use it for free.
How to Contribute/Setup
------------------------
* Setup your database parameters in `parameters.ini`
* Perform `sudo chmod +a "yourname... |
PHP | UTF-8 | 164,622 | 2.71875 | 3 | [
"MIT"
] | permissive | <?php
//namespace Sflf; // 名前空間が必要な場合はコメントを解除して下さい。(任意の名前空間による設定も可)
/**
* Single File Low Functionality Class Tools
*
* ■単一ファイル低機能 Validation 機能付きフォーム 基底クラス
*
* 【使い方】
* require_once "/path/to/Form.php"; // or use AutoLoader
*
* class UserForm extends Form {
* public $user_id;
* public $name;
* ... |
Java | UTF-8 | 6,088 | 2.390625 | 2 | [] | no_license | package com.four.five.dao.impl;
import java.util.List;
import javax.annotation.Resource;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;
import com.four.five.dao.UserDao;
import com.four.five.domain.Mail;
import com.four.five.domain.Notice;
import c... |
Python | UTF-8 | 665 | 4.25 | 4 | [] | no_license | # 3. По введенным пользователем координатам двух точек вывести уравнение прямой вида y = kx + b,
# проходящей через эти точки.
x1 = int(input('Введите координаты первой точки: '))
y1 = int(input('Введите координаты второй точки: '))
x2 = int(input('Введите координаты третьей точки: '))
y2 = int(input('Введите координа... |
C | UTF-8 | 327 | 3.328125 | 3 | [] | no_license | #include<stdio.h>
int main(){
int number[5][3];
int total=0;
int i,j;
for(i=0;i<5;i++){
for(j=0;j<3;j++){
printf("Input %d0%d ho person number>>",i+1,j+1);
scanf("%d",&number[i][j]);
total+=number[i][j];
}
}
printf("total person >>> %d\n",to... |
Ruby | UTF-8 | 85 | 2.828125 | 3 | [] | no_license |
def using_for
checklist = 1..10
for spell in checklist
puts "Wingardium Leviosa"
end
end
|
Markdown | UTF-8 | 1,095 | 2.9375 | 3 | [
"MIT"
] | permissive | ---
title: "카테고리 등록해보기"
excerpt: "특정 카테고리 1개만 보이는 페이지 및 메뉴 생성하기"
toc: true
toc_sticky: true
toc_label : "페이지 목차"
categories:
- Blog
tags:
- GitHub
last_modified_at: 2020-03-03T17:00:00-00:00
---
# 1. Category 등록
_pages 폴더에 페이지를 하나 추가해준다.
```yml
---
title: "알고리즘"
permalink: /categories/Algorithm/
layout: categ... |
PHP | UTF-8 | 769 | 2.5625 | 3 | [] | no_license | <?php
namespace Qihucms\Role\Commands;
use Illuminate\Console\Command;
class CheckExpiresCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'role:checkExpires';
/**
* The console command description.
*
... |
C++ | UTF-8 | 2,630 | 2.65625 | 3 | [] | no_license | /*************************************************************************
> File Name: frame.h
> Author: Yonghua HU.
> Mail: yonghuahu@outlook.com
> Created Time: Mon 31 Mar 2014 03:10:42 AM PDT
************************************************************************/
#ifndef __GENERAL_HEAD_H_
#defin... |
C | UTF-8 | 1,417 | 3.5625 | 4 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#define INFINITY 9999
#define undefined -1
struct edges{
int src,dst,w;
};
void bellman_ford(int V,int E,struct edges *e,int src){
int *dist=(int *)malloc(sizeof(int)*V);
int *pred=(int *)malloc(sizeof(int)*V);
int i,j,u,v;
for(i=0;i<V;i++){
dist[i]=INFINITY;
pred[i]=undef... |
Python | UTF-8 | 201 | 3.5 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# 계산기 만들기
def plus(a,b):
return a+b
def subtract(a,b):
return a-b
def multiply(a,b):
return a*b
def divide(a,b):
if b==0:
return 0;
else:
return a/b
|
Markdown | UTF-8 | 3,189 | 3.09375 | 3 | [] | no_license | ## 学习理论
####$Markov$不等式和$Chernoff$边界
对随机变量 $X$ 和 $\varepsilon>0$ , 有:
$p(|x|\ge\varepsilon)\le \frac{1}{\varepsilon^\alpha}E(|x|^\alpha),\forall \alpha>0$
证明:
$ \frac{1}{\varepsilon^\alpha}E(|x|^\alpha)=\int_{\Omega}\frac{|x|^\alpha}{\varepsilon^\alpha}f(x)dx\ge \int_{|x|\ge\varepsilon}\frac{|x|^\alpha}{\varepsilo... |
Java | UTF-8 | 1,905 | 3.5625 | 4 | [] | no_license | package Alogorithms.dynamic.programming;
import java.util.ArrayList;
/**
* 钢条切割问题
*/
public class SteelCut {
final static int[] p;
static {
p = new int[]{0, 1, 5, 8, 9, 10, 17, 17, 20, 24, 30};
}
public static void main(String[] args) {
ArrayList<SN> arrayList = SteelCut.extended... |
Java | UTF-8 | 2,213 | 3.640625 | 4 | [
"MIT"
] | permissive | package com.evolutionofmoths.evolution;
import com.evolutionofmoths.evolution.util.ChromosomeConverterUtil;
import com.evolutionofmoths.evolution.util.GeneticRandomnessUtil;
/**
* Class that defines the structure of a Chromosome.
*/
public class Chromosome {
// A set of genes constitutes a chromosome.
private Ge... |
PHP | UTF-8 | 2,944 | 3.09375 | 3 | [] | no_license | <?php
/**
* @file classes/cache/GenericCache.inc.php
*
* Copyright (c) 2013-2015 Simon Fraser University Library
* Copyright (c) 2000-2015 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class GenericCache
* @ingroup cache
*
* @brief Provides implementation-i... |
C | UTF-8 | 4,058 | 3.234375 | 3 | [
"MIT"
] | permissive |
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "semver.h"
#define MAX_LEN 4097
bool quiet = false;
bool reverse = false;
bool help = false;
bool only_ver = false;
char sep = ' ';
int field = 1;
int compare_func(const void *pindex1, const void *pindex2, void *data) {
... |
C++ | UTF-8 | 546 | 2.984375 | 3 | [] | no_license | #include <iostream>
#include "Controller/Controller.h"
using namespace std;
int main() {
Controller* controller = new Controller();
for (int i = 0; i < 10; ++i) {
controller->pushTop(i);
}
cout << "Lista 1" << endl;
for (int i = 0; i < 10; ++i) {
cout << controller->popBottom() <... |
Go | UTF-8 | 2,709 | 2.609375 | 3 | [] | no_license | package s3
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net/url"
"time"
minio "github.com/minio/minio-go/v6"
)
const defaultRegion = "us-east-1"
var ErrNotFound = errors.New("seeker can't seek")
type Bucket struct {
client *minio.Client
name string
conf Config
}
type File interface {
io.Reader
... |
Markdown | UTF-8 | 1,641 | 2.71875 | 3 | [] | no_license | # Performance Evaluation
### Daily Standups
Do the daily standups! If you don't do them then we have no idea about the obstacles you are facing. We give you the opportunity to let us know about these obstacles up front so that we can work through them together to meet deadlines. If you don't do daily standups and furt... |
Java | UTF-8 | 12,898 | 2.25 | 2 | [] | no_license | package com.example.brionsilva.raven;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.io.... |
Python | UTF-8 | 6,915 | 2.625 | 3 | [
"WTFPL"
] | permissive | import os
import os.path as osp
import pickle
import threading
import logging
import cv2
from multiprocessing import Pool
class DataFrame():
def __init__(self, foldername, mode='r', debug=False):
print('Initializing sulio dataframe...')
assert mode in ['r', 'w'], 'only read or write mode'
foldername = os... |
JavaScript | UTF-8 | 867 | 2.578125 | 3 | [
"MIT"
] | permissive | import Mixin from '@ember/object/mixin';
export default Mixin.create({
xDown: null,
yDown: null,
handleTouchStart(evt) {
const firstTouch = this.getTouches(evt)[0];
this.set('xDown', firstTouch.clientX);
this.set('yDown', firstTouch.clientY);
},
handleTouchMove(evt) {
const { xDown, yDown }... |
Shell | UTF-8 | 2,065 | 4 | 4 | [
"NCSA",
"LLVM-exception",
"MIT",
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
#===- libcxx/utils/docker/scripts/install_clang_package.sh -----------------===//
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
#===------------... |
Markdown | UTF-8 | 1,180 | 2.734375 | 3 | [] | no_license | # homeMadeBatchSys
This is the repo of a very simple, home-made batch system.
It is supposed to collect very basic settings and scripts to allow for a job queueing system.
Nota Bene: the system is supposed to run on a linux machine!
The system is not supposed to scale up significantly in throughput, but it is supposed... |
Java | UTF-8 | 1,701 | 2.28125 | 2 | [] | no_license |
package cz.dynawest.jtexy.modules;
import cz.dynawest.jtexy.RegexpInfo;
import cz.dynawest.jtexy.TexyException;
import cz.dynawest.jtexy.parsers.TexyParser;
import cz.dynawest.jtexy.parsers.TexyEventListener;
import cz.dynawest.jtexy.util.MatchWithOffset;
import java.util.List;
import org.dom4j.Node;
import org.dom4j... |
JavaScript | UTF-8 | 2,974 | 3.125 | 3 | [] | no_license | const inquirer = require('inquirer');
const Listr = require('listr');
/**
* [Command class definition to be extended by commands]
*/
class Command {
/**
* [run description]
* Call this from the commands index file
* @return {[ Promise ]} [ Resolves after all steps are complete ]
*/
run = () => new Pr... |
Java | UTF-8 | 779 | 2.5625 | 3 | [] | no_license | //
// Decompiled by Procyon v0.5.29
//
package com.vontu.util.date;
import java.util.Date;
import java.util.TimeZone;
public class LastMonth extends DateRange
{
public LastMonth() {
}
public LastMonth(final TimeZone timeZone) {
super(timeZone);
}
@Override
public Date getF... |
C++ | UTF-8 | 3,018 | 4.34375 | 4 | [] | no_license | //---------------------------------------------------- POINTER CONCEPTS ----------------------------------------------------------------/
#include <iostream>
using namespace std;
int main()
{
// //---------------------------------What is a pointer? ----> Data type which holds the address of other data types-------... |
TypeScript | UTF-8 | 1,842 | 2.765625 | 3 | [
"BSD-3-Clause"
] | permissive | import * as babylon from 'babylon';
export abstract class Node<T extends babylon.Node> {
private _instrumented: boolean;
private _raw: T;
private _parent: Node<any>;
private _start: number;
private _end: number;
constructor(raw: T, parent?: Node<any>, instrumented = false) {
this._raw = raw;
... |
Markdown | UTF-8 | 656 | 3.140625 | 3 | [] | no_license | # Module 1(Lesson 3) - Navigation
-----
## Sidebar Static Navigation
- Anchored to a section of the screen.
- Simple flat navigation
- All links are visible at all times for easy use
## Hamburger Menu
- Top left corner of the UI(User Interface)
- Toggles between a hidden menu and expanded menu
- Resembles a Hambur... |
Markdown | UTF-8 | 1,573 | 2.96875 | 3 | [] | no_license | ---
layout: default
title: Apprendre à créer une page Facebook
permalink: /facebook-creer-page/
creator: necropotame
contentdescription:
---
## Créer une page Facebook pour votre candidature
Vous devez déjà posséder un compte facebook. Dans cette aide, c’est “Charlotte Rargie” qui utilisera son compte Facebook pour s... |
Python | UTF-8 | 1,366 | 2.671875 | 3 | [] | no_license | import time
import os
import RPi.GPIO as GPIO
# import schedule
import detection_db
from send_email import sendEmail
GPIO.setmode(GPIO.BCM)
GPIO.setup(12, GPIO.IN, GPIO.PUD_DOWN)
GPIO.setup(4, GPIO.IN, GPIO.PUD_DOWN)
start = pir1_last = pir2_last = time.time()
def callback_func(pin):
global pir1_last
global ... |
Java | UTF-8 | 515 | 1.96875 | 2 | [] | no_license | package com.fujigo.services;
import java.util.List;
import com.fujigo.beans.Payment;
import com.fujigo.exceptions.ServiceException;
public interface PaymentService {
List<Payment> findAllPayments()throws ServiceException;
Payment findById(int paymentId)throws ServiceException;
void add(Payment payment)throws S... |
Java | UTF-8 | 575 | 2.25 | 2 | [] | no_license | package com.devyk.android_dp_code.abstract_factory;
import android.content.Context;
/**
* <pre>
* author : devyk on 2019-09-05 22:45
* blog : https://juejin.im/user/578259398ac2470061f3a3fb/posts
* github : https://github.com/yangkun19921001
* mailbox : yang1001yk@gmail.com
* desc : ... |
Markdown | UTF-8 | 6,911 | 2.9375 | 3 | [] | no_license | ---
title: tcp状态
date: 2015-04-01 19:39:05
categories: 网络
tags: 网络
photos: "2015/04/01/tcp状态/tcp_state.gif"
---
全部11种状态
1. 客户端独有的:(1)SYN_SENT (2)FIN_WAIT1 (3)FIN_WAIT2 (4)CLOSING (5)TIME_WAIT
2. 服务器独有的:(1)LISTEN (2)SYN_RCVD (3)CLOSE_WAIT (4)LAST_ACK
3. 共有的:(1)CLOSED (2)ESTABLISHED
各个状态的意义如下:
(1) LISTEN - 侦听来自远方... |
C | UTF-8 | 14,339 | 2.984375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "generacion.h"
void escribir_subseccion_data(FILE* fpasm)
{
fprintf(fpasm, "segment .data\n");
fprintf(fpasm, "\t_msg_error_div db \"Error, división por 0\", 0 \n");
fprintf(fpasm, "\t_msg_error_vector db \"Indice del vector fuera de r... |
Java | UTF-8 | 681 | 2.6875 | 3 | [] | no_license | package com.teron.zoomari.utils.pathfinding;
import com.badlogic.gdx.ai.pfa.Heuristic;
/**
* Created by Tejas Sharma on 5/15/2017.
*/
public class HeuristicImp implements Heuristic<Node> {
@Override
public float estimate(Node startNode, Node endNode) {
int startIndex = startNode.getIndex();
... |
Java | UTF-8 | 566 | 3.15625 | 3 | [
"MIT"
] | permissive | package ru.demi.java5;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.Month;
import static java.time.Month.JANUARY;
public class StaticImportExample {
private static final Logger log = LoggerFactory.getLogger(StaticImportExample.class);
public static void main(String[] args) {
... |
Python | UTF-8 | 1,192 | 3.53125 | 4 | [] | no_license | class BikeShops(object):
""" Bike Shops have a name, an inventory.
Bike shops also sell bikes for a profit and can report that profit.
"""
def __init__(self, shop_name, inventory_list, customer_list):
self.shop_name = shop_name
self.inventory_list = inventory_list
self.customer_list = customer_list
self.sh... |
JavaScript | UTF-8 | 3,365 | 2.53125 | 3 | [] | no_license | import React, { memo, useState } from "react";
import {
ComposableMap,
Geographies,
Geography,
ZoomableGroup
} from "react-simple-maps";
const geoUrl =
"https://raw.githubusercontent.com/zcreativelabs/react-simple-maps/master/topojson-maps/world-110m.json";
const rounded = (num) => {
if (num > 1000000000)... |
Java | UTF-8 | 1,163 | 2.078125 | 2 | [] | no_license |
package doubandao;
public class Comment {
private String Users_ID;
private String Movie_ID;
private String IsWatch;
private String Comment_Content;
private int Score;
private java.sql.Timestamp Comment_Date;
private String IsPhone;
public String getUsers_ID() {
return Users_ID;
}
public void setUsers_ID(S... |
C# | UTF-8 | 951 | 2.9375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ChessDevio.Models
{
public class Knight : Piece
{
public override bool AllowMove(Position newPosition, List<Piece> myPieces, List<Piece> opPieces)
{
// Jeśl... |
Markdown | UTF-8 | 2,426 | 3.40625 | 3 | [] | no_license | # m-todos-que-tiene-pila-y-cola-Stack-Queue-
Comparación entre Pilas y Colas
Pilas:
• En las Pilas se puede acceder a los elementos de la lista solo a través de la cima de la misma.
• Se puede acceder a los elementos de la Pila solo a través del sistema LIFO.
• Se considera como una estructura de datos Las In Fist Ou... |
Swift | UTF-8 | 1,939 | 2.640625 | 3 | [] | no_license | import UIKit
import Firebase
class FirstPage: UIViewController {
@IBOutlet weak var backgroundImage: UIImageView!
@IBOutlet weak var loginBtn: UIButton!
@IBOutlet weak var signupBtn: UIButton!
@IBOutlet weak var emailTxt: UITextField!
@IBOutlet weak var pwdTxt: UITextField!
override f... |
PHP | UTF-8 | 29,532 | 2.796875 | 3 | [] | no_license | <?php
use Slim\App;
use Slim\Http\Request;
use Slim\Http\Response;
return function (App $app) {
$container = $app->getContainer();
$app->get('/[{name}]', function (Request $request, Response $response, array $args) use ($container) {
// Sample log message
$container->get('logger')->info("Slim... |
Java | UTF-8 | 440 | 2.078125 | 2 | [] | no_license | package com.BulkSMS;
import java.util.ArrayList;
public class ArrayListMenuSetting {
public ArrayList<MenuItemList> arraylist;
ArrayListMenuSetting(){
arraylist = new ArrayList<MenuItemList>();
}
public ArrayList<MenuItemList> GetMenuSetting(){
MenuItemList menu1 = new MenuItemList();
menu1.SetTitle("Thi... |
PHP | UTF-8 | 529 | 3.28125 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
</head>
<body>
<?php
$string = <<<example
echo 'Lokale variabelen kunnen alleen in de functie in die ze toegewezen zijn worden gebruikt.<br>
Globale variabelen kunnen overal in het programma worden gebruikt.<br>
Om globale variabelen in functies te kunnen gebruiken moet je er "global" voor... |
JavaScript | UTF-8 | 180 | 3.375 | 3 | [] | no_license | const climbStairs=function (n) {
const f=[];
f[1]=1;
f[2]=2;
for(let i=3;i<=n;i++){
f[i]=f[i-1]+f[i-2]
}
return f[n]
}
console.log(climbStairs(99))
|
Markdown | UTF-8 | 3,336 | 3.53125 | 4 | [] | no_license | ## 配列
前回for文をやったんですが、それに相性のいいものを紹介します。
それが配列です。こうやって使います。
`$a=[0,1,2,3,"abcde",true];`
( ゚Д゚)
驚くでしょうw
変数には1つしか入らない、バケツだと。お前が言ったんだろう、と。
その話は変数の話です。今は配列です。
詳しくはオブジェクト指向のお話になります。
配列とは
* 基本的には変数と同じ注意
* 変数と間違えないように[]でくくる。
* 宣言時、大かっこ[]のなかに好きなだけ要素を入れられる。
* 使いたいときはa[0]とかa[2]とか書いて使う。
etc....
このあたりからすべて説明すると書ききれ... |
Java | UTF-8 | 319 | 2.0625 | 2 | [] | no_license | package blog.ex.lombok.domain.constructor;
import static org.assertj.core.api.Assertions.*;
import org.junit.jupiter.api.Test;
class AllMemberTest {
@Test
void allArgsConstructorTest() {
AllMember allMember = new AllMember("럿고@gmail.com", "럿고", 28);
assertThat(allMember).isNotNull();
}
}
|
C++ | GB18030 | 7,772 | 2.640625 | 3 | [] | no_license | #include "sift.h"
using namespace cv;
static bool isExtrema(vector<vector<Mat>> dog_list, int octa, int interv, int xi, int yi);
static bool interLocation(vector<vector<Mat>> dog_list, int octa, int &interv, int& xi, int& yi,
float contr_thr, int num_intervals,double& p);
static bool isEdge(vector<vector<Mat>> dog_... |
TypeScript | UTF-8 | 236 | 2.765625 | 3 | [
"MIT"
] | permissive | interface Page {
Name: string;
tags?: string[];
}
interface Folio extends Page {
kind: "folio";
Inhalt: object;
}
interface Chapter extends Page {
kind: "chapter";
folios?: Folio[];
}
export type IPage = Folio | Chapter;
|
C# | UTF-8 | 939 | 2.515625 | 3 | [] | no_license | public class NugetPlatformModel
{
public bool IsHavingLicense { get; set; }
public List<PlatformProducts> PlatformProduct = new List<PlatformProducts>();
public NugetPlatformModel(IPlatformProductProvider provider)
{
var xmldoc = new XmlDocument();
//System.... |
Markdown | UTF-8 | 20,457 | 3.328125 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-proprietary-license"
] | permissive | ---
layout: post
title: 操作系统学习-02-03-如何写出让 CPU 跑得更快的代码?
date: 2023-04-03 +0800
categories: [Linux]
tags: [linux, os, sh]
published: true
---
# 如何写出让 CPU 跑得更快的代码?
代码都是由 CPU 跑起来的,我们代码写的好与坏就决定了 CPU 的执行效率,特别是在编写计算密集型的程序,更要注重 CPU 的执行效率,否则将会大大影响系统性能。
CPU 内部嵌入了 CPU Cache(高速缓存),它的存储容量很小,但是离 CPU 核心很近,所以缓存的读写速度是极快的,那么如果 CPU ... |
SQL | UTF-8 | 325 | 2.90625 | 3 | [
"MIT"
] | permissive | select top 20
author,
title,
category,
url,
net_votes,
pending_payout_value,
children,
JSON_QUERY(json_metadata, '$.tags')
from
Comments (NOLOCK)
where
title <> '' and
parent_author = '' and
category = 'utopian-io' and
datediff(hour, created, GETDATE()) between 0 and 2*24
order by
children... |
JavaScript | UTF-8 | 414 | 2.796875 | 3 | [] | no_license | const ingredients = [
'Картошка',
'Грибы',
'Чеснок',
'Помидоры',
'Зелень',
'Приправы',
];
const listIngredientsRef = document.querySelector('#ingredients');
const itemIngredients = ingredients.map(option => {
const itemRef = document.createElement('li');
itemRef.textContent = option;
return itemRef... |
Java | UTF-8 | 238 | 1.976563 | 2 | [] | no_license | package com.observepoint.test.test.exceptions;
public class ResourceNotFoundException extends RuntimeException{
public ResourceNotFoundException(String message)
{
super("Error from Test ObservePoint " + message);
}
}
|
C++ | UTF-8 | 1,763 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | #include "resp_decode.h"
#include "resp_encode.h"
#include <iostream>
using namespace resp;
using namespace std;
int main(void){
char *str = "*1\r\n$4\r\nPING\r\n";
resp_decode decode;
resp_encode encode;
resp_decode_result result;
decode.inprocessBuffer(str, strlen(str), result);
cout << ... |
PHP | UTF-8 | 1,766 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | <?php
require_once($_SERVER['DOCUMENT_ROOT'].'/php/util/global.php');
$GLOBALS['database'] = new mysqli("localhost", "ec2-user", "", "HealthTechSchema");
function sql_to_assoc( $db, $query ){
$r = mysqli_query($GLOBALS['database'], $query);
$rs = [];
while ($row = $r->fetch_assoc()) {
array_push($rs, ... |
C# | UTF-8 | 1,726 | 3.59375 | 4 | [] | no_license |
namespace System
{
public static partial class RandomHelper
{
/// <summary>
/// 返回随机字节。
/// </summary>
/// <returns>小于 MaxValue 的无符号 8 位整数。</returns>
public static byte NextByte()
{
return Rand.NextByte();
}
/// <summary>
///... |
JavaScript | UTF-8 | 1,203 | 3.84375 | 4 | [] | no_license | /* hollandsBroodje
/* Leg de het onderste broodje klaar
leg hier kaas op
Dek af met bovenste broodje */
function hollandsBroodje() {
console.log('Leg de het onderste broodje klaar');
console.log('leg hier kaas op');
console.log('Dek af met bovenste broodje');
};
hollandsBroodje()
// De functie ... |
JavaScript | UTF-8 | 1,458 | 2.75 | 3 | [
"BSD-2-Clause"
] | permissive | function ImageLoadBar_hook(ctx, width, height, total, current, image) {
// change these to your liking:
var backgroundColor = "#000000";
var barBackgroundColor = "#000000";
var barForegroundColor = "#1AC819";
var barBorderColor = "#FFFFFF";
var barWidth = Math.round(width * 0.6);
var barHeight = 20;
var barBord... |
C# | UTF-8 | 47,036 | 2.734375 | 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.Threading.Tasks;
using System.Windows.Forms;
namespace WFAProyecto_King_of_Maths
{
public partial class Niveles_SUMA : Form
{
ClassSu... |
Python | UTF-8 | 2,805 | 2.984375 | 3 | [] | no_license | import os
import sys
import requests
from concurrent.futures import ThreadPoolExecutor
class JDonwload(object):
"""从网页下载m3u8视频"""
# 线程池的最大线程数
MAX_WORKERS = 10
def __init__(self, url):
"""根据url初始化一些参数"""
self.exist_file = 0
self.folder_name = url.split("/")[-2]
# m3u... |
PHP | UTF-8 | 1,356 | 2.75 | 3 | [] | no_license | <?php
//Follow.php
//Written by Qianwen
include('lib/common.php');
if (!isset($_SESSION['email'])) {
header('Location: login.php');
exit();
}
$currentUser=$_SESSION['email'];
$currentCbID=$_SESSION['cbID'];
$CBowner=$_SESSION['owner'];
//-------------------check if current user is following the owner-----//... |
PHP | UTF-8 | 861 | 3.078125 | 3 | [
"MIT"
] | permissive | <?php declare(strict_types=1);
namespace Proto\Pipe;
use Proto\Pack\Pack;
use React\EventLoop\LoopInterface;
use React\Stream\WritableResourceStream;
class Connector implements ConnectorInterface
{
private $pipe;
/**
* @var WritableResourceStream
*/
private $stream;
public function __cons... |
PHP | UTF-8 | 1,083 | 2.578125 | 3 | [] | no_license | <?php
header('Content-Type: text/html; charset=utf-8'); //网页编码
function encrypt($data, $key) {
$key = md5 ( $key );
$x = 0;
$len = strlen ( $data );
$l = strlen ( $key );
for($i = 0; $i < $len; $i ++) {
if ($x == $l) {
$x = 0;
}
$char .= $key {$x};
$x ++;
}
for($i = 0; $i < $len; $i ++) {
$str .= ch... |
Java | UTF-8 | 279 | 1.976563 | 2 | [] | no_license | package app.csumb2017.cst338.student4338.project2.library;
/**
* Created by Ben on 5/11/2017.
*/
public class CreateHoldInvalidTimespanException extends RuntimeException {
public CreateHoldInvalidTimespanException() {
super("Invalid checkout duration.");
}
}
|
JavaScript | UTF-8 | 1,698 | 2.9375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | import { useEffect, useRef } from 'react';
export default (callback, delay = 1000) => {
const callbackFunc = useRef(callback);
const timerHandle = useRef(null);
const shouldPoll = useRef(true);
// Without this, we could have overlapping executions of async`callback` running if `delay` changes
// ... |
Swift | UTF-8 | 4,034 | 2.546875 | 3 | [] | no_license | //
// UsersListViewController.swift
// UsersList
//
// Created by Alex on 23/10/2018.
// Copyright © 2018 Alex. All rights reserved.
//
import UIKit
import Kingfisher
class UsersListViewController: UITableViewController {
var users: [User] = []
@IBOutlet weak var indicator: UIActivityIndicatorView!
... |
Java | UTF-8 | 1,459 | 3.015625 | 3 | [] | no_license | import javax.swing.plaf.nimbus.State;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.regex.Pattern;
public class SelectSQL {
public static void main(String[] args) {
Connection con = null;
Statement st = null;
... |
C | UTF-8 | 1,755 | 2.90625 | 3 | [] | no_license | /*
* UARTc.c
*
* Created: 1/23/2021 6:11:25 PM
* Author: Arafa
*/
#include "MyKit.h"
#include <avr/io.h>
#include "UART.h"
#include <stdlib.h>
#include "GPIO.h"
void UART_Init(unsigned int BR)
{
/*UART_BaudRate(BR);
Dir_B(out_pin,0); //Master
UCSRC = 0b11000111; //for synchronus
*/
//UCSRC = 0b11000110... |
Go | UTF-8 | 907 | 3.609375 | 4 | [] | no_license | package main
import (
"fmt"
)
/*
- going to be given 1000 sorted iterators. An iterator looks like this:
iterator {
next() int
hasNext() bool
}
- you are guaranteed that they come back in order
- goal: return the lowest 100 globally
fn GetLowest100(iters) {
// put pair of (value, iterator) in queue
pq = Priori... |
Python | UTF-8 | 1,978 | 2.875 | 3 | [] | no_license | from os.path import join as joinpath
import csv
from numpy import interp as interpolate
from pydevsim import DS_DATADIR
class AM0(object):
"""docstring for GenericLightSource"""
def __init__(self, lambda_min=280, lambda_max=4000, samples=None):
self.lambda_min = lambda_min
self.lambda_max = la... |
JavaScript | UTF-8 | 2,114 | 2.625 | 3 | [] | no_license | import React, { useState, useEffect } from "react";
import "./App.css";
import Lists from "./componets/Lists";
import Todos from "./componets/Todos";
function App() {
const fetchedLists = () => JSON.parse(localStorage.getItem("lists")) || [];
const fetchedActiveListId = () =>
localStorage.getItem("active-list... |
C++ | UTF-8 | 11,498 | 2.75 | 3 | [
"MIT"
] | permissive |
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <map>
using namespace std;
#define OUTPUT_DEBUG1... |
C++ | UTF-8 | 1,670 | 2.640625 | 3 | [] | no_license | #pragma once
#include "IndexedGeometry.h"
#include "AftrGlobals.h"
#include "Vector.h"
#include <vector>
namespace Aftr
{
class IndexedGeometryLines : public IndexedGeometry
{
public:
/// In passed vectors are NOT owned by this instance, they are only read/copied into graphical data structures during ... |
SQL | UTF-8 | 586 | 2.875 | 3 | [] | no_license | --
-- This only works under Oracle and has the limitation of 1 to 3999
--- Higher numbers in the Middle Ages were represented by "superscores" on top of the numeral to multiply by 1000
--- Vertical bars to the sides multiply by 100. So |M| means 100,000
-- When the query is run, user provides the Arabic numerals for t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.