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 | 13,894 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import datetime
import json
import os
from typing import Optional
import click
import pandas as pd
import requests
import seaborn as sns
from gender_guesser.detector import Detector
from matplotlib import pyplot as plt
from tqdm import tqdm
HERE = os.path.abspath(os.path.dirname(__file__))
FIG... |
Python | UTF-8 | 1,297 | 2.78125 | 3 | [
"MIT"
] | permissive | # data는 e9t(Lucy Park)님께서 github에 공유해주신 네이버 영화평점 데이터를 사용하였습니다.
# https://github.com/e9t/nsmc
from collections import defaultdict
import torch
from torch.autograd import Variable
class DataSetUp(object):
def __init__(self):
self.w2i_dict = defaultdict(lambda : len(self.w2i_dict))
self.pad = self.... |
Java | UTF-8 | 6,026 | 1.90625 | 2 | [] | no_license | /*
* Copyright 1999-2010 Luca Garulli (l.garulli--at--orientechnologies.com)
*
* 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
*
* Un... |
Python | UTF-8 | 168 | 2.84375 | 3 | [] | no_license | import fractions
n = int(input())
t = [int(input()) for _ in range(n)]
for i in range(1, n):
t[i] = t[i] * t[i - 1] // fractions.gcd(t[i], t[i - 1])
print(t[-1])
|
Java | UTF-8 | 864 | 2.0625 | 2 | [
"MIT"
] | permissive | package com.sun.jna.win32;
import com.sun.jna.FromNativeContext;
import com.sun.jna.StringArray;
import com.sun.jna.ToNativeContext;
import com.sun.jna.TypeConverter;
import com.sun.jna.WString;
class W32APITypeMapper$1 implements TypeConverter {
// $FF: synthetic field
final W32APITypeMapper this$0;
W32API... |
C# | UTF-8 | 2,765 | 2.765625 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Prism.Logging;
using Prism.Services;
namespace PrismSample.Logging
{
public class LogGenerator
{
private ILogger _logger { get; }
private IDeviceService _deviceService { get; }
public LogGenera... |
Markdown | UTF-8 | 8,208 | 2.625 | 3 | [] | no_license | # Моделирование оттока для сети фитнес-центров.
Яндекс.Практикум, Анализ Данных, Проект 9: ML, sklearn, классификация: logistic regression, random forest classifier; кластеризация: distance matrix, dendrogram, K-Means.
__Attention:__ Иногда GitHub капризничает и не открывает файлы .ipynb, но проект всегда можно посмо... |
Java | UTF-8 | 325 | 2.40625 | 2 | [] | no_license | package org.demo.pattern.singleton;
/**
*
* @author
* @date 2011-5-20
* @file org.demo.pattern.singleton.Singleton.java
*/
public class Singleton {
private static Singleton instance = new Singleton();
private Singleton(){}
public static Singleton getInstance(){
return instance;
}... |
Python | UTF-8 | 3,621 | 3.203125 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
import tables as pt
from PositionModel import PositionModel
class Position:
def __init__(self):
self.position = np.array([])
def addPosition(self,timestamp,symbol,shares,purchase_price):
'''
Adds a new position
timestamp: the time the position was entered
... |
JavaScript | UTF-8 | 230 | 3.359375 | 3 | [] | no_license | function bubbleSort (array) {
for(var i=0;i<array.length;i++){
for(var j=0;j<array.length;j++){
if(array[i] < array[j]){
var lesser = array[j];
array[j] = array[i];
array[i] = lesser;
}
}
}
return array
} |
TypeScript | UTF-8 | 693 | 3.203125 | 3 | [] | no_license | interface Persona {
id: number,
nombre: string,
edad: number,
fechaIngreso?: Date
}
var personas: Persona[] = [];
const crearPersonas = (total: number) => {
for (let i = 1; i <= total; i++) {
personas.push({
id: i,
nombre: `Persona ${i}`,
edad: 4 + (i * ... |
Java | UTF-8 | 819 | 2.796875 | 3 | [] | no_license | package com.ai.common.enums;
public enum TemplateParamCategoryEnum {
MAIN(1, "固定->在页面上固定"), DYNAMIC(2, "连动->根据项不同显示不同对象");
int key;
String value;
TemplateParamCategoryEnum(int key, String value) {
this.key = key;
this.value = value;
}
public int getKey() {
return key;
}
public void s... |
Python | UTF-8 | 305 | 3.453125 | 3 | [] | no_license | f = open('a.txt','w')
f.write("hello world1\n")
f.write("hello world2")
f.close()
'''
f = open('a.txt','r')
content = f.read(3)
print(content)
f.close()
'''
f = open('a.txt','r')
content = f.readlines()
#print(type(content))
i = 1
for temp in content:
print("%d:%s"%(i,temp))
i+=1
f.close()
|
Python | UTF-8 | 2,559 | 4 | 4 | [] | no_license |
class Stack(object):
def __init__(self, size):
self.size = size # 初始化数组的大小
self.array = list()
self.cur_size = 0 # 代表当前数组的大小
def push(self, num):
if self.size <= self.cur_size:
print('can not push')
return
self.array.append(num)
... |
Python | UTF-8 | 604 | 3.578125 | 4 | [] | no_license | # Copyright(C) 2018 刘珅珅
# Environment: python 3.6.4
# Date: 2018.5.6
# 类树
def class_tree(cls, indent):
print('.' * indent + cls.__name__)
for super_cls in cls.__bases__: # 查找超类
class_tree(super_cls, indent + 3)
def instance_tree(inst):
print('Tree of {0}'.format(inst))
class_tree(inst.__cla... |
JavaScript | UTF-8 | 1,559 | 3.59375 | 4 | [] | no_license | console.log("=======SLIDE 7 PROTOTYPES =====")
var simpleObj = function(c){
this.city=c;
}
var live1= new simpleObj("Brooklyn");
var live2= new simpleObj("Bronx");
simpleObj.prototype.state ="New York";//prototype applied
console.log(live1);//simpleObj { city: 'Brooklyn' }
console.log(live2);//simpleObj { c... |
PHP | UTF-8 | 4,763 | 2.78125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | <?php
namespace artjom\ToDoListBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Symfony\Component\Validator\Constraints\Length;
use Symfony\Component\Validator\Constraints\Choice;
use Symfony\Component\Validator\ExecutionContextInterface;
use Symfony\Component... |
Java | UTF-8 | 549 | 2.4375 | 2 | [
"Apache-2.0"
] | permissive | package com.whut.demo.common.constant;
public class PayConstant {
public enum PayRespConstant{
SUCCESS(0,"支付成功"),FAILED(1,"支付失败"),
SECOND_PAY(2,"重复支付"),ORDER_NON_EXIST(3,"订单不存在");
private int code;
private String msg;
PayRespConstant(int code, String msg) {
this... |
C++ | UTF-8 | 1,040 | 3.15625 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using std::cout;
using std::endl;
using std::vector;
using std::min;
#define infinite 100
vector<vector<int>> Floyd_Warshall_algorithm(vector<vector<int>> &W)
{
int row = W.size();
vector<vector<int>> D_zero = W;
vector<vector<vector<int>>> D_vec;
D_vec... |
Python | UTF-8 | 299 | 2.828125 | 3 | [] | no_license | # input: [1,2,3,4,5,2,3,1] -> output: 5
# input: [4,1,2,1,2] -> Output: 4
# Input: [1]-> Output: 1
class Solution:
def singleNumber(self, nums: List[int]) -> int:
if nums:
res = 0
for i in nums:
res ^= i
return res
return None |
C | UTF-8 | 3,042 | 3.546875 | 4 | [] | no_license | /*
* disk.c
*
* Created on: 28-Jan-2018
* Author: rishabh
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "disk.h"
static int num_blocks = 0; // This will increase when the block is completely full
static int nreads = 0; // This will keep tr... |
Markdown | UTF-8 | 3,454 | 2.625 | 3 | [] | no_license | #Steps to run the project :
> This project is java maven project so once you unzip the directory. Please follow the below steps:
-----------------------------------------------------------------------------------------------------------------------
#####Step 1. Open terminal and goto the basediretory :
cd /path/to/... |
Markdown | UTF-8 | 7,860 | 2.5625 | 3 | [] | no_license |
# Monorepo Nix Expressions
Now it's time to put our haskell code to work.
Each of our haskell packages has to have a corresponding nix expression describing how to build it.
The process of writing Nix expressions for haskell packages is error-prone and they would likely fall
out of sync so we would like to generate t... |
Markdown | UTF-8 | 2,828 | 3.046875 | 3 | [] | no_license | ---
layout: default
nav_order: 3
title: Resources
---
# Resources
{: .no_toc }
Here, I have a list of resources for different kinds of things that I learned in grad school including things like how to set up Jupyter on cloud, how to download NGS data efficiently etc. I still come back to these for a refresher sometim... |
JavaScript | UTF-8 | 3,044 | 2.828125 | 3 | [] | no_license | import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router-dom';
import { addUser } from '../redux/actions/userActions';
/*
* Renders User Registration form
*/
function UserForm() {
const dispatch = useDispatch();
const history = useHistory();
c... |
JavaScript | UTF-8 | 710 | 3.140625 | 3 | [] | no_license | module.exports = function(name, pw){
let callback = {
result: false,
message:''
}
const reg = new RegExp(/^(?![^a-zA-Z]+$)(?!\D+$)/)
if(name == ''|| name == null)
callback.message = '请填写用户名'
else if( pw == '' || pw == null)
callback.message = '请填写密码'
else if ( name.length < 3)
callback.... |
Java | UTF-8 | 1,117 | 2.765625 | 3 | [] | 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 analisisLexico;
/**
*
* @author Caili
*/
public enum TokenType {
// basic types
ID, // [a-zA-Z][a-zA-Z0-9_]*
INT... |
Shell | UTF-8 | 1,080 | 3.546875 | 4 | [
"BSD-3-Clause"
] | permissive | #!/bin/bash
# Using a shell script for now, because it's not clear that Maven's release plugin
# exactly fits the bill....
version="$1"
if [ ! -n "$version" ]; then
echo "ERROR: specify version"
exit 1
fi
sxml_home="$(dirname "$0")"/..
cd "$sxml_home"
if [ $(svn status | wc -l) -gt 0 ]; then
svn status
... |
JavaScript | UTF-8 | 2,502 | 2.546875 | 3 | [] | no_license | function BasicTreeMap() {
var BasicTreeMap = new mantis.ViewBase("BasicTreeMap", "hierarchical");
BasicTreeMap.create_layout = function () {
// Initializing some basic width
var margin = {top: 20, right: 10, bottom: 10, left: 10};
var width = d3.select(this.container).style('width').replace('px', '') - mar... |
Java | UTF-8 | 677 | 2.09375 | 2 | [] | no_license | package com.srnpr.xmaspay.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import com.srnpr.xmaspay.response.WechatUnifyResponse;
/**
* 微信交易取消
* @author pang_jhui
*
*/
public interface IWechatTradeCancelAspect {
/**
* 交易取消响应前
*/
public void doBefore(JoinPoint joinPoi... |
Java | UTF-8 | 177 | 1.8125 | 2 | [] | no_license | package dcc.evaluation.computation.model;
public class TestArray {
public static void main(String[] args) {
double a = 0;
System.out.println(Math.abs(a)<1.0e-300);
}
}
|
Java | UTF-8 | 794 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | package ru.job4j.collections;
import org.junit.Test;
import javax.jws.soap.SOAPBinding;
import java.util.*;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;
/**
* Created by admin on 12.05.2017.
*/
public class UserConverTest {
@Test
public void TestHashMap() {
User... |
Java | UTF-8 | 934 | 3.40625 | 3 | [] | no_license | package ft.ufam.ptr.semaforo.model;
/** Objeto que representa um carro.
* @see Veiculo
* @author Felipe André
* @author Paulo Henrique
* @version 3.0, 02/08/2015 */
public class Carro implements Veiculo {
/* Atributos da classe */
private Local origem, destino;
/** Instancia um objeto Carro.
* @param ... |
Java | UTF-8 | 15,348 | 2.265625 | 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 project.tools.students;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerP... |
Python | UTF-8 | 536 | 2.859375 | 3 | [] | no_license | #! /usr/bin/env/python
import os
baseFileName = raw_input("Enter base folder name: ")
myPwd = os.getcwd()
for index in range(0, 50):
if not os.path.exists(baseFileName + str(index)):
os.makedirs(baseFileName + str(index))
os.chdir(myPwd + '/' + baseFileName + str(index))
myPwd = os.getcw... |
Java | UTF-8 | 1,933 | 2.265625 | 2 | [] | no_license | package lexcom.app;
import java.io.Serializable;
import java.util.Date;
public class Recordatorio_List implements Serializable {
private static final long serialVersionUID = 1L;
private Integer indice;
private String actor;
private String deudor;
private Date fecha_ingreso;
pr... |
C | UTF-8 | 791 | 3.8125 | 4 | [] | no_license | #include <stdio.h>
/**
* L'entrée standard (0) [stdin]
* Sortie standard (1) [stdout]
* Sortie d'erreur (2) [stderr]
*/
int main() {
FILE * fp = fopen("2/README.md", "r");
printf("Position du curseur: %ld\n", ftell(fp));
char c = fgetc(fp); // Le curseur se déplace de 1
printf("Position du curseur:... |
Python | UTF-8 | 3,267 | 3.3125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
def read_single_file_2_lines(filepath):
print('Reading from:' +filepath + '\n')
file_object = open(filepath, 'r')
contents = file_object.read() # get contents from the path
contents_lines = contents.split('\n')
return contents_lines
#获取with as 子句中所有子句的名称以及被调用的次数
def get_w... |
Python | UTF-8 | 362 | 2.5625 | 3 | [] | no_license | from mcpi.minecraft import Minecraft
import random
import time
mc = Minecraft.create("10.183.3.38",4711)
def Wool(a,b,c):
x, y, z = mc.player.getPos()
b = random.randint(0,15)
mc.setBlock(x,y,z, 35,b)
time.sleep(.25)
mc.setBlock(x,y,z, 0)
if __name__ == "__main__":
x, y, z = mc.player.getPos()
a = 1
while... |
JavaScript | UTF-8 | 563 | 3.359375 | 3 | [] | no_license | var longestCommonPrefix = function(strs) {
if (strs.length <= 0) { return '' }
let i = 0
while (strs.every(s => s[i] && s[i] === strs[0][i])) {
i++
}
return strs[0].slice(0, i)
};
var longestCommonPrefix = function (strs) {
if (strs.length > 0) {
let minLen = Math.min(...st... |
Python | UTF-8 | 904 | 2.5625 | 3 | [
"MIT"
] | permissive | import os
import sys
import time
from shutil import copyfile, rmtree
from config.logger import logger
quiet = True # set this to false if you're having issues installing to debug stuff
if quiet:
quiet = "-q"
else:
quiet = ""
logger.info("Installing requirements...")
response = os.system(
'{} -m pip inst... |
Java | UTF-8 | 6,142 | 2.359375 | 2 | [] | no_license | package com.primeton.liuzhichao.demo.redis;
import java.lang.reflect.Method;
import java.util.Set;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import o... |
C# | UTF-8 | 1,993 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | using Azure.Sdk.Tools.TestProxy.Common;
using System;
using System.Text;
namespace Azure.Sdk.Tools.TestProxy.Sanitizers
{
/// <summary>
/// This sanitizer operates on a RecordSession entry and applies itself to the Request and Response bodies contained therein. It ONLY operates on the request/response bodies.... |
Markdown | UTF-8 | 812 | 2.78125 | 3 | [] | no_license | [TOC]
# 计算收益率
## 收益率RATE:PV/FV/PMT公式
已知求未知,五大要素知其四可求另一

PV(present value):现值,2034年的十万,相当于2014年的多少钱。(算现值)
FV:终值,2014年的十万,相当于2034年的多少钱
PMT:年金,现在开始存钱,每个月存多少钱,30年后我会有多少钱
## 内部收益率:IRR公式,计算相同时间间隔的年化收益率
假如贷款10000,分12月,每月手续费0.66%,每月还本金83.33(不算手续费),看似年化手续费7.92%。实际上,输入到EXCEL,计算年化为14.31%
:
return math.floor(value / 3) - 2
input = sys.stdin.readlines()
values = [];
for line in input:
values.append(calculate_fuel(int(line.strip())))
print("Part 1: " + str(sum(values)))
fuels = [];
def calculate_module_fuel(value):
fuel_for_value = calcu... |
Java | UTF-8 | 1,370 | 2.390625 | 2 | [] | no_license | package com.journeyos.freshday.base;
import android.app.Activity;
import android.os.Bundle;
import butterknife.ButterKnife;
/**
* Desc: 基础父类
* Date: 2017/3/2 10:21
* Email: frank.xiong@coolpad.com
*/
public abstract class BaseActivity extends Activity {
public abstract void initData();
public v... |
Python | UTF-8 | 4,920 | 2.890625 | 3 | [] | no_license | # General
import pandas as pd
import numpy as np
# Statistics
import statistics as st
# Image processing
import matplotlib.pyplot as plt
# Multinomial Logit
from sklearn.linear_model import LogisticRegression
# Support Vector Machine
from sklearn.svm import SVC
# Neural Networks
from sklearn.neural_network import M... |
Python | UTF-8 | 1,573 | 3.296875 | 3 | [] | no_license | #!/usr/bin/env python3
from pprint import pprint
from typing import Dict, Set, Tuple
# INPUT_FILE_NAME: str = "test-input"
INPUT_FILE_NAME: str = "input"
Cell = Tuple[int, int, int]
actives: Set[Cell] = set()
with open(INPUT_FILE_NAME, "r") as input_file:
z = 0
y = 0
for line in input_file:
acti... |
Java | UTF-8 | 359 | 2.09375 | 2 | [] | no_license | package xyz.incraft.SimpleAnnotation.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Created by Михаил on 20.01.2016.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
... |
Java | UTF-8 | 956 | 2.125 | 2 | [] | no_license | package com.ggiit.easyblog.project.system.role.entity;
import com.ggiit.easyblog.framework.web.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 角色实体类
*
* @author gao
* @date 2019.5.8
*... |
C | UTF-8 | 1,425 | 3.03125 | 3 | [] | no_license | #include "head.h"
/***创建目录文件链表,区分文件类型***/
INFO* create_file_link()
{
DIR *dir = opendir("./");
if (NULL == dir)
{
perror("fail open rootdir /\n");
return NULL;
}
struct dirent *info_d;
INFO *head = NULL;
while (NULL != (info_d = readdir(dir)))
{
char namebuf[256] = {0};
strcpy(namebuf,info_d->d_name... |
Java | UTF-8 | 1,274 | 2.421875 | 2 | [] | no_license | package me.matzhilven.war.commands.subcommands.spawn;
import me.matzhilven.war.WARPlugin;
import me.matzhilven.war.commands.SubCommand;
import me.matzhilven.war.utils.StringUtils;
import me.matzhilven.war.war.spawns.Spawn;
import org.bukkit.command.Command;
import org.bukkit.entity.Player;
import java.util.Optional;
... |
JavaScript | UTF-8 | 420 | 2.984375 | 3 | [] | no_license | const handleEvent = (event) => {
event.preventDefault();
const data = new FormData(event.target);
const objeto = Object.fromEntries(data.entries());
objeto.optionsCheckbox = data.getAll("optionsCheckbox");
console.log(objeto);
};
const formListener = () => {
const myForm = document.querySelector("form");
... |
C | UTF-8 | 37,349 | 3.375 | 3 | [] | no_license | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "infinite_int.h"
/**
* Perform some tests on cleans.c
**/
void infint_test_cleans(void)
{
t_inf_int *ptr;
t_inf_int *n;
ptr = NULL;
printf("Enter in %s\n", __FUNCTION__);
printf("Test infinit_free :\... |
Markdown | UTF-8 | 6,460 | 2.515625 | 3 | [] | no_license | Yii 2 Basic Project Template with Deployer.php support.
==========================================================
Yii 2 Basic Project Template with Deployer.php support is a skeleton [Yii 2](http://www.yiiframework.com/) application for
rapidly creating projects.
The template contains the basic features including us... |
Java | UTF-8 | 633 | 2.703125 | 3 | [] | no_license | package fr.soat.client.util;
import fr.soat.shared.Person;
public class PersonData {
private Person person;
/**
* Liste civilités
*/
private String[] civilites;
/**
* Constructeur pour civilités
*/
public PersonData() {
civilites = new String[]{"Mlle", "Mme", "Mr"};
}
/**
... |
Python | UTF-8 | 1,031 | 2.84375 | 3 | [] | no_license | import sys
from j_scraper import j_scraper
from graphql_wrapper import graphql_wrapper
"""
This script will kick off the process to scrape a user specified
number of games from j_archive.
How to run:
python __main__.py <start_game_id> [<end_game_id>]
"""
if __name__ == "__main__":
start_game_id = int(sys.argv[1]... |
Java | UTF-8 | 641 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | package com.github.czyzby.context;
/** This class will be used to start component scanning. All annotated classes in this package and any child package
* will be detected and initiated. This is just a utility to mark context location, it should not be used otherwise.
*
* @author MJ */
// Note: normally you could us... |
Python | UTF-8 | 2,590 | 3.0625 | 3 | [] | no_license | # skip test or selective test, custom markers
# execution command - pytest test_math_selective.py -v
# execution command - py.test test_math_selective.py -v
# execution command - py.test -v -rxs
""" -k "method name "- only run tests which match the given substring expression. An expression is a python evaluatable
... |
PHP | UTF-8 | 983 | 2.5625 | 3 | [] | no_license | <?php
/*
* 关键字统计(发现、海报、店铺)
*/
class CountController extends CommonController {
public function _initialize(){
header('Content-Type:text/html; charset=UTF-8');
//header('Content-Type:application/json; charset=UTF-8');
}
/*
* 添加统计
* @param string $str 搜索关键词
* @param string $type 类型(1发现、2海报、3店铺)... |
Java | UTF-8 | 61,836 | 2.484375 | 2 | [
"Apache-2.0"
] | permissive | package panda.lang.reflect;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.GenericDeclaration;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
import java.lang.reflec... |
Shell | UTF-8 | 295 | 3.3125 | 3 | [] | no_license | #!/bin/sh
. ./bin/utils.sh
# Yarn installs node for you. Mercurial is necessary for vim.
formulae=(zsh git tmux mercurial vim yarn n ack mongodb heroku)
main()
{
print 'Installing brew formulae...'
for i in ${formulae[@]} ; do
echo "Installing $i"
brew install $i
done
}
main
|
Python | UTF-8 | 2,551 | 2.90625 | 3 | [
"MIT"
] | permissive | import toml
from .base import Base
class StackOffsetType:
BINJA = 0
IDA = 1
GHIDRA = 2
ANGR = 3
class StackVariable(Base):
"""
Describes a stack variable for a given function.
"""
__slots__ = (
"func_addr",
"name",
"stack_offset",
"stack_offset_type"... |
Java | UTF-8 | 3,080 | 2.109375 | 2 | [] | no_license | package demo.example.com.myradarapplication;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import ... |
Python | UTF-8 | 1,198 | 3.9375 | 4 | [] | no_license | class Queue():
def __init__(self):
self.items=[]
self.num_elements=0
def enqueue(self,element):
self.items.insert(0,element)
self.num_elements+=1
def dequeue(self):
if self.num_elements!=0:
top=self.items[-1]
self.items[-1:]=[]
self... |
JavaScript | UTF-8 | 4,691 | 2.5625 | 3 | [
"MIT"
] | permissive | import jQuery from 'jquery';
import abstrax from '../src/index.js';
describe('abstrax', () => {
let myModel = null;
const ajaxArgsFromCall = () => jQuery.ajax.calls.mostRecent().args[0];
const expectFakeHeader = (request, value) => {
myModel[request]();
expect(ajaxArgsFromCall().headers['Fake-Header'])... |
C++ | UTF-8 | 5,762 | 3.140625 | 3 | [] | no_license | // File: main.cpp
// Authors: Cody Valle
// Description: Draws a primitive circle.
#include <GL/glew.h>
#include <GL/freeglut.h>
#ifdef __APPLE__
# include <OpenGL/glext.h>
#else
# include <GL/glext.h>
#pragma comment(lib, "glew32.lib")
#endif
#include <cmath>
#include <iostream>
const double PI = ... |
C++ | UTF-8 | 2,585 | 3.140625 | 3 | [
"BSL-1.0"
] | permissive | #pragma once
#include <pure/types/some.hpp>
namespace pure {
/**
Stable pointer to a value. The value is allocated on the heap via new and its lifetime is handled via an atomic
refcount. The underlying value can not be mutated, because it's not guranteed to not be accessed by other
threads concurrently.
@tpa... |
Java | UTF-8 | 1,148 | 2.515625 | 3 | [] | no_license | import java.util.*;
import ngat.message.RCS_TCS.*;
import ngat.astrometry.*;
import ngat.util.*;
/** Implements the AUTOGUIDE command.*/
public class AUTOGUIDEImpl extends TCSCommandImpl {
String state;
public AUTOGUIDEImpl(StringTokenizer tokens, TCS_Status sdb) {
super(tokens, sdb);
}
/** Execut... |
C++ | UTF-8 | 1,221 | 2.921875 | 3 | [] | no_license | #include <PlainProtocol.h>
PlainProtocol mytest;
void setup() {
mytest.init();
Serial.begin(57600);
}
void loop() {
//Receive frame from serial. This function should be put in the loop and called periodically as following:
if (mytest.receiveFrame()) {
//if the received command is "speed", do the "speed" ... |
C# | UTF-8 | 2,946 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"CC0-1.0",
"BSD-2-Clause"
] | permissive | // ------------------------------------------------------------
// The code in this repository code was written by Lee Campbell, as a
// derived work from the original Java by Gil Tene of Azul Systems and
// Michael Barker, and released to the public domain, as explained
// at http://creativecommons.org/publicdomain/z... |
Swift | UTF-8 | 306 | 2.59375 | 3 | [] | no_license | //
// AbstractFactory.swift
// AbstractFactory
//
// Created by Giuseppe Primo on 07/07/2017.
// Copyright © 2017 Giuseppe Primo. All rights reserved.
//
import Foundation
protocol AbstractFactory{
func getColor(color : String) -> ColorProtocol?
func getShape(shape : String) -> ShapeProtocol?
}... |
Ruby | UTF-8 | 3,289 | 3.0625 | 3 | [
"MIT"
] | permissive | #-- encoding: UTF-8
# For Ruby 1.9.3, 2.0.0
rv = RUBY_VERSION.split('.')[(0..1)].join('')
require 'string-scrub' if rv >= '19' && rv < '21'
module Nomener
# Module with helper functions to clean strings
#
# Currently exposes
# .reformat
# .cleanup!
# .dustoff
#
module Cleaner
# Allowable c... |
Java | UTF-8 | 10,462 | 1.992188 | 2 | [] | no_license | // $Id: Id0920Process.java,v 1.1.1.1 2006/08/17 09:34:10 mori Exp $
package jp.co.daifuku.wms.idm.rft;
/*
* Copyright 2003-2005 DAIFUKU Co.,Ltd. All Rights Reserved.
*
* This software is the proprietary information of DAIFUKU Co.,Ltd.
* Use is subject to license terms.
*/
import java.io.IOException;
import java.s... |
Python | UTF-8 | 1,793 | 3.015625 | 3 | [] | no_license | #!/usr/bin/python
#coding=utf-8
class OutputFormatter:
def __init__(self):
pass
def printHeader(self, description):
print '--------------- Result Header ---------------'
def printFooter(self, description):
print '\r--------------- Result Footer ---------------'
def printResu... |
Markdown | UTF-8 | 2,584 | 2.6875 | 3 | [
"MIT"
] | permissive | # Send Event Sample
Sample application that uses the Azure IoT Dotnet SDK to send telemetry messages to the
Azure IoT Hub cloud service or to an Azure IoT Edge device. The sample demonstrates how to connect
and send messages using a protocol of your choices as a parameter.
## Build the sample
As a prerequisite you w... |
Go | UTF-8 | 4,282 | 3.09375 | 3 | [
"ISC"
] | permissive | package mux
import (
"net/http"
"net/http/httptest"
"reflect"
"testing"
)
var (
_ Router = &tree{}
_ Builder = &tree{}
_ Walker = &tree{}
)
func TestTreeAddDuplicateName(t *testing.T) {
r1 := NewRoute("/foo", nil, WithName("test"))
r2 := NewRoute("/bar", nil, WithName("test"))
tree := &tree{}
err := tre... |
Python | UTF-8 | 1,390 | 2.84375 | 3 | [] | no_license | #!/urs/bin/env python
# -*- coding:utf-8 -*-
data ={
'北京':{
'海淀区':{
'颐和园', '圆明园遗址公园', '旧土城遗址公园', '大钟寺'
},
'东城区':{
'劳动人民文化宫', '老舍纪念馆', '柳荫公园', '青年湖公园'
},
},
'浙江':{
'杭州':{
'西湖', '西溪湿地', '宋城', '钱塘江', '南宋御街',
},
... |
Java | UTF-8 | 5,290 | 1.84375 | 2 | [] | no_license | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.pelindo.ebtos.bean;
import com.qtasnim.jsf.FacesHelper;
import com.pelindo.ebtos.ejb.facade.remote.MasterUtilisasiAlatFacadeRemote;
import com.pelindo.ebtos.ejb.facade.remote.MasterEquipmentFacadeRemote;
imp... |
SQL | UTF-8 | 1,729 | 4.03125 | 4 | [] | no_license | CREATE TABLE PROFESSOR
(
MID CHAR(9) PRIMARY KEY,
NAME VARCHAR(30),
TITLE VARCHAR(20) CHECK (TITLE IN ('ASSISTANT', 'ASSOCIATE', 'FULL', 'ADJUNCT', 'INSTRUCTOR')),
DNO INT
);
CREATE TABLE DEPT
(
DNO INT PRIMARY KEY,
DNAME VARCHAR(30)
);
CREATE TABLE STUDENT
(
... |
Java | UTF-8 | 4,538 | 2.359375 | 2 | [] | no_license | package com.hbsd.rjxy.miaomiao.zsh.setting.model;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
... |
Java | UTF-8 | 3,092 | 2.265625 | 2 | [] | no_license | package com.ibank.bean;
import java.sql.Timestamp;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* Overdraft entity. @autho... |
JavaScript | UTF-8 | 2,017 | 3.046875 | 3 | [] | no_license | $(document).ready(function() {
$('.store-button').on('click', function(event) {
let titleValue = $('.input-title-field').val();
let titleBox = $(`<div class="snippet-title">${titleValue}</div>`).delay(120000).fadeOut(3000);
if (titleValue === "") {
alert("Enter a valid file name");
return false;
}
local... |
Java | UTF-8 | 2,443 | 3.671875 | 4 | [
"MIT"
] | permissive | package Assigments7;
import java.util.HashMap;
import java.util.Scanner;
public class Practice3 {
public static void main(String[] args) {
HashMap<Integer, String> studentList = new HashMap<Integer, String>();
studentList.put(101, "Karthi");
studentList.put(102, "Jose");
studentLi... |
Ruby | UTF-8 | 184 | 3.359375 | 3 | [] | no_license | def count_to_zero(number)
if number <= 0
puts "Zero already"
else
puts number
return count_to_zero(number-1)
end
end
#Test case
count_to_zero(5)
count_to_zero(0)
|
Ruby | UTF-8 | 747 | 2.921875 | 3 | [] | no_license | # This module will allow querying of TwitterCounter API
# http://twittercounter.com/pages/api
module TwitCount
# twitter_id should be an integer that is the Twitter ID (not username!)
# of the account that you would like information for
def self.query(twitter_id)
base_uri = 'http://api.twittercounter.com/'... |
C++ | UTF-8 | 550 | 3.1875 | 3 | [] | no_license | /*
* P7.cpp
*.
* Created on: Dec 7, 2016
* Author: brian wray
*
* projecteuler.net/problem=7
*
* Description: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13,
* we can see that the 6th prime is 13.
* What is the 10,001st prime number?
*
* Answer:
*
*/
#include "... |
Python | UTF-8 | 889 | 2.78125 | 3 | [
"MIT"
] | permissive | from src.class_factory import *
from pybaseball import batting_stats_bref
def get_players(team):
p1 = Player("Todd", team)
p2 = Player("Macca", team)
p3 = Player("Dan", team)
p4 = Player("Stu", team)
return [p1, p2, p3, p4]
def get_team():
team = Team("Sox")
return team
def get_bases()... |
C++ | UTF-8 | 1,731 | 3.359375 | 3 | [] | no_license | #pragma once
#include <iostream>
#include "list.h"
namespace ft
{
template <typename T, typename Sequence = ft::list<T> >
class queue
{
public:
typedef typename Sequence::value_type value_type;
typedef typename Sequence::reference reference;
typedef typename Sequence::const_reference const_reference;
typed... |
Python | UTF-8 | 606 | 3.03125 | 3 | [
"MIT",
"BSD-3-Clause"
] | permissive | from collections import Mapping
class Response(Mapping):
""" Read-only object that represents a response from Discord.
Shortcuts any key value pairs in nested dict 'data'. """
def __init__(self, status_code: int, data: dict = {}, **kwargs):
self.status_code = status_code
self._dict = data... |
Java | UTF-8 | 248 | 2.6875 | 3 | [] | no_license | package com.lz.designpatterns.factory;
/**
* 〈肉类接口〉
* @author lz
* @create 2019/6/27
* @since 1.0.0
*/
public interface Meat {
/**
* 买肉
*/
void buyMeat();
/**
* 吃肉
*/
void eatMeat();
}
|
JavaScript | UTF-8 | 3,838 | 2.625 | 3 | [
"MIT"
] | permissive | /**
* DOM handling and js isolation done via jsdom
* slow and memory consuming, but somewhat "stable"
* means great deal of bugs already discovered
*/
var fs = require('fs')
, path = require('path')
, jsdom = require('jsdom')
, Oven = require('oven')
, jqueryCode = fs.readFileSync(path.join(__dirname, 'jqu... |
C# | UTF-8 | 1,053 | 2.890625 | 3 | [
"MIT"
] | permissive | using System;
using System.IO;
using System.Runtime.CompilerServices;
using SecurityCam.Configuration;
namespace SecurityCam.Diagnostics.Implementation
{
public class ConsoleLog : ILog
{
private readonly LogConfig _config;
public ConsoleLog(LogConfig config)
{
_config = co... |
Python | UTF-8 | 229 | 3.46875 | 3 | [] | no_license | import turtle
window = turtle.Screen()
janer = turtle.Turtle()
janer.forward(50)
janer.left(90)
janer.forward(50)
janer.left(90)
janer.forward(50)
janer.left(90)
janer.forward(50)
janer.left(90)
turtle.mainloop()
|
SQL | UTF-8 | 19,267 | 2.9375 | 3 | [] | no_license | -- phpMyAdmin SQL Dump
-- version 4.9.2
-- https://www.phpmyadmin.net/
--
-- Хост: 127.0.0.1
-- Время создания: Янв 20 2020 г., 20:26
-- Версия сервера: 10.4.10-MariaDB
-- Версия PHP: 7.3.12
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHA... |
C++ | UTF-8 | 1,438 | 2.59375 | 3 | [] | no_license | /* CHARACTER CLASS
* 3/16/2018 AS OF THIS DATE, DON'T MAKE AN OBJECT WITH THIS. USE PLAYER OR ENEMY INSTEAD
*/
#ifndef _CHARACTER_H_
#define _CHARACTER_H_
#include "cocos2d.h"
#include <string>
#include <iostream>
#include "Entity.h"
#include "Weapon.h"
#include <vector>
class Character : public Entity
{
public:
C... |
C++ | UTF-8 | 1,424 | 3.984375 | 4 | [] | no_license | #include <iostream>
#include <string>
#include <vector>
using namespace std;
/*
输入一个整数数组,实现一个函数调整该数组中数字的顺序,使得所有奇数位于数组的前半部分
偶数位于数组的后半部分
思路:双指针移动?
//通用的一个双指针问题-->修改while循环的条件即可
*/
class Solution{
public:
void ReorderOddEven(vector<int> &data){
int i=0, j=data.size()-1;
//i指向偶数,j指向奇数,然后交换
while(i < j){
... |
TypeScript | UTF-8 | 3,221 | 2.65625 | 3 | [] | no_license | import {
Graphics,
interaction,
} from 'pixi.js';
export type EventsHandlerType = {
click?: (event: interaction.InteractionEvent) => void;
mousedown?: (event: interaction.InteractionEvent) => void;
mouseout?: (event: interaction.InteractionEvent) => void;
mouseover?: (event: interaction.InteractionEvent) =... |
TypeScript | UTF-8 | 1,654 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import {
animate,
query,
style,
transition,
trigger,
} from "@angular/animations";
import { Component } from "@angular/core";
@Component({
moduleId: module.id,
animations: [
trigger("listAnimation", [
transition(":enter", [
query("*", [
... |
Java | UTF-8 | 273 | 1.890625 | 2 | [] | no_license | package com.ad.model;
import java.util.List;
public interface AdDAO_interface {
public void insert(AdVO adVO);
public void update(AdVO adVO);
public void delete(Integer adID);
public AdVO findByPrimaryKey(Integer adID);
public List<AdVO> getAll();
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.