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 | 915 | 2.609375 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
#define m 200
char mat[m][m];
int arr[m][m];
int n;
void bfs(int i,int j){
if(i>n || j>n ||i<0 || j<0)
return;
if(arr[i][j]==0){
arr[i][j]=1;
if(mat[i][j]=='1'){
bfs(i+1,j+1);
bfs(i-1,j-1);
bfs(i,j-1);
... |
Python | UTF-8 | 954 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
class Solution:
def getLeastNumbers(self, arr, k):
def partition(arr, start, end):
key = arr[start]
while start < end:
while start < end and arr[end] >= key:
end -= 1
arr[start], arr[... |
Java | UTF-8 | 1,398 | 2.03125 | 2 | [] | no_license | package br.com.sensedia.embedded;
import br.com.sensedia.model.KafkaMessage;
import br.com.sensedia.service.ProducerKafka;
import br.com.sensedia.service.QueueMessages;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringB... |
C++ | UTF-8 | 932 | 3.15625 | 3 | [] | no_license | //https://www.interviewbit.com/problems/longest-palindromic-substring/
string Solution::longestPalindrome(string A) {
int n = A.length();
vector<int> temp(n, 0);
vector<vector<int> >dp(n,temp);
int maxLength = 1;
int start = 0;
for(int i=0;i<n;i++){
dp[i][i] = 1;
}
for(int i=0;i<... |
JavaScript | UTF-8 | 750 | 2.765625 | 3 | [] | no_license | /*:
* @plugindesc This plugin allows you to simply modify the in-game animations framerate.
* @author FalconPilot
*
* @param FPS
* @desc The amount of FPS (Frames Per Second) for in-game animations. Must be set between 10 and 60 (inclusive)
* @default 15
*/
(function() {
// Return a number comprised between ... |
Java | UTF-8 | 812 | 1.914063 | 2 | [] | no_license | package com.pjy.nchu2.mapper;
import com.pjy.nchu2.entity.PostEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PostMapper {
void insert(PostEntity post);
void delete(PostEntity post);
void update(PostEntity post);
// void update(int postId, String t... |
Go | UTF-8 | 2,958 | 2.671875 | 3 | [] | no_license | package ircconnection
import "code.google.com/p/goprotobuf/proto"
import "errors"
import ircproto "github.com/msparks/iq/public/irc"
import "github.com/sorcix/irc"
import "strconv"
func protoAsMessage(p *ircproto.Message) (message *irc.Message, err error) {
message = &irc.Message{}
switch p.GetType() {
case ircpr... |
JavaScript | UTF-8 | 526 | 3 | 3 | [] | no_license | const { expect } = require('chai');
const twoSum = require('./twoSum');
describe('twoSum', () => {
it('Returns empty array if items do not sum to desired', () => {
expect(twoSum(['blem'], 4)).deep.equal([]); // need to use deep equal for arrays an objects
expect(twoSum([1, 2, 1, 1, 7], 5)).deep.equal([]); //... |
Python | UTF-8 | 401 | 3.671875 | 4 | [] | no_license | list1 = str(input("list1: "))
list1s = list1.split()
list2 = str(input("list2: "))
list2s= list2.split()
def overlapping(list1s,list2s):
for i in range(len(list1s)):
for j in range(len(list2s)):
if list1s[i] == list2s[j]:
b ="true"
else:
b = "false"
... |
PHP | UTF-8 | 1,032 | 2.640625 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
declare(strict_types=1);
namespace Yiisoft\Serializer\Tests;
use PHPUnit\Framework\TestCase;
use Yiisoft\Serializer\SerializerInterface;
abstract class SerializerTest extends TestCase
{
/**
* @dataProvider serializeProvider
*
* @param mixed $value
* @param string $expected
*/
... |
C++ | UTF-8 | 417 | 2.515625 | 3 | [] | no_license | #pragma once
#include "SDL.h"
#include "Assets.h"
//child class of Assets
class Platform : public Assets
{
private:
int m_fallSpeed;
float m_timer = 1.5f;
bool isPlatformFalling;
public:
Platform(SDL_Renderer* renderTarget, string filePath, int x, int y, int framesX, int framesY);
~Platform();
... |
Java | UTF-8 | 965 | 4.09375 | 4 | [] | no_license | package Lesson2;
public class Task5 {
/* Задать одномерный массив и найти в нем минимальный
и максимальный элементы;
*/
public static void main(String[] args){
int length = (int)(Math.random() * 20);
int[] arr = new int [length];
for (int i = 0; i < arr.length; i++){
... |
Python | UTF-8 | 4,414 | 3 | 3 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Part 1
link: https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/
Using the itunes open API (link above), you need to implement
a script that will return all songs (and information about them)
that are included in this album by... |
C++ | UTF-8 | 480 | 2.96875 | 3 | [
"Unlicense"
] | permissive | //#include <iostream>
//using namespace std;
//
//
//
//unsigned int Binomial(unsigned int N, unsigned int K)
//{
// if (K > N) return 0;
//
// if (N == 1) return 1;
// else if (K == 1) return N;
// else return Binomial(N - 1, K - 1) + Binomial(N - 1, K);
//}
//
//
//
//int main()
//{
// unsigned int N, K;
// ci... |
Java | UTF-8 | 1,570 | 3.6875 | 4 | [] | no_license | /***
* Child class to Account
*/
public class Savings extends Account {
private static int nextSavingsAccountNum;
/**
* creates a Checking object and populates attributes accountNumber and balance
* @param accountNumber of type int
* @param balance of type double
*/
public Savings(int ... |
Markdown | UTF-8 | 2,583 | 3.015625 | 3 | [] | no_license | # TMCB150_config
ipyparallel configuration files to perform distributed and parallel computing in the ACME computer lab.
### Configuration Steps (for future students)
1. Create a new git repository. Name it whatever you want.
- Create a new directory `mkdir ~/myacmeshare/ipyparallel_config`
- Clone your new git reposi... |
JavaScript | UTF-8 | 2,016 | 2.53125 | 3 | [] | no_license | /** Map tooltip object
@namespace
**/
var map_tooltip_init = {
/** creates and returns an empty tooltip div template **/
getMapTooltip: function (all_map_options) {
var tooltip_div = document.createElement("div");
tooltip_div.className = "map_tooltip";
tooltip_div.setAttribute("style... |
Java | UTF-8 | 163 | 1.507813 | 2 | [] | no_license | package cn.ict.onedbcore.entity.json.objectclass;
import lombok.Data;
@Data
public class ConnectorElement {
private Long id;
private String name;
}
|
C# | UTF-8 | 1,100 | 2.96875 | 3 | [] | no_license | using FluentValidator;
using FluentValidator.Validation;
using System;
using System.Collections.Generic;
using System.Text;
namespace Largon_Snack.Domain.StoreContext.ValueObjects
{
public class Name : Notifiable
{
public Name(string firstName, string lastName)
{
FirtName = firstNa... |
JavaScript | UTF-8 | 21,298 | 3.015625 | 3 | [] | no_license | (function () {
if (window.CaibeiJSBridge) {
return;
}
// defind the JSON tool
var JSON;
if (!JSON) {
JSON = {};
}
(function() {
'use strict';
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;... |
Markdown | UTF-8 | 1,287 | 4 | 4 | [
"Apache-2.0"
] | permissive | #链表-删除
## 在O(1)时间内删除链表结点
题目:给定链表的头指针和一个结点指针,在O(1)时间删除该结点。链表结点的定义如下:
```
struct ListNode{
int m_nKey;
ListNode* m_pNext;
};
//函数的声明如下:
void deleteNode(ListNode* pListHead, ListNode* pToBeDeleted);
```
思路:
保存下一个节点的值tmp,删除下一个节点,当前节点=tmp
## 删除链表中的p节点
只给定单链表中某个结点p(并非最后一个结点,即p->next!=NULL)指针,... |
C# | UTF-8 | 10,574 | 2.609375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace Simulation
{
public class Tile : IPathNode<Tile>
{
public const float TileSize = 0.75f; // Should change to match the width of our model
private const float FlatTolerance = 0.1f; // I have no idea what ou... |
JavaScript | UTF-8 | 4,405 | 2.96875 | 3 | [] | no_license | const { assert } = require("chai");
const pacienteValidador = require("../../validadores/pacientes");
describe("Paciente Validador", () => {
describe("Al guardar", () => {
it("Debe rechazar solo un nombre y un apellidos", () => {
try {
const obj = {
n... |
JavaScript | UTF-8 | 833 | 3.90625 | 4 | [] | no_license | //获取当前日期时间字符串 格式 yyyy-MM-dd HH:mm:ss.SSS
function getDateStr() {
//1. 创建日期对象
let d = new Date();//获取当前日期对象
//2. 获取当前时间 转为字符串 格式 yyyy-MM-dd HH:mm:ss.SSS
let fullYear = d.getFullYear();//年
let month = new String(d.getMonth()+1).padStart(2,"0");//月
let date = new String(d.getDate()).padStart(2,"0")... |
C++ | UTF-8 | 961 | 3.25 | 3 | [] | no_license | #include <iostream>
/* what the above really does: iostream is a file on your
* computer containing other C++ code. The "#include" essentially
* copies and pastes all of that in place of the above line.
* Why do we need it? Well, it is too much of a pain to write
* EVERYTHING from scratch. We are going to use so... |
PHP | UTF-8 | 6,996 | 2.703125 | 3 | [] | no_license | <?php
//Herencia
class usuario extends database{
public function find_user($id){
try{
$result = parent::connect()->prepare("SELECT * FROM usuarios WHERE id_user = ?");
$result->bindParam(1, $id, PDO::PARAM_INT);
$result->execute();
return $result->fetch();
}c... |
JavaScript | UTF-8 | 819 | 2.578125 | 3 | [] | no_license | const axios = require('axios');
const getLugarLatYLong = async (dir) => {
if(!dir) throw new Error('La direccion es invalida');
const encodedURL = encodeURI(dir);
const instance = axios.create({
baseURL: `https://devru-latitude-longitude-find-v1.p.rapidapi.com/latlon.php?location=${encodedURL}`,... |
C++ | UTF-8 | 1,621 | 2.953125 | 3 | [] | no_license | #include <cstdio>
#include <algorithm>
using namespace std;
struct testee {
long long num;
int score;
int location;
int local_rank;
int final_rank;
};
bool cmp(testee t1, testee t2) {
if (t1.score != t2.score) {
return t1.score > t2.score;
} else {
return t1.num < t2.num;
... |
Swift | UTF-8 | 1,228 | 2.796875 | 3 | [] | no_license | //
// ViewController.swift
// stream-template
//
// Created by Matheus Gois on 10/08/19.
// Copyright © 2019 Matheus Gois. All rights reserved.
// TUTO:https://medium.com/free-code-camp/how-to-set-up-video-streaming-in-your-app-with-avplayer-7dc21bb82f3
import UIKit
import AVKit
import AVFoundation
class ViewCont... |
Markdown | UTF-8 | 6,311 | 2.65625 | 3 | [] | no_license | ## 第三百九十九章 恐怖设想
『章节错误,点此举报』
任何一个坐在十九局机密会议室里的与会成员都不曾想象自己会看到一个地球文明的灭亡。
视频的前半段太过震撼,后半段又太过惊悚,尤其是最后一秒钟艾德里安将军身后传来的撞门声,简直令人毛骨悚然,以至于与会者们全都瞠目结舌,无人出声。
等到欧羊鼓掌打破沉默时,默哀般的寂静已经持续了三分钟。
清亮的掌声响起,伴随着欧羊的高声喝彩。
“地球上最后一个人独自坐在房间里,这时,忽然响起了敲门声……经典,太经典了!”
保密局魏主任和新十九局钟主任对欧羊怒目而视,而杨小千则是见怪不怪,这是欧羊的老毛病又犯了。
杨小千对欧羊的了解并不深,这位三流科幻作家因丰富的想象力和超出常人的适应能力... |
Swift | UTF-8 | 1,121 | 3.09375 | 3 | [
"MIT"
] | permissive | //
// ViewController.swift
// 017-懒加载与OC的区别
//
// Created by lichuanjun on 2017/6/7.
// Copyright © 2017年 lichuanjun. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
// 注意:和 OC 不同
// 一旦 label 被设置为nil,懒加载也不会再次执行
// 懒加载的代码只会在第一次调用的时候,执行闭包,然后将闭包的结果保存在 label 的属性中
private... |
Ruby | UTF-8 | 205 | 2.796875 | 3 | [
"BSD-2-Clause-Views"
] | permissive | def Commands.say(socket, nick, channel, args)
line = ""
for word in args
line = "#{line}#{word} "
end
tsputs "SEND: PRIVMSG #{channel} :#{line}"
socket.puts "PRIVMSG #{channel} :#{line}"
end
|
Java | UTF-8 | 294 | 2.09375 | 2 | [] | no_license | package okk.pskProject_JavaEE.persistence;
import okk.pskProject_JavaEE.entities.RecordLabel;
import java.util.List;
public interface IRecordLabelDAO {
public List<RecordLabel> loadAll();
public void persist(RecordLabel recordLabel);
public RecordLabel findOne(Integer id);
}
|
Java | UTF-8 | 1,930 | 2.140625 | 2 | [] | no_license | package best_food_catering.order;
import best_food_catering.kitchen.MenuRepository;
import best_food_catering.user.company.CompanyType;
import org.junit.jupiter.api.Test;
import org.salespointframework.order.OrderManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.te... |
Java | UTF-8 | 5,684 | 1.742188 | 2 | [] | no_license | /**
* <copyright>
* </copyright>
*
* $Id$
*/
package com.googlecode.erca.rcf;
import org.eclipse.emf.common.util.EList;
import com.googlecode.erca.Entity;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Relational Context</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The follo... |
C++ | ISO-8859-1 | 5,935 | 3.171875 | 3 | [] | no_license | #ifndef cola_dinamicaH
#define cola_dinamicaH
#include <iostream>
#include "excepciones.h"
using namespace std;
template <class TElem>
class TColaDinamica;
template <class TElem>
class TNodoCola {
private:
TElem _elem;
TNodoCola<TElem>* _sig;
TNodoCola( const TElem&, TNodoCola<TElem>* = 0 );
public:
... |
Java | UTF-8 | 2,580 | 2.0625 | 2 | [] | no_license | package com.yunos.tvtaobao.biz.request.bo;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.Serializable;
/**
* 外卖订单的订单信息.
*/
public class TakeOutOrderInfoDetails4ContactInfo implements Serializable {
private static final long serialVersionUID = -610484326142980001L;
private Stri... |
Python | UTF-8 | 16,783 | 2.515625 | 3 | [] | no_license | import tensorflow as tf
from tensorflow.python.ops import array_ops
import numpy as np
from rl_benchmark.misc_utils.tf_v1.helper import conv_filter_shape, conv_bias_shape, conv_info_from_weight
from rl_benchmark.misc_utils.tf_v1.helper import deconv_filter_shape, deconv_bias_shape, deconv_info_from_weight
from rl_bench... |
Python | UTF-8 | 417 | 3.453125 | 3 | [] | no_license | def quicksort(A):
if len(A) < 2:
return A
else:
less = []
equal = []
greater = []
pivot = A[0]
for num in A:
if num < pivot:
less.append(num)
elif num == pivot:
equal.append(num)
elif num > pivot:... |
Java | UTF-8 | 356 | 1.773438 | 2 | [] | no_license | package ua.social.network.messageservice.service;
import reactor.core.publisher.Mono;
import ua.social.network.messageservice.domain.CreateChatRequest;
import ua.social.network.messageservice.domain.CreateChatResponse;
/**
* @author Mykola Yashchenko
*/
public interface ChatService {
Mono<CreateChatResponse> cr... |
TypeScript | UTF-8 | 720 | 3.15625 | 3 | [] | no_license | import { isNil } from "ramda";
import { isString, isNumber, isBoolean } from "./helpers";
export function formatSql(strs: TemplateStringsArray, ...exprs: any[]) {
let out: string[] = [];
const n1 = strs.length;
const n2 = exprs.length;
for (let i = 0; i < n1; i++) {
out.push(strs[i]);
if (i < n2) {
... |
PHP | UTF-8 | 3,495 | 2.765625 | 3 | [] | no_license | <?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "highscores";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($_GET["niveau"]==1)
{
$query = "INSERT INTO gemakelijk (username,punten)
VALUES (\"".$_GET["username"]."\",".$_GET["punten"].")";
$... |
C# | UTF-8 | 1,336 | 3.734375 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Text;
namespace BaiTap4
{
public class Shapes
{
private int x;
private int y;
public int X { get => x; set => x = value; }
public int Y { get => y; set => y = value; }
public Shapes()
{
... |
C++ | UTF-8 | 1,241 | 2.71875 | 3 | [] | no_license | #include <bits/stdc++.h>
using namespace std;
void computeLPS(string pat, int lps[]){
int len = 0;
int i = 1;
lps[0] = 0;
while(i < pat.size()){
if(pat[len] == pat[i]){
lps[i] = len + 1;
len++;
i++;
}
else{ // pat[len] != pat[i]
... |
Python | UTF-8 | 610 | 3.25 | 3 | [] | no_license | def longestPeak(array):
largestPeak = 0
idx = 1
while idx < len(array) - 1:
isPeak = array[idx - 1] < array[idx] > array[idx + 1]
if not isPeak:
idx += 1
continue
leftIdx = idx - 2
while leftIdx >= 0 and array[leftIdx] < array[leftIdx + 1]:
... |
Java | UTF-8 | 246 | 1.515625 | 2 | [] | no_license | package steps;
import io.cucumber.java.Before;
import utilities.RestAssuredExtension;
public class TestInitializer {
@Before
public void setup(){
RestAssuredExtension restAssuredExtension = new RestAssuredExtension();
}
}
|
Java | UTF-8 | 2,834 | 2.984375 | 3 | [] | no_license | package com.barf.nochmalgen;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.barf.nochmalgen.model.Color;
import com.barf.n... |
Python | UTF-8 | 253 | 3 | 3 | [] | no_license | import math
i=int(1)
no=int(2)
while i!=10001:
no=no+1
factor=2
while factor<=int(math.sqrt(no)):
if no%factor==0:
break
factor=factor+1
if factor==(int(math.sqrt(no))+1):
i=i+1
print(no)
|
Markdown | UTF-8 | 1,939 | 3.359375 | 3 | [] | no_license | ## Data Structure
# Week 06
---------------------------------------------------
#### Assignment Date: 2nd October 2019<br/>
#### Assignment Due: 14th October 2019 <br/>
#### Assignment Details can be found [here](https://github.com/visualizedata/data-structures/tree/master/weekly_assignment_06) <br/>
------------------... |
PHP | UTF-8 | 1,879 | 2.65625 | 3 | [] | no_license | <?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
class UsersTable extends Table
{
public function initialize(array $config)
{
parent::initialize($config);
$this->table('users'); // our table
$this->displ... |
JavaScript | UTF-8 | 1,799 | 2.640625 | 3 | [] | no_license | /**
* Created by eleven on 15/05/2016.
*/
var Utils = require('./Utils');
var CConfig = require('../candc/Config');
var Modules = require('../candc/Modules');
var THREE = Modules.getThree();
class CreateObj {
static box(width, height, depth, material) {
"use strict";
if (Utils.isNotDefined(width)) {
width ... |
Java | UTF-8 | 6,876 | 1.820313 | 2 | [] | no_license | package restaurantfinder.example.tran.yelpfindrestaurants.controller;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.sup... |
C | UTF-8 | 5,641 | 3.03125 | 3 | [] | no_license | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "cmdline.h"
static struct keyword_entry keyword_table[] = {
{"-?", 2, HELP},
{"-help", 2, HELP},
{"-measure", 3, MEASURE},
{"GKOM", 3, GKOM},
{"LKOM", 3, LKOM},
{"LKHM", 3, LKHM},
{"GKHM", 3, GKHM},
{"LIHE", ... |
Java | UTF-8 | 416 | 1.851563 | 2 | [] | no_license | package com.fanwe.live.model;
import com.fanwe.hybrid.model.BaseActModel;
/**
* @author 作者 E-mail:
* @version 创建时间:2016-5-27 下午2:52:19 类说明
*/
@SuppressWarnings("serial")
public class App_set_adminActModel extends BaseActModel
{
private int has_admin;
public int getHas_admin()
{
return has_admin;
}
public ... |
Markdown | UTF-8 | 6,940 | 2.96875 | 3 | [] | no_license | ---
title: "Hyperlink: A Vision for Learning Futures"
date: '2020-11-23'
author: Brendan
toc: true
living: false
tags: [announcement]
description: "A rhizomatic learning network. A home for lifelong learning. An R&D lab for internet pedagogy…and more!"
topic: "https://forum.hyperlink.academy/t/hyperlink-a-vision-for-le... |
Java | UTF-8 | 195 | 1.976563 | 2 | [] | no_license | package com.joons.jwt.share;
public class JwtVO {
private String jws;
public JwtVO(String jws) {
this.jws = jws;
}
public String getJws() {
return jws;
}
}
|
C++ | UTF-8 | 526 | 2.828125 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
using namespace std;
const int MAX=1299710;
int prime[MAX]={0};
void calculate(){
for(int i=2;i<MAX;++i){
if(!prime[i]){
for(int j=2;j<MAX/i;j++){
prime[j*i]=1;
}
}
}
}
int main(){
int n,a,b;
calculate();
while(cin>>n,n){
if(!prime[n]){
prin... |
Markdown | UTF-8 | 1,636 | 2.953125 | 3 | [] | no_license | # 第一章 学习方法
## 1.1 监督学习
应用复杂问题时,大部分时候并不知道如何给定输入到输出的具体方法
解决策略是让计算机从样本数据中学习输入到输出的具体方法
使用样例来合成计算机程序的过程叫学习方法,其中样例是输入/输出对,称为监督学习
输入/输出对通常反映了把输入映射到输出的一种函数关系
批量学习:在学习的开始,把全部数据提供给学习器(模型)
在线学习:一次只让学习器接受一个样例,并在接受正确输出前给出自己(学习器)对输出的估计
## 1.2 学习和泛化性
泛化性:一个能把训练数据之外的新样本数据正确分类的能力称之为泛化能力(泛化性)
一致假设:一个假设能够对所有训练数据正确... |
C++ | UTF-8 | 330 | 2.84375 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
class obj
{
public:
int operator()()
{
static int i = 0;
return i++;
}
};
int main()
{
std::vector<int> v(10);
std::generate(v.begin(), v.end(), obj());
for (auto i:v) {
std::cout << i <<" ";
}
re... |
Rust | UTF-8 | 1,062 | 3 | 3 | [] | no_license | use aoc2019::intcode::{IntcodeCpu, parse_intcode_program, Int};
fn main() {
let input = include_str!("../inputs/day2.txt");
solve_part1(&input);
solve_part2(&input);
}
fn solve_part1(input: &str) {
let memory: Vec<Int> = parse_intcode_program(input);
let res = run_with_args(&memory, 12, 2);
p... |
Java | UTF-8 | 6,535 | 1.898438 | 2 | [] | no_license | package com.xz.vo.response;
import java.io.Serializable;
/**
* @author yuansc
* @date 2019/3/4 0004 下午 4:12
*/
public class SysUserRes implements Serializable {
private static final long serialVersionUID = -3732853023989330317L;
/**
* 编号
*/
private String id;
/**
* 归属公司
*/
... |
C++ | UTF-8 | 1,022 | 2.640625 | 3 | [] | no_license | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
struct node{
char name[5];
}week[8];
char a[62],b[62],c[62],d[62];
int main(){
scanf("%s %s %s %s",a,b,c,d);
strcpy(week[1].name,"MON");
strcpy(week[2].name,"TUE");
strcpy(week[3].name,"WEN");
strcpy(week[4].name,"THU");
s... |
Markdown | UTF-8 | 6,766 | 2.5625 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: "申万行业分类日间表格"
date: 2016-01-13 15:04:23
categories: jekyll update
tags: [R]
---
## 前言
申银万国证券股份有限公司(简称:申银万国),是国内最早的一家股份制证券公司,也是目前国内规模最大、经营业务最齐全、营业网点分布最广泛的综合类证券公司之一。为能够实时掌握申银万国各行业的股市数据,包括当天收盘价、成交量、涨跌幅等,以应对变化多端的市场,采取正确的举措,收获最大的利益,所以一个能够实时生成申万行业分类日间表格是十分需要的。接下来,我们便使用况客Api实现这个的表格。
## 目录
1、申万行业分类日间... |
Shell | UTF-8 | 381 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
set -o errexit
main() {
init_table_script
}
init_table_script() {
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE TABLE monitoring_table (
app_user VARCHAR(100) NOT NULL,
age_range VARCHAR(100) NOT NULL,
amount INTEGER NOT NULL
);
INSERT INTO... |
Java | UTF-8 | 563 | 2.515625 | 3 | [] | no_license | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package patternRecognition.supervised.distance;
import org.apache.commons.math3.distribution.NormalDistribution;
/**
*
* @author br... |
Java | UTF-8 | 6,541 | 2.734375 | 3 | [] | no_license | package tsp;
import java.io.IOException;
import java.util.*;
public class Main {
private static int MAX_CIDADES;
private static double[][] distancias;
private static List<Cidade> cidades;
private static List<Rota> ForcaBrutaPermRotas = new ArrayList<Rota>();
private static double ForcaBrutaMenorC... |
Swift | UTF-8 | 2,721 | 2.796875 | 3 | [] | no_license | //
// BizHoursCell.swift
// QSMobileTest
//
// Created by Rydus on 18/05/2019.
// Copyright © 2019 Rydus. All rights reserved.
//
import UIKit
class BizHoursCell: UITableViewCell {
@IBOutlet weak var v1: UIView!
@IBOutlet weak var v2: UIView!
@IBOutlet weak var v3: UIView!
@IBOutlet weak var v4: ... |
Java | UTF-8 | 3,036 | 2.015625 | 2 | [] | no_license | package cn.com.yeexun.businessTerms.entity;
import java.util.Date;
import java.util.List;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.alibaba.fastjson.JSON;
import cn.com.common.ssm.engine.bean.OperationTimeAware;
import cn.com.common.ssm.engine.bean.Unique;
@Table(name = "tb_cod... |
Markdown | UTF-8 | 1,789 | 2.90625 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Review of Groundbreakers
---
[My new piece](http://bostonreview.net/blog/andrew-mayersohn-hahrie-han-elizabeth-mckenna-groundbreakers-organizing)
for _Boston Review_ is about _Groundbreakers: How Obama's 2.2 Million Volunteers
Transformed Campaigning in America_ by Elizabeth McKenna and Hahrie ... |
JavaScript | UTF-8 | 5,161 | 2.640625 | 3 | [] | no_license | (function ($) {
String.prototype.format = function () {
var args = arguments;
return this.replace(/\{\{|\}\}|\{(\d+)\}/g, function (m, n) {
if (m == "{{") {
return "{";
}
if (m == "}}") {
return "}";
}
return args[n];
});
};
var sectionHTML = '<section ... |
Markdown | UTF-8 | 9,325 | 2.65625 | 3 | [] | no_license | # Pub Pol 590 Project: Propitious Selection
## Data Source:
This data comes from the National Longitudinal Study of Adolescent Health (Add Health Study). Data and documentation can be downloaded from ICPSR, study number 21600.
Download page: http://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/21600
For this proje... |
Markdown | UTF-8 | 9,113 | 3.3125 | 3 | [] | no_license | # Dockerfile
## 什么是 Dockerfile?
Dockerfile 是一个用来构建镜像的文本文件,文本内容包含了一条条构建镜像所需的指令和说明。
## 使用dockerfile的基本方法
下面以定制一个 nginx 镜像为例。
### 生成dockersfile文件
在一个空目录下,新建一个名为 Dockerfile 文件,并在文件内添加以下内容:
```Shell
FROM nginx
RUN echo '这是一个本地构建的nginx镜像' > /usr/share/nginx/html/index.html
```
说明:
- FROM :定制的镜像都是基于 FROM 的镜像,这里的 nginx ... |
Java | UTF-8 | 153 | 1.726563 | 2 | [] | no_license | package fr.formation.afpa.exceptions;
public class Positif {
public Positif(int n ) throws ErrConst{
if(n<=0) throw new ErrConst();
}
}
|
SQL | UTF-8 | 1,621 | 3.640625 | 4 | [] | no_license | create table Category (
ID int not null auto_increment,
Name varchar(50) not null,
primary key (ID)
);
create table User (
ID int not null auto_increment,
Name varchar(50) not null,
Is_Citizen boolean not null,
primary key (ID)
);
create table Idea (
ID int not null auto_increment,
Title varchar(200) not nul... |
PHP | UTF-8 | 2,877 | 2.921875 | 3 | [] | no_license | <?php
/*
* 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.
*/
namespace Feather\Init\Objects;
/**
* Description of Response
*
* @author fcarbah
*/
class AppResponse implements \Iterator... |
JavaScript | UTF-8 | 361 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | function buildQueryString(params) {
var queryString = '';
if (!params) return queryString;
Object.keys(params).forEach(function(key, index) {
if (index === 0) {
queryString += '?';
} else {
queryString += '&';
}
queryString += `${key}=${params[key]}`;
});
return queryString;
}
m... |
Java | UTF-8 | 4,113 | 2.4375 | 2 | [] | no_license | package Menus;
import java.awt.*;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.io.File;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import Audio.AudioPlayer;
import ClientNetworking.Client... |
Java | UTF-8 | 948 | 2.546875 | 3 | [] | no_license | package com.lts.constr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class Student {
String name;
Integer sid;
String dept;
Course course;
@Autowired
pu... |
Python | UTF-8 | 537 | 3.140625 | 3 | [
"MIT"
] | permissive | import os
f = open(os.path.join(os.path.dirname(__file__), '../input/2/part1.txt'), 'r')
def main():
line = f.readline();
inputList = []
while line:
inputList.append(line)
line = f.readline();
def formatItems(row):
return sorted(list(map(lambda item: int(item), row.split('\t'... |
C++ | UTF-8 | 1,318 | 2.65625 | 3 | [] | no_license | #pragma once
#include "glm/glm.hpp"
#include"glm/gtc/constants.hpp"
#include "../../Geometry/Transform.h"
#define PI 3.14159265358979323846264338327950288
class Camera
{
Transform transform;
glm::vec3 target;
//glm::vec3 up;
glm::mat4 view;
glm::mat4 proj;
glm::mat4 view_proj;
float fov_vertical_radians = (f... |
Shell | UTF-8 | 820 | 3.15625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env bash
currentdir="${PWD##*/}"
if [ $currentdir != 'utilot' ]; then
echo '[start:err] Please cd to the project root first'
exit 1
fi
if [ "$1" = '--compile-speedups' ]; then
if [ ! -d speedups ]; then
echo '[start:err] Folder speedups does not exist'
exit 1
fi
... |
C++ | UTF-8 | 6,146 | 2.5625 | 3 | [] | no_license | //------------------------------------------------------------------------------------
// Libraries Needed For This Project
//------------------------------------------------------------------------------------
// #include <EEPROM.h> // To Be Able To Store & Read Data Between Power Off
#include <ESP8266WiFi.... |
Python | UTF-8 | 10,962 | 2.546875 | 3 | [] | no_license | import os
import json
import unittest
from flask_sqlalchemy import SQLAlchemy
from app import create_app
from models import setup_db
ADMIN_TOKEN = os.environ["ADMIN_TOKEN"]
CHEF_TOKEN = os.environ["CHEF_TOKEN"]
VIEWER_TOKEN = os.environ["VIEWER_TOKEN"]
class RecipeTestCase(unittest.TestCase):
"""This class rep... |
C# | UTF-8 | 548 | 2.640625 | 3 | [] | no_license | public class FrequentlyAccessedQueries : Controller
{
private CATALOGEntities db = FrequentlyAccessedQueries.entities();
public static CATALOGEntities entities()
{
QueryDetails qdetails = new QueryDetails();
bool uk = qdetails.IsCountryUK;
if (uk)
... |
Python | UTF-8 | 651 | 2.640625 | 3 | [] | no_license | import sys
import json
import operator
def main():
outputfile=open(sys.argv[1])
senti={}
topten={}
for ln in outputfile:
ans=0
senti=json.loads(ln)
if "text" in ln and senti.get("entities").get("hashtags"):
hashtag=senti.get("entities").get("hashtags")[0].get("text"... |
Python | UTF-8 | 4,770 | 2.9375 | 3 | [] | no_license | import tkinter as tk
from tkinter import ttk
import sys
import datetime
import numpy as np
import pandas as pd
import pickle
from get_data import League, LeagueTable, PlayerTable
from widgets import *
SMALL_FONT = ('Verdana', 8)
class Application(tk.Tk):
"""Defines the parent frame of the applicati... |
C | UTF-8 | 623 | 2.53125 | 3 | [] | no_license | #include "demineur.h"
void flushTab(CI **str)
{
int i = 0, j = 0;
while (i < 16)
{
while (j < 16)
{
str[i][j].Bombe = 0;
j++;
}
i++;
j = 0;
}
}
void initialisation(CI **str, int cases)
{
bombe(str, 16);
int i = 0, j = 0;
//printf("%d,cases i %d j %d \n", cases, i , j);
while (i < 16)
{
... |
Python | UTF-8 | 1,205 | 2.65625 | 3 | [] | no_license | import util_marshal
import random
import re
import string
# you can check available modules in conf.json
# fill the following function
def exploit(_opponent):
checkpoint, i, n, m = 0, 0, 10, 1000
while True:
alphanum = list(string.digits + string.ascii_lowercase + string.ascii_uppercase)
flag_... |
JavaScript | UTF-8 | 2,971 | 2.625 | 3 | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | import {DefaultLoadingManager, FileLoader, ObjectLoader} from "three";
import {TerrainBufferGeometry} from "../geometries/TerrainBufferGeometry.js";
import {RoundedBoxBufferGeometry} from "../geometries/RoundedBoxBufferGeometry.js";
import {CapsuleBufferGeometry} from "../geometries/CapsuleBufferGeometry.js";
import {P... |
C++ | UTF-8 | 3,407 | 3.125 | 3 | [] | no_license | // Compile: make
// Execute: ./perceptron.out setosa_v_versicolor.csv
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
using namespace std;
int Sign(int x)
{
int y;
if(x >= 0)
{
y = 1;
}
if(x < 0)
{
y = -1;
}
return y;
}
int main(int argc, ch... |
SQL | ISO-8859-1 | 1,796 | 3.90625 | 4 | [] | no_license | /*
Os operadores aritmticos servem para executar operaes matemticas em duas expresses de uma ou mais tipos de dados.
Importante ressaltar que apenas com campos do tipo de dados numricos possvel utiliz-los, so eles:
+: Adio
-: subtrao
*: multiplicao
/: diviso
%: mdulo (realiza o resto de uma diviso)
... |
C# | UTF-8 | 7,661 | 3.21875 | 3 | [] | no_license | using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using GenericList;
using System.Collections.Generic;
namespace UnitTestList
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
}
[TestMethod]
public void addNumbe... |
Markdown | UTF-8 | 68,862 | 3.21875 | 3 | [] | no_license | ---
layout: post
title: "Typed Shell:给Unix Shell加上类型系统(1)"
date: 2013-05-26 15:00:00
author:
categories: program
---
## Typed Shell:给Unix Shell加上类型系统(1)
### by
### at 2013-05-26 15:00:00
### original <http://www.soimort.org/posts/158>
<h2>写在前面</h2>
<blockquote>
<blockquote>
<blockquote>
<p><em>Those who don'... |
C | UTF-8 | 2,653 | 4.4375 | 4 | [] | no_license | //21 - Triângulo ou trapézio?
#include <stdio.h>
main(){
float a, b, c, perimetro, area;
scanf("%f %f %f", &a, &b, &c);
if (((b-c) < a && a < (b + c)) && ((a-c) < c < (a+c)) && ((a-b) < c < (a+b)))
{
perimetro = a + b + c;
printf("Perimetro = %.1f\n", truncf(perimetro*100)/100);
}
else{
area = ((a + b... |
C | UTF-8 | 956 | 4.09375 | 4 | [] | no_license | #include <stdio.h>
#include <math.h>
/* RelationOpsQuiz
* Author: Stephen Barton Jr
* Date: 05 FEB 2019
* Project: RelationOpsQuiz
*/
int main(void)
{
int x = 2;
int y = 6;
printf("1. %d is less than %d: %d", y, x, y<x);
printf("\n");
printf("2. %d is less than or equal to %d: %d", y, x, y<=x);
printf("\n");... |
Shell | UTF-8 | 302 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env bash
read -p "host: " srv
openssl s_client -showcerts -connect $srv:443 < /dev/null 2>/dev/null \
| openssl x509 -fingerprint -sha1 | sed -r '/^SHA1/!d' | sed -r 's/^.*=//m' \
| tr ':' ',' | sed -r 's/[^,]{2}/0x\0/g' \
| sed -r 's/^/const uint8_t fingerprint[]={/' \
| sed -r 's/$/};/'
|
Python | UTF-8 | 1,872 | 2.546875 | 3 | [] | no_license | import csv
import sys, getopt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.pyplot as plt
from pylab import *
### Take command line parameters
def main(argv):
try:
opts, args = getopt.getopt(argv,"hi:t:",["ifile=","title="])
except getopt.GetoptError:
print('Stopping_Power_x.py -i <... |
Java | UTF-8 | 505 | 2.203125 | 2 | [] | no_license | package com.wwd.main.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
//Retention注解决定MyAnnotation注解的生命周期
@Target( { ElementType.METHOD, ElementType.T... |
Markdown | UTF-8 | 1,052 | 2.734375 | 3 | [] | no_license | ---
layout: single-article
title: 'Rotary Encoders in oF'
categories: [hardware, code]
draft: true
---
{% include imageEmbed.html align="left" path="rotaryEncodersInOf/photo.jpg" %}
This week has been an insane crash course in rotary encoders, Arduino and oF coding. I thought I had a handle on most of the simple type... |
Python | UTF-8 | 2,738 | 3.1875 | 3 | [] | no_license | # Samuel Sunarjo
# Problem 1
import numpy as np
A = np.array([[1,3],[5,7],[9,11]])
B = np.array([[1,-1],[-1,1],[-1,0]])
A-B
A*B
np.dot(np.transpose(A),B)
np.dot(A,np.transpose(B))
np.dot(A,B)
# Problem 2
import matplotlib.pyplot as plt
%matplotlib inline
np.random.seed(0)
space = np.linspace(0,10,num=50)
sine = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.