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 | 264 | 1.757813 | 2 | [] | no_license | package com.dist.message.server.conf;
public interface WSConstants {
/**
* session中用户id
*/
String SESSION_USERNAME = "userId";
/**
* 设备类型
*/
String DEVICE_TYPE = "device";
/**
* token标识符
*/
String TOKEN = "access_token";
}
|
Java | UTF-8 | 297 | 2.859375 | 3 | [] | no_license | public class Solution {
public int lengthOfLastWord(String s) {
if(s.length()==0)
{
return 0;
}
String[] sArr = s.split(" ");
if(sArr.length == 0)
{
return 0;
}
return sArr[sArr.length-1].length();
}
} |
Shell | UTF-8 | 427 | 3.015625 | 3 | [
"BSD-3-Clause",
"MIT"
] | permissive | #!/bin/bash
./auto-init
name="STUB"
run_ionic="npm run ionic:serve"
run_horizon="./dev"
hash "tmux" 2>/dev/null
if [ $? == 0 ]; then
## has tmux installed
tmux start
tmux new -dP -s ionic "$run_ionic"
cd "../$name-horizon"
tmux new -dP -s hz "$run_horizon"
cd "../$name-ionic"
tmux attach -t ionic
else
#... |
Python | UTF-8 | 984 | 3.0625 | 3 | [
"MIT"
] | permissive | # Import the helper gateway class
from .AfricasTalkingGateway import AfricasTalkingGateway, AfricasTalkingGatewayException
#django specific imports
from django.conf import settings
#application specific imports
def send_message(phone_number, message, short_code):
'''A function to send messages using Pythons Aficas... |
Markdown | UTF-8 | 1,874 | 2.65625 | 3 | [] | no_license | # # ListingMarketHistory
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **int** | The listing market history ID. | [optional]
**listing_market_id** | **int** | The listing market ID of the current listing market history. | [optional]
**referrer_... |
PHP | WINDOWS-1252 | 9,095 | 2.546875 | 3 | [] | no_license | <?PHP
/*
Autore: Francesco Chiriaco
parametri funzione:
$myquery: query di autenticazione
$area_autenticare: area a cui si deve avere accesso
$necessario_amministratore: 0/1 indica se per l'accesso necessario essere amministratore
$querystr: la query string da accodare al link di ritorno
$valoreidut: identificativo d... |
Swift | UTF-8 | 4,671 | 2.625 | 3 | [
"MIT"
] | permissive | //
// ProjectName : SmartNews-Like-Menu
// File Name : TabMenu.swift
// Created Date : 2020/11/24
//
// Copyright © 2019-2020 KC Apps. All rights reserved.
//
import UIKit
protocol TabMenuViewDelete: class {
func tabMenuView(_ tabMenuView: TabMenuView, didChangePage id: Int)
}
final class TabMenuView: UIV... |
C# | UTF-8 | 693 | 2.90625 | 3 | [] | no_license | void Main()
{
var list = new List<DateTime>
{
new DateTime(2005, 10, 11),
new DateTime(2009, 3, 4),
new DateTime(2010, 5, 8),
new DateTime(2010, 8, 10),
DateTime.Now,
new DateTime(2010, 4, 8)
};
var result= Enumerable.Range(list.Min (l => l.Ye... |
C++ | UTF-8 | 6,068 | 3.1875 | 3 | [] | no_license | // ---------------------------------------------------------------------------------------------------------
//
// Spline
//
// ---------------------------------------------------------------------------------------------------------
#pragma once
#include "Standard/api.h"
#include "Math.h"
#include "Dirty.h"
#includ... |
Python | UTF-8 | 1,010 | 2.546875 | 3 | [] | no_license | from django.db import models
class VisibleManager(models.Manager):
def get_query_set(self):
kwargs = {"visible": True}
return super(VisibleManager, self).get_query_set().filter(**kwargs)
class Location(models.Model):
class Meta:
abstract = True
ordering = ('name',)
name ... |
Java | UTF-8 | 547 | 1.796875 | 2 | [] | no_license | package com.example.demo.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import javax.persistence.*;
import java.sql.Timestamp;
@Data
@Entity
public class AppLike {
@Id
@GeneratedValue(strategy = GenerationType.IDENTI... |
C | UTF-8 | 1,837 | 4.125 | 4 | [] | no_license | /*Alex Kastanek
Count Digits
This program counts how many of each digit are in a user-made multidimensional array.*/
#include <stdio.h>
int read_row(int rowCounter, int colCounter) {
int val;
if (colCounter == 0) {
printf("Enter row %d of array: ", rowCounter);
}
scanf("%d", &val);
return val;
}
int check... |
Java | UTF-8 | 1,215 | 1.898438 | 2 | [] | no_license |
package gov.va.oit.vistaevolution.mailman.ws.xmxapig.endpoints.interfaces.jaxws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
imp... |
Python | UTF-8 | 3,913 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | # coding: utf-8
# プロセス分散
# pip install futures
import time
from concurrent import futures
import os
from multiprocessing import Manager
import logging
logging.basicConfig(level=logging.DEBUG,
format='[%(levelname)s] time:%(created).8f pid:%(process)d pn:%(processName)-10s tid:%(thread)d tn:%(threa... |
Java | UTF-8 | 2,484 | 3.265625 | 3 | [] | no_license | import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
/*https://www.hackerrank.com/challenges/ctci-bfs-shortest-reach/problem*/
public class ShortestPath_BFS {
public static class Graph {
ArrayList<HashSet<Integer>> edges;
int n;
public G... |
Python | UTF-8 | 1,919 | 2.578125 | 3 | [] | no_license | from collections import defaultdict
from datetime import datetime
from django.db import models
from django.http import QueryDict
class Form:
def __init__(self, model=None):
self._model = model
self._converter = defaultdict(lambda: lambda value: value, {
models.CharField: lambda value: s... |
Java | UTF-8 | 1,274 | 2.015625 | 2 | [] | no_license | package com.hosiang.dev.controller;
import com.hosiang.dev.bean.Order;
import com.hosiang.dev.bean.UserBean;
import com.hosiang.dev.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
im... |
C++ | UTF-8 | 1,724 | 2.640625 | 3 | [] | no_license | #include "pch.h"
#include "nvsg/DAL.h"
namespace nvsg {
DALServer::DALServer ()
{
m_hDALNext = 0;
}
DALServer::~DALServer ()
{
}
HDAL
DALServer::storeDALData (HDAL hDAL, unsigned int dataID, DALData* data)
{
m_lock.lockExclusive ();
if (hDAL == HDAL_INVALID)
{
std::multimap<unsigned int, DALData... |
C# | UTF-8 | 879 | 2.6875 | 3 | [
"MIT"
] | permissive | namespace UniversityStudentSystem.Data.Models
{
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Common;
using CommonModels;
public class Category : BaseModel<int>
{
private ICollection<ForumPos... |
Java | UTF-8 | 1,291 | 3.578125 | 4 | [] | no_license | package easy;
import java.util.HashMap;
/**
* @author 喻浩
* @create 2020-03-13-9:51
*/
public class majority_element_169 {
/**
* question url:https://leetcode-cn.com/problems/majority-element/
* question context :
* 给定一个大小为 n 的数组,找到其中的多数元素。多数元素是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。
*
* 你可以假设数组是非空的,并... |
C | UTF-8 | 585 | 4.09375 | 4 | [] | no_license | /*4.Write a program which accept two strings from user and concat
alternate characters from second string at the end of first string.
Input : “Marvellous”
“Infosystems”
Output : MarvellousIfsses
*/
#include<stdio.h>
void StrConcat(char *str1,char *str2)
{
while(*str1!='\0')
{
str1++;
}
str1--;
while(*str2!... |
C++ | UTF-8 | 575 | 3.015625 | 3 | [] | no_license | #include <stdio.h>
#include <locale.h>
#include <math.h>
int main()
{
setlocale(LC_ALL, "Rus");
int A, B;
printf("Введите двузначное число: ");
scanf_s("%d", &A);
if (((A >= 10) && (A < 100)) || ((A <= -10) && (A > -100))) {
B = A / 10;
A = A - B * 10;
A = A * 10 + B;
... |
Python | UTF-8 | 4,803 | 2.546875 | 3 | [] | no_license | # Todo check timers of isValid()
import sys
import logging as log
from PyQt5 import QtWidgets, QtCore
from .raspberry_pi import MockPi
from .gui import Ui_MainWindow
def setup_logging():
log.basicConfig(
format="[%(asctime)s] [%(levelname)-8s] :: %(message)s",
level=log.DEBUG,
datefmt="... |
Markdown | UTF-8 | 445 | 2.53125 | 3 | [] | no_license | # sms
Command line tool written in Go that sends an SMS of the given data.
Download:
* [Mac](https://github.com/codeitloadit/sms/blob/master/bin/sms?raw=true)
Environment Variables:
* SMS_DEFAULT_MESSAGE
* SMS_DEFAULT_NUMBER
Usages:
* $ sms "This is a message" 5551234567
* $ sms "This is a message" <- Use... |
C# | UTF-8 | 2,818 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using GarmentsERP.Model;
namespace GarmentsERP.Controllers
{
[Route("api/[controller]")]
[ApiController]
pu... |
Markdown | UTF-8 | 2,135 | 3.265625 | 3 | [] | no_license | # DigitPixels
Applying OpenCV Neural Network to an image to recognize digits.
### Dependencies
To easily compile and run project install following list of dependencies:
- **pkg-config**
- **GNU/Make**
- **OpenCV**
## How does it work?
### Preparing input images
From input image
- Rectangle of Interest is taken
... |
Markdown | UTF-8 | 3,588 | 2.578125 | 3 | [] | no_license | # End to End Tests
End to end tests push a number of bags through the system and then verify expected
outcomes in Pharos, S3, and Redis. The tests include ingest, re-ingest, fixity
checking and restoration. (Deletions are not currently included because they require
email confirmations. Integration and manual tests cov... |
Java | UTF-8 | 11,196 | 1.984375 | 2 | [] | no_license | package org.greatfree.server.container;
import java.io.IOException;
import org.greatfree.client.FreeClientPool;
import org.greatfree.cluster.message.ClusterSizeRequest;
import org.greatfree.cluster.message.ClusterSizeResponse;
import org.greatfree.cluster.message.PartitionSizeRequest;
import org.greatfree.cluster.mes... |
Java | UTF-8 | 15,921 | 2.015625 | 2 | [] | no_license | package com.whcs_ucf.whcs_android;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Handler;
i... |
TypeScript | UTF-8 | 702 | 3.625 | 4 | [] | no_license | class CircleGeometryV2 {
private PI: number = 3.14
constructor(public radius: number) {
}
get area() {
return this.PI * (this.radius ** 2)
}
set area(vaule: number) {
this.radius = (vaule / this.PI) ** 0.5
}
public circumference(): number {
return 2 * this.PI... |
TypeScript | UTF-8 | 410 | 3.3125 | 3 | [] | no_license | import { LinkedList } from "./linked-list";
export class Stack {
storage: LinkedList<unknown>;
constructor() {
this.storage = new LinkedList<unknown>();
}
isEmpty() {
return this.storage.length === 0;
}
peek(): unknown {
return this.storage.tail?.value;
}
push(value: unknown) {
this... |
Markdown | UTF-8 | 3,473 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | # ReFramework Template Excel Transaction
Excelファイルのデータをトランザクションとして処理するワークフローテンプレート
## 内容
Excelファイルで管理されているデータを自動処理するロボットを作成するためのテンプレートです。
トランザクションデータを格納したxlsxファイルには以下の形式でデータが格納されていることを想定しています。
| TransactionID | TransactionField1 | TransactionField2 |
| ------------- | ----------------- | ----------------- |
| ID-1... |
Python | UTF-8 | 90 | 2.859375 | 3 | [] | no_license |
cards = [int(i) for i in input().split(" ")]
print("bust" if sum(cards) >= 22 else "win") |
Java | UTF-8 | 484 | 2.078125 | 2 | [] | no_license | package com.bro.bean;
/**
* Entity to represent property for sell/rent/lease
* @author Zubair Shaikh
* @version 1.0
*/
public class Property {
private Integer propId;
private String propConfig; // Flat/Shop/Plot
private String offerType; // Sell/Lease/Rent
private Double offerPrice;
private Double sqftRate;
... |
C++ | UTF-8 | 1,246 | 2.9375 | 3 | [] | no_license | #include <QStringList>
#include <QtAlgorithms>
#include "ConfigPath.h"
#include "ConfigPathElement.h"
namespace conf {
ConfigPath::ConfigPath() { }
ConfigPath::ConfigPath(const char *path) {
parse(path);
}
ConfigPath::ConfigPath(const QString &path) {
parse(path);
}
ConfigPath::~ConfigPath() {
... |
Go | UTF-8 | 1,661 | 2.734375 | 3 | [
"MIT"
] | permissive | // Copyright 2015 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package git
import (
"fmt"
"io"
"strings"
"sync"
)
var (
// logOutput is the writer to write logs. When not set, no log will be produced.
logOutput io... |
C | GB18030 | 1,905 | 3.171875 | 3 | [] | no_license | //**㷨ʵ
//2012/10/24/18:53
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define RANGE 16
#define N_SIZE 16
#define BUF_SIZE 128
int tmp[BUF_SIZE];
int out[N_SIZE];
int in[N_SIZE];
/*ע⣬ǻڱȽϵ㷨ʱĽΪO(n).
*÷ΧȽխһڹؼַΧȽխԪصĿȽٵ,
*ԪĿȽ϶£ڻҪĿռȽϴҲǽԭ
*ԶԸٻòãԾʱȽСŵ㣬
*ʺе
... |
Java | UTF-8 | 943 | 2.59375 | 3 | [] | no_license | package edu.wm.cs.mplus.processors;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import edu.wm.cs.mplus.model.MutationType;
import edu.wm.cs.mplus.model.location.MutationLocation;
import edu.wm.cs.mplus.selector.Selector;
import edu.wm.cs.mplus.selector.Sele... |
C++ | UTF-8 | 1,358 | 3.171875 | 3 | [] | no_license | #ifndef MEDIAS_AVERAGE_H
#define MEDIAS_AVERAGE_H
#include <cmath>
#include <vector>
#include <numeric>
using namespace std;
// Intervalos de Confiança 1
double normal_distribution_cdf(double x, double mu, double std_dev){
auto result = (1 + erf(x-mu/std_dev * sqrt(2)))/2;
return result;
}
double normal_di... |
Java | UTF-8 | 7,808 | 2 | 2 | [] | no_license | package com.backingapp.ayman.backingapp.UI;
import android.app.Activity;
import android.arch.lifecycle.Observer;
import android.arch.lifecycle.ViewModelProviders;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.ann... |
JavaScript | UTF-8 | 4,035 | 2.515625 | 3 | [] | no_license | import React, { useState, useEffect } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { editGraphic, getGraphicsById } from '../actions/GraphicsActions';
import { addGraphic } from './../actions/GraphicsActions';
import Error from '../components/Error'
import Loading from './../components/Loa... |
Java | UTF-8 | 802 | 1.9375 | 2 | [] | no_license | package uz.pdp.appdatarest.repository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestR... |
Markdown | UTF-8 | 19,180 | 3.046875 | 3 | [] | no_license | ---
title: 'Maker, Builder, Hacker'
tags:
- about
- hackers
- computer science
date: 2017-01-24 02:43:30
categories:
- ethics
layout: post
---
Over the weekend I read *A Portrait of J. Random Hacker*, an article about the people of "the hacker community" according to a Usenet survey (I couldn't find any infor... |
Python | UTF-8 | 807 | 3.015625 | 3 | [] | no_license | import sys
sys.stdin = open("1946_input.txt")
T = int(input())
for test_case in range(1, T+1):
N = int(input())
data = []
for i in range(N):
Ci, Ki = map(str, input().split())
Ki = int(Ki)
# print(Ci, Ki)
for j in range(Ki):
data.append(Ci)
# print(data)
... |
Shell | UTF-8 | 551 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env sh
# STATE_FILE="${TMPDIR}/breakvpn"
# touch $STATE_FILE
#
# LAST_STATE=`cat ${STATE_FILE}`
#
# ifconfig | grep -q tun0
#
# CURR_STATE=$?
# echo $CURR_STATE >| $STATE_FILE
#
# if [ "$LAST_STATE" != "$CURR_STATE" ]; then
# if [ ${CURR_STATE} -eq 0 ]; then
# breakvpn youtube.com yelp.com w... |
Markdown | UTF-8 | 778 | 2.8125 | 3 | [] | no_license | # 查看Python的版本
> GitHub@[orca-j35](https://github.com/orca-j35),所有笔记均托管于 [python_notes](https://github.com/orca-j35/python_notes) 仓库
可使用终端命令来查看 Python 的版本信息:
```shell
(base) C:\WINDOWS\system32>python -VV
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
(base) C:\WINDOWS\system32>python -V
Py... |
C# | UTF-8 | 137 | 2.609375 | 3 | [] | no_license | public static string RemoveSpecialCharacters(string str)
{
return Regex.Replace(str, "[^a-zA-Z0-9_ ]+", "", RegexOptions.Compiled);
} |
Java | UTF-8 | 1,068 | 2.34375 | 2 | [] | no_license | package com.facebook.login.widget;
public enum LoginButton$ToolTipMode
{
AUTOMATIC("automatic", 0), DISPLAY_ALWAYS("display_always", 1), NEVER_DISPLAY("never_display", 2);
public static ToolTipMode DEFAULT = AUTOMATIC;
private int intValue;
private String stringValue;
private LoginButton$ToolTipMode(... |
Java | UTF-8 | 8,182 | 2.359375 | 2 | [] | no_license | package info.scce.m3c.transformer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import info.scce.addlib.dd.bdd.BDD;
import info.scce.addlib.dd.bdd.BDDManager;
import info.scce.m3c.cfps.Edge;
import info.scce.m3c.cfps.EdgeType;
import info.scce.m3c.formula.BoxNode;
import info.scce.m3c.formula.Dependen... |
Markdown | UTF-8 | 1,147 | 3.296875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # :clock4: `timefmt`
> A tiny time converting util for the command line.
[](https://travis-ci.com/PDDStudio/timefmt)
## :package: Installation
You can choose one of the following ways to install `timefmt`
### :beginner: Install via your fav... |
Java | GB18030 | 6,721 | 2.953125 | 3 | [] | no_license | import java.awt.Color;
import java.awt.Graphics;
import java.io.FileNotFoundException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Random;
import javax.swing.JPanel;
/**
* ģ
*/
class Snake extends JPanel {
public final static int LEFT = 1; //ĸ
public final static int UP = 2;
public ... |
Ruby | UTF-8 | 829 | 3.203125 | 3 | [] | no_license | require 'spec_helper'
require_relative '../src/array_chunk'
RSpec.describe ArrayChunk do
describe 'positive test cases' do
it "should return the correct result" do
arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
expect(ArrayChunk.chunk(arr, 2)).to eql([[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]])
end
... |
C# | UTF-8 | 4,330 | 2.640625 | 3 | [
"Apache-2.0"
] | permissive | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Jungo.Infrastructure.Cache;
using Newtonsoft.Json;
namespace Jungo.Infrastructure.Config
{
public class JsonFileConfigLoader : IConfigLoader
{
public JsonFileConfigLoader(ICacheFactory cacheFactory, IConfigPathMa... |
Java | UTF-8 | 434 | 3.046875 | 3 | [] | no_license | package mypack;
public class DP implements Comparable<DP> {
private double x;
public DP(double x){
this.x = x;
}
public double getX() {
return x;
}
@Override
public int compareTo(DP o) {
/*if (this.x >= o.getX()) {
return 1;
}else{
... |
C++ | UTF-8 | 501 | 2.875 | 3 | [] | no_license | #include<iostream>
using namespace std;
class LongDouble{
public:
LongDouble(double x=0.0):db(x){}
operator double();
operator float();
operator int();
private:
int in;
double db;
};
LongDouble::operator double(){
cout<<"operator double"<<endl;
return db;
}
LongDouble::operator float(){
cout<<"... |
C | UTF-8 | 1,566 | 3.265625 | 3 | [
"MIT"
] | permissive | /*
Biblioteca desenvolvida por Hélter Pinheiro para trabalho de E.D
Lista simplesmente encadeada
Data: 21/10/2018
*/
#ifndef LISTA_H_
#define LISTA_H_
#define TRUE 0
#define FALSE 1
/*
estrutura correspondente ao nó da lista
*/
typedef struct _slnode_{
struct _slnode_*next;
void *data;
}Slnode;
/*
Nós da lista... |
TypeScript | UTF-8 | 1,196 | 2.625 | 3 | [
"MIT"
] | permissive | let workspaces:string[] = []
function remove(name:string){
workspaces = workspaces.filter( v => v !== name )
browser.storage.sync.set({ workspaces }).then(() => {
reload()
browser.runtime.sendMessage('reloadContextMenu');
})
}
function reload(){
browser.storage.sync.get(['workspaces']).then((storageGe... |
Python | UTF-8 | 144 | 2.9375 | 3 | [] | no_license | sh=int(input())
si=list(map(int,input().split()))
l1=si[1:sh:2]
l2=si[0:sh:2]
if(sum(l1)>=sum(l2)):
print(sum(l1))
else:
print(sum(l2))
|
Markdown | UTF-8 | 3,958 | 3.53125 | 4 | [] | no_license | # Project1B
## Goals
A startup called Sparkify wants to analyze the data they've been collecting on songs and user activity on their new music streaming app and the data resides in a directory of CSV files on user activity on the app.
In order to answer their question to the data, I will create an Apache Cassandra data... |
Python | UTF-8 | 5,110 | 3.078125 | 3 | [] | no_license | __author__ = 'harrigan'
import argparse
import inspect
# Maximum length of the short names (one-dash arguments)
MAXSHORT = 3
class Parsable(object):
"""Mixin to make as parsable."""
_is_parsable = True
class Attrib(object):
"""Container object for command line attributes."""
def __init__(self):
... |
Java | UTF-8 | 3,494 | 2.34375 | 2 | [] | no_license | package in.jogindersharma.jsframeworkdemo;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;... |
JavaScript | UTF-8 | 1,844 | 3.640625 | 4 | [
"MIT"
] | permissive | var mySingleton = (function(){
var instance;
function init () {
// body...
//Singleton
function privateMethod () {
// body...
console.log("I am private");
}
var privateVariable = "I am also private";
var privateRandomN... |
Java | UTF-8 | 1,175 | 2.65625 | 3 | [] | no_license | /**
*
*/
package functions;
import java.rmi.RemoteException;
/**
* @author Pierre Marques
*
*/
public final class GameDescription implements IGameDescription {
private static final long serialVersionUID = 1L;
private final String bindName, name, theme;
public GameDescription(String bindName, String nam... |
C++ | UTF-8 | 2,518 | 2.734375 | 3 | [] | no_license | // stringwriter.cpp
// The Windows Forms namespace lives in a different
// assembly, which is not referenced by default as is
// mscorlib.dll, so we must use #using here
#using "System.Windows.Forms.dll"
using namespace System;
using namespace System::IO;
using namespace System::Text;
using namespace System... |
Markdown | UTF-8 | 2,758 | 2.546875 | 3 | [
"MIT"
] | permissive | # oblivion
Shell alias manager
## Motivation
Shell commands are complex. Each executable has its own interface, and often multiple of these are used in one command. At some point you reach out to a notebook/notepad for writing down this perfectly crafted pipeline with tons of options for each program. Later you find y... |
JavaScript | UTF-8 | 409 | 2.8125 | 3 | [] | no_license | var addOption = document.querySelector('.addOpBtn');
addOption.addEventListener('click', function(e){
var options = e.target.parentNode.previousSibling;
var optionDiv = options.appendChild(document.createElement('div'))
optionDiv.class = 'option'
var input = document.createElement('input');
input.type = 'text';
i... |
Swift | UTF-8 | 2,036 | 2.546875 | 3 | [
"MIT"
] | permissive | //
// RemindPassViewController.swift
// iTraveler
//
// Created by Oleksandr Kurtsev on 15/06/2020.
// Copyright © 2020 Oleksandr Kurtsev. All rights reserved.
//
import UIKit
class RemindPassViewController: UIViewController {
@IBOutlet weak var emailTF: CustomTextField!
@IBOutlet weak var cancelButton: ... |
Shell | UTF-8 | 1,773 | 4.125 | 4 | [] | no_license | #!/bin/sh
args=""
main() {
mkdir -p output/beanstalk
beanstalkd -b output/beanstalk &
processargs "$@"
defaults
# keep in foreground
while true; do sleep 10000; done
}
processargs() {
while [ "$#" -ge 1 ]; do
case "$1" in
--worker)
spawn "worker" "$... |
Java | UTF-8 | 877 | 3.34375 | 3 | [] | no_license | package Encapsulation;
/**
* @author Simon
* @version 1.0
* @ID 1930026144
* @date 2020/7/9 10:37
* Knowledge:
* - 无需初始化实例变量
* - Number Primitive (including char): 0 ps: floating points: 0.0
* - Boolean Primitive: false
* - Object Reference: Null
*/
public class PoorDog {
... |
Python | UTF-8 | 2,294 | 2.75 | 3 | [] | no_license | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import pyro
from pyro.distributions import Normal
from pyro.infer import SVI
from pyro.optim import Adam
N = 100 # size of toy data
p = 1 # number of features
def build_linear_dataset(N, noise_std=0.1):
X = np.linspac... |
C# | UTF-8 | 1,803 | 2.96875 | 3 | [] | no_license | using CsvHelper;
using DataGenerator.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DataGenerator.Services
{
public class CSVTableGenerator
{
public byte[] CreateCSVFileContentFrom(FakeDataTable fa... |
C++ | UTF-8 | 1,156 | 3.296875 | 3 | [] | no_license | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> v;
int n;
long long max_res, min_res;
int seq[12];
// + : 0
// - : 1
// * : 2
// / : 3
// 각 번호별로 맞는 연산자 수만큼 vector에 넣은 후 next_permutation을 이용하여
// 경우의 수를 모두 찾으면서 우선순위 없이 앞에서부터 연산하고
// 최대, 최소값 비교하여 저장
int main(void) {
cin ... |
Ruby | UTF-8 | 311 | 3.296875 | 3 | [] | no_license | def is_factorion(fact, num)
sum = 0
i = num
while i > 0
i, d = i.divmod(10)
sum += fact[d]
end
return num == sum
end
fact = [1]
for n in 1..10
fact.push(n * fact[n - 1])
end
for j in 1..50000
if is_factorion(fact, j)
printf "%d ", j
end
end
printf("\n")
|
C++ | UTF-8 | 897 | 3.078125 | 3 | [] | no_license | // 1683.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
void mPrint(vector<int>tmpVec)
{
for (int i = 0; i < tmpVec.size() - 1;i++)
{
cout << tmpVec[i] << " ";
}
cout << *(tm... |
Shell | UTF-8 | 1,852 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | #!/bin/bash -xe
# Copyright 2018 Pax Automa Systems, 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 applicabl... |
C# | UTF-8 | 6,675 | 2.65625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using OLC1_PY1_201700988.Estructuras.Conjunto;
namespace OLC1_PY1_201700988.Estructuras.AFD
{
class nodoCabecera
{
private string idEstado;
private Arra... |
Java | UTF-8 | 474 | 3.359375 | 3 | [] | no_license |
package atividade;
import java.util.Scanner;
public class Atividadess {
public static void main(String[] args) {
Scanner teclado = new Scanner (System.in);
String sexo;
System.out.print("Digite seu sexo (M - para masculino / F - para feminino):");
sexo = teclado.next();
if (s... |
Java | UTF-8 | 3,905 | 2.203125 | 2 | [] | no_license | package com.mx.intellego.zurich.emc.bussiness.impl;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import com.box.sdk.BoxAPIConnection;
import com.box.sdk.BoxFile;
imp... |
Ruby | UTF-8 | 3,799 | 2.640625 | 3 | [
"MIT"
] | permissive | require 'spec_helper'
describe Decanter::Parser do
before(:all) do
Object.const_set('FooParser',
Class.new(Decanter::Parser::ValueParser) do
def self.name
'FooParser'
end
end
)
Object.const_set('BarParser',
Class.new(Decanter::Parser::ValueParser) do
... |
Python | UTF-8 | 321 | 3.03125 | 3 | [] | no_license | import json
from typing import BinaryIO, Any
def read_from_exchange(exchange: BinaryIO):
line = exchange.readline()
try:
return json.loads(line)
except:
return {'type':'pass'}
def write_to_exchange(exchange: BinaryIO, obj: Any) -> None:
json.dump(obj, exchange)
exchange.write("\n"... |
Markdown | UTF-8 | 21,834 | 2.625 | 3 | [] | permissive | ## Commands
A list of the available commands
#### `sfdx force:apex:class:create`
create an Apex class
```
USAGE
$ sfdx force:apex:class:create -n <string> [-d <string>] [-t <string>] [--apiversion <string>] [--json] [--loglevel
trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]
OPTIONS
-d, ... |
Java | UTF-8 | 528 | 2.875 | 3 | [] | no_license | package cell.facility.restaurant;
import cell.facility.Facility;
import point.Point;
/** Kelas Restaurant bertanggung jawab mengelola Restaurant.
* @author AZIS ADI KUNCORO (13515120)
* @version 3.0
*/
public class Restaurant extends Facility {
/** Konstruktor Restaurant dengan parameter .
* @param p Merupaka... |
PHP | UTF-8 | 2,949 | 2.609375 | 3 | [
"MIT"
] | permissive | <?php
namespace App\Http\Controllers;
use App\Product;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class ProductController extends Controller
{
public function getProducts()
{
// Get products
$products = Product::orderBy('created_at', 'desc')->paginate(10);
... |
Markdown | UTF-8 | 13,618 | 2.9375 | 3 | [] | no_license | ---
layout: post
title: 【Redis】主从复制
tag: Redis
---
### 主从复制
互联网“三高”架构
●高并发
●高性能
**●高可用**

**你的“Redis”是否高可用**
单机redis的风险与问题
●问题1.机器故障
●现象:硬盘故障、系统崩溃
●本质:数据丢失,很可能对业务造成灾难性打击
●结论:基本上会放弃使用redis.
●问题2... |
C++ | UTF-8 | 840 | 2.6875 | 3 | [] | no_license | /*
* =====================================================================================
*
* Filename: source.cpp
*
* Description:
*
* Version: 1.0
* Created: 05/07/2013 12:10:28 AM
* Revision: none
* Compiler: gcc
*
* Author: Zhujin Liang (LZJ), alfredtofu... |
Markdown | UTF-8 | 1,512 | 2.625 | 3 | [
"MIT"
] | permissive | # Geezify-Lua
geezifylua is a luarock(i.e. package for the lua language) that converts geez-script numbers to arabic and viceversa.
## Installation
```lua
luarocks install geezifylua
```
## Usage
```lua
geezifylua = require "geezifylua""
geezifylua.geezify.geezify(12) #=> '፲፪'
geezifylua.geezify.... |
Java | UTF-8 | 2,039 | 2.828125 | 3 | [] | no_license | package com.connectfour;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class DiagonalCheckerTest {
Boardable board;
Checker diagonalChecker;
@BeforeEach
void initBoardAndGameChecker(){
board = new TestClasses.Tes... |
Java | UTF-8 | 3,652 | 2.25 | 2 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | package org.cloudfoundry.multiapps.controller.core.cf.apps;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.stream.Stream;
import org.cloudfoundry.multiapps.common.test.TestUtil;
import org.cloudfoundry.multiapps.common.util.JsonUtil;
import org.junit.jupiter.params.ParameterizedTest;
i... |
C++ | UTF-8 | 1,641 | 3.359375 | 3 | [] | no_license | #ifndef AVLTREE_H
#define AVLTREE_H
#include <vector>
#include <functional>
using namespace std;
/***
* An AVLTree implementation using Desmond's implementation
* @Typename KeyType the datatype for the Key object (must have implemented comparison operators)
* @Typename DataType the datatype for the data object (m... |
Markdown | UTF-8 | 5,791 | 2.921875 | 3 | [] | no_license | ## Code of Conduct
> All attendees of Codefreeze are required to agree with the following Code of Conduct.
Codefreeze isn't an officially organised event.
For enforcement of this Code of Conduct, we only have official authority of the private accommodation we are using for sessions and the activities we organise.
Wit... |
C++ | UTF-8 | 545 | 2.578125 | 3 | [] | no_license | #pragma once
#include "Background.h"
class BackgroundManager
{
public:
BackgroundManager();
~BackgroundManager();
void setUp(sf::RenderWindow* window); // Sets up background objects
void moveWithView(char direction, float dt); // Moves background objects
void render(sf::RenderWindow* window); // Renders bac... |
Java | UTF-8 | 3,861 | 1.875 | 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 rest.modelo.entidad;
/**
*
* @author USUARIO
*/
public class Usuario {
private String usuarioid;
... |
Python | UTF-8 | 9,698 | 2.890625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
第18章:模型融合stacking
数据获取
"""
import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import variable_encode as var_encode
from sklearn.metrics import confusion_matrix,recall_score, auc, roc_curve,precision_score,accuracy_score
from sklearn.model_se... |
Markdown | UTF-8 | 1,392 | 2.90625 | 3 | [] | no_license | # parallel-corpus-for-lexical-normalization
Hi,
This is a parallel corpus of slang sentences (sentences that may contain slang words) and formal sentences (sentances that only contain formal words) in Indonesian language. This dataset, consisting of 4,910 parallel sentence pairs, was used by <a href="https://colips.o... |
Python | UTF-8 | 385 | 2.796875 | 3 | [] | no_license | import MySQLdb
#You must specify your localhost, login name, password for MySQL
#as well as the Database you are inserting into.
#This is to be setup beforehand while logged into MySQL.
host = 'localhost'
username = 'you'
password = 'password'
db = 'Database name'
def dbstuff():
database = MySQLdb.connect(host, ... |
C | UTF-8 | 14,372 | 2.78125 | 3 | [] | no_license | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "base.h"
#include "cvector.h"
#include "nkctree.h"
static void _nkctree_alloc_rows( FR_nkctree * self ,
unsigned int row_count ){
self->row_count = row_count;
self->rows = malloc( sizeof( float* ) * row_count );
}... |
Python | UTF-8 | 750 | 4.125 | 4 | [] | no_license | # exercise 52: Letter Grade to Grade Points
grade = input("enter letter grade: ")
points = ""
if grade == "F":
points = 0
elif grade == "D":
points = 1
elif grade == "D+":
points = 1.3
elif grade == "C-":
points = 1.7
elif grade == "C":
points = 2
elif grade == "C+":
points = 2.3
elif grade ==... |
Python | UTF-8 | 5,346 | 3.65625 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# In[19]:
#10:06pm version
import os
import csv
# Assign a variable to load a file from a path.
file_to_load = os.path.join("Resources", "election_results.csv")
# Assign a variable to save the file to a path.
file_to_save = os.path.join("analysis", "election_analysis.txt")
# C... |
Java | UTF-8 | 1,450 | 3.40625 | 3 | [] | no_license | package com.svetanis.datastructures.graph.clone;
import static com.google.common.collect.Lists.newLinkedList;
import static com.google.common.collect.Maps.newHashMap;
import static com.svetanis.java.base.collect.Maps.checkedGet;
import static com.svetanis.java.base.collect.Maps.checkedPut;
import java.util.Map;
impor... |
Java | UTF-8 | 2,481 | 2.15625 | 2 | [] | no_license | package com.ecostore.controller.admin.api;
import com.ecostore.model.MenuModel;
import com.ecostore.model.UserModel;
import com.ecostore.service.IMenuService;
import com.ecostore.utils.SessionUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import javax.inject.Inject;
import javax.servlet.ServletException;
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.