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 | 1,599 | 2.65625 | 3 | [] | no_license | #coding=utf-8
import pickle, time, logging
from redis import WatchError
class RedisPriorityQueue(object):
def __init__(self, redis_client, key, max_size):
self._redis_client = redis_client
self._key = key
self._pipe = redis_client.pipeline()
self._maxsize = max_size
logging... |
C | UTF-8 | 3,095 | 2.703125 | 3 | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | // Copyright (C) 2014 The Android Open Source Project
//
// 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 applic... |
Java | UTF-8 | 1,664 | 2.65625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | package org.firstinspires.ftc.teamcode.hardware.scoring.intake;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;
import com.qualcomm.robotcore.hardware.HardwareMap;
import org.firstinspires.ftc.teamcode.hardware.State;
import org.firstinspires.ftc.teamcode.hardware... |
JavaScript | UTF-8 | 903 | 3.484375 | 3 | [
"MIT"
] | permissive | "use strict";
function swap(data, i, j) {
var tmp;
if (i === j) {
return;
}
tmp = data[j];
data[j] = data[i];
data[i] = tmp;
}
function partition(data, start, end) {
var pivot = data[start];
var i, j, tmp;
for (i = start + 1, j = start; i < end; i++) {
if (data[i] < pivot) {
swap(data,... |
Ruby | UTF-8 | 11,028 | 3.265625 | 3 | [] | no_license | # frozen_string_literal: true
# typed: true
require 'sorbet-runtime'
require 'scanf'
class Complex
def x
self.real
end
def y
self.imag
end
end
class String
def last
self[-1]
end
def first
self[0]
end
end
class Array
def top
self[0]
end
def right
self[1]
end
def bot... |
Ruby | UTF-8 | 195 | 3.3125 | 3 | [] | no_license | =begin
n = 1
while n <= 5
n.downto 1 do |i|
print "* "
end
puts
n += 1
end
=end
n=1
n= gets.chomp.to_i
while n <= 10
n.upto 10 do |i|
puts ("* " * n).rjust(1)
end
puts
n += 1
end |
C | UTF-8 | 1,024 | 3.859375 | 4 | [] | no_license | # include <stdio.h>
# include <stdlib.h>
# define NO_OF_CHARS 256
# define bool int
/* Function removes duplicate characters from the string
This function work in-place and fills null characters
in the extra space left */
char *removeDups(char *str)
{
bool bin_hash[NO_OF_CHARS] = {0};
int ip_ind = 0, res_in... |
PHP | UTF-8 | 1,902 | 2.53125 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
class Admin_model extends CI_Model {
public function category_add($data) {
if ($this->db->insert('category', $data)) {
return true;
}
}
public function category_update($data, $id) {
$this->db->set($data);
$this->db->where('cat_id', $id);
if ($this... |
Python | UTF-8 | 2,558 | 2.609375 | 3 | [] | no_license | import json
import os
import urllib.request
# ftp naar de remote omgeving
import ftplib
import localvar
from bs4 import BeautifulSoup
import datetime
# specify the url
toscrape_page = localvar.s
# query the website and return the html to the variable ‘page’
page = urllib.request.urlopen(toscrape_page)
# webpagina w... |
Python | UTF-8 | 161 | 3.984375 | 4 | [] | no_license | def programFive(x):
for i in range(1, x + 1):
if x % i == 0:
print(i)
x = int(input("Please enter an integer: "))
print(programFive(x)) |
C | UTF-8 | 378 | 2.796875 | 3 | [] | no_license | #ifndef BST_H
#define BST_H
#include <stdlib.h>
#include <stdio.h>
typedef struct treeNode
{
int data;
struct treeNode *pRight;
struct treeNode *pLeft;
}TreeNode;
TreeNode *makeNode(int newData);
void insertNode(TreeNode **pRoot, int data);
void inOrderTraversal(TreeNode *pRoot);
void preOrderTraversal(TreeNode ... |
Python | UTF-8 | 2,996 | 4.03125 | 4 | [] | no_license | # ---------------------------------------
# CSCI 127, Joy and Beauty of Data
# Program 3: Msuic CSV Library
# Jack Telenko
# Last Modified: October 18, 2018
# ---------------------------------------
# Answers questions about song excel sheet asked in #1-5.
# ---------------------------------------
# --------... |
Java | UTF-8 | 12,838 | 2.078125 | 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 becasuninorte;
import javax.swing.JOptionPane;
/**
*
* @author JONATHAN
*/
public class BecaBeneficio extends javax.swing.... |
Shell | UTF-8 | 732 | 3.234375 | 3 | [] | no_license | #!/bin/sh
# chkconfig:345 85 15
# description:watch service
# processname: watchpy
lock="webhealth.py"
start(){
echo “service start....”
su root -c "python /home/monitor/webhealth.py -a www.baidu.com -p 80 &"
}
# 停止服务方法
stop(){
echo "services stop ..."
pkill -f $lock
}
status(){
... |
Python | UTF-8 | 1,989 | 3.109375 | 3 | [] | no_license | ################################################################################
####################### Extract the Window/Door Sensors' Data ##################
######## To calcuat the opening area of each window/door ########
######## write data (local_time, sensor_id, motion_status) into a file #########
#########... |
Java | UTF-8 | 1,043 | 2.140625 | 2 | [] | no_license | package actions;
import hlta.testexec.testcontrol.java.ActionBase;
import db.*;
import hlta.testexec.testcontrol.java.TestCase;
public class Db2Logon extends ActionBase {
public Db2Logon(Object object, Object param, Object extParam, Object[] args) {
super(object, param, extParam, args);
// TODO Auto-gen... |
Java | UTF-8 | 2,157 | 2.375 | 2 | [
"Apache-2.0",
"BSD-3-Clause",
"LGPL-2.0-or-later"
] | permissive | /*
* Copyright 2014 Confluent Inc.
*
* 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 i... |
Python | UTF-8 | 135 | 3.0625 | 3 | [] | no_license | import random
a = random.sample(range(1, 50), 14)
b = random.sample(range(1, 50), 19)
c = print([i for i in a for j in b if i == j]) |
Java | UTF-8 | 2,715 | 2.390625 | 2 | [] | no_license | package com.example.tp01_exo8;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.util.ArrayList;
import java.u... |
Java | UTF-8 | 577 | 2.140625 | 2 | [] | no_license | package com.xinyu.Utils;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class utils {
private static Configuration cfg=null;
private static SessionFactory sessionFactory=null;
static {
cfg=new Configuration();
cfg.configure... |
PHP | UTF-8 | 245 | 3.046875 | 3 | [] | no_license | <?php
$a = [
'a' => 1,
'b' => 2,
'c' => 'Yo <3 a Json'
];
$a = json_encode($a);
echo $a;
$b = json_decode($a, true);
var_dump($b);
echo "<br>";
echo "<br>";
echo $b["c"] . ' | '. $b['a']. ' | '. $b['b']. ' | ';
?>
|
Python | UTF-8 | 225 | 2.59375 | 3 | [
"MIT"
] | permissive | with open('SPECS.md', 'r') as f:
t = f.read()
print('A:',sum(map(t.count,"aA")),'\nE:',sum(map(t.count,"Ee")),'\nI:',sum(map(t.count,"iI")),'\nO:',sum(map(t.count,"oO")),'\nU:',sum(map(t.count,"uU")))
|
C++ | UTF-8 | 551 | 3.890625 | 4 | [] | no_license | // This program reads data from a file into an array.
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
const int ARRAY_SIZE = 10; // Array size
int numbers[ARRAY_SIZE]; // Array with 10 elements
int count = 0; // Loop counter variable
ifstream inputFile; // Input file s... |
Java | UTF-8 | 317 | 1.65625 | 2 | [] | no_license | package com.exchange.rate.exchrate.repo;
import com.exchange.rate.exchrate.enteties.ExchangeRateModel;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface ExchangeRateRepo extends JpaRepository<ExchangeRateModel, Integer> {
}
|
Python | UTF-8 | 633 | 3.625 | 4 | [] | no_license | import string
try:
def Calcular_leta_DNI():
lista = "TRWAGMYFPDXBNJZSQVHLCKE"
numeros = "1234567890"
dni =input("Introduzca el DNI(con letra): ")
respuesta= "No ha introducido un DNI valido"
if (len(dni) == 9):
letra = dni[8].upper()
dni = dni[:8]
... |
Go | UTF-8 | 1,370 | 3.546875 | 4 | [
"MIT"
] | permissive | /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
* 84. Largest Rectangle in Histogram
*
* Hard
*
* Given an array of integers heights representing the histogram's bar height where the width of
* each bar is 1, return the area of the largest rectangle in the histogr... |
C | UTF-8 | 3,175 | 3.453125 | 3 | [] | no_license | /*
Carlos Eduardo de Oliveira Ribeiro - 180099094
Estudo dirigido 10 - Problema do pombo correio usando variaveis de condicao.
*/
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#include <semaphore.h>
#include "unistd.h"
#define N 10 //número de usuários
#define CARTAS 20 //quantida... |
Markdown | UTF-8 | 79,113 | 2.640625 | 3 | [] | no_license | # 13장 동시성
이번 장에서는 동시성(concurrent) 코드 작성이라는 중요한 주제를 다룬다. 이번 장의 목표는 코루틴을 이해하는 것이다. 코루틴은 코틀린의 뛰어난 기능 중 하나로 버전 1.1부터 도입됐고 1.3부터 정식으로 릴리스(release) 상태로 격상됐다.
먼저 코틀린 코루틴을 뒷받침하는 일시중단 가능한 함수(suspending function)와 구조적인 복잡성에 대해 살펴보고, 조금씩 동시성 흐름 제어, 코루틴의 생명 주기에 따른 상태 변화, 코루틴 취소나 코루틴의 예외 처리, 동시성 작업이 스레드를 할당받는 방법 등의 주제로 나아간다.
... |
Shell | UTF-8 | 1,284 | 4.15625 | 4 | [] | no_license | #!/bin/bash
# shellcheck disable=SC1091
set -o errexit # Exit immediately if a pipeline returns a non-zero status (set -e)
# Usage: clean [build|install]
# $ clean build # only delete the BUILD remnants
# $ clean install # only delete the INSTALL remnants
# $ clean # no arguments, delete all remnant... |
Python | UTF-8 | 2,346 | 2.65625 | 3 | [] | no_license | import numpy as np
import keras,os
import cv2
from keras.models import Sequential
from keras.callbacks import ModelCheckpoint, EarlyStopping
from keras.layers import Dense, Conv2D, MaxPool2D , Flatten, Dropout
from sklearn.model_selection import train_test_split
from keras.optimizers import Adam
from astroNN.datasets i... |
Python | UTF-8 | 29,008 | 3.234375 | 3 | [] | no_license | import enum
import random
import copy
from chessagents import RandomBot, DepthPruningBot
class Side(enum.Enum):
white = 0
black = 1
@property
def other(self):
return Side.black if self == Side.white else Side.white
class PieceType(enum.Enum):
pawn = 1
bishop = 2
rook = 3,
kni... |
Java | UTF-8 | 2,232 | 2.609375 | 3 | [] | no_license | package br.ufc.ubicomp.promocity.model;
import java.util.ArrayList;
import java.util.Date;
import br.ufc.ubicomp.promocity.model.Cupom;
public class Promocao {
private int id;
private String nome;
private String descricao;
private String codigo;
private Date dataInicio;
private Date dataFim;... |
Python | UTF-8 | 354 | 3.1875 | 3 | [] | no_license | ''' 12. Dictionaries
>>> keys : any immutable type
>>> values: any type
'''
#--------------- method ------------------------------
eng2sp = {'one': 'uno', 'two': 'dos', 'three': 'tres'}
# d.keys() method returns [ a list of its keys ]
# d.values() method returns [ a list of its values ]
# d.items() method returns [ a ... |
JavaScript | UTF-8 | 468 | 3.3125 | 3 | [
"MIT",
"ISC"
] | permissive | /**
* format length output
* @param {ol.geom.Polygon} polygon
* @return {string}
*/
'use strict'
module.exports = function (polygon) {
var area = polygon.getArea()
var output
if (area > 1000000) {
output = (Math.round(area / 1000000 * 100) / 100) + ' km<sup>2</sup>'
} else if (area > 10000) {
outp... |
Java | UTF-8 | 1,252 | 2.546875 | 3 | [] | no_license | package com.dayou.mysocket;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private Button mStartSever;
private Button mSendMessege;
@O... |
PHP | UTF-8 | 4,738 | 2.53125 | 3 | [] | no_license | <?php
const AVAILABLE_IMAGE_TYPES = [
'image/jpeg',
'image/png',
'image/gif',
];
const MAX_IMAGE_SIZE = 10 * 1024 * 1024;
const IMAGE_DIR1 = 'images';
const IMAGE_DIR = IMAGE_DIR1 . DIRECTORY_SEPARATOR . 'gallery' . DIRECTORY_SEPARATOR;
if (!file_exists(IMAGE_DIR)) {
mkdir(IMAGE_DIR1);
mkdir(IMAGE_D... |
Python | UTF-8 | 78 | 3.0625 | 3 | [] | no_license | N = int(input())
C = list(input())
Rn = C.count('R')
print(C[:Rn].count('W')) |
C++ | UTF-8 | 2,921 | 2.6875 | 3 | [] | no_license | #ifndef BOOST_STATIC_LINK
# define BOOST_TEST_DYN_LINK
#endif // BOOST_STATIC_LINK
#define BOOST_TEST_MODULE CtppHtml
#define BOOST_AUTO_TEST_MAIN
#include <boost/test/unit_test.hpp>
#include <boost/test/output_test_stream.hpp>
#include <sstream>
#include "Log.hpp"
struct LogSequence {
struct Head {
... |
Ruby | UTF-8 | 825 | 3.046875 | 3 | [] | no_license | require_relative("../db/sql_runner")
class Film
attr_reader :id
attr_accessor :title, :price
def initialize(options)
@title = options['title']
@price = options['price'].to_i
@id = options['id'].to_i if ['id']
end
def save()
sql = "INSERT INTO films (title, price) VALUES ($1, $2) RETURNING ... |
Markdown | UTF-8 | 31,202 | 2.859375 | 3 | [] | no_license | # NDCDevOpsWorkshop
## Summary
The purpose of this repository and file is to take you through the "Turbo-charging your Azure DevOps experience with Octopus Deploy" workshop scheduled for the 11th & 12th March in Oslo, Norway.
This workshop will be led by Continuous Delivery Architect [Derek Campbell](https://twitter... |
C# | UTF-8 | 682 | 2.71875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RepositoryPattern.Models.CoreLayer;
namespace RepositoryPattern.Models.PersistenceLayer
{
public class StudentRepository : Repository<Student>, IStudentRepository
{
public StudentRepository(AppContext context) :... |
Python | UTF-8 | 2,607 | 2.765625 | 3 | [] | no_license | import numpy as np
import cv2
# print(cv2.__version__)
# x = int(input("Number of ryws:"))
class Minerator:
def __init__(self, x = 5):
self.x = x
self.step = int(512/(x+1))
self.img = np.full((512,512,3), 255, dtype=np.uint8)
self.font = cv2.FONT_HERSHEY_SIMPLEX
def draw_cell... |
Java | UTF-8 | 584 | 2.09375 | 2 | [] | no_license | package com.hypo.test;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.hypo.array.GasStation_187;
public class GasStation_187Test
{
GasStation_187 t187;
@Before
public void setUp() throws Exception
{
t187 = new GasStation_187();
}
@After
public void te... |
Markdown | UTF-8 | 6,143 | 3.125 | 3 | [] | no_license | ---
title: "Trabajando con Pods"
permalink: /cursos/osv4_k8s/modulo4/pods.html
---
## Creación de un proyecto
Vamos a trabajar en CRC con el usuario `developer`:
oc login -u developer -p developer https://api.crc.testing:6443
...
Using project "developer".
## Creación de Pods
OpenShift configura por de... |
Python | UTF-8 | 342 | 3.5 | 4 | [
"MIT"
] | permissive |
hex = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
num0 = ''
num1 = ''
pair = ''
line = ''
body = ''
for i in hex:
for j in hex:
num0 = r'"\\x' + i + j + r'"'
num1 = r'"\x' + i + j + r'"'
pair = num0 + ' : ' + num1
line = pair + "," + '\n'
body += line... |
SQL | UTF-8 | 530 | 3.078125 | 3 | [] | no_license | CREATE TABLE phenix.application_role_features (
arfe_arol_id NUMBER(15) NOT NULL,
arfe_afea_id NUMBER(15) NOT NULL,
arfe_creation_date DATE DEFAULT sysdate NOT NULL,
arfe_modification_date DATE DEFAULT sysdate NOT NULL,
CONSTRAINT arfe_pk PRIMARY KEY (arfe_arol_id,arfe_afea_id),
CONSTRAINT arfe_afea_fk FORE... |
JavaScript | UTF-8 | 1,531 | 4.03125 | 4 | [
"MIT"
] | permissive | 'use strict';
// 实时:new Date()
let now = new Date();
console.log(now); // Wed Oct 23 2019 16:24:20 GMT+0800 (GMT+08:00)
// 微秒,表示从 1970 年 1 月 1 日开始经过的描述:new Date(milliseconds)
let time = new Date(1000);
console.log(time); // Thu Jan 01 1970 08:00:01 GMT+0800 (GMT+08:00)
// 日期字符串: new Date("yy-mm-dd")
time = new Date(... |
C++ | UTF-8 | 5,924 | 2.859375 | 3 | [] | no_license | /*
* ColorScale.cpp
*
* Created by mooglwy on 31/10/10.
*
* This software is provided 'as-is', without any express or
* implied warranty. In no event will the authors be held
* liable for any damages arising from the use of this software.
*
* Permission is granted to anyone to use this software for any... |
C | UTF-8 | 2,653 | 3.9375 | 4 | [
"MIT"
] | permissive | #include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "list.h"
// Creates a new list with a given initial capacity
struct List *initList(int initialSize) {
List *list = malloc(sizeof(List));
if (list == NULL) {
printf("\nFAILED TO ALLOCATE LIST MEMORY!\n\n");
exit(EXIT_FAILURE);
... |
C# | UTF-8 | 897 | 3.3125 | 3 | [] | no_license | using System;
namespace toy_robot
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("**Toy Robot**");
Command command = new Command(new Robot());
while (true)
{
Console.WriteLine("Please Enter A Command... |
Java | UTF-8 | 15,577 | 3.09375 | 3 | [] | permissive | package ch.jalu.typeresolver.typeimpl;
import ch.jalu.typeresolver.CommonTypeUtils;
import ch.jalu.typeresolver.TypeInfo;
import javax.annotation.Nullable;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.u... |
C++ | UTF-8 | 226 | 2.734375 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main()
{
int n;
int a;
int answer = 0;
cin >> n;
cin >> a;
for (int i = 0; i < n; i++)
{
answer = answer + a % 10;
a = a / 10;
}
cout << answer << "\n";
return (0);
} |
Java | UTF-8 | 1,084 | 1.765625 | 2 | [] | no_license | package com.googlecode.hotire.base.controller;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import co... |
Java | UTF-8 | 5,403 | 3.1875 | 3 | [
"Apache-2.0"
] | permissive | package demo01;
import java.util.Scanner;
//汽车管理类(测试类)
public class Text {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//先创建租赁业务类(具体车辆)
ZuLin zuLin = new ZuLin();
//给数组赋值(买车放入仓库)
zuLin.init();
System.out.println("****... |
Python | UTF-8 | 2,190 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import logging
from globus_compute_sdk.sdk.login_manager import LoginManager
from globus_compute_sdk.sdk.utils.printing import print_table
from globus_sdk import AuthAPIError
NOT_LOGGED_IN_MSG = "Unable to retrieve user information. Please log in again."
logger = logging.getLogger(__name__)
def get_user_info(auth_... |
Java | UTF-8 | 852 | 2.390625 | 2 | [] | no_license | package com.luv2code.springboot.myspringbootapp.controller;
import java.time.LocalDateTime;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyController {
... |
JavaScript | UTF-8 | 2,690 | 2.5625 | 3 | [] | no_license | var ObstacleFactory = require('./obstacleFactory')
var Obstacle = require('./obstacle')
var ObstacleKind = require('./obstacleKind')
var Coords = require('../spacial/coords')
var Dimensions = require('../spacial/dimensions')
var ObstacleGenerator = function () {}
ObstacleGenerator.prototype = {
generate: function... |
Python | UTF-8 | 1,813 | 3 | 3 | [] | no_license | """
This script takes a CSV file exported from an Excel flight logbook
and adds its contents into a sqlite3 database.
It expects this format:
date,planetype,planename,roleonboard,nature,landings,time,notes
e.g.
19/03/2011,DR400-120,F-GKRD,EP,LFPL Local,4,01:04,Some notes
It then populates the 'Vols' table with links ... |
Java | UTF-8 | 271 | 1.953125 | 2 | [] | no_license | package theateam.com.tourmanager.Weather;
import retrofit2.Call;
import retrofit2.http.GET;
import retrofit2.http.Url;
/**
* Created by Hasibuzzaman on 8/22/2016.
*/
public interface WeatherServiceAPI {
@GET
Call<WeatherResponse> getWeather(@Url String url);
}
|
Go | UTF-8 | 1,843 | 2.984375 | 3 | [
"MIT"
] | permissive | package rsocket
import (
"encoding/binary"
"io"
"time"
)
type FrameLease struct {
*Header
timeToLive uint32
numberOfRequests uint32
metadata []byte
}
func (p *FrameLease) WriteTo(w io.Writer) (n int64, err error) {
var wrote int
wrote, err = w.Write(p.Header.Bytes())
n += int64(wrote)
if err... |
Python | UTF-8 | 1,895 | 2.765625 | 3 | [] | no_license | import argparse
import serial
import logging
import sys
import time
parser = argparse.ArgumentParser(description='To test ESP8266 communication')
parser.add_argument('-p',action='store', dest='comm_port', help='port',default='/dev/ttyAMA0')
parser.add_argument('-b',action='store',dest='baud_rate',help='baudrate',defau... |
Go | UTF-8 | 1,131 | 4.6875 | 5 | [] | no_license | package built_in
import "fmt"
/*
Go语言中比较牛逼的是可以将func作为一个传递参数传给别的func。
还有一个闭包的概念可以了解一下。
多说无益,上例子吧。
*/
func Hole6Example1() {
fmt.Println("Welcome to hole #6.")
// 先说闭包closure吧,就是说可以把一个函数整体直接复制给某个变量,还是举例吧
add := func(x int, y int) int {
return x + y
} // 整个func其实就是把x和y加了一下; 但是,这里的add这个变量可不是int类型了,而是func(int, int... |
Java | UHC | 4,892 | 1.953125 | 2 | [] | no_license | package notice.data;
import java.io.File;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.velocity.runtime.directive.Parse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.... |
Python | UTF-8 | 2,918 | 2.90625 | 3 | [] | no_license | #!/usr/bin/python
# Allow to transcode a SROS config file collected by admin display-config in a flat config file
# The only limitation is do not have 4 space characters in your description as indentation is
# made of 4 space characters
#
# Vaersion 1.1
#
# Usage
# python transcode-sros.sh <your-config-file... |
C# | UTF-8 | 11,289 | 3.1875 | 3 | [] | no_license | using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace HideAndSeekTests
{
using HideAndSeek;
using System;
using System.Linq;
using System.IO;
[TestClass]
public class GameControllerTests
{
GameController gameController;
[TestInitialize]
public void Initial... |
Python | UTF-8 | 824 | 2.515625 | 3 | [] | no_license | from aspect import Aspect
from Kaerber.MUD.Entities import Event, EventReturnMethod
# See aspect.py for details
def construct():
return ManaAspect()
class ManaAspect( Aspect ):
def __init__( self ):
self.Value = 0
self._host = None
def Clone( self ):
return ManaAspect()
@p... |
Ruby | UTF-8 | 3,224 | 2.65625 | 3 | [] | no_license | module Kungfuig
# Generic helper for massive attaching aspects
module Aspector
# Helper methods
class H
def value_to_method_list klazz, values_inc, values_exc
# FIXME MOVE JOKER HANDLING INTO PREPENDER !!!!
if klazz.is_a?(Module)
[values_inc, values_exc].map do |v|
... |
Markdown | UTF-8 | 469 | 2.59375 | 3 | [] | no_license | # Managing flutter Status
Application to show how to handle the variety of options that flutter has to manage de application status
## Getting Started
This project will help you to understad the next state managment:
- Singleton
- Provider
- Cubit
- Bloc
A few resources to get you started:
- [Lab: State managemen... |
Python | UTF-8 | 1,126 | 3.8125 | 4 | [] | no_license | #---------------------------------------------------------------------
# Title: Assignment 7
# Desc: Script that shows examples of pickling and handling exceptions
# Changelog: (Who, Date, info)
# BBicksler, 11-30-2020, created file, added pickling example
#---------------------------------------------------------... |
C# | UTF-8 | 581 | 2.78125 | 3 | [] | no_license | public class TestData : INotifyPropertyChanged
{
public double Test
{
get { return _test; }
set
{
_test = value;
OnPropertyChange("Test");
}
}
private double _test;
private vo... |
Java | UTF-8 | 454 | 3.28125 | 3 | [
"MIT"
] | permissive |
public class Aluno {
String name;
int cc;
public Aluno(String n, int cc)
{
name = n;
this.cc = cc;
}
public String getName(){
return name;
}
public void setName(String n){
name = n;
}
public int getCC(){
return cc;
}
public void setCC(int ... |
PHP | UTF-8 | 1,147 | 2.84375 | 3 | [
"MIT"
] | permissive | <?php
namespace Navel\Utils;
use \Navel\Core\Singleton;
/**
* Description of Session
*
* @author Julien
*/
class Session extends Singleton implements \ArrayAccess
{
protected static $_INSTANCE = null;
public function keyExists($key)
{
return $this->offsetExists($key);
}
public funct... |
C++ | UTF-8 | 2,795 | 2.84375 | 3 | [
"MIT"
] | permissive | // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved
//
// Contents: Tells a f... |
Java | UTF-8 | 2,415 | 2.140625 | 2 | [] | no_license | package com.example.controller;
import com.example.bean.Provider;
import com.example.service.ProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;... |
Java | UTF-8 | 2,429 | 2.515625 | 3 | [] | no_license | package com.br.medialert.util;
import android.os.AsyncTask;
import android.util.Base64;
import android.util.Log;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by Igor Costa on 08/10/2016.
*/... |
PHP | UTF-8 | 2,117 | 2.71875 | 3 | [] | no_license | <?php
namespace Favorite\Commands;
class Add extends \AbstractCommand implements \IFrameCommand {
private $params;
private $id;
public function validateData(\IRequestObject $requestObject) {
return true;
}
public function processData(\IRequestObject $requestObject) {
$this->params = $requestObject->getParam... |
Swift | UTF-8 | 889 | 3.34375 | 3 | [] | no_license | //
// Person.swift
// GroupRandomizer
//
// Created by Domenic Wüthrich on 15.08.18.
// Copyright © 2018 Domenic Wüthrich. All rights reserved.
//
import Foundation
public class Person {
// MARK: - Variable
/// Name of person
public var name: String
/// Random double value needed fo... |
Java | UTF-8 | 791 | 1.953125 | 2 | [] | no_license | package com.ulisses.desafio.service.impl;
import com.ulisses.desafio.api.dto.EmailDTO;
import com.ulisses.desafio.model.entity.Email;
import com.ulisses.desafio.model.repository.EmailRepository;
import com.ulisses.desafio.service.EmailService;
import org.springframework.stereotype.Service;
import java.util.List;
impo... |
C++ | UTF-8 | 1,344 | 3.21875 | 3 | [] | no_license | #include<iostream>
#include<vector>
#include<map>
#include<queue>
using namespace std;
class Solution {
public:
class mycompare {
public:
bool operator()(const pair<int,int> lhs, const pair<int,int> rhs) {
return lhs.first >= rhs.first;
}
};
vector<int> mostFrequent(vector<i... |
Go | UTF-8 | 776 | 2.671875 | 3 | [] | no_license | package errcmp
import (
"go/ast"
"go/token"
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/passes/inspect"
)
var Analyzer = &analysis.Analyzer{
Name: "errcmp",
Doc: Doc,
Run: run,
Requires: []*analysis.Analyzer{
inspect.Analyzer,
},
}
const Doc = "errcmp is ..."
func run(pass *analys... |
Markdown | UTF-8 | 2,434 | 3.15625 | 3 | [] | no_license | ---
layout: post
title: "Cohabitating Protocols"
date: 2018-04-05
preview: Using nginx +1.13.10, REST and gRPC services can cohabitate behind a single proxy.
---
**EDIT Apr 8, 2018:** The notes below may cause trouble if you have a catch-all redirect from http to https in your configuration. I think it wise to use the... |
Markdown | UTF-8 | 1,781 | 2.9375 | 3 | [
"MIT"
] | permissive | # React OTP Verification app
One top password verification code app made with react.js and textlocal.com api(sms service provider)
## Working
* Enter any Indian Phone number you have and click on send otp
* You will receive a text message with a unique code.
* Enter the code and click on Verify
* If you enter the ... |
C++ | UTF-8 | 2,255 | 2.75 | 3 | [] | no_license | #ifndef BPLUSTREE_H_INCLUDED
#define BPLUSTREE_H_INCLUDED
#include "BPlusTreeExceptions.h"
#include "BPlusBlockBuffer.h"
#include <fstream>
#include <list>
template<class Record,unsigned int leafOrder,unsigned int nonLeafOrder,unsigned int blockSize=512>
class BPlusTree{
public: class Node{
pro... |
Java | UTF-8 | 400 | 2.25 | 2 | [] | no_license | package ru.zolax.callapp.database.managers;
import java.sql.SQLException;
import java.util.List;
public interface ManagerInterface <T> {
public void add(T entity) throws SQLException;
public int update(T entity) throws SQLException;
public int deleteById(int id) throws SQLException;
public T getById(... |
Swift | UTF-8 | 321 | 2.609375 | 3 | [] | no_license | //
// Contact.swift
// ggchat
//
// Created by Gary Chang on 11/25/15.
// Copyright © 2015 Blub. All rights reserved.
//
import Foundation
class Contact {
var id: String
var displayName: String
init(id: String, displayName: String) {
self.id = id
self.displayName = displayName
... |
Java | UTF-8 | 261 | 2.28125 | 2 | [] | no_license | package com.qqxhb.spi.java;
import java.util.ServiceLoader;
public class JavaSPI {
public static void main(String[] args) {
ServiceLoader<IAnimal> serviceLoader = ServiceLoader.load(IAnimal.class);
serviceLoader.forEach(IAnimal::say);
}
}
|
Java | UTF-8 | 5,424 | 2.09375 | 2 | [] | no_license | package com.sjony.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.sjony.base.BaseController;
import com.sjony.service.SeckillSkuService;
import com.sjony.service.impl.SkuSaleSeckillServiceImpl;
import com.sjony.utils.CollectionUtils;
import org.slf4j.Logger;
import org.s... |
Ruby | UTF-8 | 2,567 | 2.546875 | 3 | [
"BSD-3-Clause"
] | permissive | # WSDL4R - Creating class code support from WSDL.
# Copyright (C) 2004 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
# This program is copyrighted free software by NAKAMURA, Hiroshi. You can
# redistribute it and/or modify it under the same terms of Ruby's license;
# either the dual license version in 2003, or any later v... |
C++ | UTF-8 | 3,116 | 2.890625 | 3 | [] | no_license | #include "resource_manager.hpp"
#include "file.hpp"
#include "log.hpp"
using std::string;
// ResourceManager::GetInstance().FindResource(filename).c_str()
bool FileExists(const std::string& filename) {
FILE* fp = fopen(filename.c_str(), "rb");
if (fp != NULL)
{
fclose(fp);
return true;
} else {
r... |
Markdown | UTF-8 | 3,898 | 3.421875 | 3 | [] | no_license | # CSC-2710 Hashing Project
Authors: Nick Greiner, Matt Ray, Brysen Allen, Sam Mycroft
https://github.com/NickGreiner/CSC-2710-Hashing-Project
# The Assignment
Hash functions and hash tables are one of the most powerful tools in computer science. When well implemented, they can take a complex large search space and... |
C++ | UTF-8 | 1,799 | 2.859375 | 3 | [] | no_license | #include <VL53L0X.h>
#include <Wire.h>
VL53L0X sensorL;
VL53L0X sensorR;
VL53L0X sensorArray[] = { sensorL, sensorR };
long int distance;
int sensorLreset = 8;
int sensorRreset = 7;
int pwm;
void setup() {
// put your setup code here, to run once:
Wire.begin();
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
... |
C++ | UTF-8 | 990 | 3.390625 | 3 | [] | no_license | #include <string>
using namespace std;
class Solution {
public:
string getPermutation(int n, int k) {
// 更优的找规律做法
int factorial[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
string result = "";
string nums[] = {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
// 防止溢出
... |
JavaScript | UTF-8 | 320 | 2.78125 | 3 | [] | no_license | function camelize(str) {
let splited = str
.split("-")
.map((word, index) => index == 0 ? word : word[0].toUpperCase() + word.slice(1))
.join("");
return splited;
}
camelize('background-color') == 'backgroundColor';
camelize('list-style-image') == 'listStyleImage';
camelize('-webkit-transition') == 'WebkitTransition';
|
Markdown | UTF-8 | 2,580 | 2.828125 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | ---
layout: post
title: "If-None-Match 在刷票软件中的应用"
subtitle: "那些刷票的骚操作"
date: 2018-11-07
author: "ms2008"
header-img: "img/post-bg-universe.jpg"
catalog: true
tags:
- HTTP
typora-root-url: ..
---
**优化系统的极限就是不发送任何请求,这一点通常使用缓存来实现**。例如,在一些流量非常大 WEB 的系统中,我们通常会在源站前面启用 CDN。这样用户直接访问的是 CDN 中的缓存内容,降低... |
Ruby | UTF-8 | 1,433 | 3.265625 | 3 | [] | no_license | require "./Board.rb"
require "./Human_Player.rb"
require 'socket'
$hostname = 'localhost' #'199.241.200.213'
$port = 8081
class Game
def play(mode)
board = Board.new
color = :white
socket = get_socket(mode)
puts "lol"
until board.done?
system "clear"
p mode
board.render
... |
Python | UTF-8 | 888 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
SincDeltaFcn.py
This script shows how a sinc^2 becomes a delta-function in the long-time limit.
Origin: CHE 525, S21, Light-matter interaction lectures
Author: Tom Allison
"""
# %%
# Preliminaries ===============================================================
impo... |
JavaScript | UTF-8 | 294 | 3.703125 | 4 | [
"Apache-2.0"
] | permissive | function giveMeVal(secondFr){
var firstFr =5;
function myResult(){
return secondFr/firstFr;
}
return myResult;
}
var firstValue= giveMeVal(5);
var secondValue= giveMeVal(10);
var thirdValue= giveMeVal(15);
console.log(firstValue());
console.log(secondValue());
console.log(thirdValue());
|
Java | UTF-8 | 1,773 | 2.640625 | 3 | [] | no_license | package common;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel... |
Ruby | UTF-8 | 979 | 2.734375 | 3 | [] | no_license | module Api
class StocksController < APIController
PAST_30_DAYS = {
start_date: Time::now-(24*60*60*30),
end_date: Time::now
}
MAX_QUERY_RESULTS = 10
def index
query = params[:q]
@stocks =
if query.present?
Stock.search query, MAX_QUERY_RESULTS
else
... |
Java | UTF-8 | 643 | 2.234375 | 2 | [] | no_license | package cn.phoenixuzoo.oauth2service.domain;
import java.math.BigDecimal;
public class Item {
private String itemName;
private BigDecimal amount;
private TimePeriod period;
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemName() {
re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.