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 |
|---|---|---|---|---|---|---|---|
Python | UTF-8 | 591 | 2.640625 | 3 | [
"MIT"
] | permissive | """Support for discovering Wordpress robots."""
from lib.request import *
class wprobots(Request):
def __init__(self,url,data,kwargs):
self.url = url
self.data = data
self.kwargs = kwargs
Request.__init__(self,kwargs)
def run(self):
if self.kwargs['verbose'] is True:
info('Checking robots paths...')
... |
PHP | UTF-8 | 3,627 | 2.84375 | 3 | [
"MIT"
] | permissive | <?php
function encrypt($str) {
return base64_encode($str);
}
function decrypt($str) {
return base64_decode($str);
}
function scan($dir) {
return array_values(array_diff(scandir($dir), array('..', '.')));
}
function isLocalhost() {
$whitelist = array(
'127.0.0.1',
'::1'
);
i... |
TypeScript | UTF-8 | 910 | 2.765625 | 3 | [
"MIT"
] | permissive | import * as Objects from '../objects'
import { APIBase } from '../APIBase'
import { IChastiKeyParam } from '../ChastiKey'
interface ILockeeDataGetParams extends IChastiKeyParam {
username?: string
discordid?: string
showdeleted?: number | boolean
}
/**
* **Query the API for the specified user**
* @export
* @... |
C++ | UTF-8 | 5,960 | 2.921875 | 3 | [
"MIT"
] | permissive | /**
* @file SortPackageCtrl.h
* @author Philip Zellweger (philip.zellweger@hsr.ch)
* @brief The sort package controll class controlls the FSM to sort the current package in the available box
* To sort the package in the box it calls the navigation controll and chassis controll of the sortic
* and co... |
C++ | UTF-8 | 787 | 2.890625 | 3 | [] | no_license | #define POT A3
#define MI_LED 11
#define MI_SERVO 9
int lectura=0;
int escritura=0;
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(9600);
// initialize the digital pin as an output.
pinMode(MI_LED, OUTPUT);
pinMode(POT, INPUT);
}
// the loop routine runs over and over ag... |
Markdown | UTF-8 | 4,023 | 3.140625 | 3 | [] | no_license | # 18.07.04
#### 큰 그림
```
- JQuery 이용
- 말 장난치는 프로그램 만들기 (hangul js github)
```
#### 수업 흐름
~~~html
- rails는 jquery가 설정되어있음. ( 버전 : Rails 5.0.7 )
- 어떤 것을 쓸 것이냐? $ : $ 표시에 jQuery가 모두 들어있다고 보면 됨!
- jQuery 연습
* 3가지 형태
1 $('css파일').이벤트명(on은 안붙임!)(function() {} 이벤트 핸들러 );
$('.btn').mouseover(func... |
PHP | UTF-8 | 4,467 | 2.515625 | 3 | [] | no_license | <?php
namespace Lemo\Bootstrap\Form\View\Helper;
use Laminas\Form\Element\Checkbox;
use Laminas\Form\Element\Hidden;
use Laminas\Form\Element\MultiCheckbox;
use Laminas\Form\Element\Radio;
use Laminas\Form\ElementInterface;
class FormGroupElement extends AbstractHelper
{
protected ?FormControlLabel $helperContro... |
Java | UTF-8 | 197 | 1.992188 | 2 | [] | no_license | package com.mycompany.l8q4;
public class TestFraction {
public static void main(String[] args) {
Fraction a = new Fraction(7,49);
System.out.println(a.reduced());
}
}
|
JavaScript | UTF-8 | 1,319 | 2.796875 | 3 | [] | no_license | const jwt = require("jsonwebtoken");
//acces check throw error if the user is not Authorized
//if user is authorized then req.userId is exist
exports.accesCheck = (req, res, next) => {
let check = req.get("Authorization");
if (!check) {
let error = new Error("Acces Denied");
error.statusCode = 401;
th... |
Java | UTF-8 | 2,733 | 2.796875 | 3 | [] | no_license | package com.sy.emotion.judge.impl;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.sy.emotion.judge.IJudge;
import com.sy.word.util.ResourceLoader;
import lombok.extern.slf4j.Slf4j;
/**
*
... |
Java | UTF-8 | 32,702 | 1.625 | 2 | [] | no_license | package br.edu.utfpr.dv.siacoes.window;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.vaadi... |
Python | UTF-8 | 611 | 3.71875 | 4 | [] | no_license | from tkinter import *
class DisplayGrid:
def __init__(self):
window = Tk()
window.title('Display Grid')
self.canvas = Canvas(window, width = 300, height = 300, bg = 'white')
self.canvas.pack()
for i in range(9):
self.canvas.create_line(10, 10 + i * 2... |
C++ | UTF-8 | 15,695 | 3.546875 | 4 | [
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-4-Clause"
] | permissive | /*******************************************************************\
Module: Unit tests for range
Author: Romain Brenguier, romain.brenguier@diffblue.com
\*******************************************************************/
#include <list>
#include <vector>
#include <testing-utils/use_catch.h>
#include <util/rang... |
C++ | UTF-8 | 18,808 | 2.671875 | 3 | [
"MIT"
] | permissive | //
// Created by Han Zhao on 5/7/15.
//
#include "SPNetwork.h"
#include <set>
#include <stack>
#include <queue>
#include <random>
namespace SPN {
// Constructor of SPN
SPNetwork::SPNetwork(SPNNode *root) {
root_ = root;
}
// Destructor of SPN
SPNetwork::~SPNetwork() {
// Delete al... |
Markdown | UTF-8 | 6,910 | 2.90625 | 3 | [] | no_license | # 登录接口开发
登录的逻辑其实很简答,只需要接受账号密码,然后把用户的id生成jwt,返回给前段,为了后续的jwt的延期,所以我们把jwt放在header上。具体代码如下:
- com.gychen.controller.AccountController
```java
@RestController
public class AccountController {
@Autowired
JwtUtils jwtUtils;
@Autowired
UserService userService;
/**
* 默认账号密码:gychen / 111111
*
... |
Markdown | UTF-8 | 352 | 2.578125 | 3 | [
"MIT"
] | permissive | ---
title: Hello Lambda!
date: 2018-09-12 00:00:00 -0500
presentation_url: https://www.slideshare.net/DavidRoberts38/hello-lambda-how-to-call-lambdas-on-aws
---
An introduction to the many ways to call a Lambda function on Amazon Web Services. We'll cover various options such as API Gateway, SNS, SQS, Kinesis and discu... |
Java | UTF-8 | 2,711 | 2.265625 | 2 | [] | no_license | package com.rahuljanagouda.popularmoviesone.adapters;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextVie... |
Python | UTF-8 | 87 | 3.1875 | 3 | [] | no_license | def dis(no):
for x in range(1,no+1):
print "Hello"
x=input("ENter number")
dis(x)
|
Shell | UTF-8 | 333 | 3.25 | 3 | [] | no_license | #!/usr/bin/env bash
# a simple script that resists death with a few messages
echo $$ > /var/run/holbertonscript.pid
sigterm() {
echo "I hate the kill command"
rm -r "/var/run/holbertonscript.pid"
exit
}
sigint() {
echo "Y U no love me?!"
exit
}
trap SIGTERM
trap SIGINT
while :
do
echo "To infinity and... |
C | UTF-8 | 439 | 3.484375 | 3 | [] | no_license | #include <stdio.h>
int main()
{
int pz[100], n,i,j;
printf("Enter the number of elements\n");
scanf("%d", &n);
printf("Enter the elements\n", n);
for (i = 0; i < n; i++)
scanf("%d", &pz[i]);
for ( i = 0 ; i < n ; i++ )
{
for ( j = 0 ; j < n ; i++ )
{
... |
C++ | SHIFT_JIS | 716 | 2.890625 | 3 | [] | no_license | #pragma once
#include "Vertex.h"
class CShape
{
public:
CShape();
~CShape();
private:
CShape* pre_shape;
CShape* next_shape;
CVertex* vertex_head;
CVertex* vertex_final;
public:
//}`Ă邩
bool close = false;
//Vertex̐
int VertexNum = 0;
//OVertex擾
CShape* GetPreShape();
//OVertexݒ
CShape* SetPreShape(... |
Markdown | UTF-8 | 916 | 2.96875 | 3 | [] | no_license | # Challenge 4
## Purpose
As A coding boot camp student I want to take a timed quiz on JavaScript fundamentals that stores high scores so that I can gauge my progress compared to my peers
## Built With
* HTML
* JavaScript
## Requirements/Notes
* GIVEN I am taking a code quiz
* WHEN I click the start button... |
Python | UTF-8 | 522 | 4.34375 | 4 | [] | no_license | """
String Looping
As we've mentioned, strings are like lists with characters as elements. You can loop through strings the same way you loop through lists! While we won't ask you to do that in this section, we've put an example in the editor of how looping through a string might work."""
for letter in "Codecademy":
... |
C# | UTF-8 | 3,279 | 2.921875 | 3 | [
"MIT"
] | permissive | namespace Manila.AirFrog.Common.Terminal
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Command
{
public string Name { get; private set; }
public string Description { get; private set; }
... |
Java | UTF-8 | 1,012 | 2.5625 | 3 | [] | no_license |
package ind.rubilacz.tools.acleaner.detector;
import ind.rubilacz.tools.acleaner.model.ColorDebris;
import ind.rubilacz.tools.acleaner.model.Debris;
import ind.rubilacz.tools.acleaner.model.Document;
public class ColorDetector extends CharactersDetector {
private static ColorDetector sDetector;
public stat... |
Python | UTF-8 | 12,451 | 3.265625 | 3 | [] | no_license | # valueIterationAgents.py
# -----------------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to ht... |
Swift | UTF-8 | 2,941 | 3.046875 | 3 | [] | no_license | //
// UIColor+Ext.swift
// TikiTest
//
// Created by Ho Trung Toan on 11/13/18.
// Copyright © 2018 Ho Trung Toan. All rights reserved.
//
import Foundation
import UIKit
extension UIColor {
public convenience init?(hexString: String) {
let r, g, b, a: CGFloat
if hexString.hasPrefix("#... |
Java | UTF-8 | 834 | 1.976563 | 2 | [] | no_license | package com.lanou.web.controller;
import com.lanou.entity.dto.NewsDto;
import com.lanou.service.IDownNewsService;
import com.lanou.util.Result;
import com.lanou.util.ResultGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframew... |
Java | UTF-8 | 912 | 2.453125 | 2 | [] | no_license | package com.arteck;
import java.util.Iterator;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
Configur... |
Java | UTF-8 | 1,290 | 2.296875 | 2 | [] | no_license | package com.clound.battery.model.bean;
/**
* author cowards
* created on 2018\10\18 0018
**/
public class HlBean {
/**
* 回路号
**/
private String hl_number;
/**
* 回路状态
**/
private String hl_state;
/**
* 回路时间
**/
private String hl_time;
/**
* 0:线上卡 1:微... |
Java | UTF-8 | 3,116 | 2.390625 | 2 | [] | no_license | package com.todo.bootstrap;
import com.todo.domain.Todo;
import com.todo.domain.TodoBucket;
import com.todo.domain.UserDetails;
import com.todo.security.utils.ROLES;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.boot.CommandLine... |
Python | UTF-8 | 1,140 | 3.296875 | 3 | [
"Apache-2.0"
] | permissive | import sys
def print_level_order_and_id(tree, indent=0, printable=[]):
if tree.__class__ in printable:
print '{1}:{0}'.format(' '*indent, tree.getLine()), tree.text, "0x%x"%id(tree), str(tree)
else:
print '{1}:{0}'.format(' '*indent, tree.getLine()), tree.text, "0x%x"%id(tree)
for chil... |
Java | UTF-8 | 2,421 | 1.945313 | 2 | [] | no_license | package auto.pages;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import auto.utility.Services;
impo... |
Python | UTF-8 | 879 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import pandas as pd
def save_snv_table(df,file_out, pkl = False,txt = False):
"""
saves snv table as .tsv file, .pkl file, or both
INPUTS
df:
SNV table pandas DataFrame object
file_out:
file name. e.g. "path/to/file"
pkl:... |
Python | UTF-8 | 190 | 2.59375 | 3 | [] | no_license | import pandas as pd
import os
import sys
s = int(sys.argv[1])
e = int(sys.argv[2])
for i in range(s,e):
os.system("python3 test.py %s" %(i))
df = pd.read_csv("output.csv")
print(df) |
PHP | UTF-8 | 4,350 | 2.828125 | 3 | [] | no_license | <?php
namespace libs;
//路由类
class Route{
private $controller="index";
private $action="index";
//解析路由
//c 表示控制器 a 表示方法名
//控制器名称后缀 Controller index=>indexController
//方法名 不变 action index=>index
public function routeParse(){
list($c,$a)=$this->getRoute();
// $c=iss... |
JavaScript | UTF-8 | 3,962 | 2.796875 | 3 | [
"MIT"
] | permissive |
// document ready
$(function () {
MAIN.Init();
});
// Define namespace
var MAIN = MAIN || {};
// Init
MAIN.Init = function () {
with (MAIN) {
let socket;
// [Connect] click
$("button[name='buttConnect']").click(function () {
console.log("buttConne... |
PHP | UTF-8 | 581 | 2.796875 | 3 | [] | no_license | <?php
namespace Dnoegel\Rules\Rule\Container;
use Dnoegel\Rules\Rule;
/**
* Container defines the interface for special rules, which conjunct child rules
*
* Interface Container
* @package Dnoegel\Rules\Rule\Container
*/
interface Container extends Rule
{
/**
* Set the internal rule collection to $rule... |
Python | UTF-8 | 780 | 2.859375 | 3 | [] | no_license | import warnings
warnings.filterwarnings("ignore", category=FutureWarning, module="sklearn")
import numpy as np
from sklearn import datasets
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
iris=datasets.load_iris()
log_model = LogisticRegression()
scores = cross_va... |
Python | UTF-8 | 175 | 3.09375 | 3 | [] | no_license | from random import *
lists=["deep","dev","ashish"]
tup=("deep","dev","ashish")
def names(l,t):
print(l[0])
print(t[0])
print(choice(l))
print(choice(t))
names(lists,tup) |
Python | UTF-8 | 4,924 | 2.8125 | 3 | [] | no_license | import numpy
from keras.datasets import cifar10
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import Flatten
from keras.layers import Dropout
from keras.layers.convolutional import Conv2D
from keras.layers.convolutional import MaxPooling2D
from keras.utils import np_utils
from ker... |
C# | UTF-8 | 15,823 | 3.25 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Specialized;
using static Auxiliary.Primitives;
namespace Auxiliary
{
public static partial class BasicStringDrawer
{
private static readonly List<MultilineSt... |
Java | UTF-8 | 465 | 2.109375 | 2 | [] | no_license | package questions.booking;
import net.serenitybdd.screenplay.Actor;
import net.serenitybdd.screenplay.Question;
import ui.booking.BookingPage;
public class BookingMessage implements Question<String> {
@Override
public String answeredBy(Actor actor) {
return BookingPage.SEARCH_SUCCESS_MESSAGE.resolveFo... |
Java | UTF-8 | 800 | 2.671875 | 3 | [] | no_license | package test;
import bean.Bean1;
import bean.Bean2;
import bean.Bean3;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestBean {
public static void main(String[] args) {
ApplicationContext context = new ClassPa... |
Java | UTF-8 | 1,971 | 2.21875 | 2 | [] | no_license | package com.tu.ziik.lms.recommender.engines;
import java.util.List;
import org.apache.mahout.cf.taste.common.TasteException;
import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.impl.model.jdbc.ReloadFromJDBCDataModel;
import org.apache.mahout.cf.taste.impl.neighborh... |
Python | UTF-8 | 11,640 | 3.828125 | 4 | [] | no_license | class Property:
"""Class of property"""
def __init__(self, square_feet='', beds='',
baths='', **kwargs):
"""
Initialize all arguments.
:param square_feet: int
:param beds: int
:param baths: int
:param kwargs:
"""
super... |
Java | GB18030 | 1,192 | 2.25 | 2 | [
"BSD-3-Clause"
] | permissive | package elf.server.ems.mock.ui.deal.manual.transform;
import org.springframework.stereotype.Service;
import elf.api.ems.consts.EmsPriceModeConsts;
@Service
public class PriceModeTransform {
public String transform(String priceMode) {
if (EmsPriceModeConsts.MARKET_IMMEDIATE_OTHER_CANCEL.equals(priceMode... |
Java | UTF-8 | 10,391 | 2.609375 | 3 | [] | no_license | package com.sinopoc.myspring.servlet;
import com.sinopoc.annotation.KAutowired;
import com.sinopoc.annotation.KController;
import com.sinopoc.annotation.KRequestMapping;
import com.sinopoc.annotation.KService;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSer... |
PHP | UTF-8 | 474 | 2.875 | 3 | [] | no_license | <?php
function connexionBd($SERVEUR = 'localhost', $USER = 'root', $MDP = '', $BD = 'Pizzeria')
{
try {
$connexion= new PDO('mysql:host='.$SERVEUR.';dbname='.$BD, $USER, $MDP);
$connexion->exec("SET CHARACTER SET utf8"); //Gestion des accents
return $connexion;
}
//gestion ... |
Java | UTF-8 | 222 | 1.734375 | 2 | [] | no_license | package com.xxx.messaging.filtering;
import com.xxx.messaging.Context;
import com.xxx.messaging.Notification;
public interface Filter {
boolean accept(Context context, Notification notification);
String name();
} |
Markdown | UTF-8 | 2,317 | 3.34375 | 3 | [] | no_license | # GloVe: Global Vectors for Word Representation
Jeffrey Pennington, Richard Socher, Christopher Manning
(https://nlp.stanford.edu/pubs/glove.pdf, 2014)
### TL;DR
- A new global log-bilinear regression model that obtains vector representation of words. It combines benefits of word2vec model AND exploits global corpus ... |
Java | UTF-8 | 317 | 1.632813 | 2 | [] | no_license | package com.example.todolist.test.runner;
import junit.framework.TestSuite;
public class Runner1 extends CommonRunner{
@Override
public TestSuite getAllTests() {
TestSuite suite = new TestSuite();
suite.addTest(LoginRunner.geTestSuite());
suite.addTest(TodoListSuite.geTestSuite());
return suite;
}
}
|
C++ | SHIFT_JIS | 3,958 | 2.734375 | 3 | [] | no_license | //=============================================================================
//
// CAttacjManagerNX [CAttacManager.cpp]
// Author : ˖{@rF
//
//=============================================================================
//*****************************************************************************
// CN[h
//******... |
Java | UTF-8 | 325 | 2.1875 | 2 | [] | no_license | package constants;
public final class FrameworkConstants {
private FrameworkConstants() {
}
private static final String PROPERTYFILEPATH = System.getProperty("user.dir") + "/src/main/resources/configProps.properties";
public static String getPropertyFilePath() {
return PROPERTYFILEPATH;
... |
Java | UTF-8 | 1,245 | 2.1875 | 2 | [] | no_license | package vn.media.controller.music;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import vn.media.controller.DBConnector;
import vn.media.models.DiaNhac;
import vn.media.view.MainFrame;
import vn.media.view.music.EditMusicView;
imp... |
Python | UTF-8 | 2,593 | 3.21875 | 3 | [] | no_license | from .Matrix import Matrix
from .Vector import Vector
from ._global import is_zero
class LinearSystem(object):
# 构建增广矩阵(argument matrix),增广矩阵结构为:Matix|Vector
def __init__(self, A, b):
assert A.row_num() == len(b), \
"row number of A must be equal to the length of b"
# 记录矩阵的行数和列数
... |
Java | UTF-8 | 2,503 | 2.203125 | 2 | [] | no_license | package com.mio780308.multipleimagepicker;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
im... |
C | UTF-8 | 2,917 | 2.71875 | 3 | [] | no_license | #include "worklog.h"
#include <stdlib.h>
#include <string.h>
#define WL_DEFAULT_CAPACITY 128
#define WL_CAPACITY_GROW_STEP 32
#define WL_NOT_FOUND (-1)
static int wl_capacity = WL_DEFAULT_CAPACITY;
static int wl_size = 0;
static double wl_total_spent = 0;
static double *wl_spent = NULL;
static wl_task_t *wl_task = NU... |
C | UTF-8 | 533 | 3.890625 | 4 | [] | no_license | #include <stdio.h>
int counting(int x) {
int div_counter = 1;
int half_x = x / 2;
for (int i = 1; i <= half_x; i++) {
if (x % i == 0) {
div_counter++;
}
}
return div_counter;
}
// Условия задания:
// Подсчитайте количество натуральных делителей числа x (вк... |
Python | UTF-8 | 472 | 3.171875 | 3 | [] | no_license | list = [
{"min_salary": 200, "max_salary": 1000, "date_posted": "2001-10-25"},
{"min_salary": 100, "max_salary": 5000, "date_posted": "2015-05-10"},
{"min_salary": 300, "max_salary": 2000, "date_posted": "2010-05-10"},
]
print(
[
min_list["min_salary"]
for min_list in sorted(list, key=l... |
Markdown | UTF-8 | 2,718 | 3.640625 | 4 | [] | no_license | # 插入区间
> 题目来源: [LintCode 算法题库](https://www.lintcode.com/problem/insert-interval/?utm_source=sc-github-wzz)
## 题目描述
<p>给出一个<font color="#e76363"><b>无重叠的</b></font><span style="line-height: 1.42857143;">按照区间起始端点排序的区间列表。</span></p><p>在列表中插入一个新的区间,你要确保列表中的区间仍然有序且<font color="#e76363"><b>不重叠</b></font>(如果有必要的话,可以合并区间)。</... |
C++ | UTF-8 | 634 | 3.703125 | 4 | [] | no_license | #include <iostream>
template <typename T>
void swap(T &a, T &b)
{
T temp = a;
a = b;
b = temp;
}
int main()
{
int i = 10;
int j = 20;
swap(i, j);
std::cout << "compiler generated int swapper:\n";
std::cout << "i: " << i << " j: " << j << "\n\n";
double x = 27.1;
double y = 81.... |
Java | UTF-8 | 5,133 | 1.9375 | 2 | [] | no_license | package com.vvn.vocavocani.home;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPage... |
C++ | UTF-8 | 637 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | #pragma once
#include <memory>
#include "sentinel-core/transport/command/command_request.h"
#include "sentinel-core/transport/command/command_response.h"
namespace Sentinel {
namespace Transport {
class CommandHandler {
public:
CommandHandler(const std::string& name) : command_name_(name) {}
virtual ~CommandHa... |
Markdown | UTF-8 | 1,388 | 2.875 | 3 | [
"MIT"
] | permissive | # Install Vagrant box CentOS7
## Overview
This is Vagrant file to
* Create a plain CentOS 7 machine.
* Make the /vagrant directory on the CentOS guest synchronize with the Vagrant directory on the Windows host.
Other note
* This file is tested on Windows 10 host with Oracle Virtual Box.
* To make CentOS ... |
Java | UTF-8 | 237 | 3 | 3 | [] | no_license | package AlexLink.HomeWork.HomeworkStream.Task1;
@FunctionalInterface
public interface Run {
void run(Animal pet);
default void info(Animal pet) {
System.out.println(pet.getClass().getSimpleName() + " running");
}
}
|
Java | UTF-8 | 4,072 | 2.046875 | 2 | [] | no_license | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of... |
Markdown | UTF-8 | 35,943 | 3.78125 | 4 | [
"MIT"
] | permissive | # Stream
<!-- toc -->
## 定义
流 (Stream)允许我们以声明性方式(declarative way)处理数据集合。流的简短定义为:a sequence of elements from a source that supports data processing operations(从支持数据处理操作的源生成的元素序列),我们来详细看下这个定义:
* Sequence of elements(元素序列)- 流提供了类似于集合(Collection)的接口,额可以操作特定元素类型的一组有序值。不过两者的关注点不同,集合主要关注数据(data),流主要关注计算(computation)。
* Sour... |
Python | UTF-8 | 471 | 2.703125 | 3 | [] | no_license | import json
import datetime
from bson import ObjectId
# Функция для получения времени в необходимом формате
def getCurrTime():
now = datetime.datetime.now()
return now.strftime("%Y-%m-%d %H:%M:%S")
# Класс для перевода в JSON
class JSONEncoder(json.JSONEncoder):
def default(self, o):
if isinstance... |
C++ | UTF-8 | 2,796 | 2.96875 | 3 | [] | no_license | #ifndef MEMORIACOMPARTIDA_H_
#define MEMORIACOMPARTIDA_H_
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <cstring>
#include <iostream>
#include <cerrno>
using namespace std;
template <class T> class MemoriaCompartida {
private:
int shmId;
T *ptrDatos;
int cantidadProcesosAdosados() co... |
C# | UTF-8 | 1,267 | 2.796875 | 3 | [] | no_license | using UnityEngine;
using System;
using System.Collections.Generic;
using System.Linq;
public static class Utils
{
public static T PickRandom<T>(T[] array)
{
return array[UnityEngine.Random.Range(0, array.Length)];
}
public static Vector3 FindIntercept(Vector3 origin1, float speed1, Vector... |
Shell | UTF-8 | 1,320 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env bash
set -x
export DEBIAN_FRONTEND=noninteractive
if [ ! -e "/home/vagrant/.firstboot" ]; then
# update us. -> ph. in apt sources.list to use APT server from Finland
perl -i -p -e 's/\/\/us\./\/\/ph./g' /etc/apt/sources.list
# install mongodb repo
apt-key adv --keyserver hkp://keyserver.ubuntu... |
TypeScript | UTF-8 | 295 | 2.75 | 3 | [] | no_license | namespace L11_Inheritance {
export class DavidStar2 extends DavidStar {
constructor(_color: string) {
super(_color);
}
move(): void {
this.x += Math.random() * 2 - 1;
this.y += Math.random() * 2 - 1;
}
}
} |
PHP | UTF-8 | 7,143 | 2.84375 | 3 | [
"MIT"
] | permissive | <?php
//Controlador: esta aplicación solo realiza una accion
include("modelo.php");
include("vista.php");
class Controlador{
protected $user;
public function __construct(){
$this->user = new Usuarios();
}
//Inicia la conexion, todas las peticiones pasan por aqui.
... |
JavaScript | UTF-8 | 4,200 | 2.703125 | 3 | [] | no_license | let playerStats = new Map([
["attack", 1],
["strength", 1],
["defence", 1],
["ranged", 1],
["prayer", 1],
["magic", 1],
["runecrafting", 1],
["construction", 1],
["hitpoints", 10],
["agility", 1],
["herblore", 1],
["thieving", 1],
["crafting", 1],
["... |
C# | UTF-8 | 1,042 | 2.734375 | 3 | [
"MS-PL"
] | permissive | namespace Grace.DependencyInjection.Conditions
{
/// <summary>
/// Simple condition true when delegate returns true
/// </summary>
public class WhenCondition : IExportCondition
{
private readonly ExportConditionDelegate condition;
/// <summary>
/// Default constructor
/// </summary>
/// <param name="co... |
Python | UTF-8 | 360 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2019/7/11 0:39
# @Author : liuqi
# @FileName: tutleTest.py
# @Software: PyCharm
import turtle
import time
# 同时设置pencolor=color1, fillcolor=color2
turtle.color("red", "yellow")
turtle.begin_fill()
for _ in range(50):
turtle.forward(200)
turtle.left(170)
turtle... |
TypeScript | UTF-8 | 4,687 | 2.84375 | 3 | [
"MIT"
] | permissive | import {
useRef,
// Types
MutableRefObject,
useEffect,
} from 'react'
import { Keys } from '../components/keyboard'
import { focusElement, focusIn, Focus, FocusResult } from '../utils/focus-management'
import { useWindowEvent } from './use-window-event'
import { useIsMounted } from './use-is-mounted'
export e... |
Markdown | UTF-8 | 2,159 | 3.296875 | 3 | [] | no_license | ```bash
# 列出所有本地分支
git branch
# 列出所有远程分支
git branch -r
# 新建一个分支,但依然停留在当前分支
git branch [branch-name]
# 新建一个分支,并切换到该分支
git checkout -b [branch]
# 合并指定分支到当前分支
$ git merge [branch]
# 删除分支
$ git branch -d [branch-name]
# 删除远程分支
$ git push origin --delete [branch-name]
$ git branch -dr [remote/branch]
```
```bash
#初始化
gi... |
Java | UTF-8 | 4,979 | 2.265625 | 2 | [] | 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 cz.certicon.routing.parser.model;
import cz.certicon.routing.parser.model.commands.DataTypeCommand;
import cz.certicon.routing... |
Java | UTF-8 | 3,559 | 2.078125 | 2 | [] | no_license | package com.wine.to.up.notification.service.mobile.fcm;
import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.wine.to.up.notification.service.components.NotificationServiceMetricsCollect... |
Python | UTF-8 | 4,291 | 3.1875 | 3 | [] | no_license | """
The rail network data and methods for loading, saving etc
"""
from persist import Serializable, Multidict, tupleify
from random import uniform
from math import sqrt, radians, sin, cos
__author__ = 'tomas.liden@liu.se'
def _move(point, r_min, r_max, d_min, d_max):
"""
Perform a polar move of the point, us... |
PHP | UTF-8 | 1,328 | 2.984375 | 3 | [
"MIT"
] | permissive | <?php
/**
* This file is part of phplrt package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Phplrt\Position;
use Phplrt\Contracts\Position\IntervalInterface;
use Phplrt\Contracts\Position\P... |
TypeScript | UTF-8 | 2,354 | 2.53125 | 3 | [
"MIT"
] | permissive | import { AnyAction } from 'redux';
import { ISittersState } from '../sitters.state';
import { createReducerHash } from '../../common';
import { SITTERS } from '../actions';
export const initialState: ISittersState = {
sitters: {},
isLoading: false,
error: null,
};
const startLoadingReducer = (state: ISittersSta... |
JavaScript | UTF-8 | 460 | 3.515625 | 4 | [] | no_license | // Function that recieves data from the form on button click and filters out the data based on form criteria then builds the table.
function filterData() {
var searchDate = d3.select("#datetime").property("value");
var searchFilters = data;
searchFilters = searchFilters.filter(ufo => ufo.datetime === searc... |
Java | UTF-8 | 9,654 | 1.851563 | 2 | [
"Apache-2.0"
] | permissive | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
C++ | UTF-8 | 25,615 | 2.796875 | 3 | [] | no_license | #include <utility>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <tuple>
#include <algorithm>
#include <iostream>
#include "AI_player.h"
#include "Basic_BK_AI_player.h"
using namespace std;
#ifndef __SETTING__
#define __SETTING__
#define EMPTY 0
#define BLACK 1
#define WHITE 2
#define BOARD_SIZE 19 ... |
C++ | UTF-8 | 345 | 3.015625 | 3 | [] | no_license | #ifndef Node_h
#define Node_h
#include <string>
class Node
{
private:
std::string element;
Node *nextNode;
public:
Node();
Node(std::string element);
~Node();
// METODOS ELEMENT
std::string getElement();
void setElement(std::string element);
Node *getNextNode();
void setNextNo... |
C++ | UTF-8 | 1,287 | 3.296875 | 3 | [] | no_license | #include<iostream>
using namespace std;
int finder(int S[], int i, int N, int n){
if(n>N)
return 0;
if(S[i]==0)
return i;
else return finder(S, S[i], N, n+1);
}
void Union(int S[], int n, int i, int j){
if(S[i]==0)
S[i]=j;
else if(S[j]==0)
S[j]=i;
else {
int x = finder(S, i, n, 0);
... |
C++ | WINDOWS-1252 | 960 | 3.484375 | 3 | [] | no_license | // Name: iѻ
// Date: Apr. 12, 2018
// Last Update: Apr. 12, 2018
// Problem statement: Vector Computation
#include <iostream>
#include "Vector.h"
using namespace std;
int main()
{
float x, y, k;
while (cin >> x >> y) {
Vector mainVector = Vector(x, y);
cin >> x >> y;
Vector addVector = Vector(x, y);
Vector... |
Python | UTF-8 | 140 | 3.625 | 4 | [] | no_license | #To reverse a string
def reversed_string(inputstring):
return inputstring[::-1]
output = reversed_string("hello")
print output
|
C# | UTF-8 | 26,209 | 2.515625 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
// TODO:
// [ ] Exception handling for various actions which... |
Python | UTF-8 | 1,275 | 3.546875 | 4 | [] | no_license | #1 My Ans, path template
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
this.val = val
this.left, this.right = None, None
"""
class Solution:
"""
@param: root: The root of the binary tree.
@param: A: A TreeNode
@param: B: A TreeNode
@return: Return the LCA... |
Java | UTF-8 | 1,193 | 2.109375 | 2 | [] | no_license | /********************************************************************************
* MIT Java Wordnet Interface (JWI)
* Copyright (c) 2007-2008 Massachusetts Institute of Technology
*
* This is the non-commercial version of JWI. This version may *not* be used
* for commercial purposes.
*
* This program a... |
Swift | UTF-8 | 1,580 | 2.75 | 3 | [
"MIT"
] | permissive | //
// DemoData.swift
// SwiftLintStarter
//
// Created by Daymein Gregorio on 3/11/20.
// Copyright © 2020 Daymein Gregorio. All rights reserved.
//
import Foundation
let p1 = CBPlayer(name: "Ken",
powerLevel: 4,
number: 5)
let p2 = CBPlayer(name: "Ryu",
power... |
Python | UTF-8 | 472 | 3.296875 | 3 | [] | no_license |
arivals = list(map(int,"1 3 5".strip().split(" ")))
departures = list(map(int,"2 6 8".strip().split(" ")))
k = int(input())
arivals = [i + 1 for i in arivals]
departures = [(-1*i) - 1 for i in departures]
# print(arivals,departures)
meets = arivals + departures
print(meets)
meets.sort(key=lambda x:abs(x))
print(... |
PHP | UTF-8 | 917 | 2.6875 | 3 | [] | no_license | <?php
//This class is used to execute queries on MIS.NEWSEARCH_PAGEVIEW table
class MIS_NEWSEARCH_PAGEVIEW extends TABLE
{
public function __construct($dbname='')
{
parent::__construct($dbname);
}
public function insertRecord($pageNo,$sid)
{
//JSM-881---temp stop
return 1;
... |
JavaScript | UTF-8 | 3,193 | 4.0625 | 4 | [] | no_license | class Node {
constructor(value) {
this.left = null;
this.right = null;
this.value = value;
}
}
class BinarySearchTree {
constructor() {
this.root = null;
}
insert(value) {
const newNode = new Node(value);
let set = false;
if (this.root === null) {
this.root = newNode;
} ... |
Java | UTF-8 | 3,616 | 2.234375 | 2 | [] | no_license | package com.zt.blog.interceptor;
import com.alibaba.fastjson.JSON;
import com.zt.blog.common.config.SpringContextHolder;
import com.zt.blog.common.constant.Constants;
import com.zt.blog.common.entity.Result;
import com.zt.blog.common.property.AppletProps;
import com.zt.blog.common.util.DateUtil;
import com.zt.blog.com... |
JavaScript | UTF-8 | 1,122 | 2.65625 | 3 | [
"MIT"
] | permissive | /*global Widget */
function ErrorWidget(widget, configName) {
this.widget = widget;
this.configName = configName;
this.dataToBind = {
'value': ''
};
}
ErrorWidget.prototype = new Widget();
ErrorWidget.prototype.constructor = ErrorWidget;
$.extend(ErrorWidget.prototype, {
/**
* Invo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.