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 | 688 | 2.765625 | 3 | [] | no_license | import glob
import os
import re
import sys
directory = sys.argv[1]
hand_history_directory = sys.argv[2]
hand_id_to_extract = input("Please enter id of the hand:")
if not hand_id_to_extract.strip():
sys.exit()
hand_history_extract = os.path.join(directory, hand_history_directory + "_hh.txt")
to_write_file = ope... |
C# | UTF-8 | 1,283 | 2.75 | 3 | [] | no_license | using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NotEnoughDB.Models
{
public class Order
{
[BsonId]//Only for MongoDB
public int ID { get; set; }
public long? ID_po... |
C++ | UTF-8 | 4,692 | 2.875 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <map>
#include <cstring>
#include <cmath>
#include <numeric>
#include <bitset>
#include "helper_functions.h"
using namespace std;
struct mask_str {
bitset<36> onemask = 0;
bitset<36> zeromask = 0;
bit... |
Shell | UTF-8 | 314 | 3.03125 | 3 | [] | no_license | #!/bin/bash
MYPATH=$(realpath $0)
cd $(dirname $MYPATH)
db_version=$(python3 manage.py db_version)
cur_version=$(python3 manage.py version)
if [ "$db_version" != "$cur_version" ]
then
echo "Upgrading local database to match the code version"
python3 manage.py upgrade || exit 1
fi
python3 src/fsperf.py "$@"
|
C# | UTF-8 | 22,906 | 2.765625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Linq;
namespace Exodus.Configuration
{
public static class ConfigFile
{
#region Variables
// xml elems
static XmlDocu... |
Rust | UTF-8 | 2,183 | 2.953125 | 3 | [] | no_license | use crate::parse;
use indicatif::ProgressBar;
pub fn solve() {
println!("PART 1: 372");
let start = parse::parse_day17("input/17.txt");
let mut world = start.clone();
world = process(world);
world = process(world);
world = process(world);
world = process(world);
world = process(world);
world = pro... |
Java | UTF-8 | 4,804 | 2.25 | 2 | [
"MIT"
] | permissive | package io.ogi.boid.simulation;
import io.helidon.messaging.Channel;
import io.helidon.messaging.Emitter;
import io.helidon.messaging.Messaging;
import io.ogi.boid.MessageQueue;
import io.ogi.boid.boidconfig.BoidSimulationConfig;
import io.ogi.boid.corealgorithm.BoidMoves;
import io.ogi.boid.model.*;
import java.util... |
Python | UTF-8 | 484 | 3.28125 | 3 | [] | no_license | import math
def prime(n):
if n==1 :
return False
elif n==2:
return True
else:
for i in range(2,n-1):
if n%i==0 :
return False
return True
m,n=raw_input().split()
m,n=eval(m),eval(n)
s=0
count=0
if m==n:
if prime(m):
... |
C# | UTF-8 | 2,999 | 2.78125 | 3 | [] | no_license | using Api.Common.Repository.Contracts.Core.Entities;
using Api.Common.Repository.Contracts.Core.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace Api.Common.Mock.Infrastructure.Data.Repositories
{
public class InMemoryRepository<TEntity> : IRep... |
Python | UTF-8 | 2,586 | 3.796875 | 4 | [
"MIT"
] | permissive | # Program to showcase PyComb functions.
# This is not a test program. It is just a sample.
# Each function in PyComb has been tested and verified against
# known results in reference tables.
# There are no known bugs.
# Caveat emptor.
import PyComb
print("PyComb.prod(45,100)")
print(PyComb.prod(45,100))
print("PyCo... |
Java | UTF-8 | 1,260 | 2.125 | 2 | [] | no_license | package fr.epione.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
@Entity
public class Patient ex... |
Java | UTF-8 | 6,942 | 1.742188 | 2 | [] | no_license | package com.ca.apm.test.atc;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.testng.Assert;
import com.ca.apm.test.atc.common.Canvas;
import com.ca.apm.test.atc.common.UI;
public abstract class CommonMapViewUITest extends UITest {
protected static final String PERSP1 ... |
PHP | UTF-8 | 953 | 3.125 | 3 | [] | no_license | <?php
namespace App\Models;
use PDO;
class Post extends \Core\Model
{
public function __construct($data)
{
foreach ($data as $key => $value) {
$this->$key = $value;
};
}
public static function getAll()
{
try {
$db = static::getDB();
$... |
Java | UTF-8 | 729 | 3.390625 | 3 | [] | no_license | package dsa;
import java.util.Arrays;
import java.util.Scanner;
public class ArrayMinElementPractice {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the size of an Array");
int size = sc.nextInt();
int arr[] = new int[size];
int min = 0;
System.ou... |
Swift | UTF-8 | 1,556 | 2.640625 | 3 | [] | no_license | //
// BaseTitleCell.swift
// AZB_swift
//
// Created by limbo on 2020/4/8.
// Copyright © 2020 limbo. All rights reserved.
//
import Foundation
class BaseTitleCell: BaseTableviewCell {
var titleLabel:UILabel?
var contentLabel:UILabel?
override func createCellUI() {
titleLabel = UILab... |
JavaScript | UTF-8 | 338 | 3.15625 | 3 | [] | no_license | class Calculate {
static sum(x, y) {
return x + y;
}
sum2(x, y) {
return x + y;
}
multiply(x, y) {
return x * y;
}
}
const CalculateOpject = new Calculate();
const calmultiply = new Calculate();
console.log(Calculate.sum(1, 2));
console.log(CalculateOpject.sum2(2, 3));
console.log(calmultiply.m... |
Markdown | UTF-8 | 1,684 | 2.609375 | 3 | [] | no_license |
# IGQG (Information Geometry of Quantum Gases)
This repository presentsa library (IGQG.py) for calculations of several functions on statistical mechanics of quantum systems. Mainly, this library calculations are based on the precise calculation of the polylogarithm family of function given by mpmath.
Examples of u... |
Java | UTF-8 | 1,134 | 2.765625 | 3 | [] | no_license | // code by jph
package ch.alpine.tensor.nrm;
import ch.alpine.tensor.Scalar;
import ch.alpine.tensor.Tensor;
import ch.alpine.tensor.api.TensorUnaryOperator;
import ch.alpine.tensor.sca.pow.Sqrt;
/** Euclidean norm
*
* ||{a, b, c}||_2 = Sqrt[a^2 + b^2 + c^2] */
public enum Vector2Norm {
;
public static final T... |
Java | UTF-8 | 709 | 2.609375 | 3 | [] | no_license | package com.magine.spy.spyclient.monitor;
import com.magine.spy.spyclient.monitor.impl.SimpleSystemCpuMonitor;
/**
* Factory class to create monitor instances
*/
public class MonitorFactory {
/**
* Create a SimpleSystemCpuMonitor instance
*
* @param interval
* int health check interval in seco... |
JavaScript | UTF-8 | 1,150 | 2.640625 | 3 | [] | no_license | function MainPage() {
};
MainPage.prototype._currentPageId = null;
MainPage.prototype._pages = null;
MainPage.prototype.loggedin = false;
MainPage.prototype.header = new Header();
MainPage.prototype.footer = new Footer();
MainPage.prototype.homePage = new HomePage();
MainPage.prototype.loginPage = new LoginPage()... |
C# | UTF-8 | 2,610 | 3.484375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _6.ConnectedComponents
{
class ConnectedComponents
{
static List<int>[] graph;
static HashSet<int[]> components;
static bool[] visitedVertices;
private static int[] FindConnectedCom... |
Shell | UTF-8 | 1,907 | 2.953125 | 3 | [] | no_license | #!/bin/bash
sudo touch ~/cloudwatch.log
cd ~
sudo -s
sudo echo Y | apt-get install python >> ~/cloudwatch.log
echo "downloading awslogs-agent-setup.." >> ~/cloudwatch.log
echo "modifying permissions for setup" >> ~/cloudwatch.log
cd /etc/systemd/system
sudo touch awslogs.service
sudo chmod 777 awslogs.service
sudo echo... |
Swift | UTF-8 | 6,332 | 2.71875 | 3 | [] | no_license |
import UIKit
extension CGAffineTransform : Printable {
public var description : String {
return NSStringFromCGAffineTransform(self)
}
}
func delay(delay:Double, closure:()->()) {
dispatch_after(
dispatch_time(
DISPATCH_TIME_NOW,
Int64(delay * Double(NSEC_PER_SEC))
... |
Markdown | UTF-8 | 1,718 | 3.578125 | 4 | [] | no_license | ### Program 1 - Coding Practice 
---------------------------------------------------------------------------------------------------------------------------------------------------
***For a given dataset [x,y] on Receiver Operating Characteristics (ROC) curve, find... |
Rust | UTF-8 | 3,903 | 2.625 | 3 | [
"MIT"
] | permissive | use crate::data::shader::*;
use crate::shd_interface;
use crate::data::LumTextureBinding;
use crate::types::{Shader, UniformParameter};
use std::collections::HashMap;
pub const LIGHT_CHUNKS: u32 = 250;
shd_interface![
LightPassShader,
camera_pos, [f32; 3],
normal_texture, LumTextureBinding,
position_... |
Java | UTF-8 | 2,214 | 3.4375 | 3 | [] | no_license | import java.util.ArrayList;
import java.util.Comparator;
public class AStarSearch {
public AStarSearch() {
}
public ArrayList<Node> aStar(Node root) {
ArrayList<Node> pathToSolution = new ArrayList<>();
ArrayList<Node> openList = new ArrayList<>();
ArrayList<Node> closedList = n... |
Markdown | UTF-8 | 4,077 | 2.609375 | 3 | [] | no_license | ---
date: 2016-10-13T19:15:05+08:00
title: CentOS 安装 Erlang
permalink: /install-erlang-on-centos
tags:
- CentOS
- Erlang
---
## 软件仓库
从 CentOS 软件仓库安装 Erlang 是最简单、最省事的。
不过 CentOS 默认仓库中没有 Erlang,需要我们预先安装 [Extra Packages for Enterprise Linux 项目](https://fedoraproject.org/wiki/EPEL)。
1. 安装 `epel-release`
```bas... |
JavaScript | UTF-8 | 314 | 2.8125 | 3 | [] | no_license | var fs = require('fs');
var input = process.argv;
var pathname = input[2];
var ext = input[3];
fs.readdir(pathname, function(err, list) {
if(err) throw err;
var output = [];
for(var i = 0; i < list.length; i ++) {
if(list[i].split('.')[1] == ext) {
output.push(list[i]);
}
}
console.log(output);
});
|
JavaScript | UTF-8 | 1,732 | 2.546875 | 3 | [] | no_license | const util = require("util");
const { MongoClient } = require("mongodb");
const newListing = require("./airbnb.data.json");
const main = async () => {
const uri = "mongodb://renderws.local:27017";
const client = new MongoClient(uri);
try {
await client.connect();
//await updateListingByName(client, "In... |
PHP | UTF-8 | 3,895 | 2.53125 | 3 | [] | no_license | <?php
/**
*--------------------------------------------------------------------------------------
* iZhanCMS 爱站内容管理系统 (http://www.izhancms.com)
*
* 商品类别
*
*
* @author 佟新华<tongxinhua@mail.b2b.cn> 2013-3-11 下午5:22:39
* @filename CategoryModel.php UTF-8
* @copyright Copyright (c) 2004-2012 Mainone Tec... |
Markdown | UTF-8 | 5,199 | 3.6875 | 4 | [] | no_license | ## Zombies and orphaned processes
### Zombies
Give a process A, whenever it creates a child process B, it is A's reponsibility to wait for B to exit, take its
exit details, such as exit code etc. To do this A performs a __wait__ operation.
In psuedocode
```
1. create A
2. A creates child B
3. A waits for child B
4.... |
Java | UTF-8 | 1,438 | 2.671875 | 3 | [] | no_license | package extremefilter.commands;
import extremefilter.main.ExtremeFilter;
import extremefilter.storage.MainStorage;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
/**
* Created by root on 04.03.2017.
*/
public class CMD... |
Markdown | UTF-8 | 5,709 | 2.953125 | 3 | [] | no_license | ---
layout: post
title: "Node JS"
description: "Node JS"
tagline: "Node JS"
category: programming
tags: [programming, digital services]
---
The landscape of writing web applications has come a long way over the years. At 23 years old, Javascript is in it's prime, the language of the web. Years ago Javascript was once ... |
PHP | UTF-8 | 3,193 | 2.6875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Some class description here...
*
* @package KAWANI
* @subpackage subpackage
* @category category
* @author SMTI-RDaludado
* @link http://systemantech.com
*/
class Violation_level_model extends MY_Model {
protec... |
Go | UTF-8 | 709 | 2.59375 | 3 | [] | no_license | package caches
import (
"github.com/go-redis/redis"
"github.com/gw123/GMQ/core/interfaces"
)
type CacheRule struct {
KeyPatten interfaces.CacheKey
Callback func(arg ...interface{}) (interface{}, error)
Client *redis.Client
}
func NewCacheRule(keyPatten interfaces.CacheKey, callback func(arg ...interface{}) ... |
C++ | UTF-8 | 632 | 2.8125 | 3 | [] | no_license | #include <iostream>
#include <pthread.h>
#include <stdio.h>
#include <chrono>
using namespace std;
using namespace chrono;
unsigned long int sum=0;
void *runner(void *param);
int main(int argc, char *argv[]){
system_clock::time_point start = system_clock::now();
int x = 0;
for (int i = 1; i <= 50000; i++)
... |
JavaScript | UTF-8 | 476 | 2.609375 | 3 | [] | no_license | let initState = {
counterBar: 12,
tableForTwo: 4,
tableForFour: 6,
tableForEight: 2,
}
const tableReducer = (state = initState, action) => {
switch (action.type) {
case 'UPDATE_INCREASE_TABLE':
return { ...state, [action.prop]: state[action.prop] + action.reserveCount }
case 'UPDATE_DECREASE_TA... |
Swift | UTF-8 | 1,446 | 2.765625 | 3 | [] | no_license | //
// NewsRow.swift
// NewsFeedAppSwiftUI
//
// Created by Maksim Kalik on 8/22/22.
//
import SwiftUI
import Kingfisher
struct NewsRow: View {
@Environment(\.colorScheme) var colorScheme
let viewModel: ArticleViewModel
var body: some View {
HStack(spacing: 10) {
// KF... |
C++ | UTF-8 | 2,230 | 3.25 | 3 | [] | no_license | #pragma once
#include <algorithm>
#include "board.hpp"
class Computer{
public:
std::pair<int, int> chooseMove(Board);
void makeMove(Board&);
private:
bool isOnCorner(std::pair<int, int>, int, int);
};
std::pair<int, int> Computer::chooseMove(Board board){
std::vector<std::pair<in... |
Java | UTF-8 | 295 | 1.601563 | 2 | [] | no_license | package org.apache.flink.runtime.operators.coordination;
import java.io.Serializable;
/**
* Root interface for all requests from the client to a {@link OperatorCoordinator}
* which requests for a {@link CoordinationResponse}.
*/
public interface CoordinationRequest extends Serializable {}
|
JavaScript | UTF-8 | 185 | 3.71875 | 4 | [] | no_license | function fibonacci(n) {
let arr = [1, 1];
for (i = 2; i < n; i++) {
arr.push(arr[i - 2] + arr[i - 1]);
}
console.log(arr);
return arr[n - 1];
}
console.log(fibonacci(9));
|
C++ | UTF-8 | 266 | 2.890625 | 3 | [] | no_license | #include <iostream>
#include <algorithm>
#include <list>
#include <string>
using namespace std;
int main(){
list<string> slst={"1","2","3","3","2","4"};
cout<<count(slst.begin(),slst.end(),"2")<<endl;
cout<<count(slst.begin(),slst.end(),"3")<<endl;
return 0;
}
|
Java | UTF-8 | 1,211 | 2.046875 | 2 | [] | no_license | package ch.quickorder.util;
import com.clusterpoint.api.CPSConnection;
import com.clusterpoint.api.CPSRequest;
import com.clusterpoint.api.CPSResponse;
import javax.xml.transform.TransformerFactoryConfigurationError;
import java.util.HashMap;
import java.util.Map;
public class ClusterPointConnectionFactory {
pr... |
TypeScript | UTF-8 | 3,388 | 3.0625 | 3 | [
"MIT"
] | permissive | import {Component} from '@layr/component';
import {Storable} from './storable';
import {primaryIdentifier, secondaryIdentifier, attribute, loader, method} from './decorators';
import {Index} from './index-class';
describe('Index', () => {
test('Creation', async () => {
class Movie extends Storable(Component) {
... |
Java | UTF-8 | 3,437 | 2.140625 | 2 | [
"BSD-3-Clause"
] | permissive | /***************************************************************************
* Copyright (c) 2013, Rapid7 Inc
*
* 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 ... |
Ruby | UTF-8 | 647 | 2.6875 | 3 | [] | no_license | # This class is from the ruby-sync gem
class Local < Base
def initialize()
end
def file_list
files = []
dirs = ['.']
dirs += dir_list
dirs.each do |d|
files += Dir.entries(d).map { |f| d=='.' ? f : "#{d}/#{f}"}.select { |f| not File.directory?(f) }
end
files
end
def dir_lis... |
Java | UTF-8 | 413 | 1.898438 | 2 | [] | no_license | package swu.xl.contentprovider;
public class URIList {
public static final String CONTENT = "content://";
public static final String AUTHORITY = "swu.xl.contentprovider";
//调用者使用
public static final String URI_USER = CONTENT + AUTHORITY + "/" + DatabaseHelper.USER_TABLE_NAME;
public static final S... |
C# | UTF-8 | 1,399 | 3.359375 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
namespace Sender
{
public class DateFormatter
{
public List<string> DayList { get; set; }
public List<string> MonthList { get; set; }
public List<string> YearList { get; set; }
public bool IsDateFormatted { get; set; }
pu... |
Java | UTF-8 | 2,302 | 2.265625 | 2 | [
"Apache-2.0"
] | permissive | /*
* 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 com.compguide.web.Persistence.SessionBeans;
import com.compguide.web.Persistence.Entities.MedicationTask;
import com.c... |
Markdown | SHIFT_JIS | 70,657 | 2.625 | 3 | [] | no_license | #zɂqI̊mۂɊւ@
zɂqI̊mۂɊւ@
ial\ܔNl\l@\jŏIFZNZO@Z㍆iŏI܂ł̖{s@߁j\ZNZ\O@Z\㍆i{sj@
@́@i\Oj
@́@茚z̈ێǗil\\j
@Ó@zɂqI̊mۂɊւ鎖Ƃ̓o^i\̓\\̌܁j
@ĺ@o^Ǝғ̒ĉ̎wi\̘Z\\̋j
@́@Gi\̏\\\lj
@Ź@i\l̓\\j
@
@@@́@
##iړIj
@̖@́A̎҂gpA͗p錚z̈ێǗɊւqKvȎ߂邱ƂɂǍzɂqIȊ̊mۂ}AČOq̌yёiɎ邱ƂړIƂB
##i`j
@̖@ɂāu茚zvƂ́AsASݓXAX܁AAwZAZ̗pɋ鑊x̋K͂L錚ziz@
ia\ܔN@... |
Java | UTF-8 | 594 | 2.21875 | 2 | [] | no_license | package com.election.hacking.model;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.Serializable;
import static com.election.hacking.ServiceConstants.KEY_TOKEN;
public class IdentityVerificationResponse implements Serializable {
@Serial... |
Java | UTF-8 | 8,126 | 1.992188 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright 2015 Loic Merckel
*
* 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 to in ... |
C | UTF-8 | 1,558 | 2.6875 | 3 | [] | no_license | #include <libgccjit.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, const char *argv[]) {
gcc_jit_context *ctxt;
gcc_jit_result *result;
int ch;
ctxt = gcc_jit_context_acquire ();
if (!ctxt) {
printf ("can't get gcc context");
exit (1);
}
g... |
Python | UTF-8 | 2,370 | 2.671875 | 3 | [] | no_license | from datetime import datetime, timedelta
#!/usr/bin/env pybricks-micropython
from pybricks import ev3brick as brick
from pybricks.ev3devices import (Motor, TouchSensor, ColorSensor,
InfraredSensor, UltrasonicSensor, GyroSensor)
from pybricks.parameters import (Port, Stop, Direction, Bu... |
Ruby | UTF-8 | 1,387 | 3.90625 | 4 | [] | no_license | def sluggish_octopus(fish_arr)
fish_arr.each_with_index do |fish1, i1|
max_length = true
fish_arr.each_with_index do |fish2, i2|
next if i1 == i2
max_length = false if fish2.length > fish1.length
end
return fish1 if max_length
end
end
def dominant_octopus(arr)
arr.merge_sort
arr.l... |
Python | UTF-8 | 5,444 | 3.25 | 3 | [] | no_license | class LogisticRegression():
def __init__(self, scorefunc=sigmoid, optimizor=BGD, fit_intercept=True, penalty="L2", gamma=0):
'''
参数:
scorefuc:激活函数
optimizor:梯度优化函数
fit_intercept:是否在X前面加一列1,将b内置到theta
penalty:正则化,可选"L1","L2"
gamma:正则化项的系数
'''
se... |
PHP | ISO-8859-1 | 1,271 | 2.625 | 3 | [] | no_license | <?php
/**
* Cuida da monitorao dos equipamentos
*
* @author apssouza
*/
class Monitor extends Model
{
const TB_NAME = 'radio';
private $allEqFora;
public function ping($ip)
{
$pingando = shell_exec("ping -c 1 $ip");
if (preg_match('/bytes from/', $pingando)) {
return true;
}
return false;
}
pu... |
Python | UTF-8 | 3,121 | 3.796875 | 4 | [] | no_license | #
# @lc app=leetcode.cn id=1181 lang=python3
#
# [1181] 前后拼接
#
# https://leetcode-cn.com/problems/before-and-after-puzzle/description/
#
# algorithms
# Medium (37.01%)
# Likes: 12
# Dislikes: 0
# Total Accepted: 1.5K
# Total Submissions: 3.9K
# Testcase Example: '["writing code","code rocks"]'
#
# 给你一个「短语」列表 phr... |
PHP | UTF-8 | 2,668 | 2.6875 | 3 | [] | no_license | <?php
session_start();
$bdd = new PDO('mysql:host=localhost;dbname=test', 'root', '' );
if(isset($_POST['pseudo'], $_POST['password'])){
$_SESSION['pseudo']= $_POST['pseudo'];
$_SESSION['password']= $_POST['password'];
$utilisateurs = $bdd->query("SELECT * FROM login");
foreach ($utilisateurs as $key => $lo... |
Python | UTF-8 | 10,982 | 2.8125 | 3 | [] | no_license | print("\n" * 5)
import datetime #SHOW THE Real Date data andinformation.
import os #OS checking the OS best compatibility
foodlist = [] #Variable both foodlist, drinklist names + prices.
drinklist = []
pricelist = [0] *... |
Markdown | UTF-8 | 943 | 3.546875 | 4 | [
"MIT"
] | permissive | ---
layout: post
title: leetcode刷题
subtitle: 整数反转
date: 2019-02-28
author: HK
header-img: img/post-bg-ios9-web.jpg
catalog: true
tags:
- leetcode(simple)
---
# leetcode刷题记录
## 整数反转
给出一个 32 位的有符号整数,你需要将这个整数中每位上的数字进行反转。
*示例 1:*<br>
输入: 123 输出: 321 <br>
*示例 2:*<br>
输入: -123 输出: -321 <br>
*示... |
C++ | UTF-8 | 2,273 | 2.828125 | 3 | [] | no_license | #include "encoder.h"
unsigned int slot_R = 0; // a flag to remember the state of Right Slot
unsigned int slot_L = 0; // a flag to remember the state of Left Slot
unsigned int r_encoder_count = 0;
unsigned int l_encoder_count = 0;
const int ONE_SECOND = 1000;
unsigned int ms_counter = 0;
unsigned int l_slot... |
Python | UTF-8 | 1,820 | 3.359375 | 3 | [] | no_license |
class CollisionError(Exception):
pass
def Up(map, row, column, indicesOfPath):
for x in range(row - 1, row - 21, -1):
row = x
if x < 0 or x >= 120:
break
if map[x][column] == 'a' or map[x][column] == 'b':
raise CollisionError()
if map[x][column] ... |
Markdown | UTF-8 | 820 | 2.84375 | 3 | [] | no_license | # Multiplayer_Yahtzee
A simple text based multiplayer Yahtzee game built using the network sockets api and multithreading api in JAVA.
The class decriptions are as follows:
1. YServer – The Server Class, hosts game
2. YThread – The Server Thread Class, manages clients
3. YState – The Server State Class, stores and... |
Java | UTF-8 | 700 | 2.234375 | 2 | [
"MIT"
] | permissive | package net.sengjea.calibre;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
public class ServiceReceiver extends BroadcastReceiver {
public ServiceReceiver() {
}
@Override
public void on... |
Java | UTF-8 | 2,227 | 2.484375 | 2 | [] | no_license | package ddwucom.mobile.activitiy_test;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Toast;
import java.util.ArrayList;
p... |
Java | UTF-8 | 774 | 2.890625 | 3 | [] | no_license | class CMaxInOneRow{
static void maxInOneRow(int x[][]){
for(int i=0;i<x.length;i++)
for(int j=0;j<x[i].length;j++)
if(x[i][j]!=1&&x[i][j]!=0)
return;
int a[]=new int[x.length];
for(int i=0;i<x.length;i++)
for(int j=0;j<x[i].length;j++)
if(x[i][j]==1)
a[i]++;
int maxval=a[0],k=0;
for(i... |
Java | UTF-8 | 2,126 | 2.9375 | 3 | [] | no_license | /**
* @author Richard Shepard
* @version Mar 25, 2015
*/
package com.rshepard.simulation;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListen... |
Python | UTF-8 | 544 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python3
# makes O(n log n) comparisons on avg
# O(n^2) worst case comparisons (rare)
A = [56,93,65,34,13,19,88,84,67,48,51,21]
def quicksort(a):
if len(a) <= 1:
return a
end = len(a)-1
pivot = a[end]
less = []
more = []
pivots = []
for i in a:
if i < pivot:
... |
Java | ISO-8859-1 | 2,410 | 3.53125 | 4 | [] | no_license | package es.argenis.proyectofinal;
import java.util.ArrayList;
import java.util.Scanner;
/*
* CLASS LISTAMUSICA: define atributos y metodos para el objeto listaMusica.
* EXTIENDE a la clase MUSICA porque guarda objetos de tipo MUSICA.
* IMPLEMENTA la interface ACCION porque, al ser una lista, existen acciones... |
Python | UTF-8 | 3,870 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import logging
import acapy_wallet_facade as wallet_facade
import ledger_facade
from schemas import DidCreationResponse
from aries_cloudcontroller import AriesAgentControllerBase
from fastapi import HTTPException
logger = logging.getLogger(__name__)
async def get_taa(controller: AriesAgentControllerBase):
"""
... |
JavaScript | UTF-8 | 782 | 3.03125 | 3 | [
"MIT"
] | permissive | var stringifyStyle = require('./stringify-style');
var stringifyClass = require('./stringify-class');
/**
* Returns a `'key1='value1' key2='value2' ...'` string from
* a `{ key1: 'value1', key2: 'value2' }` object.
*
* @param Object attrs The keys/values object to stringify.
* @return String The correspond... |
Java | UTF-8 | 380 | 2.578125 | 3 | [] | no_license | package capitulo_20_programacao_funcional_e_expressoes_lambda.util;
import capitulo_20_programacao_funcional_e_expressoes_lambda.entities.Product_function;
import java.util.function.Function;
public class UpperCaseName implements Function<Product_function, String> {
@Override
public String apply(Product_func... |
Java | UTF-8 | 2,866 | 2.078125 | 2 | [] | no_license | package com.ttech.jwt.security;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.... |
Java | UTF-8 | 3,906 | 3.1875 | 3 | [] | no_license | /**
*
*/
package assignBSTSpellCheck;
/**
* @author C.M.
*Implements a binary search tree.
*/
public class BST<type extends Comparable<? super type>>{
private BNode<type> root;
private int size;
public boolean add(type item) {
if(isEmpty()) {
BNode<ty... |
Java | UTF-8 | 2,468 | 2.390625 | 2 | [
"Apache-2.0"
] | permissive | package org.openapi2puml.openapi;
import org.apache.commons.lang3.StringUtils;
import org.openapi2puml.CliArgs;
import org.openapi2puml.openapi.plantuml.PlantUMLGenerator;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class OpenApi2PlantUML {
private static final Logger ... |
Python | UTF-8 | 3,676 | 2.53125 | 3 | [] | no_license | """
gas
===
Functions for plotting gas quantities
"""
import logging
import matplotlib.pyplot as plt
import numpy as np
from ..analysis import angmom, halo, profile
from ..units import Unit
from .generic import hist2d
logger = logging.getLogger('pynbody.plot.gas')
def rho_T(sim, rho_units=None, rho_range=None,... |
Rust | UTF-8 | 1,490 | 3 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | use super::ByteSet;
use core::{mem, slice};
/// Operations over the internal memory representation.
///
/// There are currently no stability guarantees over the internal bytes. This is
/// being tracked in [#8](https://github.com/nvzqz/byte-set-rs/issues/8).
impl ByteSet {
const SIZE: usize = mem::size_of::<Self>(... |
Markdown | UTF-8 | 940 | 2.90625 | 3 | [] | no_license | # What does this do?
This script installs the recently released & stable versions of rubies including all their fix versions from the ruby community. The number of recent versions can be optionally provided in the argumen to this scripts, otherwise, the number of recent versions defaults to 2
# Why do I need this?
T... |
C++ | UTF-8 | 4,242 | 2.703125 | 3 | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | /**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef IROHA_SIGNABLE_HPP
#define IROHA_SIGNABLE_HPP
#include "interfaces/base/model_primitive.hpp"
#include <boost/functional/hash.hpp>
#include <optional>
#include <unordered_set>
#include "cryptography/default_ha... |
Ruby | UTF-8 | 1,121 | 2.671875 | 3 | [] | no_license | require 'erubis'
require 'tempfile'
require 'corporeal/config'
# Provide instance method to flatten hash
Hash.send(:include, Module.new do
def stringify
self.inject("") do |str, kv|
str << " " unless str.length == 0
str << kv[0]
str << "=#{kv[1]}" unless kv[1].nil?
str
end
end
end)
module Corporeal... |
C++ | UTF-8 | 991 | 3.796875 | 4 | [] | no_license | //Print matrix in Spiral form
#include<iostream>
#include<cstdlib>
#include<vector>
using namespace std;
void spiral(int a[3][6])
{
int m=3;
int n=6;
int row_start=0,col_start=0,row_end=m-1,col_end=n-1;
while(row_start<=row_end && col_start<=col_end)
{
for(int i=col_start;i<=col_end;i++)
... |
Python | UTF-8 | 845 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
import sys
def universe(queries, engines):
if len(queries) == 0:
return 0
indices = []
for engine in engines:
try:
indices.append(queries.index(engine))
except ValueError:
return 0
switch = universe(queries[max(indices):], engines)
... |
Shell | UTF-8 | 3,545 | 4.25 | 4 | [] | no_license | #!/bin/sh
#
# by bohoomil
# A simple script that will repeat
# the chrooting routine for you.
# Drop it somewhere in your $PATH.
# --- colours
cres="\e[00m"
cred="\e[01;31m"
cyel="\e[01;33m"
cgre="\e[01;32m"
cblu="\e[01;34m"
usage() {
echo -e ""
echo -e "Usage:"
echo -e " cr a|b|c|...|X -- Chroot to a predefine... |
JavaScript | UTF-8 | 523 | 3.09375 | 3 | [] | no_license | var divs = document.querySelectorAll(".imageDiv");
var num = 0;
function getImage() {
if (num===divs.length){
num=0;
}
divs[num].setAttribute("class", "appear imageDiv");
var max = divs.length - 1;
var previousNode = "";
if (num === 0) {//当这个等于0,最大下标是max
previousNode = divs[max];... |
Java | UTF-8 | 1,798 | 2.890625 | 3 | [] | no_license | import javax.swing.*;
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
public class GuiImageTest extends JFrame implements MouseListener,MouseMotionListener {
private JButton buttonArray[];
private Container c;
private ImageIcon blackIcon, whiteIcon, boardIco... |
Java | UTF-8 | 2,253 | 4.375 | 4 | [] | no_license | /**
* Area Calculator
* https://programmingbydoing.com/a/area-calculator.html
* Write a program to calculate the area of four different geometric shapes: triangles, squares, rectangles, and circles.
* You must use functions.
* Your program should present a menu for the human to choose which shape to calculate, then as... |
Python | UTF-8 | 1,330 | 3.421875 | 3 | [
"MIT"
] | permissive | def validSolution(board):
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for i in range(9):
x = sorted(board[i])
if x != lst:
return False
w = [*zip(*board)]
for i in range(9):
x = sorted(w[i])
if x != lst:
return False
for i in range(0, 9, 3):
fo... |
Shell | UTF-8 | 1,571 | 3.0625 | 3 | [] | no_license | #!/bin/bash
echo "#########################################################################"
echo File Name: runla.sh
echo Author: rehemanyidiresi
echo mail: rehemanyidiresi@novogene.com
echo Created Time: `ls -l|grep runla.sh |awk '{print $6,$7,$8}'`
echo "##########################################################... |
C# | UTF-8 | 3,177 | 3.421875 | 3 | [
"MIT"
] | permissive | /* Attributions
* Mike DePaul
* https://github.com/mdepaul/XConvert.git
* **/
using System;
using System.Collections.Generic;
using System.Text;
namespace MD.RandoCalrissian
{
/// <summary>
/// Conversion utilities as extention methods
/// </summary>
public static class XConvert
{... |
C++ | GB18030 | 845 | 3.34375 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//int main()
//{
// int *p=(int*)malloc(10*sizeof(int));
// if(p==NULL)
// printf("%s\n",strerror(errno));
// else
// {
// int i=0;
// for(i=0;i<10;i++)
// {
// *(p+i)=i;
// printf("%d ",*(p+i));
// }
// }
// free(p);//ֻmallocֶ̬ڴf... |
Ruby | UTF-8 | 1,542 | 2.84375 | 3 | [
"MIT"
] | permissive | # This class will retreive some information according to param
module CorreosChile
require 'correos_chile/order'
require 'httparty'
require 'nokogiri'
def self.extract_useless_spaces(str)
composed_word = ''
partial_word = str.gsub(/[[:space:]]/, '')
length = partial_word.length
str.split(partia... |
Python | UTF-8 | 493 | 4.96875 | 5 | [] | no_license | # Making For Loops
# Step 1: Use a for loop to print out each color in the list colors
colors = ["red", "orange", "blue", "green", "purple"]
# Step 2: There are 2 ways that you could solve step 1 in Python ... can you solve it the other way now? (Hint: If you used the keyword in last time, try using len() this time, ... |
JavaScript | UTF-8 | 574 | 2.53125 | 3 | [] | no_license |
function loaddashboard() {
document.getElementById("userName").innerHTML = localStorage.getItem("dbusername");
document.getElementById("role").innerHTML = localStorage.getItem("dbusertype");
disablelinks();
}
function disablelinks(){
// alert("disable links")
//document.getElementById("history").removeAt... |
Java | UTF-8 | 208 | 1.523438 | 2 | [
"BSD-3-Clause"
] | permissive | package com.boloutaredoubeni.clamshell.apis.owm.models;
import com.google.gson.annotations.SerializedName;
/**
* Copyright 2016 Boloutare Doubeni
*/
public class Snow { @SerializedName("3h") public double volume; }
|
JavaScript | UTF-8 | 314 | 3.53125 | 4 | [] | no_license | /*function RandomListNode(x){
this.label = x;
this.next = null;
this.random = null;
}*/
function Clone (pHead) {
// write code here
if (pHead === null) return null
let newnode = new RandomListNode(pHead.label)
newnode.random = pHead.random
newnode.next = Clone(pHead.next)
return newnode
} |
Python | UTF-8 | 7,071 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
Author: Deepak Kumar, 73217151
SDG: Good health and Well Being
"""
import numpy as np
import pandas as pd
import seaborn as sb
import matplotlib.pyplot as plt
import csv
#indicators = pd.read_csv('WDI_Data.csv');
infile = open('WDI_Data.csv','r');
csvdata = csv.reader(infile... |
TypeScript | UTF-8 | 4,191 | 2.625 | 3 | [] | no_license | import { pb } from "./pb/scene";
interface Draco {
module: any;
}
let dracoDecoderType = {};
// This function loads a JavaScript file and adds it to the page. "path" is
// the path to the JavaScript file. "onLoadFunc" is the function to be called
// when the JavaScript file has been loaded.
function loadJavaScript... |
C++ | UTF-8 | 999 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <fstream>
#include <string>
#define FILE "6_2_text-1.txt"
int main() {
char ch;
bool activeScript = false; //Ik gebruik een array met 2 ofstreams, 0 en 1. Ik gebruik een bool om tussen deze twee te wisselen.
std::ifstream in_stream;
in_stream.open(FILE);
if (!in_stream)
{
std::c... |
Java | UTF-8 | 2,682 | 2.5 | 2 | [
"Apache-2.0"
] | permissive | /*
Copyright (C) 2013-2015 The Open University
Copyright (C) 2017 Simon Butler
SPDX-FileCopyrightText: 2013-2015 The Open University
SPDX-FileCopyrightText: 2017 Simon Butler
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License");
you may not use... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.