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 |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 12,383 | 2.625 | 3 | [] | no_license | import xgboost
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import ParameterGrid
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score
import datetime
import scipy.optimize as optimize
def ranking(prediction... |
Python | UTF-8 | 2,360 | 3 | 3 | [] | no_license | # coding: utf-8
# @author: Shaw
# @datetime: 2019-02-26 13:15
# @Name: KMeans_test.py
# KMeans 包含在 sklearn.cluster
from sklearn.cluster import KMeans
# KMeans(n_clusters=8, init='k-means++', n_init=10, max_iter=300, tol=0.0001, precompute_distances='auto', verbose=0, random_state=None, copy_x=True, n_jobs=1, algorith... |
Python | UTF-8 | 4,130 | 4.4375 | 4 | [] | no_license | ## this is at the top of every turtle file
from turtle import *
speed(0)
shape("turtle")
"""
### then first step is things like drawing a square
forward(100)
right(90)
forward(100)
right(90)
forward(100)
right(90)
forward(100)
right(90)
clear()
### then drawing a square through a for loop
for count in range(4):
... |
C++ | UTF-8 | 473 | 2.671875 | 3 | [] | no_license | #include <iostream>
#include <functional>
#include <vector>
#include <queue>
#include <fstream>
#include <string>
#include <bitset>
#include <sstream>
#include <climits>
#include <cmath>
using namespace std;
class Solution {
public:
int maxProfit(vector<int> &prices) {
int maxPro = 0;
int minPrice = INT_MAX;
fo... |
Markdown | UTF-8 | 439 | 2.515625 | 3 | [
"BSD-3-Clause"
] | permissive | Source code for my [Ensuring That a Linux Program Is Running at Most Once by Using Abstract Sockets](https://blog.petrzemek.net/2017/07/24/ensuring-that-a-linux-program-is-running-at-most-once-by-using-abstract-sockets/) English blog post.
Works only on Linux. Requires at least Rust 1.19 due to the use of the [`exprin... |
Markdown | UTF-8 | 2,557 | 2.921875 | 3 | [] | no_license | Chloe called me dad consistently from age 3 - 6.
Only when placed in Donna's custody did she return
to John, which she also used when she was 2.
"Grandma says Mom doesn't go to church because
they took out the part of her brain that makes her
want to go to church." - Feb or Mar 2014. This is
the kind of "believe ... |
Markdown | UTF-8 | 2,042 | 2.609375 | 3 | [] | no_license | # CloudStorage
## Курсовая работа "Сетевое хранилище"
# Состояние:
Сделано, только заготовка формы клиента, и чтение текущих директорий сервера и клиента.
Особо не успел что-то сделать, т.к. на работе завал: каркас клиента (swing), каркас сервера (netty), каркас профиля клиента (postgresql + liquibase)
#### Основно... |
Markdown | UTF-8 | 5,763 | 3.203125 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | # feedparser
feedparser gems - web feed parser and normalizer (RSS 2.0, Atom, etc.)
* home :: [github.com/feedreader/feed.parser](https://github.com/feedreader/feed.parser)
* bugs :: [github.com/feedreader/feed.parser/issues](https://github.com/feedreader/feed.parser/issues)
* gem :: [rubygems.org/gems/feedparser... |
C# | UTF-8 | 443 | 3 | 3 | [] | no_license | using System;
namespace Enemies
{
/// <summary>
/// Class named Zombie
/// </summary>
class Zombie
{
/// <summary>
/// Public field that has no value
/// </summary>
public int health;
/// <summary>
/// Public constructor, set the heal... |
Java | UTF-8 | 696 | 2.75 | 3 | [] | no_license | package org.dspace.install.model;
public enum Language {
PT("Portuguese (Portugal)", "pt-PT"),
PT_BR("Portuguese (Brazil)", "pt-BR"),
EN_US("English (US)", "en-US"),
EN_UK("English (UK)", "en-UK");
public static Language fromCode (String code) {
for (Language g : Language.values()) {
if (g.getCod... |
Swift | UTF-8 | 3,022 | 2.546875 | 3 | [] | no_license | //
// AttractionTableViewCell.swift
// PlanTrip
//
// Created by Ju Young Kim on 6/14/17.
// Copyright © 2017 Ju Young Kim. All rights reserved.
//
import UIKit
class AttractionTableViewCell: UITableViewCell {
var delegate:MyCustomCellDelegator!
var days_VC:DaysViewController? = nil
@IBOutl... |
C++ | UTF-8 | 1,494 | 2.890625 | 3 | [] | no_license | #pragma once
#ifndef __MEnginePathfindCriteria_H__
#define __MEnginePathfindCriteria_H__
/**
* This interface defines the methods that any class that is to be used as pathFind criteria must implement
*/
class MEnginePathfindCriteria
{
public:
MEnginePathfindCriteria();
~MEnginePathfindCriteria();
/**
* This metho... |
Markdown | UTF-8 | 1,784 | 2.78125 | 3 | [] | no_license | +++
title = "Evidence of an increasing NO$_2$/NO$_x$ emissions ratio from road traffic emissions"
date = 2005-01-01
authors = ["D.C. Carslaw"]
publication_types = ["2"]
abstract = "A statistical analysis of roadside concentrations of nitrogen oxides (NO$_x$) and nitrogen dioxide (NO$_2$) in London shows that from 1997 ... |
Java | UTF-8 | 3,110 | 2.5 | 2 | [] | no_license | package com.datasetup;
import java.util.HashMap;
import java.util.Map;
import org.testng.annotations.DataProvider;
public class Dataconfig {
//This method return all the testdata details from the given sheet
@DataProvider(name = "LoginTest")
public Object[][] dataSupplier() {
String datafile = "amazon.xlsx... |
Java | ISO-8859-13 | 862 | 3.453125 | 3 | [] | no_license | package esercizioEnum;
public class Program {
public static void main(String[] args)
{
// l'auto spende 1 litro per km
//l'auto spende 5 litri per km --> con il metodo commentato
// mentre adesso l'auto percorre 20km con 1 litro
Car auto = new Car(20, TipoCarburante.gas);
// l'... |
Go | UTF-8 | 839 | 2.9375 | 3 | [] | no_license | package repository
import (
"database/sql"
"github.com/mikcheal101/golang-tut-auth/models"
"github.com/mikcheal101/golang-tut-auth/utils"
"golang.org/x/crypto/bcrypt"
)
type UserRepository struct{}
func (repo UserRepository) CreateUser(db *sql.DB, user *models.User) error {
hash, err := bcrypt.GenerateFromPass... |
PHP | UTF-8 | 21,434 | 2.796875 | 3 | [] | no_license | <?php
class AccountPerson {
public $Id;
public $FirstName;
public $LastName;
public $IsEmployee;
public $Address;
public $PostNmb;
public $City;
public $Country;
public $Phone;
public $Cellphone;
public $Email;
/* Here kept as dd.mm.yyyy */
public $Birthdate;
publ... |
PHP | UTF-8 | 125 | 3.25 | 3 | [] | no_license | <?php
$r = (double) readline();
$pi = 3.14159;
$volume = (4/3.0) * $pi * $r * $r * $r;
printf("VOLUME = %.3f\n", $volume); |
Shell | UTF-8 | 4,123 | 3.578125 | 4 | [] | no_license | #!/bin/bash
source ../common.sh
dir=`mktemp -p . -d -t cr_ptree_XXXXXXX` || (echo "mktemp failed"; exit 1)
echo "Using output dir $dir"
cd $dir
BASE_DIR="../.."
FILEIO="../../fileio/fileio1"
ECHO="/bin/echo -e"
TEST_CMD="../ptree1"
# -n: children per process, -d: depth of process tree
TEST_ARGS="-n 2 -d 1 -w sle... |
JavaScript | UTF-8 | 871 | 4.375 | 4 | [] | no_license | // DAY 1
// 1.a. Write a function which count the number of occurrence of words in a paragraph or a sentence.The function countWords takes a paragraph and two words as parameters. It compare which word is most frequently occurred in the paragraph.
const paragraph = 'I love teaching. If you do not love teaching what el... |
Java | UTF-8 | 3,239 | 2 | 2 | [
"Apache-2.0"
] | permissive |
package com.wolf.utils.redis.command;
import com.wolf.utils.redis.Process;
import com.wolf.utils.redis.Process.Policy;
import com.wolf.utils.redis.ZParams;
import java.util.Set;
/**
* @author juxin.zj E-mail:juxin.zj@taobao.com
* @since 2011-7-25 上午10:33:14
* @version 1.0
*/
public interface RedisZSetCommands {... |
JavaScript | UTF-8 | 7,693 | 2.796875 | 3 | [
"LicenseRef-scancode-free-unknown",
"MIT"
] | permissive | /**
* @typedef { import('./types').ExportDir } ExportDir
* @typedef {import("./types").ExportOutputs} ExportOutputs
*/
const {getRelativePath} = require("./utils");
const FS = require("fs");
const {promisify} = require("util");
const Path = require("path");
/**
* Writes the given 'virtual' exportsDir object to di... |
Java | UTF-8 | 30,505 | 1.585938 | 2 | [] | no_license | package com.zhilian.rf_qims.mvp.sample_data.pro_quality;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.zhilian.api.StrKit;
import com.zhilian.rf_qims.R;
import com.zhilian.rf_qims.common.Common;
import com.zhilian.rf_qims.entity.Sample;
import com.zh... |
Java | UTF-8 | 628 | 2.0625 | 2 | [] | no_license | package com.gmail.perva4ina;
import com.gmail.perva4ina.BE.OnlineShop.Product;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.math.BigDecimal;
import java.util.concurrent.TimeUnit;
public class mainclass {
public static void main(String [] args){
// Syste... |
Java | UTF-8 | 953 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package javafx.plus.util;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import java.util.function.Consumer;
/**
* Contains all the List related utilities
* @author theBeacon
*/
public class ObservableListUtils {
private ObservableListUtils () {
}
/**
... |
JavaScript | UTF-8 | 654 | 3.25 | 3 | [] | no_license | "use strict"
class Pizza {
constructor(photo, name, price) {
this.photo = photo;
this.name = name;
this.composition = new Map();
this.price = price;
}
addComposition(name, calories) {
this.composition.set(name, calories);
}
countCalories() {
let calo... |
Swift | UTF-8 | 2,577 | 2.859375 | 3 | [] | no_license | //
// MealTableViewController.swift
// FoodTracker
//
// Created by Addison Francisco on 9/26/17.
// Copyright © 2017 Addison Francisco. All rights reserved.
//
import UIKit
class MealTableViewController: UITableViewController {
//MARK: Properties
var meals = [Meal]()
override func viewDidLoad() {
... |
Java | GB18030 | 2,558 | 1.976563 | 2 | [] | no_license | package com.perky.safeguard361.activities;
import java.io.IOException;
import com.perky.safeguard361.R;
import com.perky.safeguard361.utils.SmsUtils;
import com.perky.safeguard361.utils.UIUtils;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
i... |
Python | UTF-8 | 2,402 | 3.421875 | 3 | [] | no_license | """ Codewars kata: Conway's Game of Life - Unlimited Edition. https://www.codewars.com/kata/conways-game-of-life-unlimited-edition/train/python """
from collections import namedtuple
from pprint import pprint
from copy import deepcopy
Cell = namedtuple("Cell", "row col")
def neighbors(cells, cell):
neighbors =... |
Ruby | UTF-8 | 219 | 3.171875 | 3 | [
"MIT"
] | permissive | def anagram_detection(parent, child)
sorted_child = child.chars.sort
count = 0
parent.chars.each_with_index do |_, index|
count += 1 if parent[index, child.length].chars.sort == sorted_child
end
count
end
|
Java | UTF-8 | 733 | 3.65625 | 4 | [
"WTFPL"
] | permissive | class Factorial {
public static int fact(int n) {
if (n == 0) return 1;
return n * fact(n-1);
}
public static int fact2(int n){
int fact = 1;
for (int i=1; i<=n; i++) fact *=i;
return fact;
}
public static void main(String[] args) {
if (args.leng... |
Python | UTF-8 | 323 | 2.75 | 3 | [] | no_license | import pytest
from lesson_36 import add_func
from lesson_36 import mul_func
from lesson_36 import div_func
from lesson_36 import sub_func
@pytest.mark.calc
def test_sub_func():
assert sub_func(1, 1) == 0
def test_mul_func():
assert mul_func(2, 3) == 6
def test_div_func():
assert div_func(100, 10) == ... |
Shell | UTF-8 | 178 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
interface=$1
for file in /etc/sysconfig/network-scripts/ifup-local.d/[0-9][0-9]*-${interface}.sh; do
if [ -x $file ]; then
$file $interface
fi
done
|
C# | UTF-8 | 2,505 | 2.578125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using InfluxData.Net.Common.Enums;
using InfluxData.Net.Common.Helpers;
using InfluxData.Net.InfluxDb;
using InfluxData.Net.InfluxDb.Models;
namespace InfluxDb._1secBench
{
class Program
{
const int TanksCount = 30;
const int Da... |
Python | UTF-8 | 796 | 3.375 | 3 | [] | no_license | import sys
import math
t = int(input())
def getDivisor(n):
result = []
i = 1
while i <= math.sqrt(n):
if (n % i == 0) :
if (n / i == i) :
result.append(i)
else :
result.append(i)
result.append(n/i)
i = i + 1
re... |
PHP | UTF-8 | 3,120 | 2.53125 | 3 | [] | no_license | <!--<form action="" method="post" enctype="multipart/form-data">-->
<?php
//creatinf object
$format = new Format();
$db = new Database();
?>
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-md-2">
<div class="col-xs-12 col-md-12 container-fluid bg-dark text-white rounded" style="p... |
JavaScript | UTF-8 | 405 | 3.234375 | 3 | [] | no_license | function solve(arr) {
let firstDiagonal = 0;
let secondDiagonal = 0;
for (let i = 0; i < arr.length; i++) {
firstDiagonal += arr[i][i];
secondDiagonal += arr[i][arr.length - 1 - i];
}
return[firstDiagonal, secondDiagonal].join(' ')
}
console.log(solve(
[[20, 40],
... |
JavaScript | UTF-8 | 1,141 | 2.59375 | 3 | [] | no_license | import React from "react";
import "./App.css";
import FormLabel from "react-bootstrap/FormLabel";
import FormControl from "react-bootstrap/FormControl";
import FormGroup from "react-bootstrap/FormGroup";
const marked = require("marked");
class App extends React.Component {
constructor(props) {
super(props);
... |
C++ | UTF-8 | 12,053 | 2.578125 | 3 | [] | no_license | #include "unrolledlinklist.h"
#include <cassert>
#include "pmallocator.h"
#include "stdallocator.h"
#include "arenaallocator.h"
#include "simulatedarenaallocator.h"
#include "software_prefetch.h"
#include "pairvector.h"
namespace hm4{
constexpr size_t UnrollingCapacity = 2048;
template<class T_Allocator>
struct ... |
Shell | UTF-8 | 222 | 3.21875 | 3 | [
"MIT"
] | permissive | #!/bin/bash
echo -n "Enter temperature (F) : "
read tf
# formula Tc=(5/9)*(Tf-32)
tc=$(echo "scale=4;(5/9)*($tf-32)"|bc)
tk=$(echo "scale=4;$tc+273.15"|bc)
echo "Temperature (C) = $tc"
echo "Temperature (K) = $tk"
exit 1
|
Java | UTF-8 | 2,383 | 2.421875 | 2 | [] | no_license | package SQLRepository;
import CertificateRepository.TagMapper;
import Entities.Tag;
import RepositoryInterfaces.TagRepository;
import RepositorySpecification.Specification;
import RepositorySpecification.TagSpecification;
import sqlconnection.SQLConnect;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
i... |
Python | UTF-8 | 1,033 | 3.6875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 21 12:41:02 2020
@author: User
Is Temperature a Random Walk (with Drift)?
An ARMA model is a simplistic approach to forecasting climate changes, but it
illustrates many of the topics covered in this class.
The DataFrame temp_NY contains the average annu... |
Java | UTF-8 | 1,540 | 2.34375 | 2 | [
"Apache-2.0"
] | permissive | package org.openehealth.ipf.commons.xml;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openehealth.ipf.commons.core.modules.api.ValidationException;
import org.springframework.core.io.Clas... |
Markdown | UTF-8 | 2,185 | 2.78125 | 3 | [
"MIT"
] | permissive | # Ethernet Frames Message Queue (EFMQ)
EFMQ provides an MQTT pub/sub style abstraction for Ethernet Frame messaging.
[](https://godoc.org/github.com/olliephillips/efmq)
EFMQ is like MQTT for your Local Area Network. Unlike MQTT no remote or local ... |
Markdown | UTF-8 | 610 | 3.078125 | 3 | [
"MIT"
] | permissive | # letsencrypt-autorenew
Bash script for auto renew let's encrypt ssl certificates
As you may know all certificates are for 3 months.
So you need to renew them everery three monthes. Ouch
Here a way to automate it.
1) Configure config file
nano /PathToLetsencrypt/letsencrypt/cli.ini
2) Edit script to add your domain... |
Markdown | UTF-8 | 749 | 2.5625 | 3 | [] | no_license | # Listeners: What are conflict listeners and how to work with them?
To allow users to handle document replication conflicts automatically, we introduced a Document Conflict listener.
To create your own listener of this type, just implement IDocumentConflictListener interface.
{CODE:java document_conflict_listene... |
TypeScript | UTF-8 | 455 | 2.546875 | 3 | [
"MIT"
] | permissive | import { LOG_IN, LOG_OUT } from "../../../resources/strings/actions";
export interface Authenticate {
user?: object;
}
// Action constants and shape
export const SEND_MESSAGE = "SEND_MESSAGE";
export const DELETE_MESSAGE = "DELETE_MESSAGE";
interface LoginAction {
type: typeof LOG_IN;
payload: Authenticate;
}
... |
Java | UTF-8 | 4,018 | 3.640625 | 4 | [] | no_license |
import java.util.Scanner;
/**
*
* @author Eltaher
*/
public class HeadAndTailLinkedListExample {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int value, counter = 0;
... |
JavaScript | UTF-8 | 1,082 | 3.171875 | 3 | [] | no_license | import { cons } from '@hexlet/pairs';
import getRandomInt from '../get-random-int.js';
import { roundsCount } from '../index.js';
const operands = ['+', '-', '*'];
const calculate = (num1, num2, operand) => {
let result;
switch (operand) {
case '+':
result = num1 + num2;
break;
case '-':
... |
Python | UTF-8 | 3,731 | 3.25 | 3 | [] | no_license |
''' all CRUD-related routes go here '''
from flask import Blueprint, render_template, request, redirect, url_for, flash
# importing Blueprint obj from "flask" module to group all CRUD-related routes together
# also importing 'render_template' to render HTML templates
# also importing 'request' to house/handle data g... |
C++ | UTF-8 | 2,022 | 2.578125 | 3 | [] | no_license | #pragma once
#include <Windows.h>
#include <unordered_map>
#include "PEParser.h"
#include "File.h"
static constexpr const wchar_t* ORIGINAL_FILENAME_STRING{ L"OriginalFilename" };
static constexpr const wchar_t* COMPANY_NAME_STRING{ L"CompanyName" };
static constexpr const wchar_t* FILE_VERSION_STRING{ L"Fil... |
Markdown | UTF-8 | 2,335 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | <br />
<p align="center">
<h2 align="center">Autoscaler tool for Cloud Spanner</h2>
<img alt="Autoscaler" src="../resources/BlogHeader_Database_3.max-2200x2200.jpg">
<p align="center">
<!-- In one sentence: what does the code in this directory do? -->
Set up the Autoscaler using Terraform configuration f... |
SQL | UTF-8 | 315 | 2.5625 | 3 | [] | no_license | CREATE TABLE IF NOT EXISTS Topics (
TopicId INT PRIMARY KEY AUTO_INCREMENT,
CourseId INT REFERENCES Courses(CourseId),
Title VARCHAR(256)
);
INSERT IGNORE INTO Topics(TopicId, CourseId, Title) VALUES (1, 1, "Hello World!");
INSERT IGNORE INTO Topics(TopicId, CourseId, Title) VALUES (2, 2, "Jason!");
|
Python | UTF-8 | 1,207 | 3.21875 | 3 | [] | no_license | import numpy as np
from enum import IntEnum
from time import sleep
COMMON_VALUE = 100
STANDARD_DEVIATION = 20.0
class OfferResult(IntEnum):
RAISE = 1
LEAVE = 2
class Distribution(IntEnum):
GAUSSIAN = 1
UNIFORM = 2
class Buyer(object):
def __init__(self, ID, common_value=COMMON_VALUE, distributio... |
Java | UTF-8 | 4,102 | 2.296875 | 2 | [] | no_license | package com.example.user.educationhunt.adapter;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.wid... |
Markdown | UTF-8 | 2,154 | 2.828125 | 3 | [] | no_license | # BookAppointment
A React-Django-rest SPA for Hospital Appointment Mangement.
Utmost basic app:
1. Login
2. Booking appointments as a patient
3. Checking Appointments as the hospital staff.
I have NOT included registration in the Frontend, Although it can be easily done through django-admin site.
It ac... |
Java | UTF-8 | 1,063 | 2.140625 | 2 | [] | no_license | package com.example.demo.mybatisplus.pojo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* ActiveReord模式
... |
C++ | UTF-8 | 13,566 | 3.359375 | 3 | [] | no_license | #include <fstream>
#include <string>
using namespace std;
class Automata
{
char** transitionTable;
int nrOfStates;
int initialState;
int finalState;
public:
// Constructors
Automata() { nrOfStates = 0; initialState = -1; finalState = -1; transitionTable = NULL; }
Automata(int,int,int);
Automata(s... |
PHP | UTF-8 | 1,033 | 2.75 | 3 | [] | no_license | <?php
echo "<head>
<style>
table, td {
border: 1px solid black;
border-collapse: collapse;
}
th {
border: 1px solid red;
border-collapse: collapse;
background-color:rgb(200, 200, 200);
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>";
$user = $_POST["User"];
$numPosts = 0;
echo "<h1> Po... |
Python | UTF-8 | 358 | 2.78125 | 3 | [] | no_license | import numpy as np
def sample_correlation(x1, x2):
nens = x1.size
x1_mean = np.mean(x1)
x2_mean = np.mean(x2)
x1p = x1 - x1_mean
x2p = x2 - x2_mean
cov = np.sum(x1p * x2p)
x1_norm = np.sum(x1p ** 2)
x2_norm = np.sum(x2p ** 2)
if(x1_norm == 0. or x2_norm == 0):
corr = 0.
else:
corr = cov/np.... |
C# | UTF-8 | 10,229 | 3.46875 | 3 | [] | no_license | using System;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Numerics;
namespace Exercise5
{
class Program
{
public struct Complex
{
private Double m_real;
private Double m_imaginary;
... |
Python | UTF-8 | 1,379 | 3.46875 | 3 | [] | no_license | import heapq
from sys import stdin
class Priority_Queue:
def __init__(self):
self.items = []
def push(self, name, weight):
heapq.heappush(self.items, [weight, name])
def get(self):
return heapq.heappop(self.items)[1]
def dijkstras(weighted_adj_list, start, end):
... |
Ruby | UTF-8 | 2,248 | 2.921875 | 3 | [] | no_license | require 'Minitest/autorun'
require 'Minitest/pride'
require './lib/queue'
class QueueTest < MiniTest::Test
def test_it_pushes_and_pops_a_character
some_queue = ParaMorse::Queue.new
some_queue.push('0')
assert_equal '0', some_queue.pop
end
def test_it_pushes_and_pops_from_correct_ends
some_qu... |
Java | UTF-8 | 857 | 3.859375 | 4 | [] | no_license | package farm;
import java.util.ArrayList;
import java.util.List;
public class FarmWille {
public static void main(String[] args) {
List<Animal> animals = new ArrayList<Animal>();
Animal murka = new Animal(AnimalKind.CAT, "Vaska");
murka.sleep();
murka.waikup();
animals.add(murka);
Animal ran... |
PHP | UTF-8 | 1,295 | 2.78125 | 3 | [
"MIT"
] | permissive | <?php
/**
* This Class represents SendEmailVerificationEmail Event which fires on external call
* @author Mayank Jariwala <menickwa@gmail.com>
* @package App\Events
* @version v.1.1
*/
namespace App\Events;
use App\Model\User;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Il... |
C# | UTF-8 | 1,995 | 2.953125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace Project.Controller {
class FileSender {
public bool IsSocketConnected(Socket s) {
return !((s.Poll(1000, SelectMode.SelectRea... |
C | GB18030 | 1,152 | 3.109375 | 3 | [] | no_license | #include<stdio.h>
#include<stdlib.h>
#include<assert.h>
typedef char BTDataType;
typedef struct BinaryTreeNode
{
BTDataType data;
struct BinaryTreeNode* left;
struct BinaryTreeNode* right;
}BTNode;
// ͨǰ"ABD##E#H##CF##G##"
BTNode* BinaryTreeCreate(BTDataType* a, int* pi);//
void BinaryTreeDestory(BTNode* root);//ٶ
v... |
JavaScript | UTF-8 | 1,539 | 2.796875 | 3 | [] | no_license | import { io } from "socket.io-client";
import "setimmediate";
const joinRoomButton = document.getElementById("room-button");
const messageInput = document.getElementById("message-input");
const roomInput = document.getElementById("room-input");
const form = document.getElementById("form");
const socket = io("http://l... |
JavaScript | UTF-8 | 5,287 | 2.953125 | 3 | [
"MIT"
] | permissive | function myFunction() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
console.log("Hi");
}
function addMoreRow() {
var table = document.getElementById("calculatorTable... |
Swift | UTF-8 | 591 | 2.5625 | 3 | [
"MIT"
] | permissive | //
// AppTabBar.swift
// Pods
//
// Created by Halin Lee on 6/26/17.
//
//
import Foundation
open class AppTabBar:UIView{
private var _titles: Array<String> = []
var titles:Array<String>{
get{
return _titles
}
set{
_titles = titles
}
}
let l... |
JavaScript | UTF-8 | 2,771 | 3.15625 | 3 | [] | no_license | function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
function extractMeanings(jsonObject... |
Python | UTF-8 | 1,232 | 2.828125 | 3 | [] | no_license | # We are going to split the images folders in train and test.
import pandas as pd
import os
# Captions output file paths
train_captions_file_path = '../../data/corpus/devset/dev-set/train_dev-set_video-captions-cleanup.csv'
test_captions_file_path = '../../data/corpus/devset/dev-set/test_dev-set_video-captions-cleanup... |
Java | UTF-8 | 5,003 | 2.15625 | 2 | [
"Apache-2.0"
] | 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 ... |
C++ | UTF-8 | 1,316 | 3.21875 | 3 | [] | no_license |
#include "../header/myheader.h"
class LT0832
{
public:
// D D
// reverse(begin(p), end(p))
// for (auto& row : A) for (int& i: row) i ^= 1;
// int lo = 0, hi = A[0].length - 1;
// while (lo <= hi) {
// 中间列。
//Runtime: 8 ms, faster than 86.66% of C++ online submissions for Flipping an Imag... |
Markdown | UTF-8 | 9,063 | 2.84375 | 3 | [
"MIT"
] | permissive | # Additional Configuration
::: danger This Software is Abandoned
This documentation is for **abandoned software** which does not recieve any security updates or support
from the community. This documentation has been left accessible for historial reasons.
You should be installing and using [Wings](/wings/1.0/installi... |
C# | UTF-8 | 2,770 | 3.515625 | 4 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
namespace MidTerm
{
public class Product : IComparable<Product>
{
public int Id { get; set; }
public double Price { get; set; }
public string Name { get; set; }
public string Description { get; set; }
... |
Python | UTF-8 | 17,205 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 1 19:19:50 2020
@author: pierre
"""
from os.path import join, isfile
import pickle
from numpy import array, mean, max, std, histogram, correlate, argmax, arange, sqrt, cumsum
from numpy.polynomial.polynomial import polyfit
from matplotlib import... |
Swift | UTF-8 | 434 | 3.109375 | 3 | [] | no_license | public protocol Entity {
init()
}
public protocol Repository {
init(orm: Orm)
}
public protocol Orm {
init(entityType: Entity.Type)
func find(id: Int) -> Entity
}
public class FakeOrm: Orm {
let entityType: Entity.Type
required public init(entityType: Entity.Type) {
self.ent... |
Markdown | UTF-8 | 1,653 | 2.78125 | 3 | [] | no_license | ## Get the fastest China IP address from multiple websites
## 从网上爬取中国ip,选取速度最快的
#### 需求性:中国大陆境外使用国内的音乐软件(网易云、虾米、QQ等)因为海外地区没有版权无法播放
#### 根属性:不在中国大陆境内
#### 解决力:翻墙回国内 || 网上找代理服务器
#### 损益比:两个方法都能解决问题,但是市面上的选择太多且不知道网速如何要逐个去试,麻烦
<br>
瞎逼逼完了就随便讲一下这几行垃圾代码能干嘛吧:<br>
首先,有一个小爬虫从三个网站爬了N个ip和对应的端口(N可以自己改),<br>
其次,逐个ping这些ip,用正则获得丢包率... |
C++ | UTF-8 | 9,291 | 2.6875 | 3 | [
"BSL-1.0"
] | permissive | // Copyright (C) 2013 Martin Moene.
//
// Implementation note: this version targets C++03.
//
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// The idea is based on the Expecte... |
Python | UTF-8 | 409 | 2.90625 | 3 | [] | no_license | from pylab import *
def f(x, y):
return (1 - x / 2 + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
n = 10
x = np.linspace(-3, 3, 3.5 * n)
y = np.linspace(-3, 3, 3.0 * n)
X, Y = np.meshgrid(x, y)
Z = f(X, Y)
axes([0.025, 0.025, 0.95, 0.95])
imshow(Z, interpolation='nearest', cmap='bone', origin='lower')
colorbar(... |
Java | UTF-8 | 1,089 | 3.5 | 4 | [] | no_license | import java.util.*;
public class TopKFreq {
public static List<Integer> findTopKFreq(int[] nums, int k) {
Map<Integer, Integer> numFreq = new HashMap<>();
for (int num : nums) {
numFreq.put(num, numFreq.getOrDefault(num, 0) + 1);
}
PriorityQueue<Map.Entry<Integer, ... |
Markdown | UTF-8 | 2,088 | 3.34375 | 3 | [
"Apache-2.0"
] | permissive | ---
layout: post
author: chjlang
title: "Java事务"
date: 2017-02-22 17:51:00 +8000
categories: java
tags:
- java
- study
---
## jdbc事务
* 利用jdbc手动编写事务的代码模板如下:
```java
connection.setAutoCommit(false);
PreparedStatement ps = connection.prepareStatement(sqlString);
try {
ps.executeUpdate();
connection.co... |
Shell | UTF-8 | 188 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/bin/sh
ulimit -c unlimited
ulimit -f unlimited
OUR_DIR=$(dirname $0)
export PATH=$PATH:$OUR_DIR/bin/
export LD_LIBRARY_PATH=$OUR_DIR/libs
LD_PRELOAD=$OUR_DIR/bin/libudp_to_tcp.so "$@" |
Java | UTF-8 | 486 | 2.84375 | 3 | [] | no_license | import java.applet.Applet;
import java.awt.Font;
import java.awt.Graphics;
import java.util.Date;
public class Clocks extends Applet implements Runnable{
Date d;
public void init(){
new Thread(this).start();
}
public void paint(Graphics g){
g.drawString(d.toString(), Font.BOLD, 40);
}
public voi... |
Java | UTF-8 | 3,041 | 2.21875 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2016-2018 mayanjun.org
*
* 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 agr... |
Shell | UTF-8 | 2,607 | 3.046875 | 3 | [] | no_license | ################################################################
######## varaible to be set
TOK_FILE=tokenized_poisoned_prepared
# BPE_TOKENS=40000
# BPE_CODE=$prep/bpecode
final_folder=wmt14_en_fr_clean # need to change
tmp=$final_folder/tmp
mkdir -p $tmp $final_folder
#############################################... |
Ruby | UTF-8 | 165 | 3.03125 | 3 | [] | no_license | array = [10,20,5,6]
b = array.to_enum
begin
def sum (index)
index + 20
end
p sum(b.next)
p sum(b.next)
p sum(b.next)
p sum(b.next)
end while array[3] == 26 |
C | UTF-8 | 927 | 2.9375 | 3 | [] | no_license | /*
** utilities.c for in /home/BLENEA_T/Projects/math/105torus
**
** Made by Thomas BLENEAU
** Login <BLENEA_T@epitech.net>
**
** Started on Mon Jan 9 11:24:39 2017 Thomas BLENEAU
** Last update Fri Jan 20 19:53:30 2017 Thomas BLENEAU
*/
#include "my.h"
int my_strcmp(char *s1, char *s2)
{
int i;
i = 0;
wh... |
C# | UTF-8 | 1,470 | 2.546875 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FlowAgent : Vehicle {
public float radiusWander = 3f;
float boundsWeight = 100f;
Vector3 center = new Vector3 (3, -24.9f, 76f);
public bool draw;
private Vector3 ultimateForce;
// Use this for initialization
protecte... |
C++ | UTF-8 | 869 | 2.84375 | 3 | [] | no_license | #ifndef HASARD_H_INCLUDED
#define HASARD_H_INCLUDED
#include "../include/Referenced.h"
#include <vector>
class Random: public Referenced
{
public:
Random(int init = 0);
virtual ~Random();
int generer(int min, int max);
int genererParJoueur(int min, int max, int numero = 0, int initialisate... |
C# | UTF-8 | 2,823 | 2.828125 | 3 | [] | no_license | namespace NetReduce.Core
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Runtime.Serialization;
public class PerformanceMonitor
{
public static LoadStatistics GetLoadStatistics()
{
var result = new LoadSt... |
C++ | UTF-8 | 923 | 2.734375 | 3 | [] | no_license | #ifndef LTEXTURE_H
#define LTEXTURE_H
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <string>
#include <fstream>
using namespace std;
class Player
{
private:
//The velocity of the player
int mVelX, mVelY;
//player's collision box
SDL_Rect mBox;
public:
bool walk = true;
//Flip type
SDL_Ren... |
PHP | UTF-8 | 527 | 2.640625 | 3 | [] | no_license | <?php
require "database-config.php";
$email = $_GET["email"];
$password = $_GET["password"];
class Event{
function Event($email, $password){
$this->email = $email;
$this->password = $password;
}
}
$arrayEvent = array();
$query = "SELECT email, password from account where email = '".$email."' a... |
Python | UTF-8 | 11,498 | 2.6875 | 3 | [
"MIT"
] | permissive | """ Tests for the data.position module"""
# Third party imports
import pytest
import numpy as np
# Midgard imports
from midgard.data import position
from midgard.dev import exceptions
@pytest.fixture()
def pos(request):
return request.getfixturevalue(request.param.__name__)
@pytest.fixture()
def posvel(reques... |
C++ | UTF-8 | 1,177 | 3.6875 | 4 | [] | no_license | /*
Kreirati program koji ce pronaci i ispisati sve brojeve od X do Y (ukljucujuci granicne vrijednosti)
koji su djeljivi svim svojim ciframa.
Na primjer, broj 36 je djeljiv sa brojevima 3 i 6. (36/6=6 i 36/3=12).
Brojeve X i Y unosi korisnik i moraju biti u opsegu od 10 do 6000. Obavezno koristiti bar jednu funkci... |
Java | UTF-8 | 1,787 | 2.5625 | 3 | [] | no_license | package com.saal.testcases;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
public class Testselenium1 {
public static void main(String[] ... |
Python | UTF-8 | 568 | 3.84375 | 4 | [] | no_license | #!/usr/bin/python3
# file input
data = open('input.txt').read()
numbers = [[int(n) for n in tri.split()] for tri in data.splitlines()]
def isTri(a, b, c):
return a + b > c and \
b + c > a and \
a + c > b
numTris = len([tri for tri in numbers if isTri(tri[0], tri[1], tri[2])])
print("part on... |
C# | UTF-8 | 584 | 3 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Assgn1
{
public abstract class Birds
{
public void walk()
{
Console.WriteLine("bird walking");
}
}
public class bird1 : Birds
{
... |
Java | UTF-8 | 8,228 | 1.71875 | 2 | [] | no_license | package ru.lihachev.norm31937.docx;
import android.app.ProgressDialog;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.