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 |
|---|---|---|---|---|---|---|---|
Rust | UTF-8 | 4,662 | 3.34375 | 3 | [] | no_license | //! Exercise for using logging statements appropriately.
//!
//! This exercise contains many println! statements which
//! should not be released as part of making the code public.
//! It would be better to add useful logging statements with
//! appropriate severity levels to the MemoryBuffer API instead.
//!
//! 1) In... |
Java | UTF-8 | 293 | 2.8125 | 3 | [] | no_license | package com.leach.advance.annotation.meta.inherited;
/**
* @author Administrator
* @name 概述:
* @date 2019/3/6 15:54
*/
public class Cat extends Animal {
@Override
public void sayMyself() {
System.out.println("大家好,我是猫咪^_^!");
}
}
|
C++ | UTF-8 | 492 | 2.75 | 3 | [] | no_license | #pragma once
struct node
{
node* parent;
node* left;
node* right;
int key;
int height;
int heaviness;//right->height - left->height
};
class AVL
{
private:
node* AVLRootNode;
int kValue;
public:
AVL(void);
void addNode(void);
void printAVL(node*);
node* getRootNode(v... |
Markdown | UTF-8 | 2,904 | 3.625 | 4 | [
"MIT",
"Apache-2.0"
] | permissive | ---
layout: post
title: "Problem: Serialize and Deserialize BST"
date: 2015-02-18 00:00:00
author: "Marcy"
header-img: "img/post-bg-2015.jpg"
catalog: true
category: algnote
algnote-tags:
- Coding Interview
- Coding Practice
- Algorithms and Data Structures
- Tree
- Binary Tree
... |
Java | UTF-8 | 4,729 | 3.65625 | 4 | [] | no_license | package uk.ac.qub.UpdatedCalculator;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class Testing {
CalculatorMethods cm = new CalculatorMethods();
@Before
public void setUp() throws Exception {
}
@Test
public void testAddMe() { //Testing AddMe meth... |
Shell | UTF-8 | 150 | 2.765625 | 3 | [] | no_license | #!/bin/bash
BASEDIR="$(dirname "$0")"
ROOT="$(realpath $BASEDIR/..)"
PYTH="$(which python)"
PWD="$(pwd)"
cd $ROOT
$PYTH $ROOT/test/test.py
cd $PWD |
Java | UTF-8 | 1,627 | 3.5 | 4 | [
"CC0-1.0"
] | permissive | package mx.com.ventas;
public class Orden {
private final int idOrden;
private final Producto[] productos;
private static int contadorOrdenes;
private int contadorProductos;
private static final int MAX_PRODUCTOS = 10;
public Orden() {
this.idOrden = ++Orden.contadorOrdenes;
... |
Markdown | UTF-8 | 5,236 | 3.0625 | 3 | [] | no_license | # Data Visualization Final 2019
## Team Member : Vaidehi Thete (vvt221)
## Tasks Chosen:
1. What is the serving rate for each scenario throughout the day, comparing to the overall serving rate?
Serving rate is the number of successfully matched trip in a period of time. For example, is the serving
rate higher in the... |
Java | UTF-8 | 3,366 | 2.3125 | 2 | [] | no_license | package cursedflames.modifiers.common.config;
import java.nio.file.Path;
import java.util.Arrays;
import java.util.List;
import com.electronwill.nightconfig.core.file.CommentedFileConfig;
import com.electronwill.nightconfig.core.io.WritingMode;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftfo... |
Python | UTF-8 | 398 | 3.171875 | 3 | [] | no_license | from typing import *
class Solution:
"""
https://www.cnblogs.com/grandyang/p/5226206.html
博弈的问题,竟然能用这种方式。那么292题也能用这种方式了
"""
def canWin(self, s):
for i in range(1, len(s)):
if s[i] == "+" and s[i-1] == "+" and not self.canWin(s[0:i-1] + '--' + s[i+1:]):
return Tr... |
PHP | UTF-8 | 800 | 2.96875 | 3 | [
"MIT"
] | permissive | <?php
/**
* Part of the tueena lib
*
* @license http://www.opensource.org/licenses/mit-license.php MIT License
* @link http://tueena.org/
* @author Bastian Fenske <bastian.fenske@tueena.org>
* @file
*/
declare(strict_types=1);
namespace tueenaLib\sql\results;
class SelectResult implements ISelectResult
{
/**... |
JavaScript | UTF-8 | 1,999 | 2.765625 | 3 | [] | no_license | var mongo = require("./Mongo.js");
var codesReponse = require("./responseCodes.js");
exports.inscriptionHandler = function(login, mdp){
return new Promise(function(resolve,reject){
mongo.findPlayer(login).then(function(playerFound){
if(playerFound){
reject(new responseObject(fal... |
Python | UTF-8 | 599 | 2.75 | 3 | [] | no_license | from PIL import Image
import struct
def read_image(filename):
f = open(filename,'rb')
index = 0
buf = f.read()
f.close()
magic,images,rows,colums = struct.unpack_from('>IIII',buf,index)
index += struct.calcsize('>IIII')
for i in xrange(images):
image = Image.new('L',(colums,rows))
... |
PHP | UTF-8 | 2,003 | 2.734375 | 3 | [] | no_license | <?php
include('connection.php');
if(isset($_POST['upload'])){
$name = $_FILES['file']['name'];
$target_dir = "audioupload/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);
$audiodescription = ($_REQUEST['audiodescrition']);
$audioFileType = strtolower(pathinfo($target_file,... |
Java | UTF-8 | 11,139 | 1.914063 | 2 | [
"ISC",
"Apache-2.0",
"MIT"
] | permissive | package act.mail;
/*-
* #%L
* ACT Framework
* %%
* Copyright (C) 2014 - 2017 ActFramework
* %%
* 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... |
Java | UTF-8 | 4,445 | 3.125 | 3 | [] | no_license | package com.xyw.util.helper;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.s... |
C++ | UTF-8 | 1,069 | 2.96875 | 3 | [] | no_license | /*************************************************************************
> File Name: B1004.cpp
> Author: ji_zhang
> Mail:
> Created Time: 2017/11/10 1:52:52
************************************************************************/
#include <algorithm>
#include<iostream>
#include <string>
#include <v... |
Python | UTF-8 | 418 | 2.90625 | 3 | [] | no_license | #
# @lc app=leetcode id=1637 lang=python3
#
# [1637] Widest Vertical Area Between Two Points Containing No Points
#
# @lc code=start
class Solution:
def maxWidthOfVerticalArea(self, points: List[List[int]]) -> int:
temp = [i[0] for i in points]
temp.sort()
ans = 0
for i in range(... |
Shell | UTF-8 | 1,025 | 3.953125 | 4 | [
"Apache-2.0"
] | permissive | #!/bin/bash
#
# Add a newly launched service to the load balancer.
set -eou pipefail
[ ! $# = 3 ] && {
cat <<USAGE >&2
Usage: peekaboo-up <container> <port> <lb id>
Adds or updates a node on a load balancer that corresponds to a published port of a named
Docker container.
USAGE
exit 1
}
CONTAINER_NAME=${1:-}
... |
C# | UTF-8 | 16,332 | 2.546875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;
namespace UNOService
{
public class DatabaseHandler
{
private MySqlConnection connection;
private string serverIP = "localhost";
private str... |
PHP | UTF-8 | 967 | 3.453125 | 3 | [] | no_license | <?php
require('noPhpredis.php');
/*
Basic 'static' usage. Stores all three supported types, retrieves them.
*/
/*
Basic use, store a string to a key value
*/
print_r(noPhpredis::put('test_string','test'));
/*
Stores an 1 dimensional assoc. array (or object) as a hash; embedded arrays/objects are serial... |
Java | UTF-8 | 446 | 2.03125 | 2 | [] | no_license | package com.yfr.model;
public class OrdersKey {
private Integer orderid;
private String username;
public Integer getOrderid() {
return orderid;
}
public void setOrderid(Integer orderid) {
this.orderid = orderid;
}
public String getUsername() {
return username;
... |
Java | UTF-8 | 355 | 3.5625 | 4 | [] | no_license | import java.util.Scanner;
public class MajorMinor {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter age:");
int a = s.nextInt();
if(a>= 18)
{
System.out.println("Major");
}
else if(a < 0 )
{
System.out.println("Invalid Age");
}
else
... |
Markdown | UTF-8 | 1,921 | 3.546875 | 4 | [] | no_license | ## Week 1 Questions (optional)
*Social network connectivity.*
Given a social network containing n members and a log file containing m timestamps at which times pairs of members formed friendships, design an algorithm to determine the earliest time at which all members are connected (i.e., every member is a friend of a ... |
Java | UTF-8 | 10,232 | 3.15625 | 3 | [] | no_license | import java.util.Scanner;
import java.io.*;
import java.sql.*;
/**
*The databaseDriver class contains the main method, which does most of the printing to the terminal and user interface
*/
public class databaseDriver {
/**
* The main method prints to the console and gathers information to send to the 3 "ac... |
Java | UTF-8 | 304 | 2.171875 | 2 | [] | no_license | package com.github.justinespinosa.textmode.curses.ui.event;
public class UiInputEvent extends UiEvent {
private TerminalInputEvent original;
public UiInputEvent(TerminalInputEvent e) {
super(e.getSource());
original = e;
}
public TerminalInputEvent getOriginalEvent(){
return original;
}
}
|
Java | UTF-8 | 713 | 2.59375 | 3 | [] | no_license | package org.tz.pos.Lagerverwaltung;
public class Lieferant {
private int lieferantenNr;
private String lieferantenName;
public Lieferant(int lieferantenNr, String lieferantenName) {
this.lieferantenNr = lieferantenNr;
this.lieferantenName = lieferantenName;
}
public Lieferant() {
}
public int getL... |
Java | UTF-8 | 1,613 | 2.25 | 2 | [] | no_license | package com.Group2.InterestCalc.Controllers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotat... |
C | UTF-8 | 227 | 2.5625 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include "bulacio.h"
int main()
{
int n1, n2;
printf("%d", getIntRange("Ingrese una nota: ", "ERROR. Ingrese una nota valida: ", 0, 10, 3, -1));
return 0;
}
|
Python | UTF-8 | 1,915 | 4.125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:ShidongDu time:2020/4/4
'''
给你一个字符串 s 和一个整数 k 。请你用 s 字符串中 所有字符 构造 k 个非空 回文串 。
如果你可以用 s 中所有字符构造 k 个回文字符串,那么请你返回 True ,否则返回 False 。
示例 1:
输入:s = "annabelle", k = 2
输出:true
解释:可以用 s 中所有字符构造 2 个回文字符串。
一些可行的构造方案包括:"anna" + "elble","anbna" + "elle","anellena" + "b"
... |
PHP | UTF-8 | 6,168 | 2.59375 | 3 | [] | no_license | <?php
class PostsController extends AppController
{
public function execute()
{
/*
* inherits from base controller: read-only
* $this->request;
* $this->request_parts;
* $this->page;
* $this->current_theme_pages_dir;
* $this->current_theme_templates_dir;
*/
/*
* inherits from base con... |
C | UTF-8 | 7,386 | 2.546875 | 3 | [
"BSD-2-Clause"
] | permissive | /*
* Copyright (c) 2016-2018 Mindaugas Rasiukevicius <rmind at noxt eu>
* All rights reserved.
*
* Use is subject to license terms, as specified in the LICENSE file.
*/
/*
* Epoch-based reclamation (EBR). Reference:
*
* K. Fraser, Practical lock-freedom,
* Technical Report UCAM-CL-TR-579, February 2004
* ht... |
Java | GB18030 | 375 | 1.570313 | 2 | [] | no_license | package com.lzairport.ais.service.telex;
import javax.ejb.Remote;
import com.lzairport.ais.models.telex.AllowType;
import com.lzairport.ais.service.IService;
/**
* 籨Serviceӿ
* @author ZhangYu
* @version 0.9a 29/04/15
* @since JDK 1.6
*
*/
@Remote
public interface IAllowTypeService extends ISer... |
Java | UTF-8 | 4,176 | 2.53125 | 3 | [] | no_license | package ca.concordia.lanterns.tileplacement.impl;
import java.util.Arrays;
import java.util.List;
import ca.concordia.lanterns.controllers.GameController;
import ca.concordia.lanterns.exchange.impl.helper.DedicationThreat;
import ca.concordia.lanternsentities.DedicationTokenWrapper;
import ca.concordia.lanternsentiti... |
Java | UTF-8 | 12,323 | 2.984375 | 3 | [] | no_license | package com.hackthon.samurai.util;
import java.sql.Date;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class DateUtil {
public static final String YYYYMMDD_SLASH = "yyyy/MM/dd";
public static final Strin... |
SQL | UTF-8 | 1,574 | 3.71875 | 4 | [] | no_license | drop database HCA;
create database HCA;
use HCA;
create table users (
ID int(10) NOT NULL AUTO_INCREMENT,
USERNAME varchar(50) NOT NULL,
EMAIL varchar(50) NOT NULL,
PASSWORD varchar(50) NOT NULL,
ISADMIN varchar(1) NOT NULL DEFAULT 0,
createdAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updat... |
JavaScript | UTF-8 | 2,799 | 2.65625 | 3 | [] | no_license |
var path = require('path');
var fs = require('fs');
var AD = require('ad-utils');
var async = require('async');
var currentOptions = {
loginCorrect:true,
key:'mockGMA'
}
var GMA = function(options) {
this.data={
assignments:[],
measurements:[]
};
this.lookup = {
assign... |
PHP | UTF-8 | 927 | 3.234375 | 3 | [
"BSD-3-Clause"
] | permissive | <?php
namespace Bencode\Core\Traits;
/**
* Primarily used in the Bencode factory object, this Trait defines a method
* that can be used to either `read` or `decode` a value into an object given.
*
* This method is *fail-safe* up to the point of throwing internal Exceptions
* from each individual Element.
*/
tra... |
JavaScript | UTF-8 | 521 | 2.78125 | 3 | [] | no_license | import React from 'react';
/*
Добавить сортировку для задач по названию задачи
*/
const TasksSorter = (props) => {
const {tasks, sortCallback} = props;
const sortByName = () => {
tasks.sort((t1, t2) => {
if (t1.name < t2.name)
return -1;
if (t1.name > t2.name)
return 1;
return 0;
});
sortCa... |
Markdown | UTF-8 | 2,117 | 3.046875 | 3 | [] | no_license | ---
date: 2013-01-05
layout: text
alias: /post/39755076457/scripting-gmail
title: Scripting Gmail
categories: [thought]
---
<p>In an attempt to get on top of my email this year, I thought about writing an app to auto cleanup my inbox based on various rules. I love the idea of inbox zero, but would rather a lot of the ... |
Java | UTF-8 | 210 | 2.390625 | 2 | [] | no_license | package domain;
public class Message {
public String message;
public Person sender;
public Message(String message, Person sender){
this.message=message;
this.sender=sender;
}
}
|
TypeScript | UTF-8 | 3,498 | 2.640625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import { CellClassParams, ColDef } from "../entities/colDef";
import { Autowired, Bean } from "../context/context";
import { ExpressionService } from "../valueService/expressionService";
import { BeanStub } from "../context/beanStub";
import { RowClassParams } from "../entities/gridOptions";
@Bean('stylingService')
ex... |
C++ | UTF-8 | 2,843 | 3.296875 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.cpp :+: :+: :+: ... |
Java | UTF-8 | 7,429 | 1.796875 | 2 | [] | no_license | package com.leasing.rentearly.rentearlyservice.projectInfo.enity.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.leasing.common.base.entity.BaseDTO;
import com.leasing.common.entity.foundation.vo.OrgVO;
import javax.persistence.*;
import java.math.BigDecimal;
/**
* @project:leasing-clo... |
PHP | UTF-8 | 1,644 | 2.609375 | 3 | [
"MIT"
] | permissive | <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="Evenementen Website" />
<meta name="keywords" content="HTML,CSS,JavaScript" />
<meta name="author" content="Brent Berghmans" />
<link rel="stylesheet" href="/~brentberghmans/styles/generalStyle.css" type="text/css" />
<script ... |
Java | UTF-8 | 1,102 | 3.53125 | 4 | [] | no_license | package com.xiechao.swordToOffers.algorithms.tree;
import com.xiechao.swordToOffers.algorithms.TreeNode;
/**
* @ClassName LeetCode654
* @Author xiechao
* @Date 2019/3/25
* @Time 10:20
* @Description LeetCode654 Maximum Binary Tree
*
* 给出一个数组,构造二叉树,要求
* - 根节点是最大值
* - 左孩子是位于最大值左侧的最大值
* - 右孩子是位于最大值右侧的最大值
*/
p... |
Markdown | UTF-8 | 3,592 | 2.875 | 3 | [] | no_license | # Solar System Navigator - team SET-CI
As a team, we want to share our love and enthusiasm for the solar system with anyone searching for information about the cosmos. We chose a responsive design for functional viewing and user interaction from any screen size. Users can easily navigate through beautiful and informat... |
C++ | UTF-8 | 1,373 | 2.84375 | 3 | [] | no_license | #include <cstdio>
#include <iostream>
#include <string>
#include <stack>
#include <algorithm>
using namespace std;
typedef long long int ll;
ll arr[21];
ll fact (int n)
{
if(n == 0 || n == 1)
return 1;
arr[n] = n * fact(n - 1);
return arr[n];
}
int main()
{
int tes, o = 0;
scanf("%d", &tes);... |
Python | UTF-8 | 1,136 | 2.734375 | 3 | [] | no_license | from _collections import deque
n, m = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(n)]
dx, dy = [-1, 1, 0, 0], [0, 0, -1, 1]
chick_map = []
house_map = []
for i in range(n):
for j in range(n):
if data[i][j] == 2:
chick_map.append((i, j))
elif data[i... |
C++ | UTF-8 | 330 | 2.609375 | 3 | [] | no_license | #include "types.h"
m_Point::m_Point()
{
x = y = t = 0;
for each (GLdouble xt in coeff_xt) xt = 0.0;
for each (GLdouble yt in coeff_yt) yt = 0.0;
}
m_Point::m_Point(GLdouble x, GLdouble y)
{
this->x = x;
this->y = y;
this->t = 0;
for each (GLdouble xt in coeff_xt) xt = 0.0;
for each (GLdouble yt in coeff_yt) y... |
Java | UTF-8 | 893 | 3.453125 | 3 | [] | no_license | /**
*
*/
package RandomGuessMatch;
/**
* @author MH137428
*
*/
import javax.swing.JOptionPane;
public class randomGuessMatchBoolean
{
/**
* @param args
*/
public static void main(String[] args)
{
boolean response;
String answer;
int random, input, difference;
final int min = 1;
final int max ... |
Java | UTF-8 | 213 | 1.8125 | 2 | [
"MIT"
] | permissive | package uk.gov.hmcts.reform.fpl.enums;
public enum HearingStatus {
ADJOURNED,
ADJOURNED_AND_RE_LISTED,
ADJOURNED_TO_BE_RE_LISTED,
VACATED,
VACATED_AND_RE_LISTED,
VACATED_TO_BE_RE_LISTED
}
|
C# | UTF-8 | 524 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace Assets
{
public class BaseGameObject : MonoBehaviour
{
public void WaitForSeconds(Action action, float time)
{
StartCoroutine(CoWaitForSecond... |
PHP | UTF-8 | 398 | 2.703125 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Models;
use DB;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'users';
/**
* select sms
*
* @return Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function select... |
Java | UTF-8 | 1,170 | 2.5 | 2 | [] | no_license | package com.zgh.spring.ioc.container;
import com.zgh.spring.ioc.container.bean.BeanDefinition;
import com.zgh.spring.ioc.container.bean.BeanProperty;
import com.zgh.spring.ioc.container.bean.BeanPropertys;
import com.zgh.spring.ioc.container.factory.BeanFactory;
import com.zgh.spring.ioc.container.factory.DefaultBeanF... |
C# | UTF-8 | 683 | 3.078125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
namespace InheritanceRefactorings.ReplaceDelegationWithInheritance.Bad
{
public class EmployeeCollection
{
private List<Employee> _employees = new List<Employee>();
public int Count { get { return _employees.Count; } }
... |
Markdown | UTF-8 | 2,508 | 2.609375 | 3 | [] | no_license | # Lazarus-VPN
# "vpn" directory
EasyRSA
This Repository contains EasyRsa directory, which is used to initialize pki to crate CA and issue/revoke/renew certificates.
Configs
configs/base
Config directory contains base config parameters for client configuration based on OS type i.e. Windows, Linux or Mac.
config/clie... |
Java | UTF-8 | 1,187 | 2.34375 | 2 | [] | no_license | package com.accipio.tutorme;
import android.app.Application;
import android.graphics.Bitmap;
/**
* Created by rachel on 2016-11-02.
*/
public class TutorMeApplication extends Application {
private String userID;
private String firstName;
private String lastName;
private String email;
private b... |
C# | UTF-8 | 8,419 | 2.796875 | 3 | [] | no_license | using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Reflection;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
namespace RangeSelect
{
public partial class SelectionRangeSlider : UserControl
{
/// <summary>
/// Enumeration fo... |
Java | UTF-8 | 3,347 | 2.359375 | 2 | [] | no_license | package com.sxh.demo.adapters;
import android.content.Context;
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.TextView;
import com.bumptech.glide.Glide;
import com.bumpte... |
Python | UTF-8 | 7,156 | 2.84375 | 3 | [] | no_license | import os
import pandas as pd
import numpy as np
from flask_cors import CORS
__location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__)))
from flask import Flask, jsonify, request
app = Flask(__name__)
CORS(app)
@app.route('/home')
def home():
headers = ['year', 'level_1', 'level_2', 'v... |
C# | UTF-8 | 799 | 2.671875 | 3 | [] | no_license | /* ****************************************************************
* SharpSword zhangliang4629@163.com 10/3/2016 4:28:58 PM
* ****************************************************************/
using System;
namespace SharpSword.Events
{
/// <summary>
/// 此接口返回对象构造函数入参数据,方便在运行时创建此对象的时候作为入参创建对象
/... |
Shell | UTF-8 | 236 | 3 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
set -ex
trap killcontainer ERR
function killcontainer(){
killall -9 sleep
}
while true ; do
sleep 10
curl -s http://172.22.0.1:5050 > /dev/null || ( echo "Can't contact ironic-inspector-api" && exit 1 )
done
|
JavaScript | UTF-8 | 535 | 3.640625 | 4 | [] | no_license | var add = function(a,b){
return a+b;
}
var myObject = {
value:0,
increment:function (inc){
this.value += typeof inc === 'number' ? inc :1;
}
};
myObject.increment();
document.writeln(myObject.value);
myObject.increment(2);
document.writeln(myObject.value);
var sum = add(3,4);
myObject.double ... |
Rust | UTF-8 | 516 | 2.875 | 3 | [
"MIT",
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"BSD-3-Clause",
"BSD-2-Clause",
"NCSA"
] | permissive | //! Check that fold closures aren't duplicated for each iterator type.
// compile-flags: -C opt-level=0
fn main() {
(0i32..10).by_ref().count();
(0i32..=10).by_ref().count();
}
// `count` calls `fold`, which calls `try_fold` -- find the `fold` closure:
// CHECK: {{^define.*Iterator::fold::.*closure}}
//
// On... |
PHP | UTF-8 | 1,018 | 2.578125 | 3 | [
"MIT"
] | permissive | <?php
use Windwalker\Renderer\BladeRenderer;
class HotPostsWidget extends WP_Widget {
private $blade;
function __construct() {
parent::__construct( 'hot_posts_widget', '熱門文章1',
['description'=>'這是一個會顯示熱門文章的小工具,資料來源是 Google Analytics']
);
$this->blade = new BladeRenderer(__D... |
Python | UTF-8 | 2,548 | 2.734375 | 3 | [
"MIT"
] | permissive | import json
from flask import Flask, jsonify, abort, request
from modules.quiz.controllers import Controller
from modules.quiz.utils.data import get_str
from modules.quiz.utils.quiz import quiz_helper
app = Flask(__name__)
controller = Controller()
def run():
app.run()
# @app.route('/quiz', methods=['GET', 'PO... |
PHP | UTF-8 | 721 | 2.53125 | 3 | [] | no_license | <?php
session_start();
function blockPage()
{
$blockRoutes = ['login'];
$currentUri = $_SERVER['REQUEST_URI']; //todos/edit/....
foreach($blockRoutes as $route)
{
if(strpos($currentUri, $route)){
return true;
}
}
return false;
}
if(!blockPage() && empty($_SES... |
C++ | UTF-8 | 4,217 | 3.0625 | 3 | [] | no_license | #include "GDFReader.h"
GDFReader::GDFReader(){}
GDFReader::GDFReader(string inputfilepath,string outputfilepath){
this->setinputFilePath(inputfilepath);
this->setoutputFilePath(outputfilepath);
}
GDFReader::~GDFReader(){}
inline string GDFReader::trim(string s){
string str=s;
str.erase(0, str.find_fi... |
Shell | UTF-8 | 4,260 | 3.28125 | 3 | [] | no_license | #!/bin/bash
#
# This file is released under the terms of the Artistic License.
# Please see the file LICENSE, included in this package, for details.
#
# Copyright (C) 2005 Jenny Zhang & Open Source Development Labs, Inc.
#
#
# This file is modified for adding MySQL support.
#
# (c)Copyright 2006 Hewlett-Packard Develo... |
C++ | UTF-8 | 446 | 2.6875 | 3 | [] | no_license | #include "../externals/csvstream/csvstream.h"
#include "containers.h"
using namespace std;
// Main Function
int main()
{
std::vector<Data> pet_owners;
std::string in_file = "../data/input.csv";
LoadData(pet_owners, in_file);
//loop
for (auto it = std::begin(pet_owners); it != std::end(pet_owners); ... |
Java | UTF-8 | 2,816 | 2.1875 | 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 sna.controller.entities;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;
import javax.ente... |
Java | UTF-8 | 321 | 3.234375 | 3 | [] | no_license | package arrays;
public class ArrayExample3 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a[]= {50, 100, 150,200, 250};
int sum=0;
for(int i:a)
{
sum= sum+i; //50 150 300 500 750
System.out.println(sum);
}
}
}
... |
Ruby | UTF-8 | 952 | 3.96875 | 4 | [] | no_license | # Require allows us to pull in code from a gem into this file
require "rest-client"
require "pry"
require "json"
# Get a search term from the user
def get_search_term
puts "Please enter a search term: "
gets.chomp
end
# Make a request to the API with the search term and parse the response into a hash
def get_resp... |
Go | UTF-8 | 942 | 2.65625 | 3 | [] | no_license | package main
import (
"crypto/tls"
"fmt"
"github.com/Unknwon/goconfig"
"gopkg.in/gomail.v2"
)
func SendMail(subject string, body string) {
var session string = "mail"
c, err := goconfig.LoadConfigFile("set.ini")
if err != nil {
panic(err)
}
from, _ := c.GetValue(session, "from")
tolist := c.MustValueAr... |
C++ | UTF-8 | 7,021 | 3.046875 | 3 | [] | no_license | #include "LevelFactory.h"
#include <Core/Engine.h>
float LevelFactory::generateNextLevel(int level, glm::vec2 resolution, std::vector<Object2D*>& objects) {
while (!objects.empty()) {
Object2D* tmpObj = objects.at(objects.size() - 1);
objects.pop_back();
delete tmpObj;
}
... |
Markdown | UTF-8 | 1,419 | 3.953125 | 4 | [] | no_license | ### 206. Reverse Linked List - *Easy*
#### 反转一个单链表
---
#### Code
```
# Java 双指针迭代
class Solution {
public ListNode reverseList(ListNode head) {
ListNode cur = head;
ListNode pre = null;
ListNode tmp = null;
while(cur != null){
tmp = cur.next;
cur.next = pre;... |
C | UTF-8 | 972 | 3.015625 | 3 | [] | no_license | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include "../general.h"
int very_complex_function(char* password) {
int result;
char buffer[16];
result = 0;
strcpy(buffer, password);
if(strcmp(buffer, getflag()) == 0)
result = 1;
return result;
}
int main() {
init... |
Shell | UTF-8 | 492 | 3.359375 | 3 | [] | no_license | #!/bin/bash
#Pega a instancia pela tag nome
id_instancia=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=$1" --query 'Reservations[].Instances[].InstanceId' | tr -d '"' | tr -d '[' | tr -d ']')
# Cria a imagem
aws ec2 create-image --instance-id $id_instancia --name "$1_$(date +%F)" --description "$1" --n... |
C# | UTF-8 | 1,287 | 3.859375 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//We are given a school. In the school there are classes
class School : Comment
{
private readonly string Name;
private List<Class> classes;
public School(string name)
{
this.N... |
Java | UTF-8 | 11,661 | 2.03125 | 2 | [] | no_license | package com.shidonghui.mymagic.model;
/**
* @author ZhangKun
* @create 2019/6/11
* @Describe 用户信息
*/
public class UserModel {
/**
* msg : null
* rstCde : 0
* data : {"userId":"7011727918U","balance":5339.44,"cashCouponBalance":2337,"point1":0,"point":0,"cardBagCount":28,"realname":"张堃","idcar... |
Markdown | UTF-8 | 716 | 2.65625 | 3 | [] | no_license | # Article 48
Le pouvoir disciplinaire est exercé, à l'égard des magistrats du siège par le Conseil supérieur de la magistrature et à l'égard des magistrats du parquet ou du cadre de l'administration centrale du ministère de la justice par le garde des sceaux, ministre de la justice.
Il est exercé à l'égard des magist... |
C++ | UTF-8 | 5,388 | 2.53125 | 3 | [] | no_license | /***************************************************************************
* Copyright (C) 2004 by Dynamol Inc. *
* john.furr@dynamol.com *
***************************************************************************/
#include "c... |
TypeScript | UTF-8 | 1,630 | 2.875 | 3 | [] | no_license | import fs from 'fs';
import path from 'path';
/* Обязательный аргумент передается просто ссылкой, например /home/roman/Документы/Git/Homework/ */
/* Глубина передается, через опциональный флаг --depth или -d */
const argv = process.argv.slice(2);
const pathToDir = argv.find((elem) => !elem.includes('--depth=') || !el... |
C# | UTF-8 | 1,494 | 2.734375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace Andersc.CodeLib.Common.Network
{
public static class HttpRequestHelper
{
public static string GetResponseText(string url, Browser browser = null, string httpMethod = "GET"... |
PHP | UTF-8 | 8,887 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | <?php
namespace UUP\Web\Component\Collection;
require_once('CollectionWrapper.php');
/**
* Generated by PHPUnit_SkeletonGenerator on 2017-09-28 at 12:44:31.
*/
class CollectionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Collection
*/
protected $object;
/**
... |
Markdown | UTF-8 | 419 | 2.828125 | 3 | [
"MIT"
] | permissive | ---
id: set-locale
title: Set locale
---
This filter can be used to change the value of current locale. By default, WordPress sets the locale in the admin to `en_US`. With this filter it can be changed to any locale (e.g. when using a multilingual plugin).
```php
add_filter('es_forms_general_set_locale', function(str... |
C# | UTF-8 | 1,396 | 3.390625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using EnsureThat;
namespace DDD.Collections
{
/// <summary>
/// Supports the comparison of objects for equality based on a key defined by a lambda expression.
/// </summary>
/// <typeparam name="TSource">The type of the source.</typeparam>
/// <typep... |
Markdown | UTF-8 | 2,099 | 3.21875 | 3 | [] | no_license | # Frontend Mentor - Order summary card solution
This is a solution to the [Order summary card challenge on Frontend Mentor](https://www.frontendmentor.io/challenges/order-summary-component-QlPmajDUj). Frontend Mentor challenges help you improve your coding skills by building realistic projects.
## Table of contents
... |
Java | UTF-8 | 7,670 | 2.40625 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ims.servlet.image;
import ims.entity.Image;
import ims.management.ImageManagement;
import ims.management.LoginManagement;
import ims.management.ResizeImage;
import java.awt.image.BufferedImage;
import java.io.Fi... |
Python | UTF-8 | 5,496 | 3.46875 | 3 | [] | no_license | import numpy as np
import nengo
import grid
map = '''
#########
# #
# #
# #
# #
# #
# #
# #
#########
'''
# this defines the world the agent is in, based on the map above
class Cell(grid.Cell):
def load(self, c):
if c == '#':
self.wall = True
... |
Python | UTF-8 | 324 | 3.515625 | 4 | [] | no_license | from datetime import datetime
now = datetime.now()
fecha = "%02d/%02d/%04d" % (now.day, now.month, now.year) # En formato DD/MM/YYYY
hora = "%02d:%02d:%02d" % (now.hour, now.minute, now.second) # En formato HH:MM:SS
#Imprime el mensaje con día y hora:
print("La fecha de hoy es " + fecha + ", y son las " + hora + ".... |
PHP | UTF-8 | 3,084 | 2.671875 | 3 | [] | no_license | <?php
session_start();
$servername = "localhost";
$username = "root";
$password = "happypappy";
$dbname = "shoes4days";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//if n... |
PHP | UTF-8 | 1,931 | 2.640625 | 3 | [
"MIT"
] | permissive | <?php
namespace Filament\Tables\Columns;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
class Image extends Column
{
use Concerns\CanCallAction;
use Concerns\CanOpenUrl;
public $disk;
public $height = 40;
public $width;
public $rounded = false;
pro... |
Python | UTF-8 | 63 | 3.34375 | 3 | [] | no_license | lst=[]
for i in range(1,11):
lst.append(i**3)
print(lst) |
Java | UTF-8 | 1,490 | 2.15625 | 2 | [] | no_license | package com.evgeniibaibakov.jinbot.bot.command;
import com.evgeniibaibakov.jinbot.bot.processing.Command;
import com.pengrad.telegrambot.request.BaseRequest;
import lombok.extern.log4j.Log4j;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframew... |
Markdown | UTF-8 | 1,792 | 3.53125 | 4 | [] | no_license | # HTML Images
Whenever you build a website, most likely you will need to add images to your site to include a logo, photograph, illustration, diagram, or chart in your site. HTML is the responsible part for adding images to websites.
To add images to a web page we use the \<img> element without closing tag. In the \<... |
Markdown | UTF-8 | 1,813 | 3.515625 | 4 | [
"MIT"
] | permissive | ---
title: Execute Bash in Docker
date: '2019-07-25'
category: Docker
---
在 Docker 开发的过程中,有时会有脚本出错,导致执行结果不及预期的情况。这种错误有时是环境导致的,在非 Docker 环境下无法重现。如果需要通过构建 Docker 添加诸如日志之类的信息来了解具体可能出错的原因,不免有些曲折。可以考虑直接在 Docker 环境下运行 Bash 命令,通过执行脚本中的语句,来查找可能出现问题的原因。
要在 Docker 环境下执行 Bash 脚本,可以遵循以下的步骤:
1. 首先,需要知道当前运行 Docker 的容器 ID
```bash... |
C++ | UTF-8 | 2,099 | 3.953125 | 4 | [] | no_license | // Лабораторная 9, 1 упражнение
// Даны значения температуры, наблюдавшиеся в течение N подряд идущих дней.
// Найдите номера дней (в нумерации с нуля) со значением температуры выше среднего арифметического за все N дней.
#include <iostream>
#include <vector>
using namespace std;
int countAverageTemp(vector<int> te... |
C# | UTF-8 | 1,460 | 2.5625 | 3 | [] | no_license | using Ecom.Domain.Entities;
using Ecom.Repositories;
using System;
using System.Threading.Tasks;
using Xunit;
namespace Ecom.Tests.Integration.Repositorories
{
public class ProductRepositoryTests
{
private readonly IMongoDbService mongoDbService;
private ProductRepository productRepository;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.