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 | 478 | 2.765625 | 3 | [] | no_license | #include "StdAfx.h"
#include "Parametr.h"
#include "size.h"
Parametr::Parametr()
{
_size=Size();
_weight=0;
}
Parametr::Parametr(Size size,int weight)
{
_size=size;
_weight=weight;
}
Parametr::Parametr(int height, int width, int weight)
{
Size size(height, width);
_size=size;
_weight=weight;
}
Size Parametr::Ge... |
Shell | UTF-8 | 724 | 3.375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env bash
set -euo pipefail
staffi_image="local/stafi:latest"
NC='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
echo
echo -e "${RED}Ensure you run the cleanup.sh script before running this script${NC}"
echo
echo -e "${GREEN}Starting stafi container...${NC}"
docker run -d --restart=unle... |
JavaScript | UTF-8 | 1,668 | 3.375 | 3 | [
"MIT"
] | permissive | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// ENUMERADOS EN TYPESCRIPT
// Es una forma que tiene typescript para poder crear nuestros propios tipos de datos(datos reducidos)
// Permite modificar el indice de cada enumerado
// type Curso : string | number; (datos no reducidos, en number... |
Python | UTF-8 | 288 | 3.59375 | 4 | [] | no_license | funcionario = (input('Digite o seu nome: '))
qtd_horas = int(input('Digite a suas horas trabalhadas: '))
sal_valor = float(input('Digite o valor da sua hora de trabalho: '))
salario = qtd_horas * sal_valor
print('O salário do funcinário ' + funcionario + ' é de R$: ' + str(salario)) |
Python | UTF-8 | 375 | 3.75 | 4 | [] | no_license | #1) Import the random function and generate both a random number between 0 and 1 as well as a random number between 1 and 10.
import random
import datetime
print(random.random())
print(random.randint(1,10))
#2) Use the datetime library together with the random number to generate a random, unique value.
print(date... |
C# | UTF-8 | 988 | 3.734375 | 4 | [] | no_license | using System;
namespace Trie2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Radix Tree \n");
Trie t = new Trie();
string phrase = "hack hackerrank";
string[] wordsFromPhrase = phrase.Split(" ");
foreach (stri... |
C++ | UTF-8 | 1,075 | 2.765625 | 3 | [] | no_license | #pragma once
#include <string>
using namespace std;
#include "Def.h"
namespace tcp
{
// Tcp Service
class TcpService
{
public:
TcpService(const string& ip, const int& port, ETcpSrvType type);
virtual ~TcpService();
protected:
string strIp; // Ip
int nPort; // Port
ETcpSrvType type; // Tcp Servic... |
C++ | UTF-8 | 2,109 | 4.03125 | 4 | [] | no_license | /*
Author: Veeupup
汉诺塔的非递归实现
我们先来说明汉诺塔问题
对于一个有 n 个盘子的汉诺塔,有 A,B,C 三个塔
如果需要将 n 个盘子从 A -> C 上
需要有三步:
1. 将 A 上的 n-1 个盘子以 C 为辅助塔,从 A 移动到 B 上
2. 将 A 上的最大的盘子从 A->C 上
3. 将 B 上的 n-1 个盘子以 A 为辅助塔,从 B 移动到 C 上
采用递归实现即可
非递归的实现方法:
*/
#include <iostream>
#include <cstdio>
#include <cstd... |
Markdown | UTF-8 | 4,084 | 2.625 | 3 | [] | no_license | # 剧本是不是这样的:美军舰本想悄悄[过台海](http://news.sina.com.cn/c/2018-07-07/doc-
ihexfcvm4000668.shtml),结果蔡英文太咋呼
美驱逐舰过台海是在搞心理游戏。
美国两艘驱逐舰昨天通过台湾海峡,这被普遍认为是美方针对中美关系及台海问题展示姿态的一个行动。目前因贸易战中美关系整体趋紧,台海方向因蔡英文当局不断挑衅风险在
增加,这个时候美国在西太平洋地区的舰队又出来表演了。

上个月,五角大楼就通过媒体放风... |
Java | UTF-8 | 4,458 | 3.53125 | 4 | [] | no_license | /* This is the driving engine of the program. It parses the command-line
* arguments and calls the appropriate methods in the other classes.
*
* You should edit this file in two ways:
* 1) Insert your database username and password in the proper places.
* 2) Implement the three functions getInformation, registerSt... |
C++ | UTF-8 | 1,186 | 3.359375 | 3 | [] | no_license | #pragma once
#include "Common.h"
#include "MyMutex.h"
template<class T> class MyList
{
public:
MyList();
virtual ~MyList();
public:
void Push(T it);
T Pop();
public:
int Size();
bool Empty();
T Front();
T Back();
void Clear();
public:
list<T> all;
MyMutex* mtx;
};
template<cl... |
Markdown | UTF-8 | 5,837 | 3.203125 | 3 | [] | no_license | # code-standards
**This is a living document and subject to change.**
Please Note: On Acquia we will not be using their feature "Live Development" which would allow you to directly edit code on dev or stage.
## Code Review & Standards
For Drupal 8 we will generally refer to [Drupal 8 coding standards](https://www.dru... |
Python | UTF-8 | 1,292 | 2.953125 | 3 | [
"MIT"
] | permissive | import glob
import os
import re
import yaml
from collections import namedtuple
QuestionSet = namedtuple(
'QuestionSet',
['name', 'difficulty', 'coolness', 'time', 'questions'],
)
Question = namedtuple(
'Question',
['content', 'time'],
)
def sanitize(str):
try:
s = str.encode('ascii')
... |
Java | UTF-8 | 510 | 2.5 | 2 | [] | no_license | package net.upd4ting.uhcreloaded.task.tasks;
import net.upd4ting.uhcreloaded.Game;
import net.upd4ting.uhcreloaded.UHCReloaded;
import net.upd4ting.uhcreloaded.task.Task;
public class GameTask extends Task {
private Integer time;
public GameTask() {
super("GameTask", 20);
this.time = 0;
}
@Override
publi... |
Python | UTF-8 | 531 | 3.65625 | 4 | [] | no_license | # -*- encoding: utf-8 -*-
def find_num_in_partially_sorted_matrix(matrix, target):
if not matrix or not matrix[0]:
return False
i = 0
j = len(matrix[0]) - 1
while i < len(matrix) and j >= 0:
if matrix[i][j] == target:
return True
elif matrix[i][j] > target:
... |
PHP | UTF-8 | 1,517 | 2.546875 | 3 | [] | no_license | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Home_model extends CI_Model
{
function __construct()
{
parent::__construct();
}
// public function getAllProducts()
// {
// $q = $this->db->get('products');
// if($q->num_rows() > 0) {
// foreach (($q->result()) as $ro... |
C# | UTF-8 | 1,804 | 3.28125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace GrabTheScreen
{
public class Auto
{
// Du kannst die Eigenschaften des Modells mit C#-Properties darstellen.
// Properties kannst du wie ein Feld benutzen, aber du musst die
// get- und set... |
PHP | UTF-8 | 1,911 | 2.53125 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Policies;
use App\Models\Project;
use App\Models\Topic;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class TopicPolicy
{
use HandlesAuthorization;
/**
* Grant all abilities to administrator.
*
* @param \App\Models\Models\User $user
* @return... |
JavaScript | UTF-8 | 2,494 | 3.21875 | 3 | [] | no_license | let numbers = document.querySelectorAll(".number"),
operations = document.querySelectorAll(".operator"),
clearBtns = document.querySelectorAll(".clear-btn"),
decimalBtn = document.getElementById("decimal"),
result = document.getElementById("result"),
display = document.getElementById("display"),
... |
Java | UTF-8 | 6,938 | 2.3125 | 2 | [] | no_license | package ssm.springmvc.crud;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Controller;
import org.springf... |
Markdown | UTF-8 | 2,010 | 2.59375 | 3 | [] | no_license | # ReistijdenAPI
App Engine API voor reistijden verkeerscentrum
Deploying this to the Google App Engine enables the following API:
##Knooppunten
Knooppunten: List all knooppunten in the Flemish verkeerscentrum network
/knooppunten
[{"name":" A12 Meise","verkeerscentrumName":" A12 Meise","xCo":50.943906,"yCo":4.324... |
Java | GB18030 | 1,137 | 1.820313 | 2 | [] | no_license | /**
* Copyright: Copyright (c)2015
* Company: Ϣ˾(jxhtxx.com)
*/
package com.kylinapp.service.impl;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.kylinapp.model.TAB_WXBLOGCATEGORY;
import com.kylinapp.servi... |
Python | UTF-8 | 819 | 3.296875 | 3 | [] | no_license | import re
with open("input.txt") as f:
inp = f.readlines()
def parse(inp: list) -> dict:
bags = {}
for line in inp:
line = line.split("contain")
parent_bag = line[0].split("bags")[0].strip()
bag_contents = {}
for bag in line[1].split(','):
bag = bag.sp... |
Markdown | UTF-8 | 4,980 | 3.15625 | 3 | [] | no_license | # How to create a Docker for your Angular Project
The idea here is to use a multiple build step using [node](https://nodejs.org/en/) image to create an optimized and compact build and [nginx](https://www.nginx.com/) image to serve the compiled files
Here are the steps to create our Docker container with our Angular ... |
Java | UTF-8 | 726 | 2.8125 | 3 | [] | no_license | package designPatterns.proxy.javaProxy.promotion;
import designPatterns.proxy.javaProxy.core.InvocationHandler;
import java.lang.reflect.Method;
/**
* @author he_guitang
* @version [1.0 , 2018/5/22]
*/
public class TimeHandler implements InvocationHandler {
private Object object;
public TimeHandler(Obje... |
Markdown | UTF-8 | 1,400 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | # JaPNaASite v3
---
link: /
tags: website, japnaa, site
author: by JaPNaA
shortDesc: Yes, this is the third time, and there come many changes. Good or not? We'll see.
timestamp: 1562115496056
backgroundCSS: linear-gradient(169deg, #00e573, #00e5a8), #00e58e
accent: #fd908b
---
JaPNaASite revision 3.
Yes. I've re-p... |
Shell | UTF-8 | 337 | 2.765625 | 3 | [] | no_license | # Installation script for all the libraries mentioned in the repository
# Made by Vishal Sharma (https://github.com/VishalSharma0309)
#! /bin/bash
# script to install ROS-melodic directly into a linux system
# tested on Ubuntu 18.04.02
#use sudo to run this command
if [ "$(id -u)" -ne 0 ]
then echo "Must be ... |
Python | UTF-8 | 3,413 | 2.640625 | 3 | [] | no_license | import os
import cv2
from tqdm import tqdm
import imghdr
import pickle
class ImageDataset(object):
def __init__(self, test_dir, train_dir, mode, config_dir):
super(ImageDataset, self).__init__()
self.test_dir = os.path.expanduser(test_dir)
self.train_dir = os.path.expanduser(train_dir)
... |
Java | UTF-8 | 1,829 | 2.1875 | 2 | [] | no_license | /*
* Copyright (C) 2011 NATSRL @ UMD (University Minnesota Duluth) and
* Software and System Laboratory @ KNU (Kangwon National University, Korea)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Soft... |
JavaScript | UTF-8 | 1,053 | 3.328125 | 3 | [] | no_license | let answer;
let output;
let deflauts = {
display_info: "1. You have to know speed of the conveyour which can be found on Scada",
display_info2: "2. If you have a speed write it to field named 'speed' and press 'calculate'"
}
function calculation(){
var speed = parseInt(document.getElementById('speedFie... |
Python | UTF-8 | 233 | 4.0625 | 4 | [] | no_license | def find_max():
input_number = input("Enter the numbers: ")
numbers = list(input_number)
max_number = numbers[0]
for item in numbers:
if item > max_number:
max_number = item
return max_number |
Java | UTF-8 | 1,174 | 2.0625 | 2 | [
"MIT"
] | permissive | package com.example.cubeplatformer;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivi... |
Python | UTF-8 | 2,716 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import re
from django.utils.encoding import smart_unicode
class LenkerValidateService(object):
"""
Service used to validate the handlebars template objects
"""
def __init__(self, ident, source, **kwargs):
self.preprocessors = kwargs.pop('preprocessors') if 'preprocessor... |
C# | UTF-8 | 1,792 | 3.34375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
namespace Train
{
class Program
{
static void Main(string[] args)
{
List<long> wagons = Console.ReadLine().Split().Select(long.Parse).ToList();
long maxPassgerInWagon = long.Parse(Console.ReadLine());
... |
Java | UTF-8 | 1,179 | 2.09375 | 2 | [] | no_license | /**
*
*/
package com.giants.decorator.html.block;
import com.giants.decorator.config.element.Block;
import com.giants.decorator.core.Element;
import com.giants.decorator.core.TemplateEngine;
import com.giants.decorator.core.block.TemplateBlock;
import com.giants.decorator.core.exception.TemplateException;
import co... |
JavaScript | UTF-8 | 5,211 | 3.03125 | 3 | [] | no_license | /*-------------------- CURRENT DATE ----------------------*/
//const options = {weekday: 'long', day: 'numeric', month: 'long', year:'numeric'};
//document.getElementById('currentdate').textContent = new Date().toLocaleDateString('en-US', options);
// day names array
const dayNames = [
"Sunday",
"Monday",
... |
PHP | UTF-8 | 1,611 | 2.578125 | 3 | [] | no_license | <?php
require_once './core/init.php';
error_reporting(0);
$id = (isset($_GET['id']) && is_numeric($_GET['id'])) ? (integer) $_GET['id'] : null;
$mode = (isset($_GET['mode']) && is_string($_GET['mode'])) ? (string) $_GET['mode'] : null;
$cant = (isset($_GET['cant']) && is_numeric($_GET['cant'])) ? (integer) $_GET['can... |
C# | UTF-8 | 1,689 | 3.859375 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace DP
{
class DivisorGameClass
{
/// <summary>
/// the idea is that the player playing will want to make it odd for the next player
/// so if even number is there just subtract it by 1 if odd number is ... |
Java | UTF-8 | 1,529 | 2.4375 | 2 | [] | no_license |
package App.Class.Model;
//Classe bean Pedido Produto
//Autores:
// Lucas Gabriel,
// Nicollas Ramires
// Braian Maidame
// João Marcelo
public class Pedido_Produto {
private int quantidade;
private String observações;
private Pedido pedido;
private Produto prod... |
Python | UTF-8 | 1,395 | 4.09375 | 4 | [] | no_license | """
Given a binary tree, determine if it is a valid binary search tree (BST).
Assume a BST is defined as follows:
1. The left subtree of a node contains only nodes with keys less than the node's key.
2. The right subtree of a node contains only nodes with keys greater than the node's key.
3. Both the left and right ... |
Java | UTF-8 | 484 | 2.234375 | 2 | [] | no_license | package cbir.envi;
import java.io.IOException;
public class EnviFormatException extends IOException {
private static final long serialVersionUID = 1L;
public EnviFormatException() {
super();
}
public EnviFormatException(String message, Throwable cause) {
super(message, cause);
... |
Python | UTF-8 | 865 | 2.84375 | 3 | [] | no_license | import serial
import time
#mport winsound
def open_port():
ser = serial.Serial('/dev/ttyUSB0', 115200) # o "COM12" en windows
return ser
def close_port(port):
port.close()
def read_buffer(port):
if (port.in_waiting != 0):
string = str(port.read(port.in_waiting))
string = string.rep... |
Python | UTF-8 | 876 | 2.609375 | 3 | [] | no_license | import sys
import os
import time
import wx
class MainWindow(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(650,500), style=wx.DEFAULT_FRAME_STYLE)
self.Centre()
icon = wx.Icon()
icon.CopyFromBitmap(wx.Bitmap("nutrient_icon.jpg", wx.BITMAP_TYPE_ANY))
self... |
C | UTF-8 | 2,346 | 4.09375 | 4 | [] | no_license | //program to implement Linked list only Insertion
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next;
};
typedef struct node * NODE;
NODE getnode();
NODE insert_first(int item,NODE head);
void insert_end(int item,NODE head);
NODE insert_pos(NODE head,int item,int pos);
void display(NODE he... |
C++ | UTF-8 | 473 | 2.734375 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <vector>
int main() {
std::ios::sync_with_stdio(false);
std::cout.tie(NULL);
std::cin.tie(NULL);
int N;
int K;
std::cin >> N >> K;
std::vector<int> v(N);
for (int i = 0; i < N; i++) {
std::cin >> v[i];
}
int max = -99999;
for (int i = 0; i < N - K + 1;... |
Java | UTF-8 | 944 | 3.890625 | 4 | [] | no_license | package step10.ex02;
public class Stack {
private Object[] list = new Object[100];
int pos;
public int push(Object value) { // 값을 맨 마지막에 넣는다.
if (pos == list.length)
return -1;
list[pos++] = value;
return 0;
}
public Object pop() { // 맨 마지막 값을 꺼낸다.(제거한다)
if (pos == 0)
retur... |
Java | UTF-8 | 2,965 | 2.5 | 2 | [
"MIT"
] | permissive | // Copyright (c) 2017 The Authors of 'JWTS for Java'
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify... |
PHP | UTF-8 | 9,415 | 2.765625 | 3 | [] | no_license | <?php
class Employer extends AppModel {
public $validate = array(
//従業員の苗字の文字数をチェック
'staff_family_name' => array(
'rule' => array('between', 1, 30),
'message' => '苗字を30字以内で入力してください。'
),
//従業員の名前の文字数をチェック
'staff_first_name' => array(
'rule'... |
Python | UTF-8 | 167 | 3.265625 | 3 | [] | no_license | a=int(input())
b=int(input())
c=int(input())
d=int(input())
if((abs(a-c)==1)and(abs(b-d)==2))or((abs(a-c)==2)and(abs(b-d)==1)):
print('YES')
else:
print('NO')
|
Python | UTF-8 | 271 | 2.984375 | 3 | [] | no_license | from PIL import Image
from pylab import *
import os
os.chdir('C:\\Users\\蔡静静\\Desktop')
im = array(Image.open('empire.jpg'))
imshow(im)
x = [100, 200, 300, 400]
y = [50, 150, 250, 350]
plot(x, y, '.')
plot(x[:2], y[:2])
title('Plotting: "empire.jpg"')
show()
|
C# | UTF-8 | 672 | 2.671875 | 3 | [] | no_license | private EventWaitHandle asyncWait = new ManualResetEvent(false);
private Timer abortTimer = null;
private bool success = false;
public void ReadFromTwitter()
{
abortTimer = new Timer(AbortTwitter, null, 50000, System.Threading.Timeout.Infinite);
asyncWait.Reset();
input.BeginRead(buffer, 0, buffer.Length, In... |
Python | UTF-8 | 320 | 3.609375 | 4 | [] | no_license | def nan_expand(times):
empty = '\"\"'
once = 'Not a NaN'
more = 'Not a '
result = ''
if times == 0:
return empty
elif times == 1:
return once
else:
for x in range(1,times):
result += more
result += once
return result
print(nan_expand(0))
print(nan_expand(1))
print(nan_expand(2))
print(nan_expand(3)) |
PHP | UTF-8 | 1,028 | 2.8125 | 3 | [] | no_license | <?php
/**
* @category Cnnb
* @package Cnnb_Gtm
* @author Cnnb
* @copyright Copyright © CNNB All rights reserved.
*
* DataLayer Class
* For providing product's data
*/
namespace Cnnb\Gtm\DataLayer\ProductData;
/**
* ProductProvider | DataLayer Class
*/
class ProductProvider extends ProductAbstract
{
... |
Markdown | UTF-8 | 4,395 | 2.625 | 3 | [
"MIT"
] | permissive | ---
comments: true
date: 2010-04-03 23:24:13
layout: post
slug: blunt-c-sharp-1-auto-shutdown
title: 'Blunt C# (1): 自动关机'
wordpress_id: 148
categories:
- Programing
tags:
- blunt
- C#
- WinAPI
---
开始好好整理毕业设计的代码,在硬盘里找出很多以前写的C#代码,很多自己写的小应用都蛮有趣的,比如自动关机啊,修改系统变量啊,计算周年纪念日啊之类的无聊的小东西~ 想着最近博客也没有什么值得更新的内容,要不就贴一些以前的这些程序的傻傻的代码吧~ ... |
Java | UTF-8 | 1,359 | 2.0625 | 2 | [
"LicenseRef-scancode-free-unknown",
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | package integration;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static com.codeborne.selenide.Condition.attribute;
import static com.codeborne.selenide.Condition.visible;
import static com.codeborne.selenide.Selectors.byText;
import stati... |
JavaScript | UTF-8 | 126 | 3.640625 | 4 | [] | no_license | // Easy level 8 Kata
// Return a number's opposite without using conditionals
function opposite(number) {
return -number;
} |
Python | UTF-8 | 139 | 4.125 | 4 | [] | no_license | weight_kg = float(input("Please enter your weight (kg): "))
weight_pound = weight_kg * 2.2
print(f"The weight in pounds is {weight_pound}") |
Java | UTF-8 | 931 | 4.28125 | 4 | [] | no_license | import java.util.Scanner;
class Rectangle{
double length, breadth;
public void read(){
Scanner s = new Scanner(System.in);
length = s.nextDouble();
breadth = s.nextDouble();
}
public double getArea(){
return (length*breadth);
}
}
public class RectangleCheck{
public static void ma... |
Java | UTF-8 | 3,108 | 2.34375 | 2 | [] | no_license | package net.shreygupta.doctoronthego.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import... |
Java | UTF-8 | 1,361 | 2.5625 | 3 | [] | no_license | package hu.neuron.java.core.dto;
import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.RowMapper;
public class UserDTO implements Serializable {
private static final long serialVersionUID = -1265516570893529965L;
private Long id;
private Strin... |
Markdown | UTF-8 | 593 | 2.84375 | 3 | [] | no_license | # Pygame: Army Tank
Create Python Pygame with Tank shooter game in 4 main steps
1. Game have 3 main sprites: Tanks, bullets and Enemy.
2. Tank can move with pygame.key.get_pressed() to UP, DOWN, RIGHT, LEFT.
3. Tank can shoot bullets to enemy and its disappear when bullets hit.
4. Game will be over if tank hit enemy.
... |
SQL | UTF-8 | 4,804 | 3.484375 | 3 | [] | no_license | -- ----------------------------
-- Table structure for SYS_USER
-- ----------------------------
DROP TABLE "SYS_USER";
CREATE TABLE "SYS_USER" (
"USERID" VARCHAR2(32 BYTE) NOT NULL ,
"USERNAME" VARCHAR2(100 BYTE) ,
"PASSWORD" VARCHAR2(100 BYTE) ,
"NICKNAME" VARCHAR2(100 BYTE) ,
"EMAIL" VARCHAR2(50 BY... |
Python | UTF-8 | 622 | 3.078125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 24 13:15:34 2017
@author: jb2428
"""
import numpy as np
import pandas as pd
import string
N = 100
L = np.random.choice([a for a in string.ascii_uppercase[:3]],size=(N,2),replace=True)
L = pd.DataFrame(L,columns=['col1','col2'])
L['fun1'] = list(map(lambda x, y: x+'.'+y... |
Markdown | UTF-8 | 863 | 2.53125 | 3 | [] | no_license | <h1>ML Algorithms</h1>
<h3>Decision Tree, Random Forest, Boosting Techniques (AdaBoost)</h3>
<b>Course Number :</b> BITS F464
<b>Contributors : </b>
<ul>
<li>G V Sandeep</li>
<li>Kushagra Agrawal</li>
<li>Snehal Wadhwani</li>
<li>Tanmaya Dabral</li>
</ul>
<h3>Instructions to use</h3>
<ul>
<li>Install the eclipse ve... |
Java | UTF-8 | 178 | 1.898438 | 2 | [] | no_license | package epam.jmp.muha.service.inter;
import epam.jmp.muha.entity.User;
public interface IUserService {
void save(User user);
User findByUsername(String username);
}
|
Python | UTF-8 | 2,865 | 3.0625 | 3 | [] | no_license | def formula_for_single_coeff(coeff, x_in, y_in):
temp = 0.
temp += coeff[0]
temp += coeff[1] * y_in
temp += coeff[2] * x_in
temp += coeff[3] * x_in * y_in
return temp
def formula_for_single_coeff_merger(coeff, x_in):
temp = 0.
x_in_sqd = x_in*x_in
temp += coeff[0] + coeff[1] * x... |
Python | UTF-8 | 703 | 2.890625 | 3 | [] | no_license | from qualifier.input_data import InputData
import os
if __name__ == "__main__":
THIS_PATH = os.path.abspath(os.path.dirname(__file__))
directory = os.path.join(THIS_PATH, 'inputs')
print(f'Optimal scores')
for file_name in [
'a.txt', # instant
'b.txt', # 26s
'c.txt', # 17s
... |
C | UTF-8 | 1,568 | 3.046875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test.c :+: :+: :+: ... |
PHP | UTF-8 | 567 | 3 | 3 | [] | no_license | <?php
interface WPNotify_RecipientFactory {
/**
* Create a new instance of a notification recipient.
*
* @param mixed $value Value of the recipient.
* @param string $type Optional. Type of the recipient. Defaults to 'user'.
*
* @return WPNotify_Recipient
*/
public function create( $value, $type = 'u... |
C++ | UTF-8 | 723 | 2.84375 | 3 | [] | no_license | //
// Task.hpp
// cpp-concurrency
//
// Created by Vladislav Voinov on 28.06.20.
//
#pragma once
#include <future>
#include <functional>
#include "cpp-concurrency-lib/AbstractTask.hpp"
namespace task
{
template<typename TaskType>
class Task: public AbstractTask
{
using PackagedTask = std::packaged_task<TaskType()>... |
C++ | UTF-8 | 604 | 3.546875 | 4 | [] | no_license | /*Program to make an array of ten nubers display sum of odd nubers and
product of even numbers*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int x[10]; //Size of array
int sum=0;
float prod=1;
for (int j=0;j<=9;j++)
{
cout<<"\nPlease enter number :";
cin>>x[j]; //accaept... |
Markdown | UTF-8 | 1,117 | 4.40625 | 4 | [] | no_license | # Min Stack
[Leetcode](https://leetcode.com/problems/min-stack/)
題意:
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
- push(x) -- Push element x onto stack.
- pop() -- Removes the element on top of the stack.
- top() -- Get the top element.
- getMin() -- Retrieve th... |
Java | UTF-8 | 2,983 | 2.390625 | 2 | [] | no_license | /* 1: */ package org.spacehq.mc.protocol.packet.ingame.server.scoreboard;
/* 2: */
/* 3: */ import java.io.IOException;
/* 4: */ import org.spacehq.packetlib.io.NetInput;
/* 5: */ import org.spacehq.packetlib.io.NetOutput;
/* 6: */ import org.spacehq.packetlib.packet.Packet;
/* 7: */
/* 8... |
Markdown | UTF-8 | 416 | 3.1875 | 3 | [] | no_license | # Lab 5: BSTs, Time Formatting, and Queues
Start a new notebook on your virtual machine, then complete the three parts of the lab:
1. practice with [binary search trees](part1.md) -- good prep for P2
2. convert [dates to strings](part2.md) -- will also need this for P2
3. learn about [queues](part3.md) -- a fast data... |
Java | UTF-8 | 675 | 1.78125 | 2 | [] | no_license | package com.funi.platform.lshc.service;
import com.funi.platform.lshc.dto.WorkLogDto;
import com.funi.platform.lshc.entity.sys.JobAccept;
import com.funi.platform.lshc.entity.sys.JobLog;
import java.util.List;
/**
* @author 3
*/
public interface JobLogService {
/**
* 创建受理信息
* @param jobAccept
*... |
C++ | UTF-8 | 553 | 2.59375 | 3 | [] | no_license | #pragma once
using namespace System;
ref class Investment
{
public:
Investment();
//set methods
void setDate(String^);
void setEpic(String^);
void setBuyPrice(double);
void setSellPrice(double);
void setStopLoss(double);
//get methods
String^ getDate();
String^ getEpic();
double getBuyP... |
JavaScript | UTF-8 | 834 | 2.59375 | 3 | [
"MIT"
] | permissive | const zlib = require('zlib')
// for some reason plain writeHead refuses to dump all the header items
// so we need to use setHead one by one
function writeHead (remoteRes, res) {
let { headers } = remoteRes
Object.keys(headers).forEach(key => res.setHeader(key, headers[key]))
res.writeHead(remoteRes.statusCode, ... |
Python | UTF-8 | 2,151 | 3.171875 | 3 | [] | no_license | import psycopg2
import configparser
from sql_queries import create_table_queries, drop_table_queries
def create_connection():
"""
- Read configuration to get database parameters
- Connects to the Redshift database
- Returns the connection and cursor
"""
# read configuration
config = c... |
Markdown | UTF-8 | 2,183 | 3.53125 | 4 | [] | no_license | # foobar-solns
My solutions to googles old foobar challenges, lotta fun so far!
Reduced questions:
1. make a string of primes concatenated one after the other till it has length i+5 then return the last 5 digits of the string
2. take a list of positive and negative integers, find the maximum product of their entries
3... |
Java | UTF-8 | 1,585 | 2.125 | 2 | [] | no_license | package com.share.model;
import java.util.Arrays;
/**
* Created by max on 2016/11/22.
*/
public class CityVo {
public String status;
public String info;
public String infocode;
public String count;
public Suggestion suggestion;
public District[] districts;
public String getStatus() {
... |
JavaScript | UTF-8 | 228 | 2.515625 | 3 | [] | no_license | var readfile = require('./helper.js')
var fileName = 'sometext.txt'
var fileName1 = 'test.txt'
readfile(fileName).then((message) => {
readfile(fileName1).then((message1) => {
console.log(message);
console.log(message1);
});
}); |
Python | UTF-8 | 2,047 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 24 19:22:21 2016
@author: covingtonjg
Jessica Covington
"""
import numpy as np
def jacobi(A, b, x_init, kmax, tol):
n = len(A)
y = np.zeros(n)
y[:] = x_init[:]
x = np.zeros(n)
err = tol
for k in range(kmax):
for i in range(n):... |
C++ | UTF-8 | 504 | 2.640625 | 3 | [] | no_license | // Terry Lorber
// tgl@rideside.net
// U61244526
// MET CS341
// Fall 2009
// Maslanka
// Homework #2
#include "Node.h" // class implemented
Node::Node(const double& data, Node* link) :
_user_data(data),
_link(link)
{
}// Node
void Node::set_data(const double& data)
{
_user_data = data;
}// set_data
void No... |
JavaScript | UTF-8 | 922 | 2.90625 | 3 | [] | no_license | const uniquePathsWithObstacles = (obstacleGrid) => {
if (obstacleGrid[0][0] == 1) return 0; // 出发点就被障碍堵住
const m = obstacleGrid.length;
const n = obstacleGrid[0].length;
// dp数组初始化
const dp = new Array(m);
for (let i = 0; i < m; i++) dp[i] = new Array(n);
// base case
dp[0][0] = 1; ... |
Java | UTF-8 | 953 | 2.015625 | 2 | [
"LicenseRef-scancode-warranty-disclaimer",
"ANTLR-PD",
"CDDL-1.0",
"bzip2-1.0.6",
"Zlib",
"BSD-3-Clause",
"MIT",
"EPL-1.0",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-jdbm-1.00",
"Apache-2.0"
] | permissive | package com.sequenceiq.cloudbreak.service.stack.flow;
import java.util.List;
import com.sequenceiq.ambari.client.AmbariClient;
import com.sequenceiq.cloudbreak.domain.stack.Stack;
import com.sequenceiq.cloudbreak.service.StackContext;
public class AmbariStartupPollerObject extends StackContext {
private String ... |
Markdown | UTF-8 | 691 | 2.546875 | 3 | [] | no_license | # Article L5213-21
Les associations ayant pour objet principal la défense des intérêts des bénéficiaires du présent chapitre peuvent exercer une
action civile fondée sur l'inobservation des dispositions des articles L. 5213-7 et L. 5213-9 à L. 5213-12, lorsque cette
inobservation porte un préjudice certain à l'intérêt... |
Java | UTF-8 | 381 | 1.835938 | 2 | [] | no_license | package bookstoreapi.bookstoreapi.repository;
import bookstoreapi.bookstoreapi.model.BookToCartItem;
import bookstoreapi.bookstoreapi.model.CartItem;
import org.springframework.data.repository.CrudRepository;
/**
* Created by @kmartin62
*/
public interface BookToCartItemRepository extends CrudRepository<BookToCartI... |
Java | UTF-8 | 5,468 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | package org.tinos.emotion.test;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.tinos.emotion.estimation.EmotionSample;
import org.tinos.emotion.estimation.RatioMap;
import org.tinos.emotion.estimation.imp.RatioMapImp;
import org.tinos.emotion.ortho... |
TypeScript | UTF-8 | 2,023 | 2.796875 | 3 | [
"MIT"
] | permissive | import type { KeystoneConfig } from '../types';
import { idFieldType } from './id-field';
function applyIdFieldDefaults(config: KeystoneConfig): KeystoneConfig['lists'] {
// some error checking
for (const [listKey, list] of Object.entries(config.lists)) {
if (list.fields.id) {
throw new Error(
`A... |
JavaScript | UTF-8 | 245 | 2.640625 | 3 | [
"MIT"
] | permissive | //+ Jonas Raoni Soares Silva
//@ http://raoni.org
function canConstruct(a) {
// One rule that I could remember from childhood: a number is divisible by 3 if the sum of its digits is also divisible by 3 =]
return a.reduce((t, c) => t += c) % 3 ? 'No' : 'Yes';
} |
JavaScript | UTF-8 | 7,898 | 3.4375 | 3 | [] | no_license | var date = []
var sku = []
var unitPrice = []
var quantity = []
var totalPrice = []
const totalData = {}
getData();
async function getData() {
const response = await fetch('sales-data.txt');
const data = await response.text();
const rows = data.split('\n').slice(1)
const title = data.split('\n').slice(0,1)... |
JavaScript | UTF-8 | 1,274 | 3.4375 | 3 | [] | no_license | import React from "react";
class FilterString extends React.Component {
constructor() {
super();
this.solveToyProblem = this.solveToyProblem.bind(this);
this.state = {
unfilteredArray: [
"James",
"Jessica",
"Melody",
"Tyler",
"Blake",
"Jennifer",
"Mark",
"Maddy"
],
userI... |
Markdown | UTF-8 | 4,688 | 2.59375 | 3 | [
"CC0-1.0",
"LicenseRef-scancode-public-domain"
] | permissive | # 5G 真的有宣传中的那么厉害吗?无人驾驶、智能家居、远程医疗等必须得有 5G 才能实现吗?
Tags: **Science**
> 5G 真的有宣传中的那么厉害吗?无人驾驶、智能家居、远程医疗等必须得有 5G 才能实现吗?
11.20看看:
[中国移动吴彤:5G智能移动车载医疗应用解决行业两大痛点\_中国IDC圈](https://link.zhihu.com/?target=http%3A//app.idcquan.com/mobile.php%3Fcontentid%3D146162)尴尬不?
你们还真是聪明啊……还好意思冷嘲热讽。
比如,大群人在这攻击“在急救车上手术会晃”,还自以为很聪明“一针见血”。
**... |
C++ | UTF-8 | 1,275 | 2.953125 | 3 | [] | no_license | #include <stdio.h>
void exaple1(void);
void exaple2(void);
int main(void)
{
FILE *fp;
int i;
int data1 = 0;
double data2 = 0.0;
char ch;
fp = fopen("data3.txt", "rt");
if (fp == NULL)
{
//printf("File Writing Error!\n");
puts("File Reading Error!");
return -1;
}
else{
puts("File Reading Success!")... |
C++ | UTF-8 | 2,010 | 3.8125 | 4 | [] | no_license | //https://leetcode.com/problems/reverse-integer/description/
//Given a 32 - bit signed integer, reverse digits of an integer.
//
//Example 1 :
//
// Input : 123
// Output : 321
// Example 2 :
//
// Input : -123
// Output : -321
// Example 3 :
//
// Input : 120
// Output : 21
// Note :
// Assume we are dealing with an ... |
Markdown | UTF-8 | 2,832 | 2.96875 | 3 | [] | no_license | ---
layout: post
title: "2015 South Davis Recap"
date: 2015-11-22 16:44:00
author: Ethan Beseris
image: /blog/2015-south-davis-recap-highlight.jpg
---
It has been a hard three weeks of hard training since the Buff Invite, and it has certainly shown! On Saturday, November 14th, the Utes recorded their first win of the s... |
C# | UTF-8 | 841 | 3.921875 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
namespace Large_sum
{
class Program
{
const string fileName = "100 50-digit numbers.txt";
static void Main(string[] args)
{
string[] numbers = Parse();
BigInteger sum = 0;
... |
C# | UTF-8 | 2,428 | 2.953125 | 3 | [] | no_license | using Sabio.Starter.Template.Web.Domain.Tests;
using Sabio.Starter.Template.Web.Services.Interfaces;
using System;
using System.Collections.Generic;
using System.Data.Entity.Core;
using System.Linq;
using System.Web;
namespace Sabio.Starter.Template.Web.Services
{
public class EmployeeService : IEmployeeService
... |
PHP | UTF-8 | 631 | 2.828125 | 3 | [] | no_license | <?php
function connectToDB(){
require 'dbconfig.php';
$hostname = DB_HOST;
$username = DB_USER;
$password = DB_PASSWORD;
$dbname = DB_DATABASE;
try{
$conn = new PDO(
"mysql:host=$hostname;dbname=$dbname",
... |
Go | UTF-8 | 3,041 | 2.96875 | 3 | [] | no_license | package lunar
import (
"fmt"
"reflect"
"testing"
)
func TestMove(t *testing.T) {
tcs := []struct {
sP Pos
v Vel
eP Pos
}{
{sP: Pos{1, 2, 3}, v: Vel{-2, 0, 3}, eP: Pos{-1, 2, 6}},
}
for _, tc := range tcs {
got := move(tc.sP, tc.v)
if got != tc.eP {
t.Errorf("%v != %v", got, tc.eP)
}
}
}
fu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.