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 | 3,055 | 2.734375 | 3 | [
"BSL-1.0"
] | permissive | ///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2007 - 2014.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef _RING_ALLOCATOR_2010... |
Swift | UTF-8 | 5,278 | 2.734375 | 3 | [] | no_license | //
// JSONView.swift
// wusi-ios
//
// Created by James Tang on 12/9/14.
// Copyright (c) 2014 Wusi. All rights reserved.
//
import UIKit
@objc protocol JsonAttributeAssignable {
func setAttribute(value:AnyObject, forKey key:String)
}
extension UIView {
func assignDictionary(dict: [String:AnyObject], re... |
Python | UTF-8 | 499 | 2.53125 | 3 | [] | no_license | import json
import os
tools_file = open("tools.json")
tools = json.load(tools_file)
print(tools)
# tool_name = ""
# for key, value in tools.items():
# tool_name += key
# if operation !=
# operation = value
# if
def get_children(d, parent=None, l=[]):
print(d['id'], parent, len(d['children']))
... |
Shell | UTF-8 | 1,193 | 3.5625 | 4 | [] | no_license | #!/bin/bash
echo "O shell permite que se possa criar variáveis e que se possa atribuir valores por ex:"
estado="Paraiba"
echo "Foi passado uma variavel 'estado' a qual foi atribuido o valor Paraiba, para podermos exibir o valor dessa variável podemos utilizar o conceito de substituição de variáveis, onde utilizamos ... |
Rust | UTF-8 | 1,340 | 2.671875 | 3 | [] | no_license | mod graph;
mod matrix;
mod render;
use matrix::Matrix;
use render::coordinates::Point;
fn main() {
let width = 512usize;
let height = 256usize;
let dim = Point::new(width as i32, height as i32);;
let mut buffer: Vec<[u8; 4]> = vec![[255, 255, 255, 255]; width * height];
let count: usize = std::en... |
PHP | UTF-8 | 1,436 | 3.046875 | 3 | [] | no_license | <?php
namespace Framework\Support;
class Asset
{
/**
* The internal path to the resource.
*
* @var string
*/
protected $path;
/**
* The base url.
*
* @var string
*/
protected $url;
/**
* The Constructor of the class
*
* @return void
*/... |
Java | UTF-8 | 429 | 2.9375 | 3 | [] | no_license | package org.pattern.lhf.mediator;
import java.awt.*;
public class ColleageButton extends Button implements Colleage {
private Mediator mediator;
public ColleageButton(String caption){
super(caption);
}
@Override
public void setMediator(Mediator mediator) {
this.mediator=mediator;
... |
JavaScript | UTF-8 | 1,035 | 2.59375 | 3 | [] | no_license | const cheerio = require('cheerio')
const http = require('http')
const fs = require('fs')
const path = require('path')
const url = 'http://www.ziroom.com/'
const getWebData = (data) => {
let $ = cheerio.load(data)
let imgUrlArr = $('#foucsSlideList')
let imgArr = []
imgUrlArr.find('li').each(function(item){... |
Markdown | UTF-8 | 407 | 2.515625 | 3 | [] | no_license | # Ho to add new app
```yaml
# App Service
app:
# Configuration for building the docker image for the service
build:
context: ../httpserver # location of the Dockerfile
dockerfile: Dockerfile
ports:
- "8080:8080" # Ports to expose {host}:{container}
restart: unless-stopped
expo... |
Shell | UTF-8 | 445 | 3.3125 | 3 | [] | no_license | #!/bin/bash
# Usage:
# integration/docker/build/build.sh
# integration/docker/build/build.sh force # Always recreate docker image and container.
set -e
SCRIPTPATH=$(dirname "$0")
echo $SCRIPTPATH
if [ "$1" = "force" ] || [[ "$(docker images -q theta_eth_rpc_adaptor_builder 2> /dev/null)" == "" ]]; then
... |
C# | UTF-8 | 1,831 | 2.609375 | 3 | [] | no_license | using System;
using Amazon.S3;
using Amazon.S3.Model;
using System.IO;
using Amazon;
using System.Threading.Tasks;
using Carto.Core;
namespace data.collection
{
public static class BucketClient
{
public static string Name = Conf.S3BucketName;
public static string AccessKey = Conf.S3AccessKey;... |
C# | UTF-8 | 15,376 | 3.109375 | 3 | [] | no_license | using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Web;
namespace CMSHelperLib
{
public static class ImageHelpers
{
/// <summary>
/// Save image as jpeg
/// </summary>
/// <p... |
Java | UTF-8 | 2,198 | 3.0625 | 3 | [] | no_license |
import edu.blackburn.cs.cs212.restaurantbase.Money;
import edu.blackburn.cs.cs212.restaurantbase.Receipt;
/*
* 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.
*/
/**
*
* @author paul.klin... |
C++ | UTF-8 | 291 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <thread>
using namespace std;
int main(){
auto foo = [](const int &i, char* buff){
cout << i << endl;
cout << buff << endl;
};
int i = 10;
char buff[] = "hello thread";
thread t1(foo, i, buff);
t1.join();
return 0;
} |
C | UTF-8 | 159 | 2.84375 | 3 | [] | no_license | #include<stdio.h>
int main(){
int N, tn;
while(scanf("%d", &N)!=EOF){
tn = (15*N/7)+1;
if(tn%3 && tn%5)
tn--;
printf("%d\n", tn);
}
return 0;
}
|
C# | UTF-8 | 444 | 3.375 | 3 | [
"MIT"
] | permissive | using System;
//연도를 읽어 윤년인지를 판별하는 프로그램
namespace cs2._12_8
{
class Program
{
static void Main(string[] args)
{
int y = int.Parse(Console.ReadLine());
if ((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0))
Console.WriteLine("윤년입니다.");
else
... |
Java | WINDOWS-1250 | 2,073 | 3.3125 | 3 | [] | no_license | package poder;
import java.util.ArrayList;
import java.util.List;
public class AdmPoderes {
public List<Poder> poderes;
public AdmPoderes(){
this.poderes=new ArrayList<Poder>();
}
//Este metodo registra un pode previa validacin de datos necesarios y si elpoder ya existe en la lista
pub... |
Ruby | UTF-8 | 1,511 | 3.875 | 4 | [] | no_license | #write your code here
def translate(string)
words = string.split(' ')
words.map! do |x|
if /\A[[:punct:]]/.match(x) #if word begins with punctuation, preserve it
while (x[1] =~ /[aeiouy]/) != 0
if /\Aqu/.match(x[1])
x = x[0] + x[3..-1] + x[1..2]
else
... |
Python | UTF-8 | 1,525 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, project_dir)
class Solution(object):
def findNumberOfLIS(self, nums):
"""
:type nums: List[int]
:rtype: int
... |
Java | UTF-8 | 155 | 2.046875 | 2 | [
"LGPL-2.1-only",
"MIT",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"BSD-3-Clause"
] | permissive | class UnsatInstOf {
public static void main(String[] args) {
UnsatInstOf a = new UnsatInstOf();
assert a.getClass() != UnsatInstOf.class;
}
}
|
Java | UTF-8 | 1,730 | 2.96875 | 3 | [] | no_license | import java.awt.*;
import javax.swing.*;
/**
* @author hyojun
*/
public class HPDrawPanel extends JPanel {
/**
* @uml.property name="x"
*/
private int x;
/**
* @uml.property name="pl"
*/
private int pl;
/**
* @uml.property name="count"
*/
private int count;
/**
* @uml.property name="hP"
... |
Markdown | UTF-8 | 761 | 3.375 | 3 | [] | no_license | # DP 方法的计算方式
## 顺序
dp 基本的方向 都是从前向后的进行计算 dp[i] = func(dp[i-1],dp[i-2])
func 可以为 min/max/sum 这些方式同步 状态转移方程式,可以有很多方法
### [零钱兑换](https://leetcode-cn.com/problems/coin-change/)
这里是从0-N这种方式同步 状态:加/不加
不加:dp[i] = dp[i-1]
加上:dp[i] = min({dp[i],dp[i-coin]+1},coin<<coins)
## 逆序
从最大到最小的开始同步
### [最低票价](https://leetcode-cn.... |
Java | UTF-8 | 92 | 1.96875 | 2 | [] | no_license | package Utils;
public interface PasswordEncrypter {
String encryptString(String in);
}
|
C++ | UTF-8 | 1,733 | 2.9375 | 3 | [] | no_license | #include "TableDelim.h"
TableDelim::TableDelim()
{
_picture.reserve(numberDelim);
_picture.resize(numberDelim);
_picture[static_cast<int>(Delim::ADD_OP)] = "+";
_picture[static_cast<int>(Delim::AND_OP)] = "&&";
_picture[static_cast<int>(Delim::ASS_OP)] = "=";
_picture[static_cast<int>(Delim::COMMA)] = ",";
_pic... |
C++ | UTF-8 | 4,415 | 3.6875 | 4 | [] | no_license | /*
Creator:
Bradley Hobbs
Date Created:
8/24
Description:
The user will guess a randomly generated number between 1 and 100,
you have 10 guesses before the game ends, if users guess is to high or to low,
it will also tell you how many guesses you have left,
if/when you run out of guess... |
Java | UTF-8 | 1,496 | 2.40625 | 2 | [] | no_license | package com.apploidxxx.entity;
import com.apploidxxx.core.auth.PasswordChecker;
import javax.persistence.*;
import java.util.Base64;
import java.util.Objects;
/**
* @author Arthur Kupriyanov
*/
@Entity
public class Session {
@Id
@GeneratedValue
long id;
@Column
private String sessionId;
@... |
Java | UTF-8 | 97,278 | 2.53125 | 3 | [] | no_license | package com.vw.util;
import com.vw.model.Criteria;
import com.vw.model.DetailedResultSet;
import com.vw.model.MissingCriteria;
import com.vw.model.ResultSetForTotalClaims;
import com.vw.model.Usuario;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLExc... |
Python | UTF-8 | 1,070 | 3.078125 | 3 | [] | no_license | import json
import math
import requests
import os
import search_person
from decouple import config
def search_score(value):
API_KEY = config('API_KEY')
id = value
# calls tmdb api for full credits
url = f'https://api.themoviedb.org/3/person/{id}/combined_credits'
params = dict(
api_key=API_KEY... |
Java | UTF-8 | 1,075 | 3.859375 | 4 | [] | no_license | import java.util.Comparator;
public class Main {
public static void main(String[] args) {
// anonymous class
AbstractClass abstractClassImplemented = new AbstractClass() {
@Override
public void makeSurrealArt(){
System.out.println("Created by Dali!");
... |
C++ | UTF-8 | 824 | 2.515625 | 3 | [] | no_license | /*********************************************************************
Project: Dissertation
Author: Josh Martin
Name: Text
Description: A text class for holding inforamtion for font rendering
*********************************************************************/
#ifndef TEXT_H
#define TEXT_H
#include <string>
#incl... |
Python | UTF-8 | 6,376 | 3.03125 | 3 | [] | no_license |
import os
import urllib
from google.appengine.api import users
from google.appengine.ext import ndb
import jinja2
import webapp2
template_dir = os.path.join(os.path.dirname(__file__), 'templates')
jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), autoescape = True)
default_guestbook... |
C++ | UTF-8 | 526 | 2.921875 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main ()
{
int n;
int x,y;
int left,right;
int k;
scanf("%d",&n);
for ( k = 0; k < n; k++ )
{
left = right = 0;
scanf("%d %d",&x,&y);
while ( !(x==1&&y==1) )
{
if ( x > y )
{
if ( x % y == 0 )
{
left += (x-1);
break;
}
left+=x/y;... |
C | UTF-8 | 1,914 | 2.578125 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* server_bonus.c :+: :+: :+: ... |
Python | UTF-8 | 1,526 | 3.171875 | 3 | [] | no_license | from cryptography.fernet import Fernet
def get_switch_input():
# TODO: apply error checking mechanism since this is a dead man's switch
telegram_handle = input("Telegram handle to listen on: ")
reset_keyword = input("keyword to stop the dead man's switch: ")
kill_switch = input("Keyword to immediately... |
Ruby | UTF-8 | 8,678 | 2.546875 | 3 | [
"MIT"
] | permissive | require 'microsoft_kiota_abstractions'
require_relative '../microsoft_graph'
require_relative './models'
module MicrosoftGraph
module Models
class Directory < MicrosoftGraph::Models::Entity
include MicrosoftKiotaAbstractions::Parsable
##
# Conceptual container for user ... |
TypeScript | UTF-8 | 801 | 2.5625 | 3 | [
"MIT"
] | permissive | export interface Page {
name: string;
path: string;
pages?: Page[];
isPrivate?: boolean;
}
export const INDEX: Page = {
name: 'Home',
path: '/',
};
export const LOGIN: Page = {
name: 'Login',
path: '/login',
};
export const LOGOUT: Page = {
name: 'Logout',
path: '/logout',
};
export const SUBPAG... |
PHP | UTF-8 | 27,293 | 2.5625 | 3 | [] | no_license | <?php
class CG_BitBangedI2CController extends CG_Controller
{
protected function _GenerateCCode($model=NUll, $processor_type='')
{
/* SCLPORT */
if($model->scl_port == 'PORTA')
{
$latSCLName = 'LATA';
$portSCLName = 'PORTA';
$portSCLTris = 'TRISA';
... |
C | UTF-8 | 4,265 | 2.890625 | 3 | [] | no_license | #include "common.h"
#include <inttypes.h>
void mem_read(uintptr_t block_num, uint8_t *buf);
void mem_write(uintptr_t block_num, const uint8_t *buf);
static uint64_t cycle_cnt = 0;
static uintptr_t tag, group_num, block_num; // 标记,组号,内存块内地址
typedef struct
{
bool valid_bit; // true已写入, false未写入
bool dirty_bit; ... |
PHP | UTF-8 | 2,484 | 2.765625 | 3 | [] | no_license | <?php
if (isset($_POST['submit-signup'])) {
include_once 'dbh.inc.php';
session_start();
//prepare and bind
$stmt = $conn->prepare("INSERT INTO users (user_first, user_last, user_username, user_password, user_email, user_profile_pic) VALUES (?, ?, ?, ?, ?, ?);");
$stmt->bind_param("ssssss", $first... |
PHP | UTF-8 | 513 | 2.640625 | 3 | [
"MIT"
] | permissive | <?php
namespace Otisz\Billingo\Services;
use Otisz\Billingo\Facades\Billingo;
class PaymentMethods
{
/**
* Get a listing of payment methods
*
* @example https://billingo.readthedocs.io/en/latest/payment_methods/#list-the-available-payment-methods
*
* @param string $langCode Language c... |
JavaScript | UTF-8 | 4,292 | 2.9375 | 3 | [] | no_license | var redis = require("redis");
// Define amount of cycles
var maxcycles = process.env.IMTCYCLES;
if (!maxcycles) {
maxcycles = 10;
}
// Create connection, depending on your environment
var connection = process.env.IMTCONNECT;
if (!connection) {
connection = 'LOCALHOST';
}
var dbport = process.env.IMTDBPORT;
i... |
JavaScript | UTF-8 | 464 | 2.703125 | 3 | [] | no_license | describe('practice-7-1', function () {
it("get the type of data and log", function () {
var v1 = choose == 'a' || choose == 'b' || choose == 'c' || choose == 'd';
var v2 = typeof(all_data) == 'object';
var v3 = logs[0].search(typeof all_data[choose]) >= 8;
var v4 = logs[1] == undef... |
Java | UTF-8 | 1,719 | 2.078125 | 2 | [] | no_license | package xyz.zaijushou.zhx.sys.web;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframew... |
Java | UTF-8 | 668 | 2.171875 | 2 | [] | no_license | package com.jpm.hr.daos;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.springframework.stereotype.Repository;
import com.jpm.hr.entity.Employee;
import com.jpm.hr.exceptions.HrExceptions;
@Repository("HrDaos")
public class HrDaosImpl implements HrDaos{
... |
Ruby | UTF-8 | 701 | 2.6875 | 3 | [] | no_license | class InviteFiller
attr_reader :resource
def initialize(resource)
@resource = resource
end
def invites_left?
unfilled_invites.count > 0
end
def fill_invite(guest_attrs)
return with_error(I18n.t(:no_invites_left)) unless invites_left?
return with_error(I18n.t(:must_accept_invite)) unless r... |
C# | UTF-8 | 1,207 | 2.828125 | 3 | [] | no_license | using System.Collections.ObjectModel;
using System.Threading.Tasks;
using OltivaHotel.PCL.Model;
namespace OltivaHotel.PCL.Design
{
public class DesignDataService : IDataService
{
private IDownloader _downloader;
public DesignDataService(IDownloader downloader)
{
_download... |
Go | UTF-8 | 2,252 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | package main
import (
"fmt"
kingpin "gopkg.in/alecthomas/kingpin.v2"
"os"
"reflect"
"strconv"
"strings"
artifactory "artifactory.v401"
"github.com/olekukonko/tablewriter"
)
var (
repo = kingpin.Arg("repo", "Repo to show").Required().String()
)
func makeBaseRow(b artifactory.RepoConfig) []string {
s := ref... |
C++ | UTF-8 | 260 | 2.609375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
// your code here
int cases;
int n;
long long a;
cin>>cases;
while(cases--){
cin>>a>>n;
if(n==0){
cout<<"Airborne wins."<<endl;
}else{
cout<<"Pagfloyd wins."<<endl;
}
}
return 0;
} |
C# | UTF-8 | 2,286 | 2.5625 | 3 | [] | no_license | using PMS.Model;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PMS.Algorithm
{
public class PERT
{
public bool check(List<PERTTask> calc, List<PERTTask> postTask)
{
if (postTask.Count... |
Python | UTF-8 | 1,516 | 2.828125 | 3 | [
"MIT"
] | permissive | from .MultiOutput import *
import weakref
class MultiInputItem(object):
def __init__(self, models):
self.models = models
def __getitem__(self, i):
return self.models[i].Y
def __setitem__(self, i, value):
self.models[i].Y = value
def __iter__(self):
for md in self.models:... |
Java | UTF-8 | 662 | 3.203125 | 3 | [] | no_license |
/**
* Write a description of class daisy here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class daisy
{
public static void main(String args[]){
new daisy();}
public daisy(){
int num = (int)(Math.random() * 10 + 15);
for(num = num ; num < 26 ; num++){... |
Markdown | UTF-8 | 1,446 | 3.046875 | 3 | [] | no_license | <h1>JSTVRemote</h1>
<h2>Control your Smart TV from your browser</h2>
This library allows you to develop web apps to control your Smart TVs.
Support of features depends on your TV, but it can send remote control keys to your TV, input text or control mouse cursor.
Current TVs supported are:
<ul>
<li>Philips with Joint... |
C++ | UTF-8 | 1,691 | 3.765625 | 4 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
struct Node{
int val;
Node* right ;
Node* left ;
};
Node* newNode(int data){
Node* node = new Node();
node->val = data;
node->left = NULL;
node->right = NULL;
return node;
}
void preOrder(Node *root){
unordered_map<Node*,... |
Python | UTF-8 | 1,975 | 3.609375 | 4 | [] | no_license | from item import Item, Weapon, Food
from chest import Chest
from random import randint
class MapTile:
def __init__(self, x, y):
self.x = x
self.y = y
def describe(self, description):
print(description)
class Start(MapTile):
def __init__(self, x, y):
self.description = "Loo... |
Java | UTF-8 | 774 | 3.84375 | 4 | [] | no_license | package sequentialCollection;
import java.util.ArrayList;
public class AList {
public static void main(String args[]) {
ArrayList<Integer> grades = new ArrayList<Integer>();
grades.add(100);
grades.add(200);
grades.add(300);
grades.add(400);
float total = 0f;
// for(int i = 0 ; i < grades.size() ; ++i... |
Markdown | UTF-8 | 5,326 | 3.375 | 3 | [] | no_license | # Getting and Cleaning Data Assignment
Repository for Coursera Getting and Cleaning Data Assignment which is based on a [Human Activity Recognition Using Smartphones Data Set](http://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones)
## Purpose of assignment (from course project)
>The pur... |
Go | UTF-8 | 4,957 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | package machine
import (
"context"
"log"
"net"
"sync"
"time"
"github.com/rotisserie/eris"
"github.com/sparrc/go-ping"
"github.com/talos-systems/talos/api/machine"
"github.com/talos-systems/talos/pkg/client"
)
const StateUnknown = "unknown"
const pingThreshold = 2 * time.Second
const serviceCheckInterval =... |
Java | UTF-8 | 1,073 | 3.6875 | 4 | [] | no_license | package set;
public class MyStack {
private Node top;
public boolean isEmpty() {
if(top== null) {//if stack is empty return true
return true;
}
else {// if stack is not empty return false
return false;
}
}
public void push(TNode r)
{
top =... |
Java | UTF-8 | 988 | 2.5625 | 3 | [] | no_license | package ejb.simple.examples.local.impl;
import ejb.simple.examples.local.inf.BasicCalculatorEjbLocal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.Stateless;
/*The initial state of a stateless session bean is the ... |
C++ | UHC | 1,879 | 3.828125 | 4 | [] | no_license | /*
N S ־ Ƕ̵带 α ۼϽÿ.
, N 5̰ S 3 ̶, Ƕ̵ .
3
456
21987
3456789
987654321
S 1 Ѵ.
ȣ 1̶ , ¦° ʿ 1 ϵ , Ȧ° Ųٷ ´.
ڰ 10 , 1 ٲٰ ٽ Ѵ.
Է
Է ù ° ٿ N S ־. ( 1N100, 1 S 9)
ù ° ٺ Ƕ̵带 Ѵ. ( ٿ ϴ Ȯϰ Ȯֽùٶϴ.)
*/
#include <stdio.h>
int main() {
int N, S;
scanf("%d %d", &N, &S);
int space = N... |
C++ | UTF-8 | 1,458 | 3.96875 | 4 | [] | no_license | //Quicksort
#include<iostream.h>
#include<conio.h>
//Function prototypes
void quicksort(int a[10],int , int);
void display(int a[10],int);
//Main function
void main()
{
clrscr();
int a[10];
int i,j,n;
cout<<"\nEnter number of elements (max 10) : ";
cin>>n;
cout<<"\nEnter elements : ";
for(i=0;i<n;i++) ... |
Python | UTF-8 | 26,480 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
import wx,time,math,os,SourceImages
import wx.grid
from cv2 import imread
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, "My Frame", size=(800, 450))
self.createProxyWidget()
self.setMenubar()
self.SetToolBar()
def SetTool... |
Rust | UTF-8 | 14,440 | 2.984375 | 3 | [] | no_license | extern crate tempdir;
use std::fmt;
use std::error;
use std::str;
use std::io::Write;
use std::io::Read;
use std::io::Seek;
use std::io::SeekFrom;
use std::fs::File;
use std::fs::OpenOptions;
use std::path::PathBuf;
#[derive(Debug)]
pub enum DbError {
MetaUnrecognized,
StatementUnrecognized,
StatementSyn... |
Java | UTF-8 | 3,634 | 2.359375 | 2 | [] | no_license | package fastboard.checkmove.fastcheck.bcolumn;
import fastboard.FastBoardTestCase;
import fastboard.checkmove.calc.FastCheckCalc;
import fastboard.fastflip.FastBoardFlips;
import fastboard.lineconverter.LineConverter;
/**
* Created by IntelliJ IDEA.
* User: knhjp
* Date: Nov 29, 2009
* Time: 02:53:25 PM
* Tests ... |
Python | UTF-8 | 2,882 | 2.828125 | 3 | [] | no_license | import math
import pickle
from pathlib import Path
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from torch import nn
from torch import optim
from torch.utils.data import DataLoader, TensorDataset
def draw(X):
print(X.shape)
plt.imshow(X.reshape((28, 28)), cmap='gray')
plt.s... |
C# | UTF-8 | 2,524 | 2.578125 | 3 | [] | no_license | using Core.DataAccess.EntityFramework;
using DataAccess.Abstract;
using DataAccess.Concrete.EntityFramework.Context;
using Entities.Concrete;
using Entities.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DataAccess.Concrete.EntityFramework
{
public class EfCa... |
TypeScript | UTF-8 | 1,535 | 2.71875 | 3 | [
"MIT",
"MIT-0"
] | permissive | import { ComponentValue, ComponentValueType, FunctionNode } from '@csstools/css-parser-algorithms';
import { CSSToken, TokenFunction, TokenType } from '@csstools/css-tokenizer';
import { toLowerCaseAZ } from './to-lower-case-a-z';
export function isNumber(componentValue: ComponentValue) {
if (
(componentValue.type ... |
Java | UTF-8 | 598 | 2.25 | 2 | [] | no_license | package com.example.alexander.sportdiary.ViewHolders;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.example.alexander.sportdiary.R;
public class TestViewHolder extends RecyclerView.ViewHolder {
privat... |
Python | UTF-8 | 1,879 | 4.5625 | 5 | [] | no_license | # Condicionales [Python]
# Ejercicios de profundización
# Autor: Inove Coding School
# Version: 2.0
# NOTA:
# Estos ejercicios son de mayor dificultad que los de clase y práctica.
# Están pensados para aquellos con conocimientos previo o que dispongan
# de mucho más tiempo para abordar estos temas por su cu... |
JavaScript | UTF-8 | 2,189 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import twoInputsReducer, {
initState,
twoInputsChange,
twoInputsChangedDelayed,
selectValueOne,
selectValueTwo,
TWO_INPUTS_CHANGE_DELAYED
} from 'app/redux/two-inputs'
import twoInputsData from 'app/redux/two-inputs/index.test.data'
describe('two-inputs redux', function () {
it('should handle TWO_INPUTS/... |
Python | UTF-8 | 8,733 | 2.609375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# !/bin/python
"""
Author: Winslen
Date: 2019/10/15
Revision: 1.0.0
Description: Description
"""
import re
class FormatSql(object):
PARAMERTS_REG = re.compile(r':([_0-9]*[_A-z]+[_0-9]*[_A-z]*)')
def __init__(self, tableName, **kwargs):
self.kwargs = kwargs
... |
C++ | UTF-8 | 1,540 | 2.640625 | 3 | [] | no_license | #include <homodeus_arm_interface/ArmInterface.h>
// Code to test the arm interface
int main(int argc, char **argv)
{
std::string controlType;
ros::init(argc, argv, "arm_interface_node");
ros::NodeHandle n("~");
ArmInterface arm;
ROS_INFO("arm_interface_node is now running!");
ros::AsyncSpin... |
TypeScript | UTF-8 | 3,010 | 3 | 3 | [] | no_license | import { Eff, Impure, Pure, Chain, EffAny } from './index';
import { IO } from './io';
import { Failure } from './failure';
import { Either } from './either';
import { absurd, Expr } from './types';
export type Async<A = any> =
| Observable<A>
| ToAsync<A>
;
export type AsyncEffect<A> = Eff<Async, A>;
export ty... |
Ruby | UTF-8 | 733 | 4.34375 | 4 | [] | no_license | #Assigns text to X
x = "There are #{10} types of people."
#Assigns var 'binary' to binary
binary = "binary"
#Assigns var 'don't' to do_not
do_not = "don't"
#Assigns text to y and uses interpolators to take vars
y = "Those who know #{binary} and those who #{do_not}."
#puts x then y in separate lines
puts x
puts y
#Pu... |
Rust | UTF-8 | 1,313 | 2.859375 | 3 | [] | no_license | use crate::*;
pub struct PackedMessage<A>
{
inner: Box<MessageProxy<Actor = A> + Send>,
}
pub struct PackedMessageProxy<A, M>
where
M: Message
{
msg: Option<M>,
act: std::marker::PhantomData<A>,
}
pub trait MessageProxy
{
type Actor: Actor;
fn handle(&mut self, act: &mut Self::Actor, ctx: &m... |
C++ | UTF-8 | 1,818 | 2.515625 | 3 | [] | no_license | /*************************************************************************
> File Name: B.cc
> Author: sqwlly
> Mail: sqw.lucky@gmail.com
> Created Time: 2019年08月19日 星期一 21时04分03秒
************************************************************************/
#include<bits/stdc++.h>
using namespace std;
#i... |
PHP | UTF-8 | 491 | 2.625 | 3 | [] | no_license | <?php
namespace App\Policies;
use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use Symfony\Component\HttpKernel\Exception\HttpException;
final class UserPolicy
{
use HandlesAuthorization;
/**
* Only "admin" can manage users.
*
* @param User $user
* @return bool
... |
Python | UTF-8 | 216 | 3.921875 | 4 | [] | no_license | x=int(input("Enter a number"))
sum=0
temp=x
while temp>0:
num=temp%10
sum+=num**3
temp=temp//10
if x==sum:
print(x,"is a Armstrong Number")
else:
print(x,"is Not a Armstrong number")
|
TypeScript | UTF-8 | 782 | 3.734375 | 4 | [
"MIT",
"CC0-1.0"
] | permissive | import toInteger from './toInteger';
import isIterateeCall from './.internal/isIterateeCall';
import toString from './toString';
import baseRepeat from './.internal/baseRepeat';
/**
* Repeats the given string `n` times.
*
* @since 5.7.0
* @category String
* @param str The string to repeat.
* @param n The number ... |
JavaScript | UTF-8 | 12,788 | 2.671875 | 3 | [] | no_license |
function MinGestures(conf) {
var g = {
N: "n",
NW: "nw",
W: "w",
SW: "sw",
S: "s",
SE: "se",
E: "e",
NE: "ne"
};
// gesture straigh line thresholds
var xBackThr = conf && conf.xBackThr ? conf.xBackThr : 3;
var yBackThr = conf && conf.yBackThr ? conf.yBac... |
Python | UTF-8 | 4,295 | 2.828125 | 3 | [
"MIT"
] | permissive | import unittest
import warnings
from corpus2graph import FileParser, WordPreprocessor, Tokenizer, WordProcessing, \
SentenceProcessing, WordPairsProcessing, util
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
class TestProcessors(unittest.TestCase):
""" ATTENTION
Normal... |
C# | UTF-8 | 2,290 | 3.046875 | 3 | [] | no_license | using Alice.Models.Conditions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Alice.Models.Facts
{
public class Fact
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonPro... |
Shell | UTF-8 | 1,314 | 3.953125 | 4 | [] | no_license | #!/bin/sh
# Variables for the build
export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
# Variables for the script
BINUTILS_URL=https://ftp.gnu.org/gnu/binutils/binutils-2.31.tar.xz
GCC_URL=https://ftp.gnu.org/gnu/gcc/gcc-8.2.0/gcc-8.2.0.tar.xz
TMP_DIR=~/cross_tmp
# Can be c,c++
L... |
Python | UTF-8 | 1,541 | 2.59375 | 3 | [] | no_license | import torch
import numpy as np
from torch.autograd import Variable
def Val_Training_process(model, epoches, criterion, optimizer, lr_scheduler, train_loader, val_loader, cuda=False):
print('Starting to train the U_Net Model...')
loss_set = []
for epoch in range(epoches):
train_loss... |
Python | UTF-8 | 2,830 | 2.921875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# coding: utf-8
# Max Basescu
# mbasesc1@jhu.edu
import socket
import time
import os
import RPi.GPIO as GPIO
import Adafruit_CharLCD as LCD
motorPin = 17
os.chdir('/home/pi/DomeTrainingRig/')
while True:
# Initialize motor pin
GPIO.setup(motorPin, GPIO.OUT)
# Initialize the LCD using the pin... |
C | UTF-8 | 2,057 | 2.96875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C++ | UTF-8 | 4,911 | 3.75 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
const char X = 'X';
const char O = 'O';
const char empty = ' ';
const char tie = 'T';
const char notOver = 'N';
void displayInstructions();
char askYesNo(string question);
int askNumber( string question, int high, int l... |
Python | UTF-8 | 2,092 | 4.125 | 4 | [] | no_license | """
输入M和N计算C(M,N)
"""
# m = int(input('m= '))
# n = int(input('n= '))
# fm = 1
# for num in range(1, m+1):
# fm *= num
# fn = 1
# for num in range(1, n+1):
# fn *= num
# fmn = 1
# for num in range(1, m-n+1):
# fmn *= num
# print(fm // fn // fmn)
"""
重构代码
"""
# def factorial(num):
# result = 1
# for... |
Java | UTF-8 | 702 | 3.34375 | 3 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package guvi10;
import java.util.Scanner;
/**
*
* @author Student
*/
public class Guvi10 {
public static int dot(int upper,int lower){
int sum=0;
int temp=0;
for(int i=1;i<upper;i++)
temp+=i... |
Python | UTF-8 | 579 | 2.96875 | 3 | [] | no_license | #!/usr/bin/env python
n = input()
for i in range(1, n+1):
num_engines = input()
engines = set()
for j in range(num_engines):
engines.add(raw_input())
num_queries = input()
queries = []
for j in range(num_queries):
query = raw_input()
queries.insert(0, query)
print "Case #%d:" % (i),
conj_temp... |
Python | UTF-8 | 514 | 3.265625 | 3 | [] | no_license | import sys
inp = sys.stdin
t = int(inp.readline())
list = []
for x in range(t):
l = inp.readline().strip()
list.append(l)
song = ['Happy', 'birthday', 'to', 'you', 'Happy', 'birthday', 'to', 'you', 'Happy', 'birthday', 'to', 'Rujia', 'Happy', 'birthday', 'to', 'you' ]
temp = 0
flag = True
while(flag):
... |
PHP | UTF-8 | 264 | 3.65625 | 4 | [] | no_license | <?php
$a = 1;
if(is_numeric($a)){
echo "It's a number";
}
else{
echo "It's not a number";
}
$a = 3.3;
if(is_int($a)){
echo "It's a int";
}
else{
echo "It's not a int";
}
$a = 3/4;
if(is_float($a)){
echo "It's a float";
}
else{
echo "It's not a float";
}
?> |
TypeScript | UTF-8 | 3,034 | 2.515625 | 3 | [
"MIT",
"LGPL-2.0-or-later"
] | permissive | import chai from 'chai';
import sinonChai from 'sinon-chai';
import sinon from 'sinon';
import sleep from 'await-sleep';
import { BulkUsbSingleton } from './../src/bulkusbdevice';
const expect = chai.expect;
chai.should();
chai.use(sinonChai);
const dummyCpp = {
openDevice: sinon.stub(),
listDevice: sinon.stub()... |
Python | UTF-8 | 1,324 | 2.71875 | 3 | [
"MIT"
] | permissive | import json
import logging
import os
from Xlib import XK
class XLeaprConfig(object):
def __init__(self, display, path=os.path.join(os.path.dirname(os.path.realpath(__file__)), "default.json")):
self.config = {}
# Load and parse JSON config
with open(path) as data_file:
raw_c... |
Java | UTF-8 | 4,851 | 2.4375 | 2 | [] | no_license | package com.ANP.bean;
import org.springframework.lang.Nullable;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
public class EmployeeBean extends CommonAttri... |
Java | UTF-8 | 1,253 | 3.046875 | 3 | [
"MIT"
] | permissive | package com.example.oauth.service.util;
import org.springframework.stereotype.Service;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Service
public class PasswordValidator {
private Pattern pattern = null;
/**
* No one can make a direct instance
*/
public PasswordValidator() {
pattern =... |
C++ | UTF-8 | 852 | 3.9375 | 4 | [] | no_license | // exercise 9
// TODO exercise 9: write out an error if the result cannot be
// represented as an int
#include "../../std_lib_facilities.h"
int main()
{
int i, n, sum = 0;
vector<int> numbers;
cout << "Please enter the number of values you want to sum: ";
cin >> n;
while (n <= 1) {
... |
Java | UTF-8 | 2,524 | 2.234375 | 2 | [] | no_license | package atmosphere.android.activity.helper;
import interprism.atmosphere.android.R;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import atmosphere.android.constant.AtmosConstant;
import atmosphere.android.dto.SendMessageRequest;
import atmosphere.... |
Java | UTF-8 | 2,607 | 2.015625 | 2 | [] | no_license | package com.haidaiban.foxlee.model.comment;
/**
* Created by qixiaohui on 3/29/15.
*/
import javax.annotation.Generated;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
@Generated("org.jsonschema2pojo")
public class Result {
@Expose
private User user;
@Expo... |
Ruby | UTF-8 | 1,431 | 3.9375 | 4 | [] | no_license | def merge(left, right)
result = []
i, j = 0, 0
n, m = left.size, right.size
while i < n && j < m
if left[i] < right[j]
result.push(left[i])
i += 1
else
result.push(right[j])
j += 1
end
end
while i < n
result.push(left[i])
i += 1
end
while j < m
result.pu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.