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 |
|---|---|---|---|---|---|---|---|
JavaScript | UTF-8 | 354 | 3.265625 | 3 | [] | no_license | function Person(firstName, lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.getFullName = function() {
return this.firstName + " " + this.lastName;
}
}
var MyJavaClass = Java.type("com.lianjia.jsengine.TestJS");
var person1 = new Person("Peter", "Parker");
MyJavaClass.fun4(... |
JavaScript | UTF-8 | 1,690 | 2.90625 | 3 | [] | no_license | "use strict";
$(document).ready( () => {
deleteAllCookies();
const path = `http://${$(location).attr('host')}`;
$("#login-public").click( () => {
let username = $("#username").val();
// var password = $("#password").val();
if(verifyUsername(username)) {
$.ajax({
ty... |
PHP | UTF-8 | 864 | 2.859375 | 3 | [] | no_license | <!DOCTYPE html>
<html>
<head>
<title>formulaire</title>
<meta charset="utf-8"/>
</head>
<body>
<P>BONJOUR </P>
<?php
function securisation($donnees){
$donnees=trim($donnees);
$donnees=stripcslashes($donnees);
$donnees=strip_tags($donnees);
return $donnees;
}
echo securisation($_POST['prenom']) .'<br/>'. sec... |
JavaScript | UTF-8 | 824 | 4.75 | 5 | [] | no_license | // The boolean has only two values: true and flase
// This type is commonly used to store yes/no values: true means “yes, correct”, and false means “no, incorrect”.
let nameFieldChecked = true;
let ageFieldChecked = false;
console.log(nameFieldChecked)
console.log(ageFieldChecked)
let isGreat = 4 > 1;
console.log(is... |
Java | UTF-8 | 311 | 1.585938 | 2 | [] | no_license | package top.zhacker.sample.retail.online.item.domain.item.param;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* Created by zhacker.
* Time 2018/2/12 下午9:09
*/
@Data
@Accessors(chain = true)
public class ItemUpdateStatusParam {
private Long itemId;
private Integer status;
}
|
C# | UTF-8 | 2,021 | 2.671875 | 3 | [] | no_license | using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Media.Streaming.Adaptive;
using Windows.Storage;
namespace DataAccess.Data
{
public static class SettingsContext
{
private static st... |
Java | UTF-8 | 944 | 2.484375 | 2 | [
"Apache-2.0"
] | permissive | package data.cleaning.core.service.repair.impl;
import data.cleaning.core.service.dataset.impl.Record;
public class Violation {
private Record record;
public Record getRecord() {
return record;
}
public void setRecord(Record record) {
this.record = record;
}
@Override
public int hashCode() {
final int... |
Java | GB18030 | 467 | 2.140625 | 2 | [] | no_license | package ccc_ui.ui;
import java.awt.Color;
public class UiStyle
{
public String bkImage = null;
public int imageStyle = IMAGE_STYLE_STRETCH;
public Color colorForeground = null;
public Color colorBackground = null;
public static final int IMAGE_STYLE_STRETCH = 0; //
public static ... |
C++ | UTF-8 | 673 | 3.265625 | 3 | [] | no_license | // Question https://leetcode.com/problems/find-peak-element
class Solution {
public:
int findPeakElement(vector<int>& nums) {
int len = nums.size(), l = 0, r = len - 1;
int mid, mL, mR;
while (l <= r) {
mid = l + (r - l) / 2;
mL = (mid - 1 < 0) ? INT_MIN : n... |
C# | UTF-8 | 4,502 | 2.609375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using GitTask.Domain.Attributes;
using GitTask.Domain.Services.Interface;
using GitTask.Storage.Exception;
namespace GitTask.Storage
{
public class QueryService<TModel> : IQueryService<TModel>
{
private re... |
Swift | UTF-8 | 670 | 2.515625 | 3 | [] | no_license | import Foundation
import CoreData
import WalletPresentationData
public class TextureEntity: NSManagedObject, CDHelperEntity {
public static var entityName: String! { return "TextureEntity" }
@NSManaged public var front: String
@NSManaged public var back: String
}
extension TextureEntity {
... |
Ruby | UTF-8 | 575 | 2.59375 | 3 | [] | no_license | require 'Munging'
describe Munging do
describe 'min' do
it "should return day 3" do
data = [{:day => 1, :max =>88, :min => 59}, {:day => 2, :max =>88, :min => 40}, {:day => 3, :max =>88, :min => 70}]
dataMunging = Munging.new(data)
dataMunging.findSmallestRange()[:day].should eq 3
end
it "shou... |
C# | UTF-8 | 23,851 | 2.859375 | 3 | [] | no_license | /*
* Author: Kishore Reddy
* Url: http://commonlibrarynet.codeplex.com/
* Title: CommonLibrary.NET
* Copyright: � 2009 Kishore Reddy
* License: LGPL License
* LicenseUrl: http://commonlibrarynet.codeplex.com/license
* Description: A C# based .NET 3.5 Open-Source collection of reusable components.
* Usa... |
Python | UTF-8 | 2,587 | 4.59375 | 5 | [] | no_license | # --- DAY THREE ------
'''
1. Write a short Python function that takes a sequence of integer values and
determines if there is a distinct pair of numbers in the sequence whose
product is odd.
'''
def product_is_odd(values):
'''
Checks if there is distinct pairs whose product is odd
and None when is no dist... |
Java | UTF-8 | 2,204 | 3.203125 | 3 | [] | no_license | package ca.carleton.comp.game;
import ca.carleton.comp.util.RandomUtil;
import java.util.ArrayList;
import java.util.List;
public class Dice {
private int index;
private int status;
private List<DiceSide> diceSideList;
public Dice(int index) {
this.index = index;
this.status = 1;
... |
Markdown | UTF-8 | 2,265 | 2.515625 | 3 | [
"MIT"
] | permissive | # ios-sdk <a href="https://cocoapods.org/pods/IngresseSDK"><img src="https://img.shields.io/cocoapods/v/IngresseSDK.svg?style=flat"></a>
Ingresse iOS SDK
## Installation guide
Add this to your Podfile:
```ruby
pod 'IngresseSDK'
```
Import SDK on your Swift class
```swift
import IngresseSDK
```
## IngresseClient
##... |
Markdown | UTF-8 | 2,231 | 2.609375 | 3 | [] | no_license | # Overview
[Azure Policy extension](https://learn.microsoft.com/en-us/azure/governance/policy/concepts/policy-for-kubernetes) for Azure Arc enabled Kubernetes lets you centrally manage compliance of your Kubernetes clusters. In this example, we walk through how to ensure our cluster only uses docker images from approv... |
C++ | UTF-8 | 3,785 | 2.984375 | 3 | [] | no_license | #include "BackgroundController.h"
BackgroundController::BackgroundController(void)
{
tree = NULL;
listObjects = NULL; // => list object, tất cả tile
nodes = NULL; // số node
currentTiles = NULL;
}
BackgroundController::BackgroundController(int level)
{
string fileName;
switch (level)
{
case 1:
fileName ... |
C++ | UTF-8 | 804 | 2.59375 | 3 | [] | no_license | #include "Operario.h"
float Operario::calculaSalOP(float comissao, float valorProducao,float salBase)
{
float comitemp, acc, somado;
comitemp = comissao / 100;
acc = comitemp * valorProducao;
salTotal = acc + salBase;
return salTotal;
}
float Operario::salAleatorio()
{
float salBase;
float salt;
salt = ran... |
Go | UTF-8 | 1,028 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | package webhook
import (
"context"
"github.com/stretchr/testify/assert"
admissionv1 "k8s.io/api/admission/v1"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
"testing"
)
func TestContextGetAdmissionRequestAndContextWithAdmissionRequest(t *testing.T) {
type args struct {
req *admission.Request
}
tests... |
Python | UTF-8 | 743 | 2.6875 | 3 | [] | no_license |
import os
import shutil
import git
def download_repository(repository, update_repository, checkout_target='master'):
name = get_name(repository)
path = "tmp/{}".format(name)
if os.path.exists(path):
if update_repository == 'true':
shutil.rmtree(path)
else:
check... |
Rust | UTF-8 | 2,680 | 3.46875 | 3 | [
"MIT"
] | permissive | // this module adds some functionality based on the required implementations
// here like: `LinkedList::pop_back` or `Clone for LinkedList<T>`
// You are free to use anything in it, but it's mainly for the test framework.
mod pre_implemented;
pub struct LinkedList<T>(std::marker::PhantomData<T>);
pub struct Cursor<'a... |
C++ | UTF-8 | 400 | 2.84375 | 3 | [] | no_license | #include "Actor.h"
/*#TODO 3: Implement Actor*/
Actor::Actor() {
name = "unknown";
}
Actor::Actor(const string &aName) {
name = aName;
}
Actor::~Actor() {
}
const string &Actor::getName() const {
return name;
}
void Actor::setName(const string &aName) {
name = aName;
}
ostream &operator<<(ostrea... |
TypeScript | UTF-8 | 815 | 2.609375 | 3 | [
"MIT"
] | permissive | /* eslint-disable no-nested-ternary */
import {ConditionalProperty, CurrentUser} from '@sanity/types'
export interface ConditionalPropertyCallbackContext {
parent?: unknown
document?: Record<string, unknown>
currentUser: Omit<CurrentUser, 'role'> | null
value: unknown
}
export function resolveConditionalPrope... |
Python | UTF-8 | 883 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = "Razin Shaikh and Minjie Lyu"
__credits__ = ["Razin Shaikh", "Minjie Lyu", "Vladimir Brusic"]
__version__ = "1.0"
__status__ = "Prototype"
def save_row_head(file):
'''Saves the row head(gene names / ENSG) from CSV file'''
with open(file) as f:
data = f.readlines()
... |
Java | UTF-8 | 630 | 2.734375 | 3 | [
"MIT"
] | permissive | package hr.fer.zemris.ml.training.decision_tree;
import java.util.List;
import hr.fer.zemris.ml.model.data.Sample;
import hr.fer.zemris.ml.model.decision_tree.DecisionTree;
/**
* Interface for decision tree generators.
*
* @author Dan
* @param <T> Type of the target value, usually {@code String} for
... |
Java | UTF-8 | 767 | 3.09375 | 3 | [] | no_license | package sourcecode.spring.aop.javaproxy.staticproxy;
import sourcecode.spring.aop.javaproxy.staticproxy.model.Boy;
import sourcecode.spring.aop.javaproxy.staticproxy.model.Child;
import sourcecode.spring.aop.javaproxy.staticproxy.model.Girl;
import sourcecode.spring.aop.javaproxy.staticproxy.proxy.ChildProxy;
import ... |
Java | UTF-8 | 2,145 | 1.9375 | 2 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | /*
* Copyright 2019-2020 the Joy Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
JavaScript | UTF-8 | 315 | 3.171875 | 3 | [] | no_license | var hotel = {
name: 'Park',
rooms: 120,
booked: 77,
checkAvailability: function() {
return this.rooms - this.booked;
}
};
var eleName = document.getElementById('hotelName');
eleName.textContent = hotel.name;
var eleRooms = document.getElementById('rooms');
eleRooms.textContent = hotel.checkAvailability(); |
C | UTF-8 | 15,057 | 2.921875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <string.h>
#include <fcntl.h>
#include <sys/wait.h>
#include "log_debug.h"
//#include "list.h"
#include "shortcut_signal.h"
#include "custom_command.h"
#define STRLEN 255... |
Java | UTF-8 | 471 | 2.09375 | 2 | [] | no_license | package org.sagebionetworks.bridge.models.accounts;
import org.sagebionetworks.bridge.models.BridgeEntity;
import com.fasterxml.jackson.annotation.JsonProperty;
public final class ExternalIdentifier implements BridgeEntity {
private final String identifier;
public ExternalIdentifier(@JsonProperty("identifi... |
Markdown | UTF-8 | 1,026 | 3.5 | 4 | [] | no_license | # my algorithms
When I am doing projects, I am faced with problems that require me to write some algorithms to solve them. In this repository are these algorithms, please help make them optimal or leave a thank you if the are helpful to you.
# INSERT INTO BINARY TREE ALG1
This algorithm inserts a sorted list of elemen... |
Java | UTF-8 | 2,287 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | package ru.yandex.qatools.ashot.screentaker;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import java.awt.*;
import java.awt.image.BufferedImage;
/**
* @author <a href="pazone@yandex-team.ru">Pavel Zorin</a>
* <p/>
* Pastes together parts of screenshots
* ... |
C# | UTF-8 | 3,138 | 2.8125 | 3 | [
"MIT",
"MS-PL",
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | using System;
using System.Collections.Generic;
using System.Text;
using GameUtils.Math;
namespace GameUtils.Graphics
{
/// <summary>
/// Formats a given text and saves the resulting layout.
/// </summary>
public class TextLayout : IResource
{
internal struct PositionedGlyph
{
... |
Python | UTF-8 | 1,058 | 3.53125 | 4 | [] | no_license | import pandas as pd
soccer = pd.read_csv("mls-salaries-2017.csv.csv")
print(soccer.head(10))
print(len(soccer.index))
avg_sal = soccer["base_salary"].mean()
print(avg_sal)
max_sal = soccer["base_salary"].max()
print(max_sal)
max_gcompen = soccer["guaranteed_compensation"].max()
print(max_gcompen)
pl... |
Shell | UTF-8 | 197 | 2.8125 | 3 | [] | no_license | # where to keep passphrase files
PASSDIR=~/lib/secrets
# ensure the shell function is loaded when referenced
autoload gp
# do filename completion for the command 'gp'
compctl -f -W ${PASSDIR} gp
|
Markdown | UTF-8 | 1,195 | 2.71875 | 3 | [] | no_license | # 一些路径
如果 URL 是一个绝对路径 (例如 /images/foo.png ),它将会被保留不变。
<img alt="Vue logo" src="/assets/logo.png">
<img alt="Vue logo" src="http://image.xx.com/logo.png">
如果 URL 以 . 开头会作为一个相对模块请求被解释并基于文件系统相对路径。
<img alt="Vue logo" src="./assets/logo.png">
如果 URL 以 ~ 开头会作为一个模块请求被解析。这意味着你甚至可以引用 Node 模块中的资源
<img src="~some-npm-package/... |
Python | UTF-8 | 989 | 3.078125 | 3 | [] | no_license | # get link
from bs4 import BeautifulSoup
from urllib.request import Request, urlopen
req = Request("https://warstek.com/category/sains-alam")
html_page = urlopen(req)
soup = BeautifulSoup(html_page, "lxml")
links = []
for result in soup.findAll('a'):
links.append(result.get('href'))
print(links)
# get web c... |
Markdown | UTF-8 | 11,274 | 2.78125 | 3 | [] | no_license | # Trabajo Práctico Final Foundations
### ITBA - Cloud Data Engineering
Bienvenido al TP Final de la sección Foundations del Módulo 1 de la Diplomatura en Cloud Data Engineering del ITBA.
En este trabajo práctico vas a poner en práctica los conocimientos adquiridos en:
1. Bases de Datos Relacionales (PostgreSQL espe... |
Python | UTF-8 | 4,060 | 2.625 | 3 | [] | no_license | import cv2
import numpy as np
# These 4 are too slow
# BIG anime eyes
def apBigErode(frame):
return cv2.erode(frame, kernBigEllipse)
# Makes thin things disappear
def apOpen(frame):
return cv2.morphologyEx(frame, cv2.MORPH_OPEN, kernBigEllipse)
# Very funky looking - blackens and makes... |
Java | UTF-8 | 764 | 2.390625 | 2 | [] | no_license | package org.hibernate.bugs.models;
import javax.persistence.*;
@Entity
public class OrganizationProduct {
@EmbeddedId
private OrganizationProductKey org_product_id;
@ManyToOne
private Product product;
public OrganizationProduct(OrganizationProductKey org_product_id, Product product) {
... |
PHP | UTF-8 | 185 | 2.796875 | 3 | [] | no_license | <?php
class Bracket {
protected $organizers = array();
protected function addOrganizers( $user_id ) {
}
protected function getOrganizers() {
return $this->organizers;
}
}
?> |
Markdown | UTF-8 | 10,327 | 2.734375 | 3 | [
"BSD-3-Clause",
"MIT",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | # graphql-gw
This is a GraphQL gateway that lets you easily compose or federate other
GraphQL upstream servers.
<img src="https://raw.githubusercontent.com/chirino/graphql-gw/master/docs/images/graphql-gw-overview.jpg" alt="diagram of graphql-gw" width="488">
## Features
* Consolidate access to multiple upstream Gr... |
C++ | UTF-8 | 831 | 3.5 | 4 | [] | no_license | /*#include<iostream>
#include<string>
#include<vector>
using namespace std;
class DrawYellow
{
public:
void draw()
{
cout << "yellow" << endl;
}
};
class DrawRed
{
public:
void draw()
{
cout << "red" << endl;
}
};
class geometricobject
{
public:
virtual void draw() = 0;
};
template<class Color>
class geo... |
PHP | UTF-8 | 1,265 | 2.515625 | 3 | [] | no_license | <!DOCTYPE html>
<html lang="es">
<head>
<link rel="stylesheet" href="css/estilo.css">
<link href='http://fonts.googleapis.com/css?family=Nunito:400,300' rel='stylesheet' type='text/css'>
<title>Mostrar Clientes</title>
</head>
<body background="imagenes/imagen3.jpg">
<?php
include('conexion.php')... |
Java | UTF-8 | 712 | 2.328125 | 2 | [] | no_license | package ru.masterdm.spo.utils;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
public class CollectStages {
private static volatile CollectStages instance;
public final ConcurrentHashMap<Long,HashSet<Long>> cache;
public static CollectStages singleton() {
CollectStages localInstance = i... |
Python | UTF-8 | 353 | 3.828125 | 4 | [] | no_license | t = int(input())
for i in range(t):
s = input().split(" ")
d = int(s[0])
n = int(s[1])
current = 0.0
for _ in range(n):
s = input().split(" ")
remaining = d - int(s[0])
speed = int(s[1])
time = remaining/speed
current = max(time, current)
print("Case... |
Markdown | UTF-8 | 16,272 | 3.078125 | 3 | [] | no_license | # 理解 Golang 的 GC
## GC
GC 的实现方式主要分为三大类
- 引用计数
- 标记清除
- 复制
具体的定义不是本文要说的,网上很多介绍,也可以看松本行弘的《代码的未来》这本书。
GC 还有很多优化技巧,最重要的两个是**压缩(compact)**和**分代(generational)**
一句话概括 Go 实现的 GC 是采用**不压缩、不分代的并发标记清除**的实现方式。
## SLO
**99%的 SLI 和 99%的 SLO 完全不同**
如果把一次请求视为一项 SLI,用户会话视为 SLO。具体定义可见《SRE:Google 运维解密》。如果一次会话需要 100 次请求来完成,每次请求有... |
PHP | UTF-8 | 1,850 | 2.65625 | 3 | [] | no_license | <?php
require 'e.php';
use \Event as Event;
use \EventBase as EventBase;
$socketAddress = "tcp://0.0.0.0:9000";
echo $socketAddress;
$server = stream_socket_server($socketAddress);
$eventBase = new EventBase();
//记录我们所创建的这样时间,让$eventBase可以找到这个事件
$count = [];
$event = new Event($eventBase,$server,Event... |
Java | UTF-8 | 4,972 | 3.1875 | 3 | [] | no_license | package com.utrasarvikingar.tictactoe;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TicTacServiceTest{
public static void main(String args[]){
org.junit.runner.JUnitCore.main("com.utrasarvikingar.TicTacServiceTest");
}
private TicTacService s = new TicTacService();
private c... |
Java | UTF-8 | 296 | 1.554688 | 2 | [] | no_license | package bedemo.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import bedemo.service.domain.Regeling;
@SuppressWarnings("unused")
@Repository
public interface RegelingRepo extends JpaRepository<Regeling, Long> {
}
|
Markdown | UTF-8 | 1,032 | 2.609375 | 3 | [
"MIT"
] | permissive | # Film app ( test )
## Two apps CLI-client and server with express.js
# About
## Installation
1. Clone this repository
```bash
git clone https://github.com/JohnyKovalenko1337/.git
```
2. Use the package manager [npm](http://www.npmjs.com/) to install dependencies.
```bash
npm install
```
## How to start?
1. node .... |
Markdown | UTF-8 | 1,776 | 3.703125 | 4 | [
"MIT"
] | permissive | # Singly Linked List
This project uses Python to create a Linked List. The list can have items added to it as well as use a search function. The list can also be printed out.
## Challenge
- Create a Node class that has properties for the value stored in the Node, and a pointer to the next Node.
- Within your LinkedL... |
Java | UTF-8 | 3,570 | 2.296875 | 2 | [] | no_license | package com.fh.controller.masterdata;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.Req... |
Shell | UTF-8 | 9,522 | 3.828125 | 4 | [] | no_license | #!/bin/sh
# Allow only root execution.
if [ `id|sed -e s/uid=//g -e s/\(.*//g` -ne 0 ]; then
echo "This script requires root privileges."
exit 1
fi
#
# Solaris/AIX version of GDMA start/stop script.
# Installed as, under Solaris:
# /opt/groundwork/ctlscript.sh
# Called from this script, under Solaris:
# /etc/... |
Python | UTF-8 | 3,582 | 3.46875 | 3 | [] | no_license | #Emile McLennan
#1 May '14
#A7 Q3
def push_up (grid):
"""merge grid values upwards"""
merged=[]
for i in range(5):
for colNum in range(4):
for rowNum in range(3):
#shift up
if grid[rowNum][colNum]==0:
grid[rowNum][c... |
Python | UTF-8 | 10,838 | 2.515625 | 3 | [] | no_license | #!/usr/bin/python3
"""
Top Level Interface for swing_dance_scores
Run this file directly and see the CLI's --help documentation for further details.
Owner : paul-tqh-nguyen
Created : 08/25/2019
File Name : swing_dance_scores.py
File Organization:
* Imports
* Main Runner
"""
###########
# Imports #
###########
... |
Shell | UTF-8 | 249 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env bash
pushd $(cd -P -- "$(dirname -- "$0")" && pwd -P)/..
docker-compose -f docker-compose.test.yml build
docker-compose -f docker-compose.test.yml up -d
docker logs -f docker_sut_1
RET=`docker wait docker_sut_1`
popd
exit $RET
|
Python | UTF-8 | 1,191 | 3.96875 | 4 | [] | no_license | '''
Detect cycle in undirected graph.
- We can use Union Find solution to find cycle in undirected graph. O(ELogV)
- We can use DFS to find cycle
- For every visited V, if there is an adjacent u such that u is visited and u is not parent of V.
- O(E + V)
'''
from Graph import graph
def iscycle... |
Python | UTF-8 | 1,713 | 2.796875 | 3 | [] | no_license | from models.team import Team
import sqlite3
class TeamD:
def __init__(self, conn, cursor):
self.conn = conn
self.cursor = cursor
def createTable(self):
self.cursor.execute('''
CREATE TABLE IF NOT EXISTS teams (
id TEXT,
name TEXT,
... |
C++ | UTF-8 | 202 | 2.59375 | 3 | [] | no_license | #include <iostream>
#include "ATNode.h"
using namespace std;
int main() {
string word = "abc";
ATNode root = ATNode(word, 0);
std::cout << root.children[1].letter << endl;
return 0;
} |
Shell | UTF-8 | 642 | 3.265625 | 3 | [] | no_license | #!/bin/bash
read -p "Do you want to create the mn_auto script? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd ~/wagerr-2.0.1/bin
cat <<EOT > mn_auto.sh
#!/bin/bash
SERVICE='wagerrd'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo “Masternode is running! Yay!”
else
~/wagerr-2.0.1/bin/./wagerrd
fi... |
Java | UTF-8 | 1,789 | 2.265625 | 2 | [] | no_license | package ru.rvsosn.eubmstubot.eubmstu;
import one.util.streamex.StreamEx;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.List;
import java.util.Map;
public class GetAllGroupsInLastSessionTask extends AbstractTask<GetAllGroupsInLastSessionResult> {
private static Str... |
Python | UTF-8 | 387 | 3.421875 | 3 | [] | no_license | import functools
def logger(func):
@functools.wraps(func)
def wrapped(*args, **kwards):
result = func(*args, **kwards)
with open('log.txt', 'w') as f:
f.write(str(result))
return result
return wrapped
@logger
def summator(num_list):
return sum(num_list)
print("Sum... |
Java | UTF-8 | 15,411 | 1.773438 | 2 | [
"Apache-2.0"
] | permissive | package com.matrix.mbank;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.TabActivity;
import android.content.DialogInterface;
import an... |
Python | UTF-8 | 360 | 3.734375 | 4 | [] | no_license | import random
import sys
x = (random.randint(0,100))
print("Press q to exit.")
y = input("Guess a number here: ")
while x != y:
if y == 'q':
break
elif int(y) > x:
y =int(input("Guess lower: "))
elif int(y) < x:
y = int(input("Guess higher: "))
if x == y:
print("You guessed the ... |
Python | UTF-8 | 411 | 3.65625 | 4 | [] | no_license | #!/usr/bin/env python2
'''
1. Use the split method to divide the following IPv6 address into groups of 4
hex digits (i.e. split on the ":")
FE80:0000:0000:0000:0101:A3EF:EE1E:1719
'''
ipv6_address = 'FE80:0000:0000:0000:0101:A3EF:EE1E:1719'
ipv6_address_section = ipv6_address.split(":")
print "IPv6 sections below"
p... |
Python | UTF-8 | 2,147 | 2.984375 | 3 | [] | no_license | from aylienapiclient import textapi
import threading
import time,sys
import urllib.request
from aylienapiclient.errors import HttpError
#Array of urls
urls = [ "https://www.facebook.com", "https://www.baidu.com", "https://www.yahoo.com", "https://www.wikipedia.org", "https://www.google.co.in", "https://www.qq.com", "h... |
Java | UTF-8 | 2,674 | 2.359375 | 2 | [] | no_license | package com.ceiba.reservasbarultimate.mesa.dominio.servicio;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.List;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import com.ceiba.reservasbarultimate.mesa.builders.MesaDtoTestDataBuilder;
import com.ceiba.reservasbarulti... |
Java | UTF-8 | 644 | 2.46875 | 2 | [] | no_license | package com.solvd.airportJava.services;
import com.solvd.airportJava.dao.interfaces.ICountryDAO;
import com.solvd.airportJava.dao.jdbc.impl.CountryDAO;
import com.solvd.airportJava.models.Country;
public class CountryService {
private ICountryDAO countryDAO = new CountryDAO();
public CountryService() {
}... |
Python | UTF-8 | 793 | 2.65625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import gzip, json, leveldb
filename = 'artist.json.gz'
dbname = 'artist_db2'
def main(filename, dbname):
db = leveldb.LevelDB(dbname)
with gzip.open(filename, 'r') as f:
for line in f:
obj = json.loads(line)
if 'tags' not in obj.keys():
... |
C | UTF-8 | 346 | 3.53125 | 4 | [
"MIT"
] | permissive | /*
Name - Nikhil Ranjan Nayak
Regd no - 1641012040
Desc - annual population.
*/
#include "stdio.h"
void main()
{
int pop = 9870, year = 1;
printf("\nYear %10c Population", ' ');
while(pop <= 30000)
{
printf("\nYear %d %10c %d", year, ' ', pop);
pop += (0.1 * pop);
year++;
}
printf("\nIn year %d,the populat... |
C++ | UTF-8 | 11,458 | 3.546875 | 4 | [] | no_license | #ifndef _RB_TREE_H_
#define _RB_TREE_H_
#include <iostream.h>
// <summary>
// RBNode is a red-black tree node with parameterized value
// </summary>
//
// <synopsis>
// RBNode stores three pointers to parent, left, and right nodes.
// The second constructor allows the user of RBNode to specify a
//... |
Ruby | UTF-8 | 872 | 2.75 | 3 | [] | no_license | class TradierApi
attr_accessor :symbol, :price, :volume, :timestamp
def initialize(underlying)
uri = URI.parse("https://sandbox.tradier.com/v1/markets/quotes?symbols=#{underlying}")
http = Net::HTTP.new(uri.host, uri.port)
http.read_timeout = 30
http.use_ssl = true
http.verify_mode = OpenSSL::SS... |
Java | UTF-8 | 4,071 | 2.265625 | 2 | [] | no_license | package com.cooltoo.services.file;
import com.cooltoo.exception.BadRequestException;
import com.cooltoo.exception.ErrorCode;
import com.cooltoo.services.FileStorageDBService;
import com.cooltoo.util.VerifyUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation... |
TypeScript | UTF-8 | 293 | 2.609375 | 3 | [] | no_license | export class Vehiculo{
tipoVehiculo: string;
placa: string;
horaIngreso: Date;
constructor(tipoVehiculo: string, placa: string,horaIngreso: Date ) {
this.tipoVehiculo = tipoVehiculo;
this.placa = placa;
this.horaIngreso = horaIngreso;
}
}
|
Java | UTF-8 | 1,474 | 2.984375 | 3 | [] | no_license | package autoMag.httpManager;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class Request {
public static String sendPOST(String url, String content) throws IOException {
U... |
JavaScript | UTF-8 | 999 | 2.59375 | 3 | [
"ISC",
"MIT"
] | permissive | import {CART, ADD, REMOVE} from '../../assets/constant';
const initialState = {
products: [
],
addresses: [
'1 Material-UI Drive', 'Reactville', 'Anytown', '99999', 'USA'
],
payments: [
{ name: 'Card type', detail: 'Visa' },
{ name: 'Card holder', detail: 'Mr XYZ' },
... |
C# | UTF-8 | 4,389 | 2.578125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;... |
Swift | UTF-8 | 1,377 | 2.6875 | 3 | [] | no_license | //
// ViewController.swift
// customCells
//
// Created by Estudiantes on 19/5/18.
// Copyright © 2018 Juan Carlos Marin. All rights reserved.
//
import UIKit
class FavoritoTableViewCell: UITableViewCell {
@IBOutlet weak var lblNombre: UILabel!
@IBOutlet weak var imgEquipo: UIImageView!
}
class Lista... |
Python | UTF-8 | 673 | 3.0625 | 3 | [] | no_license | t=int(input())
for i in range(0,t):
n=int(input())
X=dict();
Y=dict();
n=4*n-1
for i in range(0,n):
x, y = input().split()
x = int(x)
y = int(y)
if x in X :
X[x]+=1
else :
X[x]=1;
if y in Y :
Y[y... |
Java | UTF-8 | 5,258 | 1.921875 | 2 | [
"Apache-2.0"
] | permissive | package io.fabric8.api.jmx;
import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apach... |
Java | UTF-8 | 700 | 2.3125 | 2 | [] | no_license | package com.automation.Step;
import com.automation.Pages.SearchPage;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class SearchStep {
SearchPage searchpage = new SearchPage();
@Given("^user is on ebay homepage$")
public void user_is_on_ebay_... |
C++ | UTF-8 | 653 | 2.9375 | 3 | [] | no_license | #pragma once
#include "../lists/array-list.h"
#include "../lists/linked-list.h"
#include "../date/DateTime.h"
#include <vector>
template <class T>
void swap(T* a, T* b)
{
T t = *a;
*a = *b;
*b = t;
}
template <class T>
int partition(vector<T>& vec, int low, int high);
template <class T>
void quickSort(vector<T>& v... |
Java | UTF-8 | 358 | 1.859375 | 2 | [
"MIT"
] | permissive | /*
* Copyright (c) 2014, Lukas Tenbrink.
* * http://ivorius.net
*/
package ivorius.reccomplex.nbt;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
/**
* Created by lukas on 30.03.15.
*/
public class NBTNone implements NBTStorable
{
@Override
public NBTBase writeToNBT()
{... |
Markdown | UTF-8 | 6,489 | 3.046875 | 3 | [] | no_license | ## Web开发简介
因为Go的`net/http`包提供了基础的路由函数组合与丰富的功能函数,所以在开源社区里流行一种用Go编写API不需要框架的观点,在我们看来,如果你的项目的路由在个位数、URI固定且不通过URI来传递参数,那么确实使用官方库也就足够了。但在复杂场景下,官方的HTTP库还是有些力有不逮
```
GET /card/:id
POST /card/:id
DELETE /card/:id
GET /card/:id/name
```
Go的Web框架大致可以分为两类:
- Router框架
- MVC类框架
简单来说,只要你的路由带有参数,并且这个项目的API数目超过了10,就尽量不要使用`... |
Java | UTF-8 | 12,178 | 1.96875 | 2 | [] | no_license | package org.simmi;
import java.awt.Color;
import java.awt.Component;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayLis... |
Java | UTF-8 | 767 | 2.15625 | 2 | [] | no_license | package com.klazen.shadesbot.plugin;
import java.util.regex.Matcher;
import com.klazen.shadesbot.core.MessageOrigin;
import com.klazen.shadesbot.core.MessageSender;
import com.klazen.shadesbot.core.ShadesBot;
public class WelcomeHandler extends SimpleMessageHandler {
public WelcomeHandler(ShadesBot bot) {
super(... |
Java | UTF-8 | 908 | 3.25 | 3 | [] | no_license | package br.com.phbit.cryptography.enumerator;
public enum CryptographyAlgorithm {
AES("AES", "Advanced Encryption Standard"),
DES("DES", "Data Encryption Standart"),
RSA("RSA", "Rivest Shamir Adleman");
private String initials;
private String description;
private CryptographyAlgorithm(String initials, String d... |
PHP | UTF-8 | 604 | 2.5625 | 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.
*/
/**
* Description of Gra
*
* @author andrzej.mroczek
*/
class Gra extends Decorator {
public function __construct(ICom... |
Python | UTF-8 | 558 | 3.140625 | 3 | [] | no_license | class Solution:
def help(self, s1, s2, s3):
res = False
if len(s1) == 0:
res = s2 == s3
elif len(s2) == 0:
res = s1 == s3
else:
if s1[0] == s3[0]:
res = res or self.help(s1[1:], s2, s3[1:])
if s2[0] == s3[0]:
... |
JavaScript | UTF-8 | 618 | 2.71875 | 3 | [] | no_license | import {
observable
} from 'mobx';
export default class TimeModel {
store;
id;
@observable birthday;
@observable gender;
constructor(store, id, birthday, gender) {
this.store = store;
this.id = id;
this.birthday = birthday;
this.gender = gender;
}
destroy() {
this.store.remove(thi... |
TypeScript | UTF-8 | 750 | 2.609375 | 3 | [] | no_license | import { format } from "../../deps.ts";
import { CustomComponent } from "../component.ts";
interface Dependencies {
// deno-lint-ignore no-explicit-any
customWindow: any;
dateGenerator: () => Date;
}
export const componentWith = (
{ customWindow, dateGenerator }: Dependencies,
): CustomComponent => {
class ... |
Python | UTF-8 | 8,463 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 03:36:15 2020
@author: kanikamiglani
"""
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
import re
from sklearn.model_selection import train_test_spl... |
SQL | UTF-8 | 1,881 | 4.1875 | 4 | [] | no_license | --Basic
select *
from employees;
select *
from departments;
select *
from jobs;
--Catesian Product
select *
from employees, departments;
--PK FP
select employee_id,
first_name,
e.department_id,
d.department_name
from employees e, departments d
where e.department_id = d.d... |
JavaScript | UTF-8 | 815 | 4.59375 | 5 | [] | no_license | // Take a series of numbers [1, ..., 10] add them together then square it. We will call this X. Now take that same series of numbers
// [1,...,10], square each number in the series, then add them together. Call this Y. X - Y is the answer. Now do that for [1,...,100].
// Basically, find the diff between the square of t... |
Markdown | UTF-8 | 1,977 | 3.03125 | 3 | [] | no_license | # Golang学习——前言
## 0.0
1. Golang于2009年11月发布,发明人 Robert Griesemer,Rob Pike 和 Ken Thompson均任职于Google。
2. Go和C表面看起来相似,实际远不止是C的升级版本。其优势如下:
* Go实现并发功能的设施是全新的、高效的。
* Go实现数据抽象和面向对象的途径是灵活的。
* Go实现了自动化的内存管理,即**垃圾回收**。
3. Go特别适用于构建基础设施类软件(如**网络服务器**s),以及程序员使用的**工具**和**系统**等。
4. Go的运行环境包括类UNIX系统和Windows系统。 只要在其中之一的环境中写了一个程序,... |
Shell | UTF-8 | 621 | 3.375 | 3 | [] | no_license | #!/bin/sh
WEBHOOKURL="xxxxxxx"
MESSAGEFILE=$1
#slack 送信チャンネル
CHANNEL=${CHANNEL:-"#xxxxxxx"}
#slack 送信名
BOTNAME=${BOTNAME:-"bacula job result"}
#slack アイコン
FACEICON=${FACEICON:-":hamster:"}
TMPFILE=$(mktemp)
cat ${MESSAGEFILE} | tr '\n' '\\' | sed 's/\\/\\n/g' > ${TMPFILE}
WEBMESSAGE=$(cat ${TMPFILE})
curl -s -S -X P... |
PHP | UTF-8 | 1,659 | 2.515625 | 3 | [] | no_license | <?php
namespace App\Http\Controllers\Admin;
use App\Models\Content;
use Illuminate\Http\Request;
use App\Models\Cites;
use App\Models\Schools;
use App\Http\Controllers\Controller;
/**
* This class is used for "/admin/data/..." pages
*
*/
class DataController extends Controller
{
public function showPage(Requ... |
Markdown | UTF-8 | 10,990 | 2.96875 | 3 | [] | no_license | # Rencontre du troisième type
> Le renard se tut et regarda longtemps le petit prince :
>
> -- S'il te plaît... apprivoise-moi ! dit-il.
>
> -- Je veux bien, répondit le petit prince, mais je n'ai pas beaucoup de
> temps. J'ai des amis à découvrir et beaucoup de choses à connaître.
>
> -- On ne connaît que les choses ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.