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 |
|---|---|---|---|---|---|---|---|
Java | UTF-8 | 6,640 | 2.046875 | 2 | [] | no_license | package com.vdolrm.lrmutils.Test;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.android.material.tabs.TabLayout;
import com.vd... |
Java | UTF-8 | 1,025 | 2.421875 | 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 miagesorbonne.geniusbot.plugins;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Amine Amanzou <a... |
JavaScript | UTF-8 | 1,318 | 2.71875 | 3 | [] | no_license | // connect the Select Run checkbox list to charts, to enable the hiding function
$(document).ready(function(){
//
$( ".runsListItem input:checkbox" ).each(function(event){
// runName = $(this).attr('id').slice(0,-"Checkbox".length);
var targetChart = "#"+$(this).attr('id').slice(0,-"Checkbox".l... |
Python | UTF-8 | 937 | 2.703125 | 3 | [] | no_license | import pygame
import random
from Windows.Objects import *
def display(size):
objects = []
objects.append(Image.Image("background", "assets/img/background_menu.png", (size[0] / 2), (size[1] / 2), event=False))
objects.append(Text.Text("level", "Levels:", (size[0] / 2) - 790, (size[1] / 2) - 130, font = pyg... |
Shell | UTF-8 | 1,973 | 3.484375 | 3 | [] | no_license | #!/bin/bash
set -euo pipefail
# mpc idleloop, how to start when mpd inactive
music(){
declare mpc_status
declare control
if [[ $(systemctl is-active mpd) == "active" ]]; then
mpc_status=$(mpc | grep -oP "(?<=\[)[a-z]*(?=\])")
if [[ ${mpc_status} == "playing" ]]; then
control="^... |
Python | UTF-8 | 7,309 | 2.71875 | 3 | [] | no_license | import json
import boto3
from boto3.dynamodb.conditions import Key
from botocore.exceptions import ClientError
import time
import re
from random import randint
# Auth
ACCESS_KEY = ''
SECRET_KEY = ''
REGION = ''
# DynamoDB
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=ACCESS_KEY,
... |
Ruby | UTF-8 | 4,636 | 2.609375 | 3 | [
"MIT"
] | permissive | require File.expand_path('../portal_state', __FILE__)
require File.expand_path('../software_update', __FILE__)
require File.expand_path('../whitelist_users', __FILE__)
module Hue
module Client
module Models
class Configuration
# Creates an instance of the Configuration object
#
# @r... |
Java | UTF-8 | 27,781 | 1.875 | 2 | [] | no_license | package com.open.androidtvwidget.leanback.recycle;
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.support.v4.view.ViewCompat;
import android.support.v4.view.... |
Java | UTF-8 | 540 | 1.945313 | 2 | [] | no_license | package com.cric.repo;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import com.cric.entity.Team;
public interface TeamRepo extends JpaRepository<Team, Integer> {
@... |
C++ | UTF-8 | 2,212 | 2.703125 | 3 | [] | no_license | #include "clientInventory.hpp"
const ItemInfo& ClientInventoryItem::getUniqueItem() const {
return ::getItemInfo(type);
}
void ClientInventoryItem::setStack(unsigned short stack_) {
if(stack != stack_) {
stack = stack_;
stack_texture.renderText(std::to_string(stack));
}
}
unsigned short C... |
Shell | UTF-8 | 793 | 3.1875 | 3 | [
"MIT"
] | permissive | #! /bin/bash
action=$( yad --width 300 --entry --title "System Logout" \
--image=gnome-shutdown --button="Switch User:2" --button="gtk-ok:0" --button="gtk-close:1" \
--text "Choose action:" --entry-text "Power Off" "Reboot" "Suspend" "Logout" )
ret=$?
[[ $ret -eq 1 ]] && exit 0
if [[ $ret -eq 2 ]] ; then
gdm... |
JavaScript | UTF-8 | 2,717 | 2.671875 | 3 | [] | no_license | window.SpeechRecognition = window.SpeechRecognition || webkitSpeechRecognition;
var recognition = new webkitSpeechRecognition();
recognition.lang = 'ja';
recognition.continuous = true;
recognition.interimResults = true;
let finalTranscript = '';
recognition.onresult = function (event) {
let interimTranscript = '';
... |
Python | UTF-8 | 2,002 | 3.625 | 4 | [] | no_license | """
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
"""
def matched(s, p):
regex = []
for c in p:
if c == "*":
regex[-1] += "*"
else:
regex.append(c)
return matche... |
Java | UTF-8 | 390 | 2.046875 | 2 | [] | no_license | package com.pp.database.model.scrapper.descriptor.signature;
import org.mongodb.morphia.annotations.Entity;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
@Entity("DomSignature")
public class DomSignatureModel extends SignatureModel{
public DomSignatureModel(){
super();
}
public DomSignat... |
Markdown | UTF-8 | 1,214 | 2.671875 | 3 | [] | no_license | ---
title: トロピカルリカー -Tropical Liquor- X-rated
bbslink: https://forum.say-huahuo.com/thread-25431-1-1.html
imgurl: https://www.say-huahuo.com/data/attachment/forum/201805/15/202511lgx2uayzfb8eft8r.jpg
---
歡迎來到熱帶島嶼!
「誰叫哥哥是個不起眼的飛特族呢? 而且年齡=沒有女朋友的期間對吧?」
主角(你)是個每天過著平凡生活,
外表不起眼的飛特族。
某天,你在商店街的抽獎活動中抽中南島之旅渡假券,
... |
C++ | GB18030 | 1,779 | 2.59375 | 3 | [] | no_license | #include "../include/DataBus.h"
CReceivingArray::CReceivingArray(){
SEMA_INIT(m_sema,0,MAX_ARRAY_LENGTH);
MUTEX_INIT(m_lock);
m_count = 0;
for(u_short i=0;i<MAX_ARRAY_LENGTH;i++)
{
m_topics[i]=0;
}
}
CReceivingArray::~CReceivingArray()
{
for(u_short i=0;i<MAX_ARRAY_LENGTH;i++)
{
if(m_topics[i]!=0)
{
... |
C# | UTF-8 | 783 | 2.734375 | 3 | [] | no_license | using System.Collections.Generic;
using System.Linq;
using DataGenerator.Models.DataTypes;
namespace DataGenerator.Models.DataFinal
{
public class CreatorFinalData
{
public static List<FinalDataUnit> Create(IEnumerable<DataType> dataTypes, int number)
{
List<FinalDataUnit> resList ... |
Markdown | UTF-8 | 1,859 | 2.671875 | 3 | [] | no_license | ---
layout: post
title: "Picks / what the vienna.rb team thinks is worth sharing this week"
date: 2014-11-05 20:00
published: true
comments: true
categories:
- picks
---
### 11/05 Picks!
In a series on this website we'll entertain YOU with our picks - or: what we think is worth sharing - every week.
Books, articles... |
JavaScript | UTF-8 | 956 | 3 | 3 | [] | no_license | var currPosition;
navigator.geolocation.getCurrentPosition(function(position) {
updatePosition(position);
setInterval(function(){
var lat = currPosition.coords.latitude;
var lng = currPosition.coords.longitude;
jQuery.ajax({
type: "POST",
url: "/updatelocation",... |
Markdown | UTF-8 | 325 | 2.59375 | 3 | [
"MIT"
] | permissive | ---
permalink: "/minutes/"
title: "Minutes"
---
The committee holds a meeting every two weeks during term time. Meetings are usually held in Forrest Hill.
<ul>
{% for meeting in site.minutes reversed %}
<li><a href="{{ site.baseurl }}{{ meeting.url }}">{{ meeting.date | date: "%a, %d %B %Y" }}</a></li>
{% endfor %}
... |
Java | UTF-8 | 3,439 | 3.375 | 3 | [] | no_license | package simplilearnphase1project;
import java.io.IOException;
import java.util.Scanner;
public class LockedMe {
// Print stars
public void printStars() {
int i = 0;
while(i < 10) {
System.out.print("*");
i++;
}
System.out.println();
}
public static void main(String[] args) throws IOException {... |
Java | UTF-8 | 781 | 3.203125 | 3 | [] | no_license | import java.util.Random;
import java.util.Vector;
import java.lang.Integer;
public class RandomInputGenerator {
public static void main(String[] args) {
// TODO Auto-generated method stub
RandomInput ri= new RandomInput();
Vector<Integer> vector= ri.getVector();
System.out.print("Input rando... |
Python | UTF-8 | 809 | 2.875 | 3 | [
"MIT"
] | permissive | from .extension import Extension
class MathJax(Extension):
def run(self, code, path):
return mathjaxify(code)
def mathjaxify(code):
splitted = code.split("$$")
result = ""
for i, section in enumerate(splitted):
if i % 2:
section = section \
.replace('<em>'... |
Java | UTF-8 | 6,708 | 2.09375 | 2 | [] | no_license | /* Zipeg for Google App Engine components License
Copyright (c) 2006-2011, Leo Kuznetsov
All rights reserved.
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 copyri... |
Java | UTF-8 | 825 | 2.8125 | 3 | [] | no_license | import java.util.ArrayList;
import java.util.List;
/**
* @Classname P46Permute
* @Description TODO
* @Date 2019/6/5 21:31
* @Created by Anigy
* @Email kingjya@163.com
* @Leetcode https://github.com/
*/
public class P46Permute {
public List<List<Integer>> re = new ArrayList<>();
public List<List<Integer... |
Python | UTF-8 | 3,810 | 2.609375 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import pytest
import xarray as xr
from climpred import HindcastEnsemble, PerfectModelEnsemble
NLEADS = 5
NMEMBERS = 3
NINITS = 10
START = "1990"
HindcastEnsemble_verify_kw = dict(
metric="rmse", comparison="e2o", dim="init", alignment="maximize"
)
PerfectModelEnsemble_verif... |
C++ | UTF-8 | 260 | 3.125 | 3 | [
"Apache-2.0"
] | permissive | /*
Factorial trailing digits
Problem 160
For any N, let f(N) be the last five digits before the trailing zeroes in N!.
For example,
9! = 362880 so f(9)=36288
10! = 3628800 so f(10)=36288
20! = 2432902008176640000 so f(20)=17664
Find f(1,000,000,000,000)
*/ |
Markdown | UTF-8 | 11,257 | 2.90625 | 3 | [] | no_license | 二十九
许慈航笑道:“我倒没有什么扬威武林壮志,只想倚仗此剑,设法破除‘黑地狱’,救出一干沉沦其内的江湖人物!”
“黑地狱”三字,谷家麒与水中萍均系闻所未闻,不由向许慈航愕然问道:“许兄,你所说的‘黑地狱’,是在何处?其中……”
许慈航慨然叹道:“这‘黑地狱’三字,是桩几乎绝无人知的莫大秘密!说来其话甚长,谷兄与水姑娘且请找个僻静之处,听我细诉!”
谷家麒手指右侧高崖说道:“这座小崖,不过十来丈高,我们且到崖顶一叙!”
水中萍好奇喜事,急于得知有关“黑地狱的”秘密,首先提气腾身,许慈航也随后往上纵去!
谷家麒暗地留神观察许慈航的轻功身法,仍觉他最少要比自己与水中萍,差了三四成... |
TypeScript | UTF-8 | 1,365 | 3.234375 | 3 | [
"MIT"
] | permissive | import * as _ from 'lodash';
import {EventEmitter} from 'events';
export interface TestResult
{
name: string;
min: number;
max: number;
avg: number;
results: number[];
}
export default class Test extends EventEmitter
{
private _name: string;
private _test: () => void;
private _test_rep... |
Java | UTF-8 | 1,862 | 1.914063 | 2 | [] | no_license | package com.fanyafeng.firstblog.controller.user;
import com.fanyafeng.firstblog.interceptor.LoginInterceptorAnnotation;
import com.fanyafeng.firstblog.model.User;
import com.fanyafeng.firstblog.returnmessage.MessageResponse;
import com.fanyafeng.firstblog.service.UserService;
import com.fanyafeng.firstblog.service.imp... |
Python | UTF-8 | 2,563 | 4.59375 | 5 | [] | no_license | """
One of the most important data structure in existence. Provides expected O(1) insertion, lookup, deletion.
However, if the choice of a hash function is bad, collision may often arise and this performance may degrade to
O(n) in every case.
Following is a crude implementation of a hash table, capable of storing stri... |
JavaScript | UTF-8 | 2,282 | 4.78125 | 5 | [] | no_license | // Async:Promiseを返却する関数を宣言する
// Await:Promiseを返却する関数(Async)の非同期処理が完了するまで待つ
// function sleep(val) {
// return new Promise(function(resolve) {
// setTimeout(function() {
// console.log(val++);
// resolve(val);
// }, 1000);
// });
// }
// sleep(0).then(function(val) {
// return sleep(val);
// }... |
Swift | UTF-8 | 2,340 | 3.328125 | 3 | [
"BSD-3-Clause"
] | permissive | //
// SettingsExtension.swift
// Patriot
//
// This object implements a model for persisting user settings.
// It is expected to be injected into classes needing it.
// Defaults are provided if not previously saved.
//
// Created by Ron Lisle on 6/7/17.
// Copyright © 2017 Ron Lisle. All rights reserved.
//
imp... |
Python | UTF-8 | 6,166 | 2.5625 | 3 | [] | no_license |
#import selenium for automation
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exce... |
Python | UTF-8 | 2,076 | 2.859375 | 3 | [] | no_license | # -*- coding:utf-8 _*-
"""
@author:crd
@file: test.py
@time: 2018/03/03
"""
import pandas as pd
import numpy as np
import matplotlib.pylab as plt
from matplotlib.pylab import rcParams
from statsmodels.tsa.stattools import adfuller
from statsmodels.tsa.seasonal import seasonal_decompose
from statsmode... |
TypeScript | UTF-8 | 4,266 | 2.671875 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | import { err, ok, Result } from 'neverthrow'
import { PublicKey, PublicKeyT } from '@radixdlt/crypto'
import { Encoding } from '../bech32'
import {
AbstractAddress,
FormatDataToBech32Convert,
HRPFromNetwork,
isAbstractAddress,
NetworkFromHRP,
ValidateDataAndExtractPubKeyBytes,
} from './abstractAddress'
import { ... |
C# | UTF-8 | 587 | 3.234375 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Fizzbuzz
{
public class Fizzbuzz
{
public static T Result<T>(int i)
{
if (i < 1 || i > 100)
return (T)(object)"Out of range";
if... |
Markdown | UTF-8 | 1,784 | 2.96875 | 3 | [] | no_license | ---
title: Water Shortage
author: logician
layout: post
permalink: /definitions/water-shortage/
aktt_notify_twitter:
- yes
idNumber:
- 64
robotsmeta:
- index,follow
---
In Australia on average <!--more-->we have less water than can come out of your tap. Most of the time when you have a shower it actually sucks an... |
Markdown | UTF-8 | 1,880 | 2.640625 | 3 | [
"MIT"
] | permissive | # Notes on Git and Submodule management
This projects makes use of submodules. [This is the best online resource](https://www.atlassian.com/git/tutorials/git-submodule) I have found about submodules.
The min-devkit (and therefore all packages derived from it, including `gyro`), contains two submodules: the [min-api]... |
Java | UTF-8 | 6,349 | 2.171875 | 2 | [] | no_license | package org.light.portlets.addressbook;
import static org.light.portal.util.Constants._CHARSET_UTF;
import static org.light.portal.util.Constants._PORTLET_JSP_PATH;
import java.net.URLDecoder;
import java.util.List;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portl... |
JavaScript | UTF-8 | 2,397 | 2.640625 | 3 | [] | no_license |
function update(emp_no,emp_name,dept_no1,position_rank1,sal1){
var dept_no = document.getElementById(dept_no1).selectedIndex;
var position_rank = document.getElementById(position_rank1).selectedIndex;
var sal = document.getElementById(sal1).value;
var dept_name = document.getElementById(dept_no1).opti... |
C++ | GB18030 | 821 | 2.953125 | 3 | [] | no_license | #include <iostream>
#include <fstream>
using namespace std;
//ʹļIOıƷʽʾд
//ļ
struct ServerInfo
{
char _ip[32];//ip
int _port;//˿
};
struct ConfigManager
{
public:
ConfigManager(const char* configfile = "bitserver.config")
:_configfile(configfile)
{}
void WriteBin(const ServerInfo& info)
{
//עöƵķʽ
ofstream o... |
C++ | UTF-8 | 212 | 2.5625 | 3 | [] | no_license | #ifndef CIRCLE_H_
#define CIRCLE_H_
class Circle {
public:
Circle(unsigned int radius);
float get_circumference();
float get_area();
private:
unsigned int radius;
};
#endif /* CIRCLE_H_ */
|
SQL | UTF-8 | 346 | 3.171875 | 3 | [] | no_license | create table courses(
school_code enum('L', 'B', 'A', 'F', 'E', 'T', 'I', 'W', 'S', 'U', 'M') not null,
dept_id TINYINT UNSIGNED NOT NULL,
course_code char(5),
name VARCHAR(150),
primary key(course_code),
FOREIGN key (school_code) REFERENCES departments (school_code)
)engine = INNODB DEFAULT character SET = utf8 ... |
C | UTF-8 | 87 | 2.796875 | 3 | [] | no_license | #include<stdio.h>
main()
{
int i;
for (i=0;i<=10;i+=2)
printf("%d\t",i);
}
|
Markdown | UTF-8 | 1,550 | 2.828125 | 3 | [
"MIT"
] | permissive | # Task.GroupDocs.Conversion
This is a small demo of GroupDocs Conversion from any format to PDF format in a specified folder hardcoded in the code. You can change the code according to your needs if you want to test out the GroupDocs API for document conversion purposes.
##How To Build?
Clone the repository and sync i... |
Python | UTF-8 | 2,610 | 3.984375 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Project 0x03. Probability"""
class Normal:
"""Class that represents an Normal distribution"""
e = 2.7182818285
pi = 3.1415926536
def __init__(self, data=None, mean=0., stddev=1.):
"""Constructor of Normal
Parameters:
data (list): List of num... |
PHP | UTF-8 | 11,358 | 2.734375 | 3 | [] | no_license | <?php
namespace AddressBookBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\Request;
use AddressBookBundle\Entity\Person;
use Addres... |
SQL | UTF-8 | 2,992 | 3.21875 | 3 | [] | no_license | /*
Navicat MySQL Data Transfer
Source Server : Gopal
Source Server Version : 50721
Source Host : 127.0.0.1:3306
Source Database : spring-transaction
Target Server Type : MYSQL
Target Server Version : 50721
File Encoding : 65001
Date: 2018-12-09 09:22:29
*/
SET FOREIGN_KEY_CHECKS=0... |
Java | UTF-8 | 1,686 | 2.5625 | 3 | [] | no_license | package com.fuping;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.HashMap;
public class URLDNSCheck... |
Java | UTF-8 | 255 | 1.515625 | 2 | [] | no_license | package seleniumproject.SrideviJenkins;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class NewTest2 {
@Test
public void f() {
System.out.println("test2");
}
}
|
Ruby | UTF-8 | 1,535 | 3.109375 | 3 | [] | no_license | # Returns a file containing student names and their corresponding multiple choice grade
# to input into Pandagrader
require 'csv'
require_relative '../csv_helpers'
# multiple_choice_grades_file = 'mult_choice_grades.csv'
# frq_grades_file = 'midterm1_grades.csv'
#
# merged_grades_file = 'multiple_choice_with_names.c... |
Python | UTF-8 | 4,905 | 3.109375 | 3 | [] | no_license | import pandas as pd
writer = pd.ExcelWriter('BaseIPDO.xlsx', engine= 'openpyxl') #para usar essa função, é necessário instalar o pacote "xlsxwriter" ou "openpyxl"
pd.set_option('display.width', 100)
#determinação de constantes, para melhor legibilidade do código:
#definições relativas às tabelas em análise para indexaç... |
C# | UTF-8 | 11,856 | 3.015625 | 3 | [] | no_license | using ConsoleAppTest.DebugAndSecurity;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
using System.Transactions;
// Aliased generics:
using ASimpleName = System.Collections.G... |
Markdown | UTF-8 | 1,727 | 2.953125 | 3 | [] | no_license | # MakersBnB
## First Makers Academy group project.
Simple posting web app built as a lite version of AirBnB. The app was built as the first group project during the Makers Academy coding bootcamp.
### Team members: [Isabel Larner](https://github.com/ilarne), [Sulaiman Ahmadshah](https://github.com/sulaimancode), [Hen... |
Java | UTF-8 | 296 | 2.375 | 2 | [] | no_license | //import java.awt.Image;
//import javax.swing.*;
class SJFrame extends javax.swing.JFrame
{
/**
*
*/
private static final long serialVersionUID = 1L;
SJFrame()
{
setSize(500,90);
setTitle("Java with SJ");
setVisible(true);
//setIconImage(new Image("c:\\"));
}
}
|
C | UTF-8 | 1,454 | 3.796875 | 4 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
/*
* return true if all the value in the array is negetive
* argument: input array, size of array
*/
int isNeg(int*, int);
/*
* return the maximun number of the two input
* argument: number one, number two
*/
int maxNum(int x, int y);
/*
... |
Java | UTF-8 | 850 | 3.5625 | 4 | [] | no_license | package day27_arrays05;
import java.util.*;
public class CopyOf2 {
public static void main(String[] args) {
int [] nums1 = {34, 56, 23, 1, 55};
int [] nums2 = Arrays.copyOf(nums1, nums1.length+2);
int [] nums3 = Arrays.copyOfRange(nums1, 1, 4);
System.out.println(Arrays.toString(nums2));
System.out.pr... |
Java | UTF-8 | 2,018 | 2.4375 | 2 | [] | no_license | package com.niit.collaboration.dao;
import org.springframework.stereotype.Repository;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.niit.collaboration.model.Event;
import org.springframework.transaction.annotation.Tr... |
Ruby | UTF-8 | 2,282 | 3.046875 | 3 | [
"MIT"
] | permissive | require 'rspec'
require 'pry'
require 'list'
include List
List::Configuration.validate! # set lists to raise errors
class ListOfNumbers < List[Integer]
def sum
inject(&:+)
end
def mean
sum / count
end
end
class ListOfStrings < List[String]
def longest
sort_by(&:length).reverse.first
end
d... |
Java | UTF-8 | 17,005 | 1.796875 | 2 | [] | no_license | /*******************************************************************************
* .
* Velo 1.0
* ----------------------------------------------------------
*
* Pacific Northwest National Laboratory
* Richland, WA 99352
*
* ... |
Python | UTF-8 | 214 | 2.625 | 3 | [] | no_license | import os
cwd = os.getcwd()
module_dir = os.path.dirname(__file__)
full_path, curent_folder = os.path.split(module_dir)
print(full_path)
print(curent_folder)
|
Markdown | UTF-8 | 610 | 2.71875 | 3 | [] | no_license | # REACT API movies -4th final GeeksHubs challenge
The challenge is to create an API able to interact with API Endpoints provided by themoviedb.
## Getting started:
### npm install
Installing npm for the application.
### npm start
Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost... |
JavaScript | UTF-8 | 170 | 2.640625 | 3 | [] | no_license | export const fetchData = async (url) => {
const response = await fetch(url);
const jsonData = await response.json();
return jsonData;
}
|
PHP | UTF-8 | 3,754 | 2.765625 | 3 | [] | no_license | <?php
//Controlador para el módulo de alumnos
class AlumnosController extends Zend_Controller_Action {
private $_model = null;
public function init() {
$this->_model = new DbTable_Alumnos();
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('list', 'html... |
TypeScript | UTF-8 | 402 | 2.609375 | 3 | [] | no_license | import weatherRepository from '../api/repositories/weather.repository';
import { Coords } from '../model/interfaces/coords';
import { DailyWeather } from '../model/interfaces/daily-weather';
export class WeatherService {
public static fetchWeatherByCoords = async (coords: Coords): Promise<DailyWeather[]> => {
re... |
C | UTF-8 | 2,452 | 4.34375 | 4 | [] | no_license | #include <stdio.h>
#include <stdbool.h> //Позволяет нам использовать булевы выражения тип(bool) может содержать 2 значение 1 - true or 0 - false
#define SIZE 4 //Препроцессорная директива define
/*while(условие цикла)
{
тело цикла
}*/
int main (void)
{
int prices[SIZE] = { 100, 200, 300, 400 }; // Л... |
Java | UTF-8 | 3,277 | 3.90625 | 4 | [] | no_license | package atguigu.structure;
public class JosepFu {
public static void main(String[] args) {
CircleSingleLinkedList circleSingleLinkedList=new CircleSingleLinkedList();
circleSingleLinkedList.addNode(5);
circleSingleLinkedList.showList();
circleSingleLinkedList.countBoy(1,2,5);
}
... |
C | UTF-8 | 330 | 2.890625 | 3 | [] | no_license | #include <stdio.h>
#include <stdint.h>
#include <sys/time.h>
int main()
{
struct timeval tv;
gettimeofday(&tv, NULL);
uint64_t num = tv.tv_sec * 1000000 + tv.tv_usec;
fprintf(stderr, "%llu\n", num);
int64_t inum = num;
fprintf(stderr, "%lld\n", inum);
uint64_t res = inum;
fprintf(stderr, "%llu\n", res);
re... |
Ruby | UTF-8 | 16,337 | 2.828125 | 3 | [
"BSD-2-Clause"
] | permissive | require_relative "scheme"
$orig_env = $global_environment.dup
describe "scheme" do
before(:each) do
$global_environment = $orig_env.dup
end
before(:all) do
@orig_stdout = $stdout
#$stdout = File.open("/dev/null", "r+")
end
after(:all) do
$stdout = @orig_stdout
end
subject { scheme_eval... |
Python | UTF-8 | 1,104 | 2.703125 | 3 | [] | no_license | from gi.repository import Gtk
class HarchTreeStore(Gtk.TreeStore):
def __init__(self, *arg, **kwarg):
super(HarchTreeStore, self).__init__(*arg, **kwarg)
self.branches = dict()
self.added_items = dict()
def add(self, name, item):
levels = name.split("/")
name = levels[-... |
C++ | UTF-8 | 435 | 2.609375 | 3 | [] | no_license | #ifndef USER_HH
#define USER_HH
#include "string"
#include "vector"
#include "payment.hh"
using std::string;
using std::vector;
class Payment;
class User{
protected:
string user_name;
string user_email;
vector<Payment> payments;
public:
User();
User(string, string, ve... |
C++ | UTF-8 | 2,587 | 3.453125 | 3 | [] | no_license | /*
差值博弈 极大极小 博弈DP
题意:一堆数,两个小朋友,轮流从堆里面取数,要求第一个人取的数在[a,b], 0 <= a <= b区间内,每次取的数x和前一次(也就是对方)取的数y满足a <= x-y <= b。两人都想使得自己取得的数总和减去对方的总和的差值尽量大,问最后第一个小朋友减去第二个小朋友的差值最大为多少?
思路:差值博弈
易推出后面取的数总是比前面取的数大,所以先排序
dp[i]表当前选手确定选了i之后,可以达到的最大分差
两人都想让自己的与对方的分差尽量大,而当前选手选了i之后,是轮到对方选。假设当前选手A选了i之后,先手变成了对方B,那B当然在后面的状态种也是要使得自己与A... |
Python | UTF-8 | 1,183 | 3.28125 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
import pygame
def main():
#创建游戏窗口
screen = pygame.display.set_mode((480,852),0,32)
#把本地文件夹的图片,获取到代码中
background = pygame.image.load('./images/background.png')
player = pygame.image.load('./images/hero1.png')
# 定义好的位置和尺寸
rect = pygame.Rect(190,728,100,124)... |
Go | UTF-8 | 14,042 | 2.8125 | 3 | [
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | // Copyright 2022 The Dawn 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 agreed t... |
Markdown | UTF-8 | 2,090 | 2.90625 | 3 | [
"MIT"
] | permissive | ---
layout: post
title: "알고리즘 연습방법"
tags: [Python, 자료구조 알고리즘]
comments: true
---
.
[학습시 참고자료]
패스트캠퍼스 ‘알고리즘 / 기술면접 완전 정복 올인원 패키지 Online’ 를 공부하고 정리한 학습노트입니다.
URL : https://www.fastcampus.co.kr/dev_online_algo
[학습내용]
### 알고리즘 연습 방법
* 알고리즘을 잘 작성하기 위해서는 잘 작성된 알고리즘을 이해하고, 스스로 만들어봐야 함
- 모사! 그림을 잘 그리기 위해서는 잘 그린 그림을 모방... |
C++ | WINDOWS-1251 | 712 | 3.046875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
struct node //
{
int key;//
struct node* left;//
struct node* right;//
};
struct node* newNode(int key);
struct node* rightRotate(struct node* x);
struct node* leftRotate(struct node* x);
struct node* splay(struct node* root... |
C# | UTF-8 | 6,022 | 2.578125 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Xml.Xsl;
using System.Diagnostics;
using System.Globalization;
using System.IO;
namespace Arebis.Caching
{
/// <summary>
/// A cache for XSLT document files.
/// </summa... |
Python | UTF-8 | 621 | 2.640625 | 3 | [
"MIT"
] | permissive | class Solution:
def videoStitching(self, clips: List[List[int]], time: int) -> int:
dp = [99999] * (time + 1)
dp[0] = 0
clips.sort(key=lambda x: (x[1], -x[0]))
reach = 0
for clip in clips:
if (clip[0] > reach) or (clip[0] >= time):
... |
Java | UTF-8 | 478 | 3.203125 | 3 | [] | no_license | package trial;
public class staircase
{
public void print(int n)
{
for (int i = n-1; i >= 0; i--)
{
for(int j =0; j <n;j++)
if(j<i)
System.out.print(" ");
else
System.out.print("#");
System.out.println();
}
}
public static void main (String[] args)
{
String s = "I had a,word:... |
Markdown | UTF-8 | 793 | 3.421875 | 3 | [] | no_license | ## <b> Pre-test</b>
#### Please attempt the following questions
Q.What is matrix?<br>
a)An equation of over 5 numbers or symbols .<br>
<b>b)A set of numbers in rows and columns.</b><br>
c)A method of finding the nth value of a series.<br>
d)A complicated number system.<br>
Q.What must be true in order to determine in... |
Java | UTF-8 | 227 | 2.328125 | 2 | [
"BSD-3-Clause"
] | permissive | package com.jayfella.pixels.core;
import com.jme3.math.Vector2f;
/**
* A generic noise evaluator that allows the user to use any noise generator.
*/
public interface NoiseEvaluator {
float evaluate(float x, float y);
}
|
Markdown | UTF-8 | 277 | 3.015625 | 3 | [
"MIT"
] | permissive | # Whiteboard Challenge 33
##### Date: February 28, 2018
##### Big O Notation:O(1)
## Problem Domain:
Write a function that takes two arguments, a base number and an exponential, and returns the sum of the return value's digits.
````
For example: fn(2, 15) => 32768 => 26 |
C++ | UTF-8 | 2,810 | 2.984375 | 3 | [] | no_license | #pragma once
#include <vector>
#include <numeric>
#include <algorithm>
#include <span>
#include <optional>
#include "coords.hpp"
struct TileState {
int player = -1;
int num = 0;
};
class Board {
std::vector<TileState> _state;
std::vector<TriCoord> _exploding;
std::vector<int> _totals;
int _size;
TileState& g... |
Java | UTF-8 | 502 | 1.890625 | 2 | [] | no_license | package com.leo.demo.test.rabbit;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Configuration;
/**
* 文件名:RabbitConfig.java
*
* @create 2018-05-05 11:33
* <p>
* <p>
* <p>
* 北京中油瑞飞信息技术有限责任公司(http://www.richfit.com)
* Copyright 2017 Richfit Information Technology Co.,... |
Go | UTF-8 | 1,579 | 2.515625 | 3 | [
"MIT"
] | permissive | // Unless explicitly stated otherwise all files in this repository are licensed
// under the MIT License.
// This product includes software developed at Guance Cloud (https://www.guance.com/).
// Copyright 2021-present Guance, Inc.
package nginx
import (
"net"
"net/url"
"gitlab.jiagouyun.com/cloudcare-tools/datak... |
JavaScript | UTF-8 | 410 | 2.75 | 3 | [] | no_license | import math from 'mathjs';
const mae = (rating, rekomendasi) => {
const result = [];
rating.forEach((row, rowIndex) => {
let pembilang = 0;
const penyebut = row.length;
row.forEach((val, valIndex) => {
pembilang += val - rekomendasi[rowIndex][valIndex];
});
pembilang = math.abs(pembilang... |
Ruby | UTF-8 | 404 | 3.390625 | 3 | [] | no_license | class Phrase
NOT_LETTERS_OR_NUMBERS_REGEXP = /[^a-z0-9]/
attr_accessor :message
def initialize(message)
@message = message
end
def word_count
words = normalized_message.split(' ')
words.each_with_object(Hash.new(0)) { |elem, result|
result[elem] += 1
}
end
def normalized_message
... |
Java | UTF-8 | 5,595 | 2.046875 | 2 | [
"MIT"
] | permissive | package mrtjp.projectred.transmission.data;
import codechicken.lib.colour.EnumColour;
import codechicken.lib.datagen.recipe.RecipeProvider;
import codechicken.lib.util.CCLTags;
import mrtjp.projectred.transmission.WireType;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation;
impor... |
C++ | UTF-8 | 549 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
class Solution {
public:
int minRefuelStops(int target, int startFuel, vector<vector<int>>& stations) {
priority_queue<int>pq;
int ans = 0;
int last = 0;
stations.push_back({ target,0 });
for (auto &station : stations) {
sta... |
Java | UTF-8 | 1,011 | 2.4375 | 2 | [
"BSD-2-Clause"
] | permissive | package martin.common.xml;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import java.io.IOException;
public class EntityResolver implements org.xml.sax.EntityResolver {
private DefaultHandler defaultHandler = new DefaultHandler();
private St... |
C++ | UTF-8 | 4,259 | 2.625 | 3 | [
"MIT"
] | permissive | //
// Created by alex on 11/14/19.
//
#ifndef R_TYPE_DISPATCHER_HPP
#define R_TYPE_DISPATCHER_HPP
#include "Definitions.hpp"
#include "StateMachine.hpp"
#include "ThreadPool.hpp"
#include "ISystem.hpp"
#include <iostream>
#include <queue>
#include <array>
namespace ecs {
template<typename T> class ISystem;
templat... |
Python | UTF-8 | 309 | 3.140625 | 3 | [] | no_license | def solution(phone_book):
answer = True
phone_book.sort()
for i in range(len(phone_book)-1):
phone = phone_book[i]
next_phone = phone_book[i+1]
if len(phone) <= len(next_phone):
if phone == next_phone[:len(phone)]:
return False
return answer |
JavaScript | UTF-8 | 578 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | const Discord = require('discord.js');
module.exports = {
name: "fuser",
aliases: ["finduser", "find"],
description: "Searchs users with a term provided. (In all guilds Im in)",
run: async (client, message, args, config) => {
let users = client.users;
let searchTerm = args[0];
... |
Java | UTF-8 | 9,822 | 1.851563 | 2 | [] | no_license | package com.pbids.sanqin.ui.activity.zhizong;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import androi... |
Python | UTF-8 | 204 | 3.28125 | 3 | [] | no_license | def my_int(s, b = 10):
if b == 2:
return(int(s,2))
if b == 8:
return(int(s,8))
if b == 16:
return(int(s,16))
else:
return(int(s))
print(my_int("1001", 8))
|
Python | UTF-8 | 850 | 3.015625 | 3 | [] | no_license | import unittest
from mongo import Montgomery
class MyTestCase(unittest.TestCase):
def setUp(self) -> None:
self.obj = Montgomery(k=6, n=37)
self.a = 52
self.b = 35
def test_multiply(self):
a_n = self.obj.reminder(self.a)
b_n = self.obj.reminder(self.b)
result ... |
C++ | UTF-8 | 1,064 | 2.640625 | 3 | [] | no_license | " The proxy host can be specified the exact same way as the proxy\n"
" environment variables, including the protocol prefix (http://)\n"
, stdout);
fputs(
" and the embedded user + password.\n"
"\n"
-" From 7.21.7, the proxy string may be specified with a... |
Python | UTF-8 | 2,058 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | from typing import List
import json, codecs, os
from .hulkReplaceMethod import replaceAllMatrix, replaceAllBar, replaceRootOf, replaceFrac, replaceAllBrace
with codecs.open(os.path.join(os.path.dirname(__file__),
"convertMap.json"),
"r", "utf8") as f:
convertMap = jso... |
C++ | UTF-8 | 1,407 | 3.5 | 4 | [] | no_license | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<int> preOrder;
vector<int> inOrder;
TreeNode *DFS(int pos, int left, int ri... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.