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 | 1,346 | 3.578125 | 4 | [] | no_license | #include <iostream>
#include <vector>
#include <numeric>
#include <cmath>
class RemovedNumbers
{
public:
static unsigned long long Get_Sum_Of_Numbers(long long n)
{
unsigned long long sum_of_numbers = 0;
for(int number = n; number >= 0 ; --number)
{
sum_of_numbers += number... |
Python | UTF-8 | 10,845 | 4.6875 | 5 | [
"CC-BY-SA-3.0",
"CC-BY-SA-4.0",
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # An introduction to Regular Expressions in Python
# Ian Watt - Aberdeen Python User Group, 13 January 2021
#
# Licence: [CC-BY-SA](https://creativecommons.org/licenses/by-sa/4.0/)
# ## Finding strings
# Finding strings inside longer strings in Python is quite easy __if__ y... |
Java | UTF-8 | 6,563 | 3.046875 | 3 | [] | no_license | import javax.tools.Tool;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/**
* Created by Chrono on 19.05.2017.
*/
public class Toolkit {
public void progress(String text) {
System.out.println("--- " + text + " ---");
}
... |
Python | UTF-8 | 681 | 3.78125 | 4 | [] | no_license | from decimal import *
def run_timing():
total = []
while s := input("Enter 10 km run time: "):
try:
total.append(float(s))
except ValueError as e:
print("Enter a valid time.")
print(f"Average of {sum(total)/len(total)}, over {len(total)} runs")
def beyond(... |
C++ | UTF-8 | 1,199 | 2.71875 | 3 | [] | no_license | #include <curses.h>
#include <iostream>
#include "Game.hpp"
#include "Player.hpp"
#include "Enemy.hpp"
#include<unistd.h>
int main()
{
//ncurses shit
initscr();
cbreak();
noecho();
keypad(stdscr, TRUE);
nodelay(stdscr, TRUE);
start_color();
init_pair(1, COLOR_YELLOW, COLOR_GREEN);
... |
C# | UTF-8 | 3,270 | 2.578125 | 3 | [
"MIT"
] | permissive | using System;
using System.IO;
using System.Net;
using System.Text;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Xunit;
namespace Http2Sharp
{
public sealed class IntegrationTest : IDisposable
{
private const string BASE_URL = "http://localhost:8080";
private readonly HttpServer ... |
Shell | UTF-8 | 12,486 | 2.96875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | #!/bin/bash
################################################################################
#
# Copyright (c) 2016, EURECOM (www.eurecom.fr)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1.... |
Java | UTF-8 | 1,043 | 3.296875 | 3 | [] | no_license | package oncemore;
public class P101 {
public class TreeNode {
int val;
TreeNode left;
TreeNode right;
TreeNode(int x) { val = x; }
}
// public boolean isSymmetric(TreeNode root) {
// if(root == null) return true;
// if(root.left.val == root.right.val) {
// return isSym... |
Java | UTF-8 | 1,428 | 2.046875 | 2 | [] | no_license | package net.greatsoft.main.db.po;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
@Entity
public class VisitMedicine extends Entry {
private String VISIT_ID;
private String MEDICINE_TIMES;// 使用次数
private String MEDICINE_NAME;// 药品名称
priva... |
C++ | UTF-8 | 888 | 3.96875 | 4 | [
"Apache-2.0"
] | permissive |
#include <iostream>
using namespace std;
// This creates the class queue.
class queue {
int q[100];
int sloc, rloc;
public:
queue(); // constructor
~queue(); // destructor
void qput(int i);
int qget();
};
// This is the constructor.
queue::queue()
{
sloc = rloc = 0;
cout << "Queue initialized.\n";
}
// This is t... |
Python | UTF-8 | 2,912 | 2.9375 | 3 | [] | no_license | import pico2d
import random
width = 1280
heigth = 1024
pico2d.open_canvas(1280, 1024)
running = True
back_img = pico2d.load_image("KPU_GROUND.png")
csr_img = pico2d.load_image("hand_arrow.png")
char_img = pico2d.load_image("animation_sheet.png")
player_is_view_left = False
player_running_i = 0
player_running_i_max... |
Java | UTF-8 | 3,572 | 2.015625 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
* with the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" fil... |
C# | UTF-8 | 603 | 2.71875 | 3 | [] | no_license | using Microsoft.EntityFrameworkCore;
using news_server.Data;
using System.Linq;
namespace news_server.Features.Services
{
public class UserSerivce
{
private readonly NewsDbContext context;
public UserSerivce(NewsDbContext context)
{
this.context = context;
}
... |
Ruby | UTF-8 | 1,808 | 2.734375 | 3 | [] | no_license | require 'json'
module JsonImporters
class SenateImporter
def initialize
@file_path = Rails.root + "app/assets/json/senate.json"
end
def perform
return false unless @file_path
senate_json = JSON.parse File.read(@file_path)
senate_reps = senate_json['results'][0]['members']
... |
JavaScript | UTF-8 | 1,386 | 2.828125 | 3 | [] | no_license | export { AnimationType as default}
class AnimationType{
construction(akvOptionsIn){
const kvDefaults = {
strURL: null,
context: null,
nCurrentFrame: 0,
nRate: 60
};
//Object.assign shallow
this.akvOptions = Object.assign({}, kvDefaults... |
Java | UTF-8 | 1,684 | 2.796875 | 3 | [] | no_license | package net.lectusAPI.utils;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public abstract class LectusInventory {
public static ArrayList<LectusInventory> inventorries = new ArrayList<>();
priv... |
Python | UTF-8 | 2,077 | 3.578125 | 4 | [] | no_license | # Longest Common Prefix in a given set of strings
class Node:
def __init__(self, c=None):
self.char = c
self.children = dict()
self.word_end = False
self.hit_count = 0
self.depth = -1 # note: root is depth -1 since it does not hold any char
class Context:
def __ini... |
Java | UTF-8 | 1,886 | 1.976563 | 2 | [] | no_license | package com.ponysdk.spring.servlet;
import com.ponysdk.core.server.application.AbstractApplicationManager;
import com.ponysdk.core.server.application.ApplicationManagerOption;
import com.ponysdk.core.server.application.UIContext;
import com.ponysdk.core.ui.main.EntryPoint;
import com.ponysdk.impl.webapplication.page.I... |
JavaScript | UTF-8 | 1,266 | 2.859375 | 3 | [] | no_license | 'use strict';
const crypto = require('crypto');
class CryptoMon {
constructor(secret){
if (!secret || typeof secret !== 'string') {
throw new Error('Cryptr: secret must be a non-0-length string');
}
this.secret = secret;
this.key = crypto.createHash('sha256').update(Str... |
Python | UTF-8 | 2,618 | 2.796875 | 3 | [] | no_license | # coding=utf-8
"""Define table and operations for users."""
from flask_login import UserMixin
from sqlalchemy import Column, Integer, VARCHAR, DATE, BOOLEAN
from . import Base, session, handle_db_exception, collections
class Users(Base, UserMixin):
"""Table constructed for users."""
__tablename__ = 'Users'
... |
Java | UTF-8 | 374 | 1.921875 | 2 | [] | no_license | package com.aissure.packet.packet.job;
/**
* Created by Administrator on 2017/7/14.
*/
public class JobFactory implements IJobFactory{
// @Override
// public BaseAccessibilityJob createWeiXinJob() {
// return WeChatJob.getWeChatJob();
// }
//
// @Override
// public BaseAccessibilityJob createQ... |
Java | UTF-8 | 8,931 | 2.09375 | 2 | [] | no_license | package com.example.paulap.crowdsourcing.report;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.location.Location;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.StrictMode;
import android.support.v4.content.FileProvider;
impor... |
Python | UTF-8 | 4,090 | 3.21875 | 3 | [] | no_license | import numpy as np
import random as rd
from scipy.spatial import distance
class Molecule:
def __init__(self, coordinates):
self.coordinates = coordinates
def select_process(constant_list):
"""
CHOOSE A PATHWAY
constant_list: rate constants list
return: chosen path index
"""
r = n... |
Python | UTF-8 | 1,438 | 3.1875 | 3 | [] | no_license | from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import mglearn
import matplotlib.pyplot as plt
# Loading dataset
iris_dataset = load_iris()
# Printing dataset
print("Keys of iris_dataset: \{}".format(iri... |
Python | UTF-8 | 432 | 2.9375 | 3 | [] | no_license | import serial
import sys
def send_text(number, text, path='COM5'):
ser = serial.Serial(path, 9600,timeout=1)
if not ser.isOpen():
ser.open()
# set text mode
ser.write(('AT+CMGF=%d\r' % 1).encode())
# set number
ser.write(('AT+CMGS="%s"\r' % number).encode())
# send message
ser.wr... |
Python | UTF-8 | 2,454 | 2.765625 | 3 | [] | no_license | import json
import redis
from django.conf import settings
redis_conn = redis.Redis(host=settings.REDIS_HOST, port=settings.REDIS_PORT)
def inc_room_count(room_name):
"""Увеличивает счетчик участников в комнате чата"""
counter_key = create_counter_key(room_name)
counter_value = redis_conn.incr(counter_ke... |
C | UTF-8 | 620 | 3.234375 | 3 | [] | no_license | #ifndef _STACK_H
#define _STACK_H
#include "transmitters.h"
/*
Creates new stack for transmitters and returns pointer to it's top.
*/
transmitters *t_stack_create_stack();
/*
Adds new transmitter value on top of stack **stack.
*/
void t_stack_push(transmitters **stack, transmitter *value);
/*
Removes top of stack an... |
Python | UTF-8 | 767 | 2.578125 | 3 | [] | no_license | wp=open('wp.php')
config = []
wp_full =[]
for line in wp:
new_val = ""
if line.startswith('define'):
st1 = line.find("'")
sp1= line.find("'",st1+1)
par = line[st1+1:sp1]
st2 = line.find("'",sp1+1)
sp2 = line.find("'", st2 + 1)
val = line[st2+1:sp2]
n... |
Java | UTF-8 | 2,013 | 2.46875 | 2 | [] | no_license | package com.muruw.portfolio.dao;
import com.muruw.portfolio.model.Project;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@Repo... |
Markdown | UTF-8 | 2,418 | 3.640625 | 4 | [] | no_license | ---
layout: default_layout
title: JavaScript中Promise使用
date: 2019-01-24 17:19:36
tags:
---
## 定义
Promise对象用于包装异步函数执行结果,以便用同步的方式处理其结果。
```javascript
var mypromise = new Promise(function(resolve, reject){
// asynchronous code to run here
// call resolve() to indicate task successfully completed
// call reject() to i... |
Markdown | UTF-8 | 19,222 | 2.59375 | 3 | [] | no_license | import javaLogo from './java-logo.svg'
import styles from './document.module.css'
<div className={styles["Welcome"]}>
<div className={styles["logo"]}>
<img src={javaLogo} className={styles["logo-java"]} alt="logo" />
</div>
## Wstęp
W swojej karierze trenera oprogramowania przyglądałem się już kilkudziesięciu oso... |
C++ | UTF-8 | 19,909 | 2.609375 | 3 | [] | no_license | #include <string>
#include <iostream>
#include <utility>
#include "GL.hpp"
#include "gl_errors.hpp"
#include "View.hpp"
#include "Load.hpp"
#include "data_path.hpp"
#include "ColorTextureProgram.hpp"
namespace view {
struct RenderTextureProgram {
// constructor and destructor: these are heavy weight functions
// ... |
JavaScript | UTF-8 | 643 | 2.578125 | 3 | [] | no_license | const CHANGE_OBJECT_TYPE = Object.freeze({
DELETION: 0,
INSERTION: 1,
});
const privateProps = new WeakMap();
class ChangeObject {
constructor(position, value, CHANGE_OBJECT_TYPE) {
privateProps.set(this, {position: position, value: value, type: CHANGE_OBJECT_TYPE});
}
getRow() {
return this.getPos... |
C# | UTF-8 | 4,310 | 2.5625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Web;
using System.Web.Caching;
using InverGrove.Domain.Exceptions;
using InverGrove.Domain.Extensions;
using InverGrove.Domain.Interfaces;
using InverGrove.Domain.Utils;
namespace InverGrove.Domain.Services
{
public class SermonService : ISermonService
... |
Python | UTF-8 | 4,421 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import json
import sys
import os
import glob
import click
from jsonschema import validate, ValidationError, SchemaError, Draft7Validator
stats = {
'validationFailures': 0,
'validationSuccesses': 0,
'skipped': 0,
'successPush': 0,
'failedPush': 0,
}
timing_groups = [
"1xDaily",
"2xDaily",
... |
Python | UTF-8 | 1,335 | 3.40625 | 3 | [] | no_license | '''
给定一个数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。
candidates 中的每个数字在每个组合中只能使用一次。
说明:
所有数字(包括目标数)都是正整数。
解集不能包含重复的组合。
示例 1:
输入: candidates = [10,1,2,7,6,1,5], target = 8,
所求解集为:
[
[1, 7],
[1, 2, 5],
[2, 6],
[1, 1, 6]
]
示例 2:
输入: candidates = [2,5,2,1,2], target = 5,
所求解集为:
[
[1,2,2... |
Python | UTF-8 | 811 | 3.21875 | 3 | [] | no_license | class college:
def __init__(self,name,place,pincode):
self.college_name=name
self.college_place=place
self.college_pincode=pincode
def getCDetails(self):
print("College: ",self.college_name,"\nPlace: ",self.college_place,"\nPincode: ",self.college_pincode)
class student(... |
Java | UTF-8 | 3,481 | 3.828125 | 4 | [] | no_license | package DAILY_PRACTICE;
import java.util.Arrays;
public class Frist {
/* public static void main(String[] args) {
* 석차구하기 : 모든 점수가 1등올 시작해서 다른 점수들과비교해 자신의 점수가 작으면 1씩 증가시키는 방식
* 선택정렬 : 첫번째 숫자부터 그 뒤의 모든 숫자들과 비교해서 작은수와 자리바꾸기를 반복해서 앞에서부터 작은 수를 채워가는 방식
* 버블정렬 : 첫번째 숫자부터 바로 뒷 숫자와 비교해서 작은수와 자리 바꾸기를 반복해 뒤에서부터 큰 수를 채워나가는... |
Java | UTF-8 | 3,230 | 2.359375 | 2 | [] | no_license | package com.example.springbootmybatis.controller;
import com.example.springbootmybatis.annotations.CheckRepeatSubmit;
import com.example.springbootmybatis.aop.HttpLister;
import com.example.springbootmybatis.entity.User;
import com.example.springbootmybatis.service.UserService;
import lombok.extern.slf4j.Slf4j;
import... |
Python | UTF-8 | 2,020 | 2.6875 | 3 | [] | no_license | from collections import deque
from copy import deepcopy
import heapq
from itertools import combinations, permutations
from itertools import combinations_with_replacement
import sys
input = lambda: sys.stdin.readline().rstrip()
test = True
if test:
try:
sys.stdin = open('input_data.txt', 'r')
print... |
Markdown | UTF-8 | 2,029 | 4.0625 | 4 | [] | no_license | ## Java变量
1. 在程序设计中,变量是指一个包含值的存储地址以及对应的符号名称。
2. 创建变量:声明变量
>* 给变量命名
>* 定义变量的数据类型
  ` DataType 变量名;`
  `int a`
  `char b`
  `int age`
  `int number`
3. 给变量赋值
```
int a;
a = 1;
```
```
int a = 1;
```
  创建多个**类型相同**的变量
```
int ... |
Java | UTF-8 | 976 | 2.71875 | 3 | [] | no_license | package qf.jdbc.datasource.custom;
import qf.jdbc.Utils;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import static qf.jdbc.DatabaseConfiguration.*;
public class MyDataSourceTest {
public static void main(String[] args) throws SQLException {
Data... |
Java | UTF-8 | 4,423 | 2.515625 | 3 | [
"Zlib"
] | permissive | /*
* Copyright (C) 2018 Fionn Langhans
*/
package feder.types;
import java.util.LinkedList;
import java.util.List;
import feder.FederCompiler;
/**
* @author Fionn Langhans
* @ingroup types
*/
public class FederInterface extends FederBody implements FederArguments, FederHeaderGen
{
/**
* The arguments of the ... |
Python | UTF-8 | 4,450 | 2.953125 | 3 | [] | no_license |
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.model_selection import cross_val_score, train_test_split
from sklearn.linear_model import LinearRegression
import matplotlib.pyplot as plt
import seaborn as sns
import statsmodels.api as sm
def import_data(dir):
#Import the dat... |
Java | UTF-8 | 1,130 | 2.453125 | 2 | [] | no_license | package com.dev.mark.notes.data.database;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import static com.dev.mark.notes.data.database.NotesDbSchema.NotesTable.NAME;
public class NotesBaseHelper extends SQLiteOpenHelper {
private s... |
C++ | UTF-8 | 1,079 | 2.84375 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+2;
vector<int> parent(N);
vector<int> sz(N);
void make_set(int v)
{
parent[v]=v;
sz[v]=1;
}
int find_set(int v)
{
if(v==parent[v])
{
return v;
}
//optimisation
return parent[v] = find_set(parent[v]);
... |
Java | UTF-8 | 6,684 | 2.640625 | 3 | [] | no_license | package com.example.bryn.hleonard_cardiobook;
import android.icu.util.Measure;
import android.os.Parcel;
import android.os.Parcelable;
import java.net.PasswordAuthentication;
import java.security.PrivilegedActionException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat... |
Java | UTF-8 | 346 | 1.851563 | 2 | [] | no_license | package com.maes.lionel.cars;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import java.util.List;
@Dao
public interface UsersDao {
@Insert
public void insertUser(Users user);
@Query("select * from Users")
public L... |
Java | UTF-8 | 1,226 | 2.0625 | 2 | [
"MIT"
] | permissive | package ca.gc.aafc.dina.repository.meta;
import ca.gc.aafc.dina.mapper.IgnoreDinaMapping;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.crnk.core.resource.annotations.JsonApiMetaInformation;
import io.crnk.core.resource.meta.MetaInformation;
import lombok.Builder;
import lombok.Getter;
import lombok.S... |
TypeScript | UTF-8 | 630 | 2.953125 | 3 | [
"Apache-2.0"
] | permissive | import { WeekDay } from '@angular/common';
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'weekDaySort'
})
export class WeekDaySortPipe implements PipeTransform {
transform(value: string[], startOfWeek: WeekDay): string[] {
// ensure start of week is in range
startOfWeek =... |
Rust | UTF-8 | 8,761 | 3.171875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | use serde::de;
use std::fmt;
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Encoding {
Primitive,
Constructed,
}
impl fmt::Display for Encoding {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Primitive => write!(f, "PRIMITIVE"),
Self::... |
JavaScript | UTF-8 | 1,566 | 3.0625 | 3 | [
"Apache-2.0"
] | permissive | /**
* Filename: paging.js
* Company: Touchdown Delivery, LLC
* Author: Darien Tsai
* Collaborators: none
* Date Created: 12/17/18
* Description:
* Manages the transition between the index page and all the others
*/
//select body
let body = document.getElementsByTagName('body')[0];
//Index page links
let mob... |
Python | UTF-8 | 333 | 2.90625 | 3 | [] | no_license | # Libraries
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
# Reader simplification
reader = SimpleMFRC522()
# To test if it works
try:
# Type data to write on the tag/card
text = input('New data: ')
print("Hold tag at reader")
reader.write(text)
# Confirmation it worked
print("Written")
finally:
GP... |
C# | UTF-8 | 5,065 | 2.609375 | 3 | [] | no_license | using Cds.BusinessCustomer.Domain.CustomerAggregate;
using Cds.BusinessCustomer.Domain.CustomerAggregate.Abstractions;
using Cds.BusinessCustomer.Infrastructure.CustomerRepository.Dtos;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Htt... |
Python | UTF-8 | 595 | 2.625 | 3 | [] | no_license | import os
ROOT='.'
gt=os.path.join(ROOT,'gt')
out=os.path.join(ROOT,'out')
# print(os.listdir(gt))
for txt in os.listdir(gt):
basename= os.path.splitext(txt)[0]
# print(basename)
with open(out+'/'+txt,'w') as f_o:
with open(gt+'/'+txt) as f:
lines = [line for line in f.readlines() if ... |
Markdown | UTF-8 | 4,242 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | # Tools for creating a basic Infrastructure-as-a-Service (v3.2.27)
This is a set of bash-script files for creating a basic single-host IaaS on a Linux server.
The purpose is to give every user a personal virtual machine in the form of a docker container (http://docker.com). Users’ containers can be built from any doc... |
Java | UTF-8 | 633 | 3.15625 | 3 | [] | no_license | import java.io.*;
import java.util.*;
public class DiagonalTraversal {
public static void main(String[] args) throws Exception {
// write your code here
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int a[][]=new int[n][n];
for(int i=0;i<a.length;i++)
{
... |
Java | UTF-8 | 972 | 2.859375 | 3 | [] | no_license | package ModelObjects;
public class Category {
int categoryID;
String categoryName;
String categoryIcon;
public Category(){
}
public Category(int _categoryID){
this.categoryID = _categoryID;
}
public Category(String _categoryName,String _categoryIcon... |
C# | UTF-8 | 435 | 2.609375 | 3 | [] | no_license | using System;
using System.Security.Cryptography;
using System.Text;
namespace OwnID.Extensibility.Extensions
{
public static class HashExtensions
{
public static string ToSha256(this string input)
{
using var sha256 = new SHA256Managed();
var hash = Convert.ToBase64Stri... |
Java | UTF-8 | 2,754 | 2.984375 | 3 | [] | no_license | package com.dualnback.game;
class Score {
private int countOfRightSoundGuesses;
private int countOfWrongSoundGuesses;
private int countOfRightLocationGuesses;
private int countOfWrongLocationGuesses;
private int expectedTotalSoundMatch;
private int expectedTotalLocationMatch;
private do... |
Python | UTF-8 | 124 | 2.953125 | 3 | [] | no_license | def f():
return 3
def test_function():
a = f()
assert a % 2 == 0, "判断a为偶数,当前a的值为:%s"%a |
Python | UTF-8 | 2,828 | 2.6875 | 3 | [
"MIT"
] | permissive | import os
import platform
from flac_to_mka.tools import config
if platform.system() == "Windows":
import win32api
import win32con
# Handle via config
configuration = config.GetConfig()
METAFLAC_EXE = configuration['metaflac']
SOX_EXE = configuration['sox']
MKVMERGE_EXE = configuration['mkvmerge']
OUTPUTDIR =... |
C# | UTF-8 | 809 | 3.015625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FB.Contracts.Services;
namespace FB.Infrastructure.Services.Validation
{
public class StringLengthValidator : IValidator
{
public int MinimumLength { get; protected set; }
public int MaximumLength { get... |
JavaScript | UTF-8 | 566 | 2.953125 | 3 | [] | no_license | var sea;
var ship;
var ship_moving;
var seaImage;
function preload(){
ship_moving= loadAnimation("ship-1.png","ship-2.png","ship-3.png","ship-4.png");
seaImage= loadImage("sea.png");
}
function setup(){
createCanvas(800,600);
ship= createSprite(400,250,10, 10);
ship.addAnimation("moving", ship_moving);
ship.s... |
C# | UTF-8 | 10,676 | 2.5625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PCLStorage;
using SkiaSharp;
using SkiaSharp.Views.Forms;
using Xamarin.Forms;
namespace MEPSLog_Forms
{
public class FileManager
{
private static FileManager _... |
Java | UTF-8 | 4,069 | 1.507813 | 2 | [] | no_license | package com.facebook.events.permalink.actionbar;
import com.facebook.analytics.CurationMechanism;
import com.facebook.analytics.CurationSurface;
import com.facebook.common.futures.AbstractDisposableFutureCallback;
import com.facebook.events.eventsevents.EventsEventBus;
import com.facebook.events.eventsevents.EventsEve... |
C# | UTF-8 | 5,502 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | using CryptoSQLite.Tests.Tables;
using Xunit;
namespace CryptoSQLite.Tests
{
[Collection("Sequential")]
public class CountTests : BaseTest
{
[Fact]
public void CountOfAllRecordsInTable()
{
var item1 = IntNumbers.GetDefault();
var item2 = IntNumbers.GetDefaul... |
Python | UTF-8 | 352 | 2.765625 | 3 | [] | no_license | class Category:
def __init__(self, category_id=0, category_name='', description=''):
self.category_id = category_id
self.category_name = category_name
self.description = description
def serialize(self):
return{
'category_id' = self.category_id,
'category_name' = self.category_name,
'desc... |
Java | UTF-8 | 848 | 2.375 | 2 | [] | no_license | package com.poc.dao;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "User_Type")
public class UserType {
@Id
@GeneratedValue(strat... |
C++ | UTF-8 | 596 | 2.828125 | 3 | [] | no_license |
#include "Game.hpp"
#include "lua.hpp"
#include <iostream>
#include <memory>
#include <string>
int main() {
std::cout << "Creating game" << std::endl;
auto game = std::make_unique<Game>("1st Game", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, false);
std::cout << "Initializing logic" << std::... |
Ruby | UTF-8 | 1,753 | 3.09375 | 3 | [] | no_license | desc "This task make the scraping of the Relics and add them to the database"
require "nokogiri"
require "open-uri"
task :scraping_potions => :environment do
web = "https://slaythespire.gamepedia.com"
potions_url = "/Potions"
doc = Nokogiri::HTML(open(web + potions_url))
@newImputs = []
table = doc.at("tab... |
Rust | UTF-8 | 3,175 | 3.265625 | 3 | [] | no_license | pub mod value {
use std::fmt::{self, Display};
use crate::opcodes::Instruction;
#[derive(Debug, Clone, Hash)]
pub enum Val {
Nil,
EmptyList,
Cons(Box<Val>, Box<Val>),
Num(i32),
Bool(bool),
String(String),
VMFunction(VMFunction),
Closure(V... |
Markdown | UTF-8 | 1,355 | 3.390625 | 3 | [
"MIT"
] | permissive | # LEARNING REACT 7 - LIST MAPPING
React Introduction
## Installation
Clone this repository and use `npm start` in your terminal to make it start
## Activities and Objectives
You are tasked to create a `MenuBar` component that gets populated from an array of objects including option name, classes, action on click a... |
Shell | UTF-8 | 1,899 | 2.90625 | 3 | [] | no_license | #!/bin/bash
rm -rf CA
rm -rf Server
rm -rf Client
mkdir CA
cd CA
echo 'Generating CA Private/Public(Cert) Key Pairs'
openssl req -x509 -newkey rsa:4096 -nodes -days 365 -keyout ca-key.pem -passout pass:prvt1Key -out ca-cert.pem -subj "/C=IN/ST=MP/L=INDORE/O=Hackers Inc/OU=Development/CN=shreyasd/emailAddress=shd22@g... |
Java | UTF-8 | 1,733 | 2.5 | 2 | [] | no_license | package com.bupt.scs626.entity;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;
import javax.persistence.*;
import java.util.Date;
/**
* Created by cj .
*/
@Entity
@Table(name = "light")
public class Light {
... |
Python | UTF-8 | 141 | 3.46875 | 3 | [] | no_license |
height = input("How tall are you? ")
if height > 150 :
print "wow you`re tall!"
if height >= 56 :
print "ok!"
else :
print "too short" |
C++ | UTF-8 | 1,532 | 2.75 | 3 | [] | no_license | /*
* split_by_row_test.cpp
*
* Created on: 2013.12.11.
* Author: kisstom
*/
#include "../../../main/common/graph_converter/split_by_row.h"
#include <gtest/gtest.h>
#include <stdio.h>
#include <vector>
#include <iostream>
#include <sstream>
using std::vector;
using std::stringstream;
using std::ios_base;
usi... |
C++ | WINDOWS-1251 | 1,370 | 3.375 | 3 | [] | no_license | // 5.1.9.3.Obtaining_derived_data_from_object.cpp: .
//
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
class AdHocSquare
{
public:
AdHocSquare(double side)
{
set_side(side);
}
void set_side(double side);
double get_area();
private:
double side;
};
void AdHocSquare::set_si... |
PHP | UTF-8 | 617 | 2.609375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', '... |
Java | UHC | 1,189 | 3.390625 | 3 | [] | no_license | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class MouseWheelFrame extends JFrame {
public MouseWheelFrame() {
super("콺 Ʈ ũ ");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JLabel label = new JLabel("Love Java... |
C++ | UTF-8 | 1,095 | 3.140625 | 3 | [] | no_license |
#ifndef GPIO_H
#define GPIO_H
#include <fstream>
#include <string>
#include <sstream>
class GPIO {
public:
enum DIRECTION {IN, OUT};
protected:
unsigned port;
DIRECTION dir;
public:
GPIO(unsigned port, DIRECTION dir);
~GPIO();
// 设置
void set(unsigned port, DIRECTION dir);
// 设置方向
... |
C++ | UTF-8 | 609 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #ifndef PROCESSH_H
#define PROCESSH_H
#include <string>
// Basic class for Process representation
// It contains relevant attributes as shown below
// Renamed this file to processh.h cause it was conflicting with process.h found
// in Windows Kit
class Process {
public:
Process(int pid);
int Pid();
std::stri... |
C++ | UTF-8 | 6,174 | 2.8125 | 3 | [
"MIT"
] | permissive | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup()
{
// Use GL_TEXTURE_2D Textures (normalized texture coordinates 0..1)
ofDisableArbTex();
// FBO with multiple render targets
ofFbo::Settings fboSettings;
fboSettings.width = ofGetWindowWidth()... |
Python | UTF-8 | 628 | 4.3125 | 4 | [] | no_license | # In this lets see about the "Built-in functions" in python.
# Built-in function is defined as the functions whose functionality is pre-defined in the python compiler.
# Lets see about "ord( ) bilt-in function" in python.
# ord( ) - Used to return an unicode value for the given String.
# Here is the program... |
Markdown | UTF-8 | 4,275 | 3.015625 | 3 | [
"MIT"
] | permissive | ---
layout: series
title: GeoData Training Programme
description: A training to help civil servants operationalise geographical data and tools for public health and disaster response.
permalink: /series/open-geodata-programme/
---
### Context
Last year, Facebook publicly released the world’s most accurate populati... |
Python | UTF-8 | 4,011 | 2.859375 | 3 | [
"MIT"
] | permissive | """Used for generating failure recommendations on the Insights page of the dashboard"""
def get_failure_tip(current, previous, last_success):
if current.is_success():
return "All good.", ""
else:
return handle_failure(current, previous, last_success)
def handle_failure(current, previous, las... |
JavaScript | UTF-8 | 1,873 | 3.140625 | 3 | [] | no_license | let request = require('request');
let fs = require('fs');
let secrets = require('./secrets.js');
let args = process.argv.slice(2);
function getRepoContributors(repo, callback)
{
//URL and headers for API request
let options =
{
url: "https://api.github.com/repos/" + repo[0] + "/" + repo[1] + "/contributors",... |
Shell | UTF-8 | 920 | 2.796875 | 3 | [] | no_license | #!/bin/bash
. ./path.sh || exit 1
. ./cmd.sh || exit 1
nj=1 # number of parallel jobs - 1 is perfect for such a small data set
lm_order=1 # language model order (n-gram quantity) - 1 is enough for digits grammar
# Safety mechanism (possible running this script with modified arguments)
. utils/parse_options.s... |
JavaScript | UTF-8 | 2,886 | 2.515625 | 3 | [
"MIT"
] | permissive | import React, { useState, useRef, useEffect } from "react";
import { createUseStyles } from "react-jss";
import Color from './color';
import ColorBox from "./colorBox";
import HexBox from "./hexBox";
import utils from "./utils";
import ColorComponentPicker from "./colorComponentPicker";
// Fun fact: this is Pantone C... |
C++ | UTF-8 | 1,471 | 3.140625 | 3 | [] | no_license | #include "bst_node.h"
using namespace std;
BSTNode::BSTNode () {
left = NULL;
right = NULL;
}
BSTNode::BSTNode (string word, unsigned int freq) {
left = NULL;
right = NULL;
wordObj_.setFreq(freq);
wordObj_.setWord... |
C# | UTF-8 | 645 | 3.265625 | 3 | [] | no_license | public interface IClass
{
int a { get; set; }
int b { get; set; }
}
class First : IClass
{
public int a { get; set; }
public int b { get; set; }
public int c = 2;
public _second;
public First()
{
_second = new Second(th... |
PHP | UTF-8 | 1,039 | 2.8125 | 3 | [
"MIT"
] | permissive | <?php /* List file names & line numbers for all stack frames;
clicking these links/buttons will display the code view
for that particular frame */ ?>
<?php foreach ($frames as $i => $frame): ?>
<div class="frame <?php echo ($i == 0 ? 'active' : '') ?> <?php echo ($frame->isApplication() ? 'frame-app... |
JavaScript | UTF-8 | 1,075 | 2.765625 | 3 | [] | no_license | const bcrypt = require("bcrypt");
const userRouter = require("express").Router();
const User = require("../models/user");
userRouter.get("/", async (request, response) => {
const users = await User.find({});
response.json(users);
});
userRouter.post("/", async (request, response) => {
const { username, name, pa... |
Python | UTF-8 | 290 | 2.921875 | 3 | [] | no_license | data=[
{
'name': 'dipesh shrestha',
'email': 'dipdreaming92@gmail.com'
},
{
'name':'dinesh shrestha',
'email': 'dinesh95@gmail.com'
}
]
print('name:%s' %data[1]['name'])
print('name:%s' %data[1]['email'])
for(i,item) in enumerate(data):
print('\nuser %d' %(i+1))
print('name: %s' %item['name'])
print('name: %s' %i... |
Java | UHC | 1,402 | 3.484375 | 3 | [] | no_license | package org.comstudy21.ch11ex04;
public class {
public static void test02(String[] args) {
[] aniArr = new [3];
aniArr[0] = new ();
aniArr[1] = new ();
aniArr[2] = new ();
for(int i=0;i<aniArr.length;i++){
if(aniArr[i] instanceof ){
(()aniArr[i]).Դ();
}
if(aniArr[i] instanceof ){
... |
TypeScript | UTF-8 | 124 | 2.671875 | 3 | [] | no_license | export class Hello {
getName() {
return 'Jest'
}
sayGreeting() {
return `Hello, ${this.getName()}!`;
}
}
|
JavaScript | UTF-8 | 1,310 | 2.546875 | 3 | [
"MIT"
] | permissive | /**
* Created with JetBrains WebStorm.
* User: admin
* Date: 01/08/2013
* Time: 01:50
* To change this template use File | Settings | File Templates.
*/
var readline = require('readline'),
rl = readline.createInterface(process.stdin, process.stdout);
var promts = [ 'Enter admin email address: ',
... |
Java | UTF-8 | 518 | 1.734375 | 2 | [
"Apache-2.0"
] | permissive | package tv.bgm.materialdesgincomponent.ui;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import tv.bgm.materialdesgincomponent.R;
/**
* Created by Chihiro on 2018/8/7.
*/
public class ConstraintLayoutActivity extends AppCompatActivity {
... |
Markdown | UTF-8 | 1,692 | 2.796875 | 3 | [
"MIT"
] | permissive | # Cache Middleware
The Cache middleware uses the Web Standard's [Cache API](https://developer.mozilla.org/en-US/docs/Web/API/Cache). It caches a given response according to the `Cache-Control` headers.
The Cache middleware currently supports Cloudflare Workers projects using custom domains and Deno projects using [De... |
JavaScript | UTF-8 | 3,168 | 2.625 | 3 | [] | no_license | function lollipopPlot() {
let margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 600,
height = 400,
innerWidth = width - margin.left - margin.right,
innerHeight = height - margin.top - margin.bottom,
xValue = d => d[0],
yValue = d => d[1],
xScale = d3.scaleLinear(),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.