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 | 1,887 | 3.046875 | 3 | [] | no_license |
package be.mdelbar.geneticcells;
import be.mdelbar.geneticcells.ability.Ability;
import be.mdelbar.geneticcells.ability.AbilityPoints;
import be.mdelbar.geneticcells.config.ConfigFactory;
import java.awt.Color;
/**
*
* @author Matthias Delbar
*/
public class Cell {
private static final int BASE_RESISTANC... |
C# | UTF-8 | 878 | 3.140625 | 3 | [] | no_license | using HanoiEntity;
using System.Collections.Generic;
using System.Linq;
using System;
namespace HanoiRepository
{
public class EntityRepository<T> : IEntityRepository<T> where T : BaseEntity
{
private static List<T> _repo = new List<T>();
public void Add(T entity)
{
entity... |
Java | UTF-8 | 760 | 3.59375 | 4 | [] | no_license | /*
Receba os valores do comprimento, largura e altura de um paralelepípedo. Calcule e mostre seu volume.
*/
import javax.swing.JOptionPane;
public class Paralelepipedo
{
public static void main(String args[])
{
Double comp, larg, alt, paralelepipedo;
comp = Double.parseDouble(JOption... |
JavaScript | UTF-8 | 1,843 | 2.890625 | 3 | [] | no_license | /**
* It's possible to some extent but won't be really accurate, the idea is load image with a known file size then in its onload event measure how much time passed until that event was triggered, and divide this time in the image file size.
Important things to keep in mind:
1. The image being used should be properl... |
C# | UTF-8 | 2,237 | 2.609375 | 3 | [] | no_license | namespace GitHubTracker.Core
{
using System;
using GitHubTracker.Contracts;
using GitHubTracker.GitHubViews;
using GitHubTracker.Models;
public class Dispatcher : IDispatcher
{
private IIssueTracker tracker;
public Dispatcher()
: this(new Views())
{
... |
Markdown | UTF-8 | 5,395 | 2.890625 | 3 | [
"CC0-1.0"
] | permissive | # Archivo .gitignore
En esta actividad empezaremos a trabajar con algo más real. Por ejemplo, una sencilla aplicación de Java. Esta actividad también es práctica.
Vamos a seguir utilizando el repositorio que estabamos usando en las actividades anteriores.
**`git log --oneline --all`**

- [Data wrangling](#data-wrangling)
- [Managing data in Azure](#managing-data-in-azure)
- [Datastore](#datastore)
- [Dataset](#dataset)
- [Data versioning](#data-versioning)
- [Working with features](#working-with-features)
- [Featu... |
Python | UTF-8 | 1,832 | 3.078125 | 3 | [] | no_license | import time
import calendar
from tkinter import *
from tkinter import ttk
from tkinter import font
import winsound
h=0
m=0
s=0
t="am"
def get_alarm(*args):
global h
h=input("What Hour")
global m
m=input("What Minute")
global s
s=input("What Second")
global t
t=input... |
Python | UTF-8 | 1,297 | 2.546875 | 3 | [] | no_license | from models.siswa import Siswa
class SiswaController(db_controller):
def __init__(self , db_construct):
self.db = db_construct
def get_all_siswa(self):
siswa_list = []
siswa_data = self.db.session.query(Siswa).all()
for result in siswa_data:
siswa_list.append({"id":... |
Swift | UTF-8 | 1,347 | 2.578125 | 3 | [] | no_license | //
// MLTextRecongnizeViewController.swift
// MachineLearningBasedSystem
//
// Created by mabaoyan on 2021/5/31.
//
import UIKit
import Vision
@available(iOS 13.0, *)
class MLTextRecongnizeViewController: MLBasedSystemViewController, CaptureImageDelegate {
var date:NSDate?
override func viewDidLoad() {
... |
PHP | UTF-8 | 983 | 2.53125 | 3 | [] | no_license | <?php
session_start();
if(isset($_SESSION['clearence'])){
if($_SESSION['clearence']>1){
//after clearence check, start checkout table process
require_once("../includes/inc.header.php");
require_once("../includes/inc.db.php");
$con = connect();
try {
//get change book to checked in
$sql = $con->prepare(... |
JavaScript | UTF-8 | 1,003 | 2.875 | 3 | [] | no_license | const axios = require("axios");
module.exports = {
myFunction: function() {
console.log("Custom function called...123");
},
sendSMS: async function(mobile, msg) {
msg = encodeURI(msg);
axios
.get(
process.env.SMS_PATH +
"&to=" +
mobile +
"&sender=ROSEAT&mes... |
C++ | UTF-8 | 4,359 | 3.109375 | 3 | [
"MIT"
] | permissive | #include "OPERADORA_FRAC.h"
#include <iostream>
int OperaTADFRAC::numerador()const {
return numerator;
}
void OperaTADFRAC::numerador(int n){
numerator = n;
}
double OperaTADFRAC::resultado()const{
return result;
}
void OperaTADFRAC::resultado(double r){
result = r;
}
int OperaTADFRAC::denominador() const{
... |
Markdown | UTF-8 | 4,396 | 3.015625 | 3 | [] | no_license | ### Content
* [Consistency of Plug-in Confidence Sets for Classification in Semi-supervised Learning](#CPCSCSL)
<h2 id="#CPCSCSL">
### [Consistency of Plug-in Confidence Sets for Classification in Semi-supervised Learning](https://arxiv.org/pdf/1507.07235.pdf)
<p align="right"> Jan. 4, 2020 </p>
Not assigining lab... |
Markdown | UTF-8 | 25,059 | 2.6875 | 3 | [] | no_license | Alatazan estava curioso com o desempenho de _Neninha_, sua modelo predileta.
<img src="http://www.aprendendodjango.com/media/img/ilustracao_7.gif" align="right"/>
- E aí, como foi lá, Nena?
- Puxa, foi mó legal, parece que eles gostaram dela!
- É? E ela foi contratada?
- Ahhh, você sabe como é o papai né... categó... |
Python | UTF-8 | 996 | 3.109375 | 3 | [] | no_license | #1226. [S/W 문제해결 기본] 7일차 - 미로1
def dfs(a,b):
if maze[a][b] == 3:
global result
result = 1
return
elif result ==1:
return
else:
global visited
visited[a][b] = True
if b+1 <16 and maze[a][b+1] != 1 and visited[a][b+1] == False:
dfs(a,b+1)
... |
Python | UTF-8 | 662 | 4 | 4 | [] | no_license | '''
要求
1、要有明确的结束条件 (递归最多999次)
2、每次进入更深一层递归时,问题规模相比上次递归都应有所减少
3、递归效率不高,递归层次过多会导致栈溢出(在计算机中,函数调用是通过栈(stack)这个数据结构实现的,每当进入一个函数调用,栈就会加一层栈帧,每当函数返回,栈会漏一层栈桢。由于栈的大小不是无限的,所以递归调用的次数多,会导致栈溢出)
'''
def calc(n):
print(n)
return calc(n + 1)
# calc(0)
def calcs(n):
print(n)
if int(n / 2) > 0:
return calcs... |
Java | UTF-8 | 752 | 2 | 2 | [] | no_license | package com.smartstudy.xxd.mvp.contract;
import com.smartstudy.commonlib.entity.SmartSchoolRstInfo;
import com.smartstudy.commonlib.mvp.base.BasePresenter;
import com.smartstudy.commonlib.mvp.base.BaseView;
import com.smartstudy.xxd.entity.SmartChooseInfo;
import java.util.ArrayList;
/**
* Created by louis on 2017/... |
Java | UTF-8 | 431 | 2.21875 | 2 | [] | no_license | package com.beeva.banco.BancoBeeva.dao;
import java.util.List;
import com.beeva.banco.BancoBeeva.entity.Cliente;
/**
* @author Armando Duran Salavador
*/
public abstract class ClienteDao {
public abstract Cliente saveCliente(Cliente cliente);
public abstract Cliente removeCLiente(int id);
public abstract Client... |
Swift | UTF-8 | 4,526 | 2.96875 | 3 | [
"MIT"
] | permissive | // Name: Brandon Siebert
// Course: CSC 415
// Semester: Fall 2017
// Instructor: Dr. Pulimood
// Project name: Discuss Action
// Description: iOS application that facilitates active discussion for social justice issues.
// Filename: MainViewController.swift
// Description: Entry point for the application. Controls t... |
Python | UTF-8 | 1,903 | 2.703125 | 3 | [
"MIT"
] | permissive | from .server_handler import ServerHandler
"""
Square Customer Group Object Handler between the Square Client and Squre Online server
"""
class Tournament:
def __init__(self, details):
# Dicitonary object to compensate for overall JSONObject usage
self.details = details
class TournamentHandler(Se... |
Markdown | UTF-8 | 187,876 | 2.609375 | 3 | [] | no_license | # Debunking the List of Alleged atrocities committed by the US authorities
Correcting the record on US interventions—covert or overt—human rights issues, and more. This project relies on the established documentary record over allegations and sensational headlines. We must not embrace anti-intellectualism for it leads ... |
Python | UTF-8 | 1,521 | 2.5625 | 3 | [] | no_license | from server.dao.ign_review_dao import IGNReviewDAO
from server.db_driver import initializeDB
from server.model.ignReviewModel import IGNReviewModel
from server.read_csv import read
def setup():
initializeDB()
read()
global dao
dao = IGNReviewDAO()
def testSelect():
model = dao.select((1,))
a... |
Java | UTF-8 | 3,577 | 2.171875 | 2 | [] | no_license | package com.example.aciko11.tennistournaments;
import android.content.Context;
import android.content.Intent;
import android.provider.ContactsContract;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.aciko11.tennisto... |
Java | UTF-8 | 13,738 | 1.75 | 2 | [] | no_license | package com.example.myapplication.activity;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
import android.os.Bundle;
import android.os.StrictMode;
imp... |
Java | UTF-8 | 2,499 | 2.40625 | 2 | [] | no_license | package com.example.sampleandroidanimationsandtransitions;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Vi... |
C++ | UTF-8 | 1,428 | 3.03125 | 3 | [] | no_license | #pragma once
#include "geometry.hpp"
#include <cmath>
Vec3::Vec3(double x, double y, double z): coefs{x,y,z}{ };
double dot(const Vec3 &a, const Vec3 &b){
double result = 0.0;
for (size_t i=0;i<3;i++){
result += a.coefs[i]*b.coefs[i];
}
return result;
};
QuaternionRotation::QuaternionRotation (double qi,double ... |
PHP | UTF-8 | 15,627 | 2.84375 | 3 | [] | no_license | <?php
require_once('../inc/init.inc.php');
//Si l'internaute n'est pas admin ou pas connecté il n'a rien à faire sur cette page, on le redirige vers la page connexion
if(!connecteAdmin())
{
header('Location:' . URL . 'connexion.php' );
}
//----------------------SUPPRESSION SALLE
if (isset($_GET['action']) && $_... |
Java | UTF-8 | 3,085 | 2.40625 | 2 | [] | no_license | package com.xingcloud.dataproxy.membase.test.config;
import org.w3c.dom.Node;
import com.xingcloud.dataproxy.membase.test.util.XMLUtil;
public class PoolConfig {
private int initConnect;
private int minConnect;
private int maxConnect;
private long idleTime;
private long maintSleep;
public PoolConfig(){
thi... |
Java | UTF-8 | 475 | 1.734375 | 2 | [] | no_license | package orar.dlfragmentvalidator.HornALCHOIF;
import java.util.Set;
import org.semanticweb.owlapi.model.OWLAxiom;
import orar.dlfragmentvalidator.TBoxValidator;
public class HornALCHOIF_TBox_Validator extends TBoxValidator {
public HornALCHOIF_TBox_Validator(Set<OWLAxiom> inputTBoxAxioms) {
super(inputTBoxAxiom... |
Java | UTF-8 | 2,817 | 2.421875 | 2 | [] | no_license | /**
* 版权所有, 允风文化
* Author: 允风文化 项目开发组
* copyright: 2012
*/
package com.yf.system.base.passenger;
import java.sql.SQLException;
import java.util.*;
import com.yf.system.base.util.PageInfo;
public class PassengerComponent implements IPassengerComponent{
private IPassengerManager passengerManager;
... |
JavaScript | UTF-8 | 7,712 | 2.96875 | 3 | [] | no_license | var debug = false;
if (debug === true){
var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = '#bgCanvas {opacity: 0 !important;}';
document.body.appendChild(css);
// Autoreload for the most tedious parts
// setTimeout(function(){
// window.location.reload(1);
// }, 500... |
C | UTF-8 | 617 | 2.671875 | 3 | [
"LicenseRef-scancode-public-domain"
] | permissive | // # htab_iterator_next.c
// # Řešení IJC-DU2, 25.4.2019
// # Autor: xhajek48 (Karel Hajek), FIT VUT
// # Přeloženo: gcc 8.2.1
#include "htab.h"
#include "htab_structs.h"
htab_iterator_t htab_iterator_next(htab_iterator_t it){
// if it points to the last element of index
if(it.ptr->next == NULL){
for(s... |
PHP | UTF-8 | 3,408 | 3.015625 | 3 | [] | no_license | <?php
class question
{
private $id, $owneremail, $ownderid, $createdate, $title, $body, $skills, $score, $downvoted_ids, $upvoted_ids;
public function __construct($id, $owneremail, $ownderid, $createdate, $title, $body, $skills, $score, $downvoted_ids, $upvoted_ids)
{
$this->id = $id;
$this... |
Markdown | UTF-8 | 16,736 | 2.921875 | 3 | [] | no_license | >文章收录在公众号:**bigsai** 更多精彩干货敬请关注!
### 前言
说起八皇后问题,它是一道回溯算法类的经典问题,也**可能**是我们大部分人在上数据结构或者算法课上遇到过的最难的一道题……

第一次遇到它的时候应该... |
Python | UTF-8 | 134 | 2.9375 | 3 | [] | no_license | names = ['john','moses','janet','mary']
emails = ['me@gmail.com','moses@gmail.com','ja@gmail.com','yahoo']
for i,j in zip(names,emails):
print(i,j) |
Java | UTF-8 | 10,524 | 2.4375 | 2 | [
"Apache-2.0"
] | permissive | package com.qouteall.immersive_portals.render;
import com.qouteall.immersive_portals.CGlobal;
import com.qouteall.immersive_portals.CHelper;
import com.qouteall.immersive_portals.my_util.BoxPredicate;
import com.qouteall.immersive_portals.portal.Portal;
import com.qouteall.immersive_portals.render.context_management.P... |
Markdown | UTF-8 | 1,600 | 2.875 | 3 | [] | no_license | MINIMEALS README
PROJECT SUMMARY: A web app that allows parents to log and review the meals their toddler is eating, after seeing several posts online by parents bemoaning the lack of a program that does this. The resulting project is the start of a response to this problem, with the intention that it provides a qui... |
C++ | UTF-8 | 1,361 | 2.65625 | 3 | [] | no_license | #include <Wire.h>
#include "Adafruit_TCS34725.h"
/* Example code for the Adafruit TCS34725 breakout library */
#define LED 7
/* Connect SCL to analog 5
Connect SDA to analog 4
Connect VDD to 3.3V DC
Connect GROUND to common ground */
/* Initialise with specific int time and gain values */
Adafruit_... |
Python | UTF-8 | 287 | 3.75 | 4 | [] | no_license | '''
filter函数
过滤函数 对一组数据进行过滤,符合条件的数据会生成一个新的列表并返回
'''
def isEven(n):
return n%2 == 0
list1 = [i for i in range(10)]
print("list1=", list1)
rst = filter(isEven, list1)
print(rst)
print([i for i in rst])
|
Python | UTF-8 | 409 | 3.03125 | 3 | [] | no_license | class Instruction():
def __init__(self, instruction, message, line):
self.instruction = instruction
self.message = message
self.line = line
def getMessage(self):
return self.message
def setLine(self, l):
self.line = l
def getLine(self):
ret... |
Python | UTF-8 | 1,054 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | import mmap
import numpy as np
import pandas as pd
import sys
file_path = sys.argv[1]
out_file_path = sys.argv[2]
memory_map = sys.argv[3] == "True"
with open(file_path, 'rb') as my_file:
if memory_map:
my_file = mmap.mmap(my_file.fileno(), 0, prot=mmap.PROT_READ)
with open(out_file_path, 'wb') as ou... |
Java | UTF-8 | 2,681 | 2.640625 | 3 | [] | no_license | package com.hazelcast.samples.serialization.hazelcast.airlines;
import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.Strea... |
Python | UTF-8 | 563 | 3.421875 | 3 | [] | no_license |
import requests
import time
url = "https://animechan.vercel.app/api/random"
print("\nWellcome to anime quote generator")
time.sleep(0.3)
print("Type 'quit' or 'exit' to exit")
while (True):
generate = input("\nPress [Enter] to generate quote \n")
if generate == 'quit' or generate == 'exit':
print("Tha... |
Python | UTF-8 | 2,590 | 3.0625 | 3 | [] | no_license | import os
import re
import MySQLdb
dir_to_scan = '/home/yura/test'
filetype_to_scan = 'txt'
'Get content of directory'
# TODO add directories scan recursively
def dir_content(scan_dir):
if os.path.exists(scan_dir) and os.path.isdir(scan_dir):
os.chdir(scan_dir)
return os.listdir(scan_dir)
# pr... |
Java | UTF-8 | 587 | 2.921875 | 3 | [] | no_license | package aniket12;
import java.util.Scanner;
public class Nosum {
public static void main(String[] args) {
System.out.println("Enter the number :");
Scanner sc=new Scanner(System.in);
int num = sc.nextInt();
int r=0,sum=0;
while(num>0 || sum>=10)
{
... |
Shell | UTF-8 | 181 | 2.953125 | 3 | [] | no_license | #!/bin/bash
rt=$(ps -p "$1" -o etime | tail -1 | tr -d ' ')
mem=$(sudo pmap -x "$1" | tail -1 | grep -oE '[0-9]+' | head -1)
echo "Running time : $rt"
echo "Memory : $mem kB"
|
Python | UTF-8 | 235 | 4.375 | 4 | [] | no_license | animals = ['dog', 'cat', 'horse', 'cow', 'sheep']
for animal in animals:
print(animal)
print(f"\n")
for animal in animals:
print(f"A {animal} has four legs\n")
print(f"You can eat all these animals, except a {animals[1]}")
|
C++ | UTF-8 | 1,623 | 4.40625 | 4 | [] | no_license | /*
Given n multiple digit numbers, return the maximum number
possible to obtain by aligning the given numbers in some order
A greedy strategy which works for the single digit problem
does not work in this case. A simple trick used here is to
convert numbers to strings and compare them digit by digit
(thus... |
Markdown | UTF-8 | 4,010 | 2.75 | 3 | [
"CC-BY-4.0",
"MIT"
] | permissive | ---
title: Provision a Wi-Fi profile via a website
description: Allow your users to download a profile from a website, and provision it.
ms.topic: article
ms.date: 01/22/2020
---
# Provision a Wi-Fi profile via a website
The workflow described in this topic was introduced in Windows 10, version 2004. This topic shows... |
Markdown | UTF-8 | 4,368 | 3.078125 | 3 | [
"MIT"
] | permissive | # Units
[](https://www.npmjs.com/package/units)
[](https://www.npmjs.com/package/units)
Simple, module-like dependency injection system with two-step initialization and de... |
Python | UTF-8 | 4,212 | 2.953125 | 3 | [
"Unlicense"
] | permissive | """
Create a standalone Dockerfile that pulls the recipes from Github.
This script concatenates Dockerfile_base and Dockerfile_fenics and replaces the
ADD command with a 'git clone'. Furthermore, it updates the environment
variables that specify which version of FEniCS to build.
This script requires Python 3.
Usage ... |
Java | UTF-8 | 9,439 | 1.65625 | 2 | [
"Apache-2.0"
] | permissive | /*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
package com.aws.greengrass.lambdatransformer;
import com.amazon.aws.iot.greengrass.component.common.ComponentRecipe;
import com.amazon.aws.iot.greengrass.component.common.ComponentType;
import com.amazo... |
C# | UTF-8 | 963 | 2.765625 | 3 | [] | no_license | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
enum EquipType { hat, chest, gloves, pants, feet, mainHand, offHand, twoHand }
[CreateAssetMenu(fileName = "Equipment", menuName = "Items/Equipment", order = 2)]
public class Equipment : Item
{
[SerializeField]
private EquipType eq... |
JavaScript | UTF-8 | 2,965 | 2.671875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | import React from 'react';
import * as d3 from 'd3';
class RoleSelector extends React.Component { // eslint-disable-line react/prefer-stateless-function
constructor(props) {
super(props);
this.state = {
Top: true,
Jungle: true,
Middle: true,
ADC: true,
Support: true,
sty... |
Markdown | UTF-8 | 7,293 | 3.1875 | 3 | [] | no_license | formX
=====
FormX is a Javascript-based mapping between XML content and web forms.
It consists of three parts, or rather two, and you're responsible for
the third. There is the formX object, which provides methods for
loading data from an XML file into a web form, a mapping file, the
spcification for which may be fou... |
Markdown | UTF-8 | 761 | 2.578125 | 3 | [] | no_license | # e-commerce-website
This project deals with developing an e-commerce website for Online Product Sales.
It provides the user with a catalog of different products available for purchase in the store.
In order to facilitate online purchases, a shopping cart is provided to the user.
[![Screenshot-2020-12-22-Screenshot.p... |
Markdown | UTF-8 | 20,852 | 2.734375 | 3 | [] | no_license | ---
title: MySQL
date: 2017-04-16T09:00:00.000Z
tags: null
---
# SQL:DDL,DML
## DDL:Data Defination Language `mysql> HELP Data Definition`
```
CREATE, ALTER, DROP
DATABASE, TABLE
INDEX, VIEW, USER
FUNCTION, FUNCTION UDF, PROCEDURE, TABLESPACE, TRIGGER, SERVER
```
## DML: Data Manipulation Language `mysq... |
Java | UTF-8 | 57 | 1.546875 | 2 | [] | no_license | package com.company;
public interface Comparable<U> {
}
|
C++ | UTF-8 | 552 | 2.671875 | 3 | [] | no_license | #include <iostream>
using namespace std;
struct Stu{
string id;
int test;
int fin;
};
Stu ps[1500];
int main()
{
int nS;
cin >> nS;
for(int i = 0; i < nS; i++)
{
cin >> ps[i].id >> ps[i].test >> ps[i].fin;
}
int nQ;
cin >> nQ;
for(int i = 0; i < nQ; i++)
{
... |
Python | UTF-8 | 704 | 3.109375 | 3 | [] | no_license | testcases = [
("Adjacent C++ style comments",
'''\
// foo
// bar\
'''),
("Adjacent C style comments",
'''\
/* foo *//* bar */\
'''),
("Nonterminated comments",
'''\
/*
'''),
("Nonterminated comments",
'''\
/* foo *\
'''),
("Everything",
'''
// c++ style comment
a = b + c;
d = 1 / 234 * foo - 2. + .2 + 2.2;
if what... |
C++ | GB18030 | 1,110 | 3 | 3 | [] | no_license | /*!
* Licensed under the MIT License.See License for details.
* Copyright (c) 2018 콭ĴϺ.
* All rights reserved.
*
* \file defer.hpp
* \author 콭ĴϺ
* \date 2017
*
* ģʵgolangdefer塣ںǰִһЩ
*
*/
#ifndef __DAXIA_DEFER_HPP
#define __DAXIA_DEFER_HPP
#include <stack>
#include <functional>
#define deferinit() daxia:... |
Markdown | UTF-8 | 2,171 | 3.71875 | 4 | [] | no_license | #### Lowest Common Ancestor
source: [HackerRank](https://www.hackerrank.com/topics/lowest-common-ancestor),
#### Naive Approach $O(N)$:
```cpp
#define mx_nodes 100
bool visited[mx_nodes];
int parent[mx_nodes];
vector<int> tree[mx_nodes];
int root_node = 0;
/*GetParents() function traverses the tree and computes the ... |
Java | UTF-8 | 178 | 1.742188 | 2 | [
"MIT"
] | permissive | package pl.pawel.linkshell.model.enums.strategy;
/**
* Created by pawellinkshell on 11.02.2018.
*/
public enum DecisionStrategyType {
PLAYER_LIVE,
PLAYER_AI_DEFAULT
}
|
Markdown | UTF-8 | 3,658 | 2.546875 | 3 | [
"MIT"
] | permissive | # Shell Script Tools
> Repository for some useful shell scripts which I've done to solve problems or make things...
---
**Table of Contents**
- [install_flash_player.sh](#install_flash_player)
- [kdialog_progbar_helper](#kdialog_progbar_helper)
- [cowsay_and_whatthecommit.sh](#cowsay_and_whatthecommit)
- [fix_icc_... |
Python | UTF-8 | 873 | 3.03125 | 3 | [] | no_license | # https://leetcode.com/problems/minimum-path-sum/
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
maxRows = len(grid)-1
maxCols = len(grid[0])-1
for i in range(maxRows, -1, -1):
for j in range(maxCols, -1,-1):
# current coords is bott... |
PHP | UTF-8 | 908 | 2.65625 | 3 | [] | no_license | <?php
function set_status($msg, $flag='info') {
return '<div class="message '.$flag.'">'.$msg.'</div>';
}
function convert_4digits($num) {
$ctr = 0;
$str = "";
while($ctr < 4) {
$str = $num%10 . $str;
$num /= 10;
$ctr++;
}
return $str;
}
function get_today() {
return date('Y-m-d');
}
function add_d... |
Java | UTF-8 | 5,377 | 3.328125 | 3 | [] | no_license | /**
* @FileName : case_01
* @author : wang.xiaolong
* @Date : 2017年7月31日
* @Description : 文件操作
* @check
* 【A】
* 八、buf值
*/
package case_01;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
... |
Python | UTF-8 | 462 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
import page
class BaseDriver:
driver=None
def get_driver(self):
if self.driver is None:
self.driver=webdriver.Chrome()
self.driver.maximize_window()
self.driver.get(page.URL)
return self.driver
def driver_quit(self):
... |
Python | UTF-8 | 1,368 | 2.875 | 3 | [] | no_license | import cv2
import numpy as np
import glob
import matplotlib.pyplot as plt
import random
imgs = glob.glob('96DM/*.png')
def rotate_image(image, angle):
image_center = tuple(np.array(image.shape[1::-1]) / 2)
rot_mat = cv2.getRotationMatrix2D(image_center, angle, 1.0)
result = cv2.warpAffine(image, rot_mat, ... |
Ruby | UTF-8 | 668 | 2.5625 | 3 | [] | no_license | class PainSeverityService
def self.analyze(submission)
new(submission).perform
end
def initialize(submission)
@submission = submission
end
def perform
set_pain_severity
end
private
def set_pain_severity
pain_severity = if @submission.current_pain_answer.value > 30
# => Notify... |
JavaScript | UTF-8 | 557 | 2.609375 | 3 | [] | no_license | function getDetail(id) {
window.location.href = `/product/${id}`;
}
function addToCart(id) {
fetch('/cart', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
productId: id,
}),
})
.then((response) => response.json())
.then((data) =>... |
Python | UTF-8 | 19,841 | 2.609375 | 3 | [
"MIT"
] | permissive | from prawcore.exceptions import RequestException, ResponseException, InvalidToken
import pickle as cPickle
import threading
import datetime
import operator
import sqlite3
import config
import praw
import time
import re
class bot:
# defined variables
def __init__(self):
self.reddit = praw.Reddit(client_id = config... |
C++ | UTF-8 | 1,402 | 3.46875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
struct Socks
{
int shortSock;
int longSock;
};
bool CheckIsValid(int n, int k);
bool CompareTwoSocks(Socks first, Socks second);
int main()
{
//Implementation 1
int n;
int k;
std::cin >> n >> k;
if (CheckIsValid(n, k) == true)
{
... |
Java | UTF-8 | 329 | 2.546875 | 3 | [] | no_license | package wsdemo;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public class Employee {
@WebMethod
public String greet(String message) {
return message;
}
@WebMethod
public double calculateSalary(double salary) {
return salary;
}
@WebMethod
public int calculateLeaves() {
return... |
C++ | UTF-8 | 1,285 | 3.4375 | 3 | [] | no_license | //
// main.cpp
// Week6Prog6
//
// Created by James Lawson on 10/16/18.
// Copyright © 2018 James Lawson. All rights reserved.
//
#include <iostream>
#include <string>
#include<cmath>
using namespace std;
template <class B>
class box {
private:
B depth;
B width;
B height;
public:
B getWidth(vo... |
PHP | UTF-8 | 4,955 | 2.90625 | 3 | [] | no_license | <?php
/*
* This file is part of the BFOSBrasilBundle package.
*
* (c) Paulo Ribeiro <paulo@duocriativa.com.br>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace BFOS\BrasilBundle\Validator\Constraints;
use Symfony\Componen... |
Markdown | UTF-8 | 1,801 | 3.25 | 3 | [
"MIT"
] | permissive | # batch-run-cmd
## 1 Introduction
See `https://github.com/linzhi2013/batch-run-cmd`.
This is a Python3 package which will read command lines from an input file,
and run each line of command one by one, and check their exit status.
More importantly, if one command fails, you can just jump to next command
(`-e` opti... |
Java | UTF-8 | 426 | 2.75 | 3 | [] | no_license | package com.rutgers.pm2;
public class MainFile {
public static void main(String[] args)
{
InsertionSort test = new InsertionSort();
test.push(10);
test.push(4);
test.push(14);
test.push(9);
test.push(3);
System.out.println("Linked test start");
test.printlist(test.head);
test.InsertionSo... |
C++ | UTF-8 | 209 | 2.8125 | 3 | [] | no_license | #include<iostream>
using namespace std;
int main(){
int n;
int count=1;
cin>>n;
for(int i=2;i<=n/2;i++){
if(n%i==0){
count++;
}
}
cout<<count<<endl;
}
|
Java | UTF-8 | 273 | 2.25 | 2 | [] | no_license | package com.app.util.exception;
/**
* common interface for various exception handler implementation.
* can be wrapper, logged or thrown back.
* @author ramkumarsundarajan
*
*/
public interface ExceptionHandler {
public void handle(Exception e,String message);
}
|
C# | UTF-8 | 4,928 | 2.625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SMX.Maths;
namespace SimplePang
{
public static class Game
{
public static RendererBase mRenderer;
public static InputBase mInput;
public static int mCurrentLevelId... |
Python | UTF-8 | 121 | 3.875 | 4 | [] | no_license | print("hello World!!!")
x = 0
for index in range(10):
x += 10
print("The value of x is currently {0}".format(x))
|
C | UTF-8 | 881 | 3.046875 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
int main (int argc, char *argv[])
{
struct hostent *h;
if (argc != 2)
{
fprintf (stderr,"usage: getip address\n");
exit(1);
}
if((h=gethostbyname(argv[1])) == NULL)
{
p... |
Shell | UTF-8 | 22,173 | 3.4375 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash
# itest bash script
# name : test-installer-creator.sh
# desc : Standalone installer test core script
# parameters which has to be exported from server:
# ITEST_BUILD_NAME
# ITEST_BUILD_VERSION
# ITEST_CREATOR_PATH
# ITEST_CREATOR_SUBDIRS
# ITEST_CREATOR_FILES
# *************... |
Python | UTF-8 | 737 | 3.21875 | 3 | [] | no_license | def MinNoOnes(a,low,high):
if low>high:
return -1
else:
mid=int((low+high)/2)
if(a[low]==1):
return low
if a[mid]==0:
return MinNoOnes(a,mid+1,high)
else:
return MinNoOnes(a,low,mid)
#
# a=[0,1,1,1,1,1,1,1,1]
# n=len(a)-1
# val=MinNoOne... |
Java | UTF-8 | 1,510 | 2.34375 | 2 | [] | no_license | package com.ljx.chapter3_1.unit;
import com.ljx.chapter3_1.configuration.Chapter3_2Configuration;
import com.ljx.chapter3_1.model.User;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.sprin... |
TypeScript | UTF-8 | 484 | 2.75 | 3 | [
"MIT"
] | permissive |
export class Transformation {
name: string;
disabled?: boolean;
collections?: string[];
applyToAllDocuments?: boolean;
script?: string;
}
export function serializeTransformation(transformation: Transformation) {
return {
Name: transformation.name,
Disabled: transformation.disab... |
C++ | UTF-8 | 3,603 | 2.515625 | 3 | [] | no_license | // ==============================================================
// This file is part of Glest (www.glest.org)
//
// Copyright (C) 2001-2008 Marti�o Figueroa
//
// You can redistribute this code and/or modify it under
// the terms of the GNU General Public License as published
// by the Free Software Foundation; eithe... |
Markdown | UTF-8 | 1,055 | 2.609375 | 3 | [] | no_license | # Pi Companion
A portable linux companion for my iPad Pro.
## Getting Started
Burn the latest raspbian lite image onto an SD Card. Balena etcher is a
reasonable tool on windows for this.
Create an empty file called `ssh` in the boot dir of the new SD.
Create a file called `wpa-supplicant.conf` in the boot dir of t... |
Java | UTF-8 | 465 | 2.046875 | 2 | [] | no_license | package com.abaghel.examples.spring.springboot.security.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import com.abaghel.examples.spring.springboot.security.entity.RememberMeToken;
/**
*
* @author abaghel
*
*/
public interface RememberMeTokenRepository extends ... |
C++ | UTF-8 | 1,616 | 3.5 | 4 | [] | no_license | #pragma once
#include <mutex>
#include <shared_mutex>
#include <type_traits>
template <class Ty>
class Synchronized {
public:
using value_type = std::remove_const_t<std::remove_reference_t<Ty>>;
using mutex_t = std::mutex;
using guard_t = std::lock_guard<mutex_t>;
template <class Guard, class Value>
stru... |
JavaScript | UTF-8 | 2,086 | 2.734375 | 3 | [] | no_license | const hamburgerBtn = document.querySelector(".hamburger-menu");
const hamburgerNavbar = document.querySelector(".hamburger-navbar");
//Mobile navigation
const mbInicio = document.querySelector('#mb-inicio');
const mbServicios = document.querySelector('#mb-servicios');
const mbProyectos = document.querySelector('#mb-pr... |
Shell | UTF-8 | 973 | 3.4375 | 3 | [
"MIT"
] | permissive | #!/bin/bash
set -e
mkdir -p $OUTPUT_BINARIES
mkdir -p $GOPACKAGES
echo ' '
echo '------------------'
echo "Adding user $DO_USER"
echo '------------------'
echo ' '
useradd $DO_USER -u $DO_UID
echo '------------------'
echo "Reading $GOREPOS and fetching with git"
echo '------------------'
echo ' '
# REMOVE OLD P... |
C# | UTF-8 | 1,532 | 2.78125 | 3 | [] | no_license | using UnityEngine;
namespace Environment {
[System.Serializable]
public class SerializableEnvironmentColor {
[SerializeField] public Color skyColor1;
[SerializeField] public Color skyColor2;
[SerializeField] public Color skyColor3;
[SerializeField] public Color skyColor4;
... |
JavaScript | UTF-8 | 4,064 | 2.546875 | 3 | [
"MIT"
] | permissive |
'use strict'
/**
* @license
* Copyright Little Star Media Inc. and other contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* 'Software'), to deal in the Software without restriction, including
* without limi... |
C++ | UTF-8 | 733 | 2.609375 | 3 | [
"MIT"
] | permissive | #include<sequencer.hpp>
#include<selector.hpp>
#include<action.hpp>
#include<iostream>
bool doorOpen = true;
bool isDoorOpen() {
if (doorOpen) {
std::cout << "door is opened" << std::endl;
return true;
}
std::cout << "door is closed" << std::endl;
return false;
}
bool closeDoor() {
doorOpen = false;
std::... |
Ruby | UTF-8 | 433 | 3.765625 | 4 | [
"MIT"
] | permissive | class Question
attr_accessor :num1, :num2, :answer, :operator
def initialize
@num1 = 1 + rand(20)
@num2 = 1 + rand(20)
@operator = ["+", "-", "*"].sample
@answer = num1.method(operator).(num2)
end
def generate_question
puts "What is #{num1} #{operator} #{num2}?"
end
def verify_answer(... |
Java | UTF-8 | 771 | 3.859375 | 4 | [] | no_license | package com.class33;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class HomeWork {
public static void main(String[] args) {
/*create an arraylist of cars and retrieve all the values using
* 3 diffrent ways
*/
List<String> car=new ArrayList<>();
car.add("Nissan"... |
Java | UTF-8 | 4,968 | 2.265625 | 2 | [] | no_license | package com.hs3.lotts.n11x5.nx;
import com.hs3.lotts.LotteryUtils;
import com.hs3.lotts.NumberView;
import com.hs3.lotts.PermutateUtils;
import com.hs3.lotts.PlayerBase;
import com.hs3.utils.ListUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import j... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.