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 | 533 | 2.921875 | 3 | [] | no_license | using Node.Interfaces;
using System;
namespace Node
{
class Program
{
static string configFile = "Node.ini";
static void Main(string[] args)
{
IConfig config = new Config(configFile);
Node node = new Node(config);
while (true)
{
... |
PHP | UTF-8 | 3,216 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use App\DataTables\FAQDataTable;
use App\Http\Requests;
use App\Http\Requests\CreateFAQRequest;
use App\Http\Requests\UpdateFAQRequest;
use App\Repositories\FAQRepository;
use Flash;
use App\Http\Controllers\AppBaseController;
use Response;
class FAQController extends AppBaseCon... |
Markdown | UTF-8 | 14,497 | 2.59375 | 3 | [] | no_license | # 【Boost】boost库asio详解3——io_service作为work pool - DoubleLi - 博客园
无论如何使用,都能感觉到使用boost.asio实现服务器,不仅是一件非常轻松的事,而且代码很漂亮,逻辑也相当清晰,这点上很不同于ACE。
使用io_service作为处理工作的work pool,可以看到,就是通过io_service.post投递一个Handler到io_service的队列,Handler在这个io_service.run内部得到执行,有可能你会发现,io_services.dispatch的接口也和io_service.post一样,但不同的是它是直接调用而不是经过push... |
TypeScript | UTF-8 | 324 | 4.0625 | 4 | [] | no_license | /**
* 数组中每一项都应该是输入的 value 的类型
* @param length
* @param value
* @returns
*/
function createArray<T>(length: number, value: T): Array<T> {
let result: T[] = [];
for (let i = 0; i < length; i++) {
result[i] = value;
}
return result;
}
createArray<string>(3, "x");
|
Java | UTF-8 | 1,735 | 2.859375 | 3 | [] | no_license | package models;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Objects;
public class Cohort {
private int cohort_id;
private String name;
private String module;
private Timestamp startDate;
private Timestamp endDate;
public Cohort( String name, String module, Timestam... |
C++ | UTF-8 | 8,562 | 2.546875 | 3 | [] | no_license | #include "Light.h"
#include "Cube.h"
#include <glm/gtc/matrix_transform.inl>
//BAD!! NEVER statically INITIALIZE GLEW STUFF!!! GLEW INIT WILL NOT BE CALLED AT THIS TIME!!!
//Shader* Light::defaultShader = new Shader("src/Shaders/Light_And_Shadow/VertexLight.vs", "src/Shaders/Light_And_Shadow/FragmentLight.fs");
void ... |
C++ | UTF-8 | 3,101 | 2.546875 | 3 | [] | no_license | /**
* @file Plugin.hpp
* @author Ludvig Arlebrink
* @date 9/27/2018
*/
#pragma once
#include "BaseTypes.hpp"
#include "CoreAPI.hpp"
#include "Status.hpp"
#include <string>
#ifdef _WIN32
#include <Windows.h>
#elif __linux__
// @todo Linux implementation.
#endif // _WIN32
namespace gdt
{
namespace ... |
Python | UTF-8 | 4,926 | 3.515625 | 4 | [] | no_license | """
EXTERNAL LIBRARIES
"""
import sys
import numpy as np
import random
import matplotlib.pyplot as plt
import math
"""
INTERNAL UTIL LIBRARIES
"""
# Add parent directory to the sys path
sys.path.append('../')
# Import any python modules from parent directory
from utils.auxfunctions import plot_decision_boun... |
C++ | UTF-8 | 1,271 | 2.5625 | 3 | [] | no_license | #ifndef motion_h
#define motion_h
#include <Servo.h>
#include <Octosnake.h>
class Motion{
public:
Motion (int hip1, int knee1, int hip2, int knee2, int hip3, int knee3, int hip4, int knee4);
void init();
void runs(float steps, int period);
void walk(float steps, int period);
void back(float steps,... |
Python | UTF-8 | 1,551 | 2.96875 | 3 | [
"MIT"
] | permissive |
# coding: utf-8
# In[6]:
import os
import string
import nltk
from nltk import word_tokenize,WordNetLemmatizer,PorterStemmer,RegexpTokenizer
from collections import defaultdict
from nltk.util import ngrams
# In[5]:
topic_path = ''
ref_path = ''
regex= RegexpTokenizer(r'\w+')
# In[14]:
def abstract(topic,sum... |
Python | UTF-8 | 1,117 | 2.625 | 3 | [] | no_license | """
# 字符串整理
通过 `cat /etc/services` , 我们可以列举 linux 常见的网络端口
但是这个文件里的内容, 对于机器是易读, 但对于人而言却排版有点乱
现在, 我们需要把该文件内容重新整理, 使其整整齐齐, 一目了然
整理的需求如下:
1. 对齐所有的行列
2. 不使用 tab, 全使用空格
3. 两列之间的空格至少为4个
eg: 整理前[L193,L199]
klogin 543/tcp # Kerberized `rlogin' (v5)
kshell 544/tcp krcmd # Kerberized `rsh' (v5)
dhcpv6-cli... |
Swift | UTF-8 | 7,050 | 2.59375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"Swift-exception"
] | permissive | //===----------------------------------------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/L... |
C++ | UTF-8 | 688 | 2.78125 | 3 | [] | no_license | #include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <fstream>
#include <cmath>
#include <sstream>
#include <bits/stdc++.h>
#include <climits>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string instr;
int four = 0,seven = 0;
cin >> in... |
Java | UTF-8 | 387 | 2.796875 | 3 | [] | no_license | class ManejoDeVariables{
public static void main(String[] args) {
int a=0;
int b=20;
double c=30.3;
//realizamos alguna modificación en el archivo para que se suba el branch
double d=40.3;
System.out.println(a);
System.out.println(b);... |
JavaScript | UTF-8 | 804 | 2.734375 | 3 | [] | no_license | function buscar() {
var nombre = $("#txtId").val();
$.ajax({
type: 'POST',
url: 'buscadordistributor.do',
data: {
dato: nombre
},
success: function (result) {
$("#resultado").html(result);
}
});
}
function validateFormIndex(){... |
Markdown | UTF-8 | 2,618 | 2.859375 | 3 | [
"MIT"
] | permissive | # PHYS220 CW 5
**Author(s):** Aaron Grisez, Preston Kamada_
[](https://travis-ci.org/chapman-phys220-2016f/cw-05-YOURNAME)
**Due date:** 2016/10/04
## Specification
**Note: As of this assignment, we will be switching to Py... |
Markdown | UTF-8 | 9,252 | 2.609375 | 3 | [] | permissive | # SNMP How-To
## Simulate SNMP devices
SNMP is a protocol for gathering metrics from network devices, but automated testing of the integration would not be practical nor reliable if we used actual devices.
Our approach is to use a simulated SNMP device that responds to SNMP queries using [simulation data](./sim-form... |
Shell | UTF-8 | 902 | 2.8125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
Markdown | UTF-8 | 3,031 | 3.03125 | 3 | [] | no_license | ---
title: "Reproducible Data assignment 1"
output:
html_document:
keep_md: yes
keep_md: true
---
## Loading and Processing Data
```r
Act_Data <- read.csv("activity.csv")
Act_Data$date <- as.Date(as.character(Act_Data$date))
library(knitr)
```
## What is mean total number of steps taken... |
Java | UTF-8 | 243 | 1.835938 | 2 | [] | no_license | package service1.service;
import service1.domain.Message;
import service1.domain.MessageAcknowledgement;
import rx.Observable;
public interface MessageHandlerService {
Observable<MessageAcknowledgement> handleMessage(Message message);
}
|
C | UTF-8 | 5,340 | 3.203125 | 3 | [
"MIT"
] | permissive | #include <stdlib.h>
#include <string.h>
#include <homekit/tlv.h>
tlv_values_t *tlv_new() {
tlv_values_t *values = malloc(sizeof(tlv_values_t));
values->head = NULL;
return values;
}
void tlv_free(tlv_values_t *values) {
tlv_t *t = values->head;
while (t) {
tlv_t *t2 = t;
t = t->... |
TypeScript | UTF-8 | 2,798 | 2.5625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import {
I18NContext,
I18NSystem,
I18NSystemStorageOperations,
I18NSystemStorageOperationsCreate,
I18NSystemStorageOperationsUpdate
} from "@webiny/api-i18n/types";
import { Entity } from "dynamodb-toolbox";
import WebinyError from "@webiny/error";
import defineSystemEntity from "~/definitions/syste... |
PHP | UTF-8 | 3,154 | 3.140625 | 3 | [
"MIT"
] | permissive | <?php
// Second year Project Artificial Intelligence 2014
// Gerben van der Huizen - 10460748
// Vincent Erich - 10384081
// Michiel Boswijk - 10332553
// Michael Chen - 10411941
/**
* Creates a list with random numbers from a list with chars.
*
* The function 'randomObjects' replaces the old representati... |
Java | UTF-8 | 511 | 2.265625 | 2 | [] | no_license | package com.spring.interview.SpringBeanLifeCycleAwareInterfaces;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello *Aware ---" );
ClassPathXmlA... |
Python | UTF-8 | 2,491 | 3.046875 | 3 | [] | no_license | KAPASITEETTI = 5
OLETUSKASVATUS = 5
class IntJoukko:
def __init__(self, kapasiteetti=None, kasvatuskoko=None):
if kapasiteetti is None:
self.kapasiteetti = KAPASITEETTI
elif not isinstance(kapasiteetti, int) or kapasiteetti < 0:
raise Exception("Väärä kapasiteetti") # heit... |
JavaScript | UTF-8 | 2,658 | 2.796875 | 3 | [] | no_license |
var graph=[];
var finder=document.getElementById("row1");
var mapper = document.getElementById("mapelements");
var nodes= [];
for (var i = 0; i <=1500; i++) {
nodes[i] = [];
}
nodeconnection();
create();
function create(){
var cellno=1;
for(i=1;i<=25;i++){
for(j=1;j<=60;j++){
... |
Python | UTF-8 | 12,845 | 2.90625 | 3 | [] | no_license | """
Script to convert the Media-Frames-Corpus, provided as json, in a format which fits the Webis-format (csv)
media_frames = {"Economic",
"Capacity and resources",
"Morality", "Fairness and equality",
"Legality, constitutionality and jurisprudence",
... |
Markdown | UTF-8 | 1,175 | 2.6875 | 3 | [] | no_license | ## Master, The Tempest Is Raging!
Master the tempest is raging!
The billows are tossing high!
The sky is o’er shadowed with blackness;
No shelter or help is nigh;
Carest Thou not that we perish?
How canst Thou lie asleep,
When each moment so madly is threatening,
A grave in the angry deep.
Chorus
“The winds and the... |
Java | UTF-8 | 325 | 1.609375 | 2 | [] | no_license | package com.test.login;
import org.testng.annotations.Test;
import com.vetty.actions.BaseClass;
import com.vetty.actions.SSNTraceSubmission;
public class LoginTest extends BaseClass{
SSNTraceSubmission obj = new SSNTraceSubmission();
@Test
public void test() throws InterruptedException {
obj.Login();
... |
JavaScript | UTF-8 | 1,469 | 4.125 | 4 | [] | no_license |
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} l1
* @param {ListNode} l2
* @return {ListNode}
*/
var addTwoNumbers = function(l1, l2) {
const a1 = list2array(l1);
const a2 = list2array(l2);
const a3 = add... |
Java | UTF-8 | 347 | 2.140625 | 2 | [
"MIT"
] | permissive | package com.zalivka.sregex.matcher;
import junit.framework.TestCase;
public class CharTest extends TestCase {
public void testChar() {
assertTrue(Matcher.match(new Char('a'), "a").success());
assertFalse(Matcher.match(new Char('a'), "b").success());
assertFalse(Matcher.match(new Char('a'),... |
Python | UTF-8 | 2,333 | 3.453125 | 3 | [] | no_license | # _*_ coding: utf-8 _*_
# ---------------example 1-------------------
import functools
import time
def log(func):
@functools.wraps(func) # make the name attribute of original function not change
def wrapper(*args, **kw):
print('call %s():' % func.__name__)
return func(*args, **kw)
return ... |
C# | UTF-8 | 1,150 | 3.171875 | 3 | [
"MIT"
] | permissive | using UnityEngine;
namespace mechanics.nutrients
{
public abstract class Nutrient : MonoBehaviour
{
protected virtual int ResourceStore { get; set; }
protected virtual int ResourceMaximum => 10;
/// <summary>
/// The percentage of nutrient available mapped between (0,... |
Python | UTF-8 | 2,514 | 2.734375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | import unittest
from typing import Iterator
from context import comedian # pylint: disable=W0611
from comedian.traits import DebugMixin, EqMixin
class X(DebugMixin, EqMixin):
def __init__(self, x: int, y: int, z: int):
self.x = x
self.y = y
self.z = z
def __fields__(self) -> Iterat... |
Java | UTF-8 | 6,500 | 2.65625 | 3 | [] | no_license | package db.dao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import db.ConnectionPool;
import db.DAOUtil;
import db.models.EmergencyCall;
import db.models.EmergencyCat... |
Shell | UTF-8 | 656 | 3.40625 | 3 | [] | no_license | #!/bin/bash
PS3="Enter your choice :"
select choice in "Create Database" "List Database" "Connect to DataBase" "Drop Database" "Exit"
do
case $choice in
"Create Database" )
. ./CreateDatabase.sh
break
;;
"List Database" )
. ./listdatabases.sh
... |
Markdown | UTF-8 | 29,389 | 2.984375 | 3 | [] | no_license | ---
jupytext:
text_representation:
extension: .md
format_name: myst
format_version: '0.9'
jupytext_version: 1.5.2
kernelspec:
display_name: Python 3
language: python
name: python3
---
# Wavefield Imaging
In many applications, acoustic or electromagnetic waves are harnessed to *see* things; und... |
JavaScript | UTF-8 | 1,347 | 3.09375 | 3 | [] | no_license | /**
* Created by bilibili_ on 2016/6/15.
*/
"use strict"
function demo (msg) {
console.log("test");
}
demo('Hi Hello World!');
let Test = require('./Test.js');
let t = new Test();
t.logTest();
var handler = {
id: '123456',
init: function() {
document.addEventListener('click',
e... |
C++ | UTF-8 | 2,679 | 3 | 3 | [] | no_license | //
// Created by rutger on 11/7/20.
//
#include "DistanceTableCollection.h"
DistanceTableCollection::DistanceTableCollection(GL& gl, unsigned int numberOfSeedPoints)
: smallestDistanceScore(std::numeric_limits<double>::max()),
largestDistanceScore(std::numeric_limits<double>::min())
{
distanceTables.res... |
SQL | UTF-8 | 5,735 | 3.375 | 3 | [
"MIT"
] | permissive | -- --------------------------------------------------------
-- Host: localhost
-- Server version: 10.1.21-MariaDB - mariadb.org binary distribution
-- Server OS: Win32
-- HeidiSQL Version: 9.4.0.5125
-- ------------------------------------------------... |
Java | UTF-8 | 1,594 | 2.0625 | 2 | [] | no_license | package br.ufba.dcc.mestrado.computacao.openhub.data.organization;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import br.ufba.dcc.mestrado.computacao.openhub.data.OpenHubResultDTO;
@XmlRootElement(name = OpenHubPortifolioProjectDTO.NODE_NAME)
public class Ope... |
Python | UTF-8 | 691 | 2.84375 | 3 | [] | no_license | def user_check(u):
a=['-','.','_']
if u[0].isalpha():
for i in u:
if i.isalnum() or (i in a):
continue
else:
return False
else:
return False
return True
n=int(input())
for i in range(n):
a=input()
b=a.find('<... |
C++ | UTF-8 | 1,129 | 3.078125 | 3 | [
"MIT"
] | permissive | // 1126
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
int main() {
int n, m;
scanf("%d %d", &n, &m);
vector<vector<int> > graph;
graph.resize(n+1);
for(int i=0; i<=n; i++) {
graph[i].resize(n+1);
for(int j=0; j<=n; j++)
graph[i][j] = -1;... |
Markdown | UTF-8 | 3,106 | 3.03125 | 3 | [
"MIT"
] | permissive | Cache Info Bundle
====================
This bundle adds a simple command to dump information about HTTP Cache in a Symfony project.
## Installation
```sh
composer require mapado/cache-info-bundle
```
```php
// AppKernel.php
$bundles = array(
...
new Mapado\CacheInfoBundle\MapadoCacheInfoBundle()... |
Python | UTF-8 | 2,660 | 2.671875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | r"""Main routine to calculate ROUGE scores across text files.
Designed to replicate scores computed by the ROUGE perl implementation as
closely as possible.
Output is a text file in CSV format.
Sample usage:
rouge ---rouge_types=rouge1,rouge2,rougeL \
--target_filepattern=*.targets \
--prediction_fliepatter... |
Markdown | UTF-8 | 5,348 | 2.953125 | 3 | [] | no_license | 三一
第六十二回作“彩云”,但显然就是第三十九回大家说她老实的彩霞,偷了许多东西送贾环,反而受他的气,第七十二回他终于负心。
第三十九回与第二十五回同属X本。第三十三回作“彩云”、同回有早本漏改的“姆姆”二字。显然贾环的恋人原名彩云,至X本改名彩霞,从此彩云不过是一个名字,没有特点或个性。
全抄本第二十五回彩霞初出场的一段如下:
那贾环……一时又叫彩云倒茶,一时又叫金钏儿剪蜡花。众丫鬟素日原厌恶他,只有彩云(他本作“霞”)还和他合的来,倒了一杯茶递与他……悄悄向贾环说:“你安分些罢,……”贾环道:“……你别哄我,如今你和宝玉好,把我不大理论,我也看出来了。”彩云(他本作“霞”)道:“没良心的... |
Markdown | UTF-8 | 24 | 2.71875 | 3 | [] | no_license | # mrwebivuyisa.github.io |
Java | UTF-8 | 3,504 | 2.140625 | 2 | [
"Apache-2.0"
] | permissive | package com.luanguan.mcs.empty_roll_location.infrastructure;
import com.luanguan.mcs.empty_roll_location.domain.*;
import com.luanguan.mcs.framework.domain.Version;
import com.luanguan.mcs.mission.domain.MissionId;
import com.luanguan.mcs.shared_kernel.BatteryModel;
import com.luanguan.mcs.shared_kernel.Position;
impo... |
Swift | UTF-8 | 3,747 | 2.703125 | 3 | [] | no_license | import KeychainAccess
protocol LastSuccessLoginHolder {
var lastSuccessLogin: String? { get }
}
enum AuthorizationStatus {
case notAuthorized
case authorized(jwt: String)
}
protocol AuthorizationStatusHolder: class {
var authorizationStatus: AuthorizationStatus { get }
var isAuthorized: Bool { ge... |
C# | UTF-8 | 2,884 | 3.328125 | 3 | [
"MIT",
"zlib-acknowledgement"
] | permissive | // Copyright (c) Charlie Poole, Rob Prouse and Contributors. MIT License - see LICENSE.txt
using System;
namespace NUnit.Common
{
/// <summary>
/// Class used to guard against unexpected argument values
/// or operations by throwing an appropriate exception.
/// </summary>
public static class Gua... |
Java | UTF-8 | 373 | 1.734375 | 2 | [] | no_license | package gg.babble.babble.dto.request;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Getter
@AllArgsConstructor
@NoArgsConstructor
public class TagUpdateRequest {
@NotNull
private String name;
@... |
Markdown | UTF-8 | 2,827 | 2.625 | 3 | [] | no_license | ## 논문에서의 앙상블
- high level feature
더 높은 차원의 feature
- low level feature
텍스쳐 같은 느낌
## 앙상블
- 앙상블 기법은 weak learner 을 잘 조합해서 strong learner를 만드는것을 목표로 한다
- 현실에서의 기능은 개개인의 능력을 갖고있는 팀원들을 모아 개인이서 할수없는일을 해내는 것이 앙상블이다
>> 앙상블기법에는 대표적으로 bagging과 boosting이 있다
- bagging은 기본 데이터셋을 샘플링하여 n개의 데이터셋을 만들어서 n개의 모델을 학습시켜 최종 ... |
Python | UTF-8 | 1,299 | 3.21875 | 3 | [] | no_license | #14_QCheckBox.py - under QWidgetDemo
from PyQt5.QtWidgets import QDialog, QLineEdit, QPushButton, QVBoxLayout, QApplication, QLabel, QCheckBox
import sys
class QWidgetDemos(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle("QWidgets Demo")
#ex2-to make handler to che... |
C# | UTF-8 | 4,064 | 2.546875 | 3 | [] | no_license | using SharpDX.Core;
using SharpDX.Direct2D1;
using SharpDX.DirectWrite;
using SharpDX.Mathematics.Interop;
namespace SharpDX.UI.Controls
{
class Label : UiControlBase
{
private TextFormat _format;
private TextLayout _layout;
private Brush _brush;
private Color4 _color;
... |
PHP | UTF-8 | 2,699 | 2.78125 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title>All Orders</title>
<meta name="Author" value="Chris Card">
<link rel="stylesheet" type="text/css" href="view_all_orders.css">
</head>
<body>
<?php
$orders = load_orders();
function load_orders(){
$orders = array();
ini_set('auto_detect_line_endings',true);
... |
JavaScript | UTF-8 | 1,444 | 2.71875 | 3 | [] | no_license | import { useReducer } from 'react';
function reducer(state, action) {
switch (action.type) {
case 'LOGIN':
return { ...action.payload };
case 'SIGN_UP':
return console.log('SIGN_UP REDUCER');
default:
throw new Error();
}
}
const initialState = {
isAuthenticated: false,
error: '',... |
Java | UTF-8 | 407 | 2.265625 | 2 | [] | no_license | package test;
import org.slf4j.ILoggerFactory;
import org.slf4j.Logger;
/**
* @author huanyao
* @version 1.0
* @ClassName CustomLoggerFactory.java
* @Description TODO(用一句话描述该文件做什么)
* @date 2021/7/12 4:14 下午
*/
public class CustomLoggerFactory implements ILoggerFactory {
@Override
public Logger getLogger... |
C | UTF-8 | 2,365 | 2.625 | 3 | [] | no_license | /*
** EPITECH PROJECT, 2024
** MUL_my_rpg_2019
** File description:
** Created by Leo Fabre
*/
#include "rpg.h"
void give_popo(t_rpg *rpg, int fight_count)
{
switch (fight_count) {
case 1:
add_to_inventory(rpg, 5);
add_xp(rpg, 75);
break;
case 3:
add_to_inventory(rpg, 8);
... |
Go | UTF-8 | 1,326 | 3.234375 | 3 | [
"MIT"
] | permissive | package apns
import "encoding/json"
// BadgeNumber is much a NullInt64 in
// database/sql except instead of using
// the nullable value for driver.Value
// encoding and decoding, this is specifically
// meant for JSON encoding and decoding
type BadgeNumber struct {
Number uint
IsSet bool
}
// Unset will reset the... |
SQL | UTF-8 | 650 | 4.15625 | 4 | [] | no_license | SELECT
pr . *,
r.rating,
r.comment,
r.id AS review_id,
u.username,
b.name AS brand_name
FROM
(SELECT
p . *, r.product_id, MAX(r.date_created) AS review_date
FROM
(SELECT
*
FROM
product
WHERE
product.brand_id = ?
ORDER BY date_created DE... |
JavaScript | UTF-8 | 1,186 | 2.703125 | 3 | [
"MIT"
] | permissive | import React, { Component } from 'react'
import ThemeSwitcher from 'react-css-vars'
const myFirstTheme = {
myBackground: 'palevioletred',
myColor: 'purple',
myAccent: 'darkred',
}
const mySecondTheme = {
myBackground: 'red',
myColor: 'yellow',
myAccent: 'blue',
}
const themes = [myFirstTheme, mySecondTh... |
PHP | UTF-8 | 594 | 2.625 | 3 | [] | no_license | <?php
session_start();
function __autoload($classname) {
include_once ('./classes/'. $classname .'.php');
}
$email = isset( $_SESSION['registratie']['email'] ) ? $_SESSION['registratie']['email'] : '';
$pass = isset( $_SESSION['registratie']['pass'] ) ? $_SESSION['registratie']['pass'] : '';
if (isset... |
PHP | UTF-8 | 1,580 | 2.6875 | 3 | [
"MIT"
] | permissive | <?php
namespace net\pixeldepth;
use net\pixeldepth\warframe\Warframe;
final class Request_Listener {
public static $action = "";
public static $page = "";
public static function listen(){
Utils :: clean_get();
self :: get_action();
self :: get_page();
self :: monitor();
}
private static function get... |
Java | UTF-8 | 5,421 | 2.234375 | 2 | [] | no_license | package com.ejavashop.service.impl.member;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import com.ejavashop.core.ConstantsEJS;
import com.ejavashop.core.P... |
Rust | UTF-8 | 5,483 | 3.71875 | 4 | [] | no_license | use std::iter::IntoIterator;
#[derive(Debug)]
pub struct Matrix<T> {
pub dimensions: usize,
m: Vec<T>
}
impl<T> Matrix<T> {
pub fn new(dimensions: usize) -> Matrix<T> {
Matrix {
dimensions: dimensions,
m: Vec::with_capacity(dimensions * dimensions)
}
}
pub fn with_data(dimensions: usi... |
Java | UTF-8 | 288 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | /**
* @author Lewis Matos, Julich Mera
*/
public class Dice{
public static void main(String[] args){
int face[]=new int[6];
for(int i=0; i<300; i++){
++face[0+(int)(Math.random()*((5-0)+1))];
}
for(int i=0; i<face.length; i++){
System.out.println((i+1)+"\t\t"+face[i]);
}
}
} |
JavaScript | UTF-8 | 277 | 2.71875 | 3 | [] | no_license | function (key,values,rereduce){
var result = [], found = {};
if (rereduce) values = [].concat.apply([],values);
for (var i=0; i<values.length; i++) found[values[i].toLowerCase()] = 1;
for (var k in found) result.push(k);
return result;
} |
Java | ISO-8859-1 | 187 | 1.648438 | 2 | [] | no_license | package estoque.integration.dao.postgresql;
//Padro Abstract Factory : ConcreteProduct
public class CategoriaDAO extends DAO implements estoque.integration.dao.CategoriaDAO {
}
|
PHP | UTF-8 | 2,393 | 2.5625 | 3 | [] | no_license | <?php
include 'conection.php';
if(isset($_POST["submit"]))
{
$name=$_POST["name"];
$address=$_POST["address"];
$gender=$_POST["gender"];
$dob=$_POST["dob"];
$phone=$_POST["phno"];
$email=$_POST["email"];
$username=$_POST["username"];
$password=$_POST["password"];
$conform=$_POST["conformpassword"];
//ech... |
Markdown | UTF-8 | 2,124 | 2.53125 | 3 | [] | no_license | ---
layout: default
title: "当霸凌遇到流氓:印度专家称除非中国承认「一个印度」,印航不会更改台湾名称"
date: 2018-06-28T05:07:48.000000+08:00
---
中国民航局要求国际间44家航空公司,在各自网站上将对「台湾」的称谓标示改为「中国台湾」。印航发言人表示,更名应由政府决定;印度专家则认为,除非中国承认「一个印度」,否则印度航空不会更改台湾名称。
中央社今天报导,印度金德尔大学(OP Jindal Global University)国际事务学院资深研究员曼尼(Tridivesh Singh Maini)表示,由于中国没有承认「一个印度」,印度历次与中国的联合声明或... |
Markdown | UTF-8 | 6,371 | 3.109375 | 3 | [
"MIT"
] | permissive | ---
title: 推免答辩·自我介绍
---
老师们好,我是来自中大数据院的吴坎,本科就读的是计算机科学与技术专业的超算方向,也是我院的特色专业。接下来我将用大约九分钟的时间,从以下六个角度介绍自己,以便让老师们全面的了解我。
首先是我的学业情况。我的成绩在我们专业排名前 15%,同时我在大学三年里分别获得三等奖学金、二等奖学金、一等奖学金。其中由于疫情原因,今年获得的一等奖学金评选流程比往年稍慢一些,还在公示期。
接下来是我本科一些课程的成绩和班级排名。我有比较强的动手能力,能在实验课和以实验为主的课程取得高分和优异的成果。其中,在大二上学期,我在计算机组成与原理实验课上设计的单周期、多周期 CPU 项目... |
JavaScript | UTF-8 | 2,971 | 2.859375 | 3 | [] | no_license |
var html = require('fs').readFileSync(__dirname+'/GeoChat3.html');
var server = require('http').createServer(function(req, res){
console.log('Running');
res.end(html);
});
server.listen(8080);
var nowjs = require('now');
var everyone = nowjs.initialize(server);
var listOfRooms =[] ;
//everyone.now.distribute... |
PHP | UTF-8 | 3,050 | 2.921875 | 3 | [] | no_license | <?php
error_reporting(E_ALL ^ E_NOTICE);
function ajout_absence($date,$nom_absent){
try {
$db=connect();
$resultat= $db->prepare("INSERT INTO absence (date,nom_absent) VALUES (?,?)");
$resultat->bindValue(1, $date, PDO::PARAM_INT);
$resultat->bindValue(2, $nom_absent, PDO::PARAM_STR);
$resultat->... |
C | UTF-8 | 1,859 | 2.90625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
Swift | UTF-8 | 298 | 2.59375 | 3 | [] | no_license | //
// Extensions.swift
// ReduxTest
//
// Created by Guilherme Paciulli on 07/08/17.
// Copyright © 2017 Guilherme Paciulli. All rights reserved.
//
import Foundation
extension String {
public func isValid() -> Bool {
return !(self.isEmpty || self.trimmingCharacters(in: .whitespaces).isEmpty)
}
}... |
JavaScript | UTF-8 | 3,820 | 2.71875 | 3 | [] | no_license | import React, { Component } from 'react';
import Autosuggest from 'react-autosuggest';
import getData from './getData.js';
import { connect } from 'react-redux';
import { withRouter } from 'react-router';
import { browserHistory } from 'react-router';
//https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regula... |
JavaScript | UTF-8 | 2,636 | 2.546875 | 3 | [] | no_license | require('dotenv').config();
require('../../lib/utils/connect')();
const mongoose = require('mongoose');
const User = require('../.././lib/models/User');
const { tokenized } = require('../../lib/utils/token');
describe('test the user model', () => {
beforeEach(done => {
return mongoose.connection.dropData... |
Python | UTF-8 | 383 | 3.28125 | 3 | [] | no_license | def main():
genome=input('please input a string:')
found=False
start=-1
for i in range(len(genome)-2):
triplet=genome[i:i+3]
if triplet=='ATG':
start=i+3
elif (triplet=='TAG' or triplet=='TAA' or triplet=='TGA') and start!=-1:
gene=genome[start:i]
if len(gene)%3==0:
found=True
print(gene)
... |
Shell | UTF-8 | 577 | 3.375 | 3 | [] | no_license | #!/bin/bash
set -x
GCP_FILESTORE_IP=$1
ETH_GATEWAY=$2
ETH_DEV=$(ifconfig | grep -B1 "$(echo "${ETH_GATEWAY}" | awk -F. '{print $1 "." $2 "." $3}')" | grep eth | awk -F: '{print $1}')
# change BOOTPROTO from default none to dhcp on 2nd NIC
sed -i 's/BOOTPROTO=none/BOOTPROTO="dhcp"/' /etc/sysconfig/network-scripts/ifc... |
Markdown | UTF-8 | 6,086 | 3.1875 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: 浅谈Disruptor
categories: [Java, 高性能, 锁]
description: 浅谈Disruptor
keywords: Disruptor, 无锁, 高性能
---
<h1 text-align="center">浅谈Disruptor</h1>
Disruptor是一个低延迟(low-latency),高吞吐量(high-throughput)的事件发布订阅框架。通过Disruptor,可以在一个JVM中发布事件,和订阅事件。相对于Java中的阻塞队列(ArrayBlockingQueue,LinkedBlockingQueue),Disruptor的优... |
Java | UTF-8 | 1,166 | 2.84375 | 3 | [] | no_license | package io.goen.net.p2p.dht;
import io.goen.net.p2p.Node;
public class NodeContract implements Comparable<NodeContract> {
private Node node;
private long lastTouch;
private int staleCount;
public NodeContract(Node node) {
this.node = node;
this.lastTouch = System.currentTimeMillis() / 1000L;
this.staleCoun... |
C | GB18030 | 516 | 3.296875 | 3 | [] | no_license | #pragma once
#include "000⺯.h"
int Fbi(int n) {
if (n <= 0)
return 0;
else if (n == 1)
return 1;
else
return Fbi(n - 1) + Fbi(n - 2);
}
int T010()
{
int i;
int a[40];
printf("ʾ쳲У\n");
a[0] = 0;
a[1] = 1;
printf("%d ", a[0]);
printf("%d ", a[1]);
for (i = 2; i < 40; i++)
{
a[i] = a[i - 1] + a[i - 2... |
Java | UTF-8 | 215 | 1.84375 | 2 | [] | no_license | package org.iplantc.de.client.models.apps;
import org.iplantc.de.client.models.HasSettableId;
public interface AppRefLink extends HasSettableId {
void setRefLink(String refLink);
String getRefLink();
}
|
C | UTF-8 | 243 | 3.59375 | 4 | [] | no_license | #include "main.h"
/**
* _isupper - check for capitalized letter
* @c: ascii character buffer
* Return: 1 for true, 0 for false
*/
int _isupper(int c)
{
int i = 65;
for (; i <= 90; i++)
{
if (c == i)
return (1);
}
return (0);
}
|
Ruby | UTF-8 | 4,606 | 3.296875 | 3 | [] | no_license | class Node
include Comparable
attr_accessor :data, :left, :right
def initialize(data)
@data = data
@left = nil
@right = nil
end
end
class Tree
attr_accessor :root
def initialize(array)
@root = build_tree(array.uniq.sort)
end
def build_tree(array)
return nil if array.empty?
#... |
Python | UTF-8 | 409 | 3.34375 | 3 | [
"MIT"
] | permissive | #!/bin/python
def pad(string,mylen,char):
i=len(string);
final="";
while i<=mylen:
final+=char;
i+=1;
return string+final;
team=[{'name':'Rob','title':'SR Analyst'},{'name':'Usha','title':'SR Analyst'},{'name':'Tom','title':'SR Analyst'},{'name':'t','title':'Lead'}];
team=sorted(team,key=lambda k:k['title'])... |
Python | UTF-8 | 7,317 | 3.296875 | 3 | [] | no_license |
from sys import exit
import time
import random
import os
import game
#Creates a parent class for the player
class Person(object):
def __init__(self, name, age, weight, gender):
self.name = name
self.age = age
self.weight = weight
self.gender = gender
class Player(Perso... |
Java | UTF-8 | 5,208 | 2.296875 | 2 | [] | no_license | package com.example.admin.androidproject.DAO;
import android.util.Log;
import com.example.admin.androidproject.Entities.FoodEntities;
import com.example.admin.androidproject.Entities.OrderEntities;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;... |
C++ | UTF-8 | 868 | 3.71875 | 4 | [
"MIT"
] | permissive | #include "stdafx.h"
#include "Tree.h"
// Constructor
Tree::Tree() {
root = nullptr;
}
// Virtual Destructor
Tree::~Tree() {
}
// Returns the Root Node
Node* Tree::getRoot() {
return root;
}
// Sets the Root Node
void Tree::setRoot(Node* tmp) {
root = tmp;
}
// Inserts a new int into the tree, then calls 'rehea... |
C++ | WINDOWS-1252 | 478 | 3 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=9 lang=cpp
*
* [9] ????C???
*/
#include <string>
#include <iostream>
using namespace std;
class Solution {
public:
bool isPalindrome(int x) {
string str_(to_string (x));
string resStr(str_);
reverse(resStr.begin(), resStr.end());
if... |
Go | UTF-8 | 2,968 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | package namespace
import (
"context"
"fmt"
"sync/atomic"
"github.com/pingcap/errors"
"github.com/tidb-incubator/weir/pkg/config"
"github.com/tidb-incubator/weir/pkg/proxy/driver"
"github.com/tidb-incubator/weir/pkg/proxy/metrics"
)
type NamespaceHolder struct {
nss map[string]Namespace
}
type NamespaceWrapp... |
Go | UTF-8 | 2,985 | 2.640625 | 3 | [] | no_license | package main
import (
"bufio"
"context"
"flag"
"fmt"
"log"
"math/rand"
"time"
"github.com/andregri/tiny-p2p-blockchain/api"
"github.com/andregri/tiny-p2p-blockchain/blockchain"
"github.com/andregri/tiny-p2p-blockchain/peer"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/proto... |
TypeScript | UTF-8 | 593 | 2.65625 | 3 | [] | no_license | import {
Column,
Model,
Table,
PrimaryKey,
AutoIncrement,
DataType,
Unique
} from 'sequelize-typescript'
@Table
export default class Account extends Model<Account> {
@PrimaryKey
@AutoIncrement
@Column(DataType.INTEGER)
id!: number
@Column(DataType.STRING)
name!: string
@Unique
@Column(... |
Markdown | UTF-8 | 4,616 | 2.921875 | 3 | [] | no_license | ## To Many Open files
今天查看服务日志的时候,突然发现服务器上出现了大量的错误日志`socket: too many open files` ,
> too many open files(打开的文件过多)是Linux系统中常见的错误,从字面意思上看就是说程序打开的文件数过多,不过这里的files不单是文件的意思,也包括打开的通讯链接(比如socket),正在监听的端口等等,所以有时候也可以叫做句柄(handle),这个错误通常也可以叫做句柄数超出系统限制。 引起的原因就是进程在某个时刻打开了超过系统限制的文件数量以及通讯链接数
用以往的经验分析,肯定是文件`fd`过少,到服务器通过`ulimit -n`... |
C++ | UTF-8 | 971 | 2.640625 | 3 | [] | no_license | /*
* CanThrottle.h
*
* Created on: 18.06.2013
* Author: Michael Neuweiler
*/
#ifndef CAN_THROTTLE_H_
#define CAN_THROTTLE_H_
#include <Arduino.h>
#include "config.h"
#include "Throttle.h"
#include "TickHandler.h"
#define CAN_THROTTLE_REQUEST_ID 0x7e0 // the can bus id of the throttle level... |
Python | UTF-8 | 663 | 2.75 | 3 | [] | no_license | from docx import Document
def write(docname):
document = Document()
styles = document.styles
document.add_heading('Document Tile',0)
p = document.add_paragraph('A plain paragraph having some ')
p.add_run('bold').bold = True
p.add_run('italic.').italic = True
document.add_heading('Heading, l... |
C++ | UTF-8 | 2,428 | 2.890625 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include "xo/system/assert.h"
#include "xo/utility/types.h"
namespace xo
{
/// find element in a container
template< typename C > typename auto find( C& cont, const typename C::value_type& e )
{ auto it = std::begin( cont ); for ( ; it != std::end( cont ); ++it ) if ( *it == e ) break; return it; }
... |
TypeScript | UTF-8 | 2,218 | 2.78125 | 3 | [] | no_license | export const enum CouponType {
AFFILIATECOUPON = 'AFFILIATECOUPON',
ABSOLUTECOUPON = 'ABSOLUTECOUPON'
}
export const enum CouponAmountType {
ONETHOUSAND = 'ONETHOUSAND',
THREETHOUSAND = 'THREETHOUSAND',
FIVETHOUSAND = 'FIVETHOUSAND',
SEVENTHOUSAND = 'SEVENTHOUSAND',
TENTHOUSAND = 'TENTHOUSAND'
}
export ... |
Python | UTF-8 | 1,266 | 2.921875 | 3 | [] | no_license | import gettrades
import opentrades
import closetrades
import get_prices
import sys
import time
import oandapy
if len(sys.argv) == 4:
trials = int(sys.argv[1])
keep_alive = True if int(sys.argv[2]) == 1 else False
compress = True if int(sys.argv[3]) == 1 else False
print ("keep alive " + str(keep_ali... |
Java | UTF-8 | 1,143 | 2.390625 | 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 aplicacion.controlador.beans;
import java.io.Serializable;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.