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 | 2,150 | 2.40625 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.logica.ndk.tm.fileServer.service.input;
import org.apache.commons.io.IOUtils;
import org.slf4j.LoggerFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.... |
Python | UTF-8 | 481 | 2.625 | 3 | [] | no_license | #coding:utf-8
class GameStats():
'''statistical information of game tracing'''
def __init__(self, ai_settings):
'''initial the information'''
self.ai_settings = ai_settings
#flag is true when game is active
self.game_active = False
self.high_score = 0
self.reset_stats()
def reset_stats(self):
... |
Markdown | UTF-8 | 5,879 | 2.65625 | 3 | [] | no_license | ---
layout: default
title: HoloLens Dev tips
---
This is a HoloLens development documentation for the project.
---
## [Getting started with HoloToolkit](https://forums.hololens.com/discussion/2364/getting-started-with-holotoolkit)
Here are the steps that you currently need to take to run sample projects in HoloTool... |
Markdown | UTF-8 | 1,834 | 3.453125 | 3 | [
"MIT"
] | permissive | <!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
<!--+----------------------------------------------------------------------+-->
<!--|@author openset <openset.wang@gmail.com> |-->
<!--|@link https://github.com/openset |-->
... |
Markdown | UTF-8 | 1,770 | 2.765625 | 3 | [] | no_license | #About this repository
The original code was taken from "https://github.com/adeept/Adeept_RFID_Learning_Kit_Python_Code_for_RPi", it is written in Python and intended to be run on Raspberry Pi
As I have bought the kit, and came accross the codes I found some mistakes and incomplete codes and description, so I have mad... |
Java | UTF-8 | 570 | 2.9375 | 3 | [] | no_license | import java.lang.reflect.*;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) throws IllegalAccessException {
Person person = new Person(123, "张三");
Object proxyInstance = new MyProxy(person).getProxyInstan... |
PHP | UTF-8 | 5,331 | 2.578125 | 3 | [] | no_license | <?php
/**
* Created by PhpStorm.
* User: moroz
* Date: 02.03.19
* Time: 13:37
*/
require __DIR__ . './../vendor/autoload.php';
require __DIR__ . './../core/functions.php';
use Automattic\WooCommerce\Client;
use Automattic\WooCommerce\HttpClient\HttpClientException;
$apiKey = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni... |
Python | UTF-8 | 1,259 | 3.046875 | 3 | [] | no_license | # encoding:UTF-8
import re
import codecs
from doi_bot import doi2ref
# def re_doi(doi_num):
doi_num = 2
# 保证即使出错文件句柄也会关闭
with open("entry.wiki", "r+", encoding="utf8") as fo:
entry = fo.read()
# 正则参数
doi_pattern = r'({{cite doi\|[ ]*){1}(10\.[^\s\/]+\/[^\s]+)([ ]?}})'
flags = re.I # 大小写不敏感
# 总 ... |
Markdown | UTF-8 | 1,168 | 2.921875 | 3 | [] | no_license | Assuming that 3 points.
We can raise an event everyTime the `logError` is called with the `error` parameter.
This way we can separate the manual logging in the text file from the handling of the "counter".
Let's call this event __ERROR_THROW__, and that event should have the __ERROR_DATE__ in UTC.
We will register a ... |
C++ | UTF-8 | 310 | 3.625 | 4 | [] | no_license | #include<iostream>
#include<string>
using namespace std;
int FunctionToDebug(int a, int b) {
int sum = a + b;
return sum;
}
int main(int argc, const char** argv) {
cout<< "Hello World.\n" ;
int sum = FunctionToDebug(2, 3);
cout<< "Sum of 2 + 3 = " << sum << ".\n" << endl;
return 0;
} |
Java | UTF-8 | 14,744 | 2.90625 | 3 | [] | no_license | package com.warcraftII.player_asset;
//import com.warcraftII.asset.player.PlayerAsset;
import com.warcraftII.position.TilePosition;
import com.warcraftII.position.UnitPosition;
import com.warcraftII.units.Unit;
import java.util.List;
import java.util.Vector;
public class VisibilityMap {
public enum ETileVisibil... |
Java | UTF-8 | 3,425 | 2.6875 | 3 | [
"WTFPL"
] | permissive | /*
* 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 spm;
import java.text.SimpleDateFormat;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.No... |
C | UTF-8 | 336 | 3.46875 | 3 | [] | no_license | #include <stdio.h>
#include <conio.h>
void main()
{
int n, c;
long int f = 1;
printf("\n Enter the number");
scanf("%d", &n);
if (n < 0)
goto end;
for (c = 1; c <= n; c++)
f = f * c;
printf("\n factorial = %d ", f);
end:
getch();
}
/*
output:
Enter the number5
fac... |
C++ | UTF-8 | 935 | 2.859375 | 3 | [] | no_license | void createZarray(string str, int Z[])
{
int n = str.length();
int L, R, k;
L = R = 0;
for (int i = 1; i < n; ++i)
{
if (i > R)
{
L = R = i;
while (R < n && str[R - L] == str[R])
R++;
Z[i] = R - L;
R--;
}
... |
JavaScript | UTF-8 | 2,958 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | // Copyright 2010 Google Inc. All Rights Reserved.
// Author: jacobsa@google.com (Aaron Jacobs)
//
// 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/LI... |
C++ | UTF-8 | 442 | 2.65625 | 3 | [] | no_license | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int maxn=15;
int t, ans;
char str[maxn];
int main()
{
scanf("%d", &t);
while(t--){
scanf("%s", &str);
if(strlen(str)==5)ans=3;
else{
ans=1;
if(str[1]=='w'&&str[2]=... |
Python | UTF-8 | 961 | 2.84375 | 3 | [] | no_license | """
Define classes for an accountability.
"""
from swarm_intelligence_app.models import db
class Accountability(db.Model):
"""
Define a mapping to the database for an accountability.
"""
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(255), nullable=False)
role_id = ... |
JavaScript | UTF-8 | 791 | 2.734375 | 3 | [] | no_license | (function () {
'use strict';
window.onload = function () {
var form = document.forms.contestForm,
input = form.K,
output = form.out,
indicator = document.getElementById('indicator'),
worker;
worker = new Worker('contestWebWorker.js?' + Math.random());
wor... |
PHP | UTF-8 | 963 | 2.546875 | 3 | [] | no_license | <?php
require_once 'PHP/dbconfig.php';
include 'header.php';
?>
<div class="container">
<div id="tools-wrapper">
<h1 class = "title-line-style">Total Protein Intake</h1>
<div id = "upper-part">
<?php
$servername="localhost";
$username="root";
$password="";
$dbname="snc";
$conn=mysqli_connect($servername,$use... |
Markdown | UTF-8 | 356 | 3.125 | 3 | [] | no_license | # Level 0
> The goal of this level is for you to log into the game using SSH. The host to which you need to connect is bandit.labs.overthewire.org, on port 2220. The username is bandit0 and the password is bandit0
To log into the game, simply run this command `ssh bandit0@bandit.labs.overthewire.org -p 2220` and inpu... |
JavaScript | UTF-8 | 387 | 2.5625 | 3 | [] | no_license | const ACTION_TYPES = {
SET_IS_LOADING: 'SET_IS_LOADING',
};
export const setIsLoading = payload => ({
type: ACTION_TYPES.SET_IS_LOADING,
payload,
});
const isLoadingReducer = (isLoading = false, action) => {
switch (action.type) {
case ACTION_TYPES.SET_IS_LOADING:
return action.payload;
default... |
JavaScript | UTF-8 | 2,994 | 4.28125 | 4 | [] | no_license | // STEP 1 understanding the problem
//
// 1. restate the question back in my own words
// 2. what are the inputs to the problem
// 3. what are the outputs that are to be returned
// 4. can the outputs be determined from the inputs
// 5. how should i label important pieces of data that are part of the problem
// STEP ... |
Markdown | UTF-8 | 1,070 | 2.578125 | 3 | [] | no_license | # Collection of Dockerfile
## Debian stack
I used debian as base for all my other application following thhis schema:
<img src="https://github.com/Seba0691/Dockerfiles/raw/master/docker_arch.png">
- **Debian custom** : provides a common layer where the most common utility are installed
- **Python stack** : provides... |
Ruby | UTF-8 | 1,400 | 3.46875 | 3 | [] | no_license | class Action
def place(command)
_command, x, y, f = command.tr(',', ' ').split
Position.new(x.to_i, y.to_i, f)
end
def move(position)
y = position.y
x = position.x
f = position.f
y += 1 if f.match?('NORTH')
x += 1 if f.match?('EAST')
... |
Ruby | UTF-8 | 208 | 2.984375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive |
def key_for_min_value(name_hash)
if name_hash != {}
m = 100000
msg=""
name_hash.each do |k,v|
if m > v
m = v
msg = k
end
end
else
return nil
end
msg
end |
Shell | UTF-8 | 303 | 3.453125 | 3 | [] | permissive | #!/bin/sh
set -e
MAKE=${MAKE:-make}
subdir="$1"
tarball="$2"
tmpdir=$(mktemp -d)
trap "rm -rf '$tmpdir'" EXIT
tar xf "$tarball" -C "$tmpdir"
cd "$tmpdir/$subdir"
if [ -n "${CONFIG_PATH}" ]; then
echo "Setting config to ${CONFIG_PATH}"
cp "${CONFIG_PATH}" test/resources/config.json
fi
$MAKE test
|
Shell | UTF-8 | 974 | 2.859375 | 3 | [] | no_license | rm output.csv
#Remove Headers if you dont need
echo "Cluster","Namespace","Deployment Count","Pod Count" >> output.csv
for cluster in $(python3 queryinstana.py label FROM KubernetesCluster where 'entity.selfType:kubernetesCluster' )
do
for namespace in $(python3 queryinstana.py label FROM KubernetesNamespace wher... |
C | UTF-8 | 1,644 | 2.703125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* terminates2.c :+: :+: :+: ... |
PHP | UTF-8 | 1,923 | 2.78125 | 3 | [] | no_license | <?php
/**
* @author JKetelaar
*/
namespace Parabot\BDN\BotBundle\Service\Library\TeamCity\Entity;
use Parabot\BDN\BotBundle\Service\Library\TeamCity\TeamCityPoint;
use Symfony\Component\Serializer\Annotation\Groups;
class TeamCityBuild implements TeamCityEntity {
/**
* @Groups({"default"})
*
* ... |
Java | UTF-8 | 12,860 | 1.679688 | 2 | [] | no_license | /* */ package cn.mopon.scenic.gateway.remote;
/* */ // this is hostA changed HostA pust 2
/* */ // this is hostA changed new hostB
// HOst B Add again
// HOST B ADD 2
/* */ import cn.mopon.scenic.gateway.constant.ResponseConstants;
/* */ import cn.mopon.scenic.gateway.constant.Transactio... |
C++ | UTF-8 | 3,597 | 2.953125 | 3 | [] | no_license | #include "IPListDAO.h"
IPListDAO::IPListDAO(SQLite &db) : db(db)
{
}
IPListDAO::~IPListDAO()
{
}
int IPListDAO::insert(IPListModel model)
{
string sql = "INSERT INTO `ip_list` (`vps_id`,`ip_type`,`ip`) VALUES (?, ?, ?);";
this->db.setQuery(sql);
this->db.setParamInt(model.getVPSID());
this->db.setParamText(mod... |
Java | UTF-8 | 889 | 3.1875 | 3 | [] | no_license | package com.company;
import java.io.*;
public class CSVDataWriter implements DataWriter {
private String outputFile;
private FileWriter CSVwriter;
public CSVDataWriter(String outputFileName) throws IOException {
outputFile = outputFileName;
CSVwriter = new FileWriter(outputFile);
... |
Swift | UTF-8 | 1,046 | 2.921875 | 3 | [] | no_license | //
// PersonDetailsViewController.swift
// TableMVVM-Example
//
// Created by Flávio Silvério on 07/09/17.
// Copyright © 2017 Flávio Silvério. All rights reserved.
//
import UIKit
class PersonDetailsViewController: UITableViewController {
var viewModel : PersonDetailsViewModel!
init(with style: UIT... |
PHP | UTF-8 | 7,547 | 3.03125 | 3 | [] | no_license | <?php
class Inscription extends Modele
{
public function valide_infos($pseudo,$courriel)
{
$valeur_pseudo = "";
$valeur_confirmation = "";
$type_pseudo = "hidden";
$type_confirmation = "hidden";
$statut_pseudo = true;
$helo_address = "mail.vif.ca";
$verifi... |
C++ | UTF-8 | 1,860 | 2.796875 | 3 | [] | no_license | #include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>
#include <bits/stdc++.h>
#include "userdefined.h"
double dot_prod(double A[2], double B[2]) {
return A[0]*B[0] + A[1]*B[1];
}
double max(double a, double b) {
if(a>b) return a;
return b;
}
double min(double a, double b) {
if(a<b) return a;
return b;
}
... |
C# | UTF-8 | 541 | 2.640625 | 3 | [] | no_license | namespace RPI.WiringPiWrapper.WiringPi.Wrappers.Timing
{
public class TimingWrapper : IWrapTiming
{
public void Delay(uint howLong)
{
WiringPi.Timing.Delay(howLong);
}
public void DelayMicroseconds(uint howLong)
{
WiringPi.Timing.DelayMicrosecond... |
Markdown | UTF-8 | 22,014 | 2.75 | 3 | [] | no_license |
# 通过赔率预测比赛 - unixfy - 博客园
# [程序最美(寻路)](https://www.cnblogs.com/unixfy/)
你还在坚持练习你的技术吗?运动员天天训练,音乐家也会演练更难的曲章。你呢?
## [通过赔率预测比赛](https://www.cnblogs.com/unixfy/p/3476696.html)
通过赔率预测比赛
根据历往博彩公司开的赔率以及每次比赛的胜负,运用分类算法(本质上是二元分类,因为只是针对胜负)进行未来比赛的预测。得到的结果并不算很理想。主场情况下,最好只能达到七成的准确率,客场更差,对于二串一的玩法这种准确率无法胜任。
采用的分类算法是KNN,KNN的实现也可以详见之前的C... |
C# | UTF-8 | 4,815 | 3.203125 | 3 | [] | no_license | using System;
class GameBarObject : GameObject
{
private const int MIN_SIZE = 3;
private const int BORDER_WIDTH = 2;
private double percent;
private int max;
private int value;
private string output = "";
private int fillCount = 0;
private ConsoleColor colour;
public GameBarObject... |
Java | UTF-8 | 1,219 | 2.484375 | 2 | [] | no_license | package com.docsis.beans;
import java.util.Date;
public class Cliente {
private int codCliente;// bigint PRIMARY KEY,
private String nome;// varchar(70),
private Date caddata;// date,
private Date bloqdata;// date,
private long contrato;//bigint
private String cpf; //varchar
public long getContrato() {
r... |
SQL | UTF-8 | 4,637 | 3.484375 | 3 | [] | no_license | CREATE DATABASE IF NOT EXISTS TPCH DEFAULT CHARACTER SET GBK COLLATE GBK_CHINESE_CI;
CREATE SCHEMA IF NOT EXISTS Sales DEFAULT CHARACTER SET GBK COLLATE GBK_CHINESE_CI;
USE Sales;
CREATE TABLE IF NOT EXISTS Region ( -- 地区表
regionkey INTEGER PRIMARY KEY, -- 地区编号(主键)
name CHAR(25), ... |
Shell | UTF-8 | 3,779 | 3 | 3 | [] | no_license | #!/bin/sh
set -eu
if [ $# -eq 1 ]; then
re='^[0-9]+$'
if ! [[ $1 =~ $re ]] ; then
echo "Invalid number of cores" >&2; exit 1
fi
jobs=$1
else
jobs=$(sysctl -n hw.logicalcpu_max)
fi
curl -fsSL "https://zlib.net/zlib-$ZLIB_VERSION.tar.gz" -o zlib-$ZLIB_VERSION.tar.gz
shasum -a 256 zlib-$ZLIB_VERSION.tar.gz ... |
Shell | UTF-8 | 149 | 2.53125 | 3 | [] | no_license | #!/bin/bash
FP="./_posts/$(date +%Y-%m-%d)-$1.md"
echo "---" >> $FP
echo "layout: post" >> $FP
echo "title: $1" >> $FP
echo "---" >> $FP
vim $FP
|
C++ | UTF-8 | 378 | 2.5625 | 3 | [] | no_license | /* Copyright G. Hemingway @ 2019, All Rights Reserved */
#include "Composite_Binary_Node.h"
// Ctor
Composite_Binary_Node::Composite_Binary_Node(Component_Node* left, Component_Node* right)
: Composite_Unary_Node(right)
, leftChild(left)
{
}
// Return the left child pointer
Component_Node* Composit... |
JavaScript | UTF-8 | 1,476 | 2.578125 | 3 | [
"MIT"
] | permissive | "use strict";
import React from 'react';
import { LunchGroupList } from '../components/LunchGroupList';
import LunchGroupService from '../services/LunchGroupService';
export class LunchGroupsListView extends React.Component {
constructor(props) {
super(props);
this.state = {
loadi... |
Java | UTF-8 | 6,813 | 1.5 | 2 | [] | no_license | package org.apache.jsp.view;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
public final class signup_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static final JspFactory _jspxFactory = JspFactory.getDefaul... |
Java | UTF-8 | 465 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | package com.bluecatcode.common.base;
/**
* @see java.util.concurrent.Callable
* @see com.bluecatcode.common.base.Consumer
* @see com.bluecatcode.common.base.Effect
* @see com.google.common.base.Function
* @see com.google.common.base.Predicate
* @see com.google.common.base.Supplier
*/
public interface Block<T> {... |
Shell | UTF-8 | 825 | 3.8125 | 4 | [] | no_license | echo "Running unit tests"
# create a header for this run in the log
echo "\n" >> tests/tests.log
echo "Starting Test Suite "$(date) >> tests/tests.log
echo "================================================" >> tests/tests.log
for tf in tests/*_tests; do
if test -f $tf; then
# Create a header for this fi... |
SQL | UTF-8 | 161 | 3.46875 | 3 | [] | no_license | SELECT object.MEDIUM, country.COUNTRY
FROM
object NATURAL JOIN country_object NATURAL JOIN country
GROUP BY country.countryid
ORDER BY COUNT(0) DESC
LIMIT 10 |
Java | UTF-8 | 641 | 2.828125 | 3 | [] | no_license | package array;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.Random;
public class ArraysSortTest {
public static void main(String[] args) {
String token = "4gService";
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat... |
Java | UTF-8 | 1,362 | 2.375 | 2 | [
"Apache-2.0"
] | permissive | package denominator.common;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static denominator.common.Preconditions.checkArgument;
import static denominator.common.Preconditions.checkNotNull;
import static denominator.common.Preconditions.checkState;
import static org.as... |
Python | UTF-8 | 1,545 | 2.703125 | 3 | [] | no_license | from flask import Flask, request, redirect, url_for, render_template
from flask_login import LoginManager, login_user, logout_user, current_user, login_required
from models import User, query_user
# https://www.jianshu.com/p/01384ee741b6
app = Flask(__name__)
app.secret_key = '1234567'
login_manager = LoginMana... |
Markdown | UTF-8 | 5,966 | 2.984375 | 3 | [
"MIT"
] | permissive | ---
layout: blog
categories:
- blog
title: "Chi Hack Night's Open Data Pledge for Cook County Clerk of the Circuit Court"
description: "With the initial success of our open data pledge for Cook County State’s Attorney, Chi Hack Night is turning our attention to another important county race. We’re inviting every can... |
JavaScript | UTF-8 | 1,030 | 2.609375 | 3 | [] | no_license | var React = require('react');
var UserSignIn = (props) => {
return (
<div className="signin input">
Sign In
<form onSubmit={props.postToSignin}>
<input type='text' id='username' placeholder = 'username' name='usernameInSignin' onChange={props.handleUsernameChange} required/>
<input ty... |
Python | UTF-8 | 4,669 | 2.875 | 3 | [] | no_license | from yaml import dump
try:
from yaml import CDumper as Dumper
except ImportError:
from yaml import Dumper
import pdb
import re
import logging
from os import path
import sys
import bs4
from .corpus import Queryable
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHa... |
Python | UTF-8 | 2,123 | 2.609375 | 3 | [] | no_license | import pandas as pd
from requests import get
from bs4 import BeautifulSoup
import os
################################ Acquire Blogs #################################
def get_blogs(websites, cached = False):
if cached == True:
blogs = pd.read_json('blogs.json')
else:
... |
Python | UTF-8 | 2,790 | 2.75 | 3 | [
"MIT"
] | permissive | import discord
from discord.ext import commands
import random
import config
description = '''Bot for Kugu discord, all questions should be directed to "Kirsty (Princess Vamps)"'''
bot = commands.Bot(command_prefix='!', description=description)
@bot.event
async def on_ready():
print('Logged in as')
print(bot.u... |
Java | UTF-8 | 1,186 | 3.03125 | 3 | [] | no_license | import com.crosswords.controlers.Generator;
import com.crosswords.controlers.GeneratorThread;
/**
* Created by Mariusz on 2014-05-18.
*/
public class Algorithm {
public static char[][] generate(String[] args) {
char[][] matrix=null;
try {
int maxWordsCount = 0;
int maxSi... |
C | GB18030 | 2,401 | 3.265625 | 3 | [] | no_license | #include"game.h"
void InitArray(char board[ROW][COL], int row, int col)
{
int i = 0;
int j = 0;
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
board[i][j] = ' ';
}
}
}
void PrintArray(char board[ROW][COL], int row, int col)
{
int i = 0;
int j = 0;
for (i = 0; i < row; i++)
{
for (j = 0; j <... |
Markdown | UTF-8 | 717 | 3.453125 | 3 | [
"MIT"
] | permissive | # Usecase
The following homework is to apply the learning of using an iterator for dealing a deck of cards. It is very similar to the lab for cards, however, you will need to:
1. Create the cards in a ArrayList.
2. Have a class variable that is the iterator of the ArrayList.
You will use the iterator to do the dealing... |
C++ | UTF-8 | 798 | 2.953125 | 3 | [] | no_license | #include "../Headers/Modyst.h"
#include <sstream>
namespace Text
{
//Enables a modificator in a string
std::string setMod(Code code)
{
std::stringstream stst;
stst << "\033[" << code << "m";
return stst.str();
}
//Disable a modificator in a string
std::string clearMod(C... |
Python | UTF-8 | 2,047 | 2.59375 | 3 | [] | no_license | import torch
from torchvision.utils import make_grid
from torchvision.transforms import ToTensor
from torchvision.datasets import MNIST, ImageFolder
from torch.utils.data.dataloader import DataLoader
from torch.utils.data import random_split
import matplotlib.pyplot as plt
import numpy as np
def get_data(batch_size,... |
Markdown | UTF-8 | 1,062 | 2.8125 | 3 | [] | no_license | # immobilienscout24
immobilienscout24 Technical Challenge
### Technologies used
* Java 8
* Library
* Jsoup (HTML Parser)
* Guava (Util library)
* Apache commons-validator (Util library)
* Spring-boot (Application)
* Thymeleaf (Template engine)
* Bootstrap (CSS)
### Run the Application
You can package and run t... |
Python | UTF-8 | 1,647 | 2.859375 | 3 | [] | no_license | import torch
import matplotlib.pyplot as plt
from data_handler import DataHandler
def display(config_path, model_path):
data_handler = DataHandler(config_path)
height, width = data_handler.raw_image.shape
model = torch.load(model_path)
predicted_image = model(data_handler.torch_data["features"]).deta... |
C# | UTF-8 | 486 | 2.578125 | 3 | [] | no_license | using Microsoft.AspNetCore.Authorization;
namespace Globomantics.Core.Authorization
{
public class RequiredRightAttribute : AuthorizeAttribute
{
public const string PolicyPrefix = "RequiredRight";
public RequiredRightAttribute(string right)
{
Right = right;
}
... |
PHP | UTF-8 | 2,180 | 2.6875 | 3 | [] | no_license | <html>
<head>
<title>Word List</title>
<!-- Bootstrap CDN -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/boo... |
Markdown | UTF-8 | 6,663 | 3.09375 | 3 | [
"MIT"
] | permissive | ---
layout: default
title: "MSEngine ZA Ultra"
date: 2020-06-16 13:35:03 -0400
tags: minesweeper
---
# MSEngine ZA Ultra
### My journey creating a zero allocation minesweeper engine and solver
Before I begin this series of posts documenting this project, I have a confession to make.
> I have never actually played... |
Java | UTF-8 | 2,247 | 3.03125 | 3 | [] | no_license | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution
{
static int map[][];
static boolean visit[][];
static int N, K;
static int max = 0;
static final int dx[] = {0, 0, 1, -1};
static final int dy[] = {1, -1, 0, 0};
static int ans;
sta... |
C++ | UTF-8 | 631 | 2.90625 | 3 | [] | 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.
*/
/*
* File: main.cpp
* Author: johnchan
*
* Created on 2016年4月13日, 下午2:16
*/
#include <cstdlib>
#include <iostream>
#include <... |
Markdown | UTF-8 | 1,590 | 2.875 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Online Learning Workshop in Paris
date: 2017-10-20 23:18:45
categories: events
---
An online learning workshop was held at Telecom Paritech on September 20, followed by the PhD defense of <a href="https://www.cvernade.com/" style="color:#3A01DF">Claire Vernade</a>. <a href="https://sites.ualb... |
Markdown | UTF-8 | 2,089 | 3.09375 | 3 | [] | no_license | # 115 Distinct Subsequences
1. DFS(TLE)
```c++
class Solution {
public:
string S,T;
int ans=0;
int func(int i,int j,int matched){
if(matched==T.size()){
ans++;
return;
}
if(i==S.size()||j==T.size())return;
func(i+1... |
Python | UTF-8 | 3,247 | 3.015625 | 3 | [] | no_license | import math
import argparse
def get_data(ip):
splt = ip.split("/")
ip = splt[0]
mask = int(splt[1])
return ip,mask
def get_oct_ip(ip):
ip_array=ip.split(".")
octet=[]
for part in ip_array:
octet.append(int(part))
return octet
def bit_not(n, numbits=8):
return (1 << numbits... |
C# | UTF-8 | 3,707 | 2.71875 | 3 | [] | no_license | //Steven Cruickshank
//October 22 2017
//Assignement #2 for OOPL/C#
//
//BIGBUCKSBANK application. create an ATM application called BIGBUCKSBANK. include required
//functions, and data. Calculations are performed, and when the user is finished, a list of
//transactions are printed out as a digital "receipt", and the... |
TypeScript | UTF-8 | 533 | 2.5625 | 3 | [] | no_license | import {
PipeTransform,
Injectable,
BadRequestException
} from '@nestjs/common';
@Injectable()
export class PipeJoiValidation implements PipeTransform {
constructor(private readonly schema: any) {}
transform(value: any) {
const { error } = this.schema.validate(value);
if (error) {
... |
C++ | UTF-8 | 5,098 | 2.875 | 3 | [] | no_license | // Demonstrate creating a spritesheet
#include <SFML/Graphics.hpp>
#include <iostream>
using namespace std;
enum DIR{LEFT,RIGHT};
enum STATE{ON,OFF};
bool flipped = false;
DIR fire = LEFT;
DIR facing = LEFT;
int width = 22;
int height = 25;
int main(int argc, char ** argv){
//create a font
sf::RenderWin... |
Markdown | UTF-8 | 1,221 | 3.015625 | 3 | [] | no_license | # HTN-Demo
This is a demo of a Hierarchical task network.
Created with Unity version 2018.2.10
The demo is a small game. The objective is to collect 5 items (purple) before the The other agent, or have more items if both get caught.
The player is the blue agent.
The AI is the green agent.
Player controls:
A,S,D,W:... |
Java | UTF-8 | 6,097 | 2.59375 | 3 | [] | no_license | package dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import factory.ConexaoFactory;
import model.Fabricante;
public class FabricanteDAO extends BasicDAO {
@Override
public void incluir(Object ... |
Java | UTF-8 | 223 | 2.34375 | 2 | [] | no_license | package edu.cs.fsu.cen4020.weapons;
/**
* Created by Javier on 3/29/2017.
*/
public class IllegalArmorException extends Exception{
public IllegalArmorException() {
super("Armor value is illegal!!");
}
}
|
Rust | UTF-8 | 2,954 | 2.765625 | 3 | [] | no_license | use std::io::Read;
use errors::*;
use lines::Line::*;
use queries::*;
use query::*;
use peg;
pub fn parse<P: Parse>(text: P) -> Result<Queries> { Parse::parse(text) }
pub trait Parse {
fn parse(text: Self) -> Result<Queries>;
}
impl<'a, R: Read> Parse for &'a mut R {
fn parse(text: &mut R) -> Result<Quer... |
Python | UTF-8 | 665 | 2.75 | 3 | [] | no_license | import sys
from PyQt5 import QtCore, QtGui
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import(
QMainWindow,
QApplication,
QLabel
)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.label = QLabel()
canvas = QtGui.QPixmap(400, 300)
canvas.... |
Java | UTF-8 | 3,323 | 2.21875 | 2 | [] | no_license | package com.es.dao.user;
import java.sql.Timestamp;
import java.util.List;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.... |
SQL | UTF-8 | 5,781 | 4.09375 | 4 | [
"MIT"
] | permissive | -- REQUIRES MYSQL-SERVER-5.7.6 OR HIGHER
CREATE DATABASE IF NOT EXISTS TELEPHONE_DIRECTORY;
USE TELEPHONE_DIRECTORY;
CREATE USER IF NOT EXISTS 'DIRECTORY_APP'@'localhost' IDENTIFIED BY 'D!rect0ry';
CREATE TABLE IF NOT EXISTS `CONTACTS` (
`id` VARCHAR(40) NOT NULL COMMENT 'System-generated GUID',
`full_name`... |
C++ | UTF-8 | 739 | 2.515625 | 3 | [] | no_license | /**************************************************************************************************
** Program Name:Zoo Tycoon
** Author: Clinton Hawkes
** Date: 04/21/2019
** Description: Header file for the Turtle class. This file contains the constructor and the two
member functions used ... |
JavaScript | UTF-8 | 825 | 2.546875 | 3 | [] | no_license | import axios from 'axios';
/**
* Получить все продукты.
*/
export const getProducts = () => {
return axios.get('http://localhost:1234/product');
}
/**
* Получить продукт по id.
*/
export const getProductById = (id) => {
return axios.get('http://localhost:1234/product/' + id);
}
/**
* Создать продукт.
*... |
C++ | UTF-8 | 1,202 | 2.515625 | 3 | [] | no_license | #pragma once
#include <vector>
#include <list>
#include "../Structs/Rectangular.h"
#include "../Structs/Vector.h"
#include "../Interfaces/Updateable.h"
#include "../Structs/Assert.h"
class IBaseObject :
public IUpdateable
{
public:
IBaseObject(const IBaseObject * Owner, EUpdateSpeed UpdateSpeed, bool IsMoveable);... |
Markdown | UTF-8 | 592 | 3.578125 | 4 | [
"Apache-2.0"
] | permissive |
## リストの要素を前からいくつか削る
drop関数を使います
### フォーマット
drop(削る要素数)
### 実装サンプル
val array = arrayOf(1, 2, 3, 4, 5)
array.drop(1).forEach{println(it)} // => 2, 3, 4, 5
array.drop(2).forEach{println(it)} // => 3, 4, 5
array.drop(3).forEach{println(it)} // => 4, 5
array.drop(4).forEach{println(it)} // => 5... |
Java | UTF-8 | 884 | 2.671875 | 3 | [] | no_license | package com.imarticus.demo.SpringCoreProject;
import java.util.List;
public class Department {
private int did;
private String name;
private List<String> functions;
public Department() {
super();
// TODO Auto-generated constructor stub
}
public Department(int did, String name, List<String> functions) {
... |
C++ | UTF-8 | 601 | 2.90625 | 3 | [] | no_license | /*
NEWPTIT
*/
#include<bits/stdc++.h>
#define ll long long
using namespace std;
string strcpy(string s, int l, int r){
string str="";
for(int i=l;i<=r;i++)
str=str+s[i];
return str;
}
bool searchString(string s2, string s1){
if(s2==s1)
return true;
ll l1= s1.length();
ll l2= s2.length();
for(int i=0; l1 - i... |
C++ | UTF-8 | 1,103 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode *buildTree(vector<int> &inorder, vector<int> &postorder) {
int pos = postorder.size() - 1... |
Markdown | UTF-8 | 2,248 | 3.25 | 3 | [] | no_license | **Get All channels**
----
Returns json data about all channels in the system.
* **URL**
api/channels
* **Method:**
`GET`
* **URL Params**
None
* **Data Params**
None
* **Success Response:**
* **Code:** 200 <br />
**Content:** `[{ "name": "C1" }, { "name": "C2" }, { "name": "C3" }]`
* **Er... |
Java | UTF-8 | 1,373 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | package com.talanlabs.taskmanager.engine.manager;
import com.talanlabs.taskmanager.engine.graph.IStatusGraph;
import com.talanlabs.taskmanager.engine.task.IStatusTask;
import com.talanlabs.taskmanager.model.ITaskObject;
import java.util.List;
public interface ITaskObjectManager<E, F extends ITaskObject> {
/**
... |
C++ | UTF-8 | 1,112 | 2.546875 | 3 | [] | no_license | #include "stdlib.h"
#include "windows.h"
#include <ChaCha.h>
int main()
{
ChaCha c1;
ChaCha c2;
uint8_t key[ 32u ];
for( int i = 0u; i < sizeof( key ); ++i )
{
key[ i ] = uint8_t( rand() );
}
c1.setKey( key, sizeof( key ) );
c2.setKey( key, sizeof( key ) );
uint8_t iv[ 12u ];
for( int i = 0u; i < sizeof... |
Shell | UTF-8 | 7,670 | 4.03125 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
## Tested on:
## Mac OSX 10.11, 10.12 & 10.13
## Ubuntu 16.04
## Amazon Linux & Amazon Linux 2
## Tomato USB Router
## requires jq - available via most Linux package managers, Brew on OSX
## and binaries or source at https://stedolan.github.io/jq/download/
## Cache file settings
## cacheFileDir must end ... |
C++ | GB18030 | 9,597 | 2.546875 | 3 | [] | no_license | #define _CRT_SECURE_NO_DEPRECATE 0
/*
* Copyright(C), 2007-2008, XUPT Univ.
* ţTTMS_UC_02
* File name: Seat_UI.c
* Description : λ
* Author: XUPT
* Version: v.1
* Date: 2015422
*/
#include "EntityKey_Persist.h"
#include "Seat_UI.h"
#include "Seat.h"
#include "Studio.h"
#include "List.h"
#include <stdio.h>
#include ... |
Python | UTF-8 | 225 | 3.359375 | 3 | [] | no_license | print('Just another print statement. Nothing special.')
import test
var = input('What is the radius of the circle?')
print('Circumference is', test.Circumference(float(var)), 'and area is', test.Surface_area(float(var)))
|
Python | UTF-8 | 1,494 | 2.796875 | 3 | [
"MIT"
] | permissive | def ergMetersPerDay(workoutsData, Activities, DateManager):
chronologicalData = DateManager.getWorkoutsDataChronologically(workoutsData)
ergMetersPerDay = {}
for workout in chronologicalData:
workoutDate = DateManager.fetchDateFromTimestampString(workout['time'])
if (workoutDate not in ergMe... |
Java | UTF-8 | 859 | 3.5 | 4 | [] | no_license | public class Example1{
@FunctionalInterface
interface HelloWorld{
default void sayGoodBye(){
System.out.println("adeus mundo");
}
void sayHelloWorld(String message);
//void xpto(String xxxx);
}
class HelloWorldImpl implements HelloWorld{
public void sayHelloWorld(String message){
System.out.print... |
Markdown | UTF-8 | 2,762 | 2.6875 | 3 | [] | no_license | ```python
import equity_backtesting_library as elib
import datetime as dt
result = {}
result['instrument'] = 'SOXX'
result['spread'] = 0
result['sign1'], result['sign2'] = elib.strategy_type('medium')
result['margin_used'] = 1
result['funds'] = 50000
result['levarage'] = 1
result['tx_cost'] = 0
result['strategy'] = "s... |
Markdown | UTF-8 | 5,746 | 2.703125 | 3 | [] | no_license |
# Get UniProt Protein Info (GUPPI)
Process TDReports or flat files by getting information from the UniProt webservice and filtering by a selectable FDR value. Install the necessary packages (using `A_install.packages.R`), set input parameters and source `00_run_all.R` to process data.
## Input
All input parameters ... |
Java | UTF-8 | 4,640 | 2.09375 | 2 | [] | no_license | /*
Copyright (c) 2004, The JAP-Team
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the follow... |
C++ | UTF-8 | 808 | 3.484375 | 3 | [] | no_license | #pragma once
#include <string>
class Board{
public:
enum Play{
X = -1,
O = 0
};
Board();
~Board();
/**
* @brief Checks if the board has a winner
*
* @return char 'x' if x wins or 'o' of o wins. Otherwise returns a space ' '
*/
char winner();
/**
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.