text stringlengths 1 1.05M |
|---|
package org.hiro.things.scrolltype;
import org.hiro.IOUtil;
import org.hiro.Misc;
import org.hiro.character.Player;
import org.hiro.things.Scroll;
public class WakeUpMonster extends Scroll {
public WakeUpMonster(){
super();
}
@Override
public void read(Player player) {
/*
* T... |
#!/bin/bash
# TODO: find out why we are using the if/else and if it's still needed for kubernetes
if oc --insecure-skip-tls-verify -n ${OPENSHIFT_PROJECT} get route "$ROUTE_DOMAIN" &> /dev/null; then
oc --insecure-skip-tls-verify -n ${OPENSHIFT_PROJECT} patch route "$ROUTE_DOMAIN" -p "{\"metadata\":{\"labels\":{\"di... |
package io.chronetic.data.measure;
import org.jetbrains.annotations.NotNull;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.temporal.ChronoField;
import java.time.temporal.ChronoUnit;
import java.util.*;
import java.util.stream.Collectors;
import static java.util.Objects.requireNonNull;
... |
describe FaHarnessTools::CheckSchedule do
describe "#verify?" do
after do
Timecop.return
end
context "before 9am on Monday" do
before do
Timecop.freeze(Time.utc(2019, 10, 28, 07, 0))
end
it "returns false outside deployment window" do
expect(subject.verify?).to eq... |
package sword.langbook3.android.db;
import android.os.Parcel;
import sword.collections.ImmutableMap;
import sword.collections.MutableHashMap;
import sword.collections.MutableMap;
import sword.langbook3.android.models.Conversion;
public final class ConversionParceler {
public static Conversion<AlphabetId> read(P... |
/*
* Copyright 2015 lixiaobo
*
* VersionUpgrade project licenses this file to you 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 requ... |
-- Optimize the program by applying indexes to columns used in WHERE and ORDER BY clauses.
CREATE INDEX discount_index
ON order (discount);
-- Optimize the program by changing the order of operations.
SELECT item, price, quantity
FROM order
WHERE discount > 0
ORDER BY discount desc
FETCH FIRST 10 ROWS ONLY; |
<filename>src/reduxUtils/modules/footer.js<gh_stars>0
/* eslint-disable import/prefer-default-export */
import reducerRegistry from '../../reduxUtils/reducerRegistry';
import makeRequest from '../../utils/makeRequest';
const reducerName = 'footer';
const createActionName = name => `toi/${reducerName}/${name}`;
// act... |
<filename>src/components/Footer/styles.js
import styled from "styled-components";
export const Container = styled.section`
background-color: var(--black);
color: var(--white);
`;
export const FooterContent = styled.div`
padding: 6vh 4vw;
display: flex;
flex-direction: column;
align-items: center;
max-wi... |
TERMUX_PKG_HOMEPAGE=https://rustscan.github.io/RustScan
TERMUX_PKG_DESCRIPTION="The modern,fast,smart and effective port scanner"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="Krishna Kanhaiya @kcubeterm"
TERMUX_PKG_VERSION=2.0.1
TERMUX_PKG_DEPENDS="nmap"
TERMUX_PKG_SRCURL=https://github.com/RustScan/RustScan/arc... |
package net.cabezudo.sofia.core.sites;
import java.nio.file.Path;
import java.sql.SQLException;
import java.util.Iterator;
import net.cabezudo.json.JSONPair;
import net.cabezudo.json.values.JSONArray;
import net.cabezudo.json.values.JSONObject;
import net.cabezudo.json.values.JSONValue;
import net.cabezudo.sofia.core.... |
/**
Copyright 2019 University of Denver
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,... |
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = R... |
/**
* @typedef {object} Phaser.Types.Physics.Arcade.ArcadeWorldTreeMinMax
* @since 3.0.0
*
* @property {number} minX - The minimum x value used in RTree searches.
* @property {number} minY - The minimum y value used in RTree searches.
* @property {number} maxX - The maximum x value used in RTree searches.
... |
import { Injectable } from '@angular/core'
import { HttpClient } from '@angular/common/http'
@Injectable({
providedIn: 'root'
})
export class ApiService {
constructor(private http: HttpClient) {}
getData() {
return this.http.get('http://myapi.com/data');
}
} |
class Date:
def __init__(self, year, month, day):
self.year = year
self.month = month
self.day = day
def is_leap_year(self):
if (self.year % 4 == 0 and self.year % 100 != 0) or self.year % 400 == 0:
return True
else:
return False
def days_unt... |
/*
* Copyright (c) 2020 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
p... |
<gh_stars>0
/*
* This file is generated by jOOQ.
*/
package jooq.generated.entities.mappings.tables.records;
import java.sql.Timestamp;
import java.util.UUID;
import javax.annotation.Generated;
import jooq.generated.entities.mappings.tables.AreaMapper;
import org.jooq.Field;
import org.jooq.Record3;
import org.jo... |
const greaterThan = (array, num) => {
return array.filter(item => item > num);
};
const array = [1,2,3,4,5];
const number = 3;
const result = greaterThan(array, number);
console.log(result); // [4,5] |
<filename>test/ehonda/typed_message_test.rb
require_relative '../test_helper'
require 'active_attr'
require 'ostruct'
require 'ehonda/typed_message'
describe Ehonda::TypedMessage do
before do
@typed_message = Ehonda::TypedMessage
@valid_message = {
headers: {
id: SecureRandom.uuid,
type... |
<filename>src/sections/home/home.ctrl.js
'use strict';
angular
.module('app.core', ['ui.bootstrap'])
.controller('HomeController', function ($scope, $uibModal, PageValues) {
//Set page title and description
PageValues.title = "HOME";
PageValues.description = "Learn AngularJS using best p... |
python transformers/examples/language-modeling/run_language_modeling.py --model_name_or_path train-outputs/512+512+512-common/13-model --tokenizer_name model-configs/1536-config --eval_data_file ../data/wikitext-103-raw/wiki.valid.raw --output_dir eval-outputs/512+512+512-common/13-512+512+512-STWS-first-256 --do_eval ... |
echo "Wait 5s"
sleep 5
go run client.go
echo "Wait 5s"
sleep 5
go run client.go
# mantain container running
tail -f /dev/null |
#!/usr/bin/env bash
# Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved.
# 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 r... |
package net.synqg.qg.service;
import com.google.common.collect.ImmutableList;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import net.synqg.qg.nlp.DependencyNode;
import net.synqg.qg.nlp.NamedEntitySpan;
import net.synqg.qg.nlp.SemanticRole;
import net.synqg.qg.nlp.SemanticRoleList;
import net.synqg.... |
class RoleDimension < ApplicationRecord
end
|
"""
For my project, I am interested in seeing how the fitnesses of the mutants
affect the loss of the D allele. For example, let's see the distribution of how many
generations it takes for the D allele to reach 80% of its initial frequency with
neutral mutations (you could then choose different fitness values to see h... |
#!/bin/bash
VROAPI=$VROENDPOINT"/d9ad2397-ac07-444d-978e-5f86c07f09d5/executions"
echo "Starting clone workflow at "$VROAPI" with user "$VROUSER
echo "Clone settings:"
echo "Host: "$CLONEHOST
echo "Cluster: "$CLONECLUSTER
echo "Base Image: "$BASEVM
#TOKEN=$(curl -s -D - -u $VROUSER:$VROPASS -k -X POST --header 'Conte... |
#!/bin/bash
dest_loc=$1
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m'
if [ "$#" -ne 1 ]; then
printf "\n${NC}usage: $0 <destination folder>\n\n"
printf "${NC}example usage: $0 /opt/\n\n"
exit
fi
if [ -z $dest_loc ]; then
printf "${RED}No destination folder provided...\n"
p... |
<reponame>fleonasb/bootstrap-breadcrumbs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:copyright: Copyright 2022 The American School of Barcelona
:contact: <EMAIL>
"""
from __future__ import unicode_literals
from setuptools import setup, find_packages
setup(
name='django4_bootstrap_breadcrumbs',
... |
#!/bin/bash
pushd $(dirname "${BASH_SOURCE[0]}")/..
git pull
mkdir -p build
pushd build
cmake ..
make $@
make all_tests $@
source ./activate_run.sh
./tests/unit_tests
|
def temperature_stats(temps):
max_temp = max(temps)
min_temp = min(temps)
avg_temp = sum(temps) / len(temps)
print("Maximum temperature is {}. Minimum temperature is {}. Average temperature is {}.".format(max_temp, min_temp, avg_temp))
if __name__ == '__main__':
temperatures = list(map(int, input('... |
<gh_stars>1-10
/* yarn example */
import testPackage_7 from '../src'
(async () => {
await testPackage_7()
})()
|
package counter_clock_wise;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
*
* @author exponential-e
* 백준 16491번: 대피소
*
* @see https://www.acmicpc.net/problem/16491/
*
*/
public class Boj16491 {
private static final String NEW... |
#include <stdio.h>
#define WND_WIDTH 1000
#define WND_HEIGHT 1000
#define PI 3.1415826535897932384626
void drawCircle(int x, int y, int radius) {
// Implementation for drawing a circle
printf("Drawing circle at (%d, %d) with radius %d\n", x, y, radius);
}
void drawRectangle(int x, int y, int width, int heigh... |
#!/bin/bash
#
# Set permissions of files and directories
if [[ -f "$(dirname "$(readlink -f "${0}")")/.functions" ]]; then
# shellcheck disable=SC1090
# shellcheck disable=SC1091
source "$(dirname "$(readlink -f "${0}")")/.functions"
else
echo "File does not exist!"
echo "$(dirname "$(readlink -f "${0}")")/.... |
<reponame>shadowbq/ruby-auth-proxy
Warden::Strategies.add(:password) do
def valid?
params['user'] && params['user']['username'] && params['user']['password']
end
def authenticate!
user = User.first(username: params['user']['username'])
if user.nil?
throw(:warden, message: "The username you ent... |
import Vuex from 'vuex';
import Vue from 'vue';
import Api from '@/services/api';
import _ from 'lodash';
Vue.use(Vuex);
let store = new Vuex.Store({
state: {
data: [],
},
getters: {
//filter: state => date => state.data.filter(item => item.x = date);
lastDate(state) {
let data = state.da... |
<filename>INFO/Books Codes/Oracle PLSQL Tips and Techniques/OutputChapter16/16_12.sql
-- ***************************************************************************
-- File: 16_12.sql
--
-- Developed By TUSC
--
-- Disclaimer: Neither Osborne/McGraw-Hill, TUSC, nor the author warrant
-- that this source code... |
#!/bin/bash
export EXECUTION_ID="rowcount_binder"$@
java $DEBUG $JVM_ARGS \
-cp $ADP_LIB:$ALGORITHMS/binder/build/libs/binder-0.1.0-SNAPSHOT-database.jar \
de.metanome.cli.App \
--algorithm de.metanome.algorithms.binder.BinderDatabaseAlgorithm \
$DB \
--table-key INPUT_DATABASE \
--tables tesmaexp \
--algorithm-config... |
<gh_stars>0
import { Component, OnInit } from '@angular/core';
import {ServerService} from '../../pages/services/user.service';
import { Router } from '@angular/router';
import {HttpClient,HttpHeaders,HttpErrorResponse} from '@angular/common/http';
import { NgxSpinnerService } from 'ngx-spinner';
@Component({
selecto... |
# Replace this with hostname of remote unless testing locally
HOST=localhost
PORT=8089
# This will connect to the socket listener at which point you can issue commands
telnet $HOST $PORT
|
import { HTMLAttributes, ReactNode } from 'react';
export type TripleVerticalLayoutPropsType = {
header?: ReactNode;
footer?: ReactNode;
} & HTMLAttributes<HTMLElement>;
|
#!/bin/bash
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 applica... |
SELECT
user_id,
MAX(activity_timestamp) AS 'recent_activity'
FROM users_activity
GROUP BY user_id
ORDER BY recent_activity DESC
LIMIT 10; |
function transposeMatrix(matrix) {
let rows = matrix.length;
let columns = matrix[0].length;
let newMatrix = [];
// Outer loop to create columns
for (let i = 0; i < columns; i++) {
let subArray = [];
// inner loop to create rows
for (let j = 0; j < rows; j++) {
... |
<reponame>maksimandrianov/cdstructures<gh_stars>10-100
// The MIT License (MIT)
// Copyright (c) 2017 <NAME>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, includi... |
<filename>src/index.ts
export * from 'strom';
import pump from 'pump';
export { pump };
import pumpify from 'pumpify';
export { pumpify };
|
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
package com.amazon.dataprepper.plugins.prepper.oteltrace.model;
import java.util.Random;
public class TestUtils {
private static final Random RANDOM = new Random();
public static byte[] getRandomBytes(int len) {
byt... |
The bug present in the code is that there is no colon (':') after the 'for value in arr' line. The code needs it to be identified as a loop statement and hence will throw an error if run. The correct code should look like this:
arr = [1, 2, 3, 4, 5]
for value in arr:
print("Value is: + value) |
#!/usr/bin/env bats
# vim: ft=sh:sw=2:et
set -o pipefail
load os_helper
load foreman_helper
if [[ -e /etc/profile.d/puppet-agent.sh ]] ; then
. /etc/profile.d/puppet-agent.sh
fi
@test "check smart proxy is registered" {
hammer proxy info --name=$(hostname -f)
}
@test "assert puppet version" {
if tIsRedHatCom... |
#!/bin/bash
SCRIPTPATH=$( cd "$(dirname "$0")" ; pwd -P )
sudo docker-compose -f $SCRIPTPATH/docker-compose-certbot.yml \
--env-file $SCRIPTPATH/.env \
run --rm certbot-renew
sudo docker-compose -f $SCRIPTPATH/docker-compose.yml restart nginx-proxy |
#!/bin/sh
#
# BASH script to generate training and validation sets using the synthetic dataset generator
# as well as a .json file containing the annotations in COCO format
# Arguments: ycb_video_data_path selected.txt
#source ~/.virtualenvs/ycb_data_gen/bin/activate
# Generate training dataset
#echo "Gener... |
#include <iostream>
#include <string>
class Transaction {
public:
virtual void process() = 0;
};
class DepositTransaction : public Transaction {
public:
void process() override {
std::cout << "Processing deposit transaction" << std::endl;
}
};
class WithdrawalTransaction : public Transaction {
pu... |
#!/bin/sh
#SBATCH --time=4:00:00
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=28
#SBATCH --exclusive
#SBATCH --partition=broadwell
#SBATCH --mem-per-cpu=2200M
#SBATCH --comment="cpufreqchown"
#SBATCH -J "lulesh_sacct"
#SBATCH -A p_readex
#SBATCH --reservation=p_readex_56
#SBA... |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you ma... |
import time
class GPIOEventSystem:
def __init__(self):
self.event_callbacks = {}
def add_event_detect(self, channel, edge, bouncetime):
# Simulate event detection setup
print(f"Event detection added for channel {channel} on edge {edge} with bouncetime {bouncetime}ms")
def add_even... |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. The ASF licenses this file to You
* 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
*
* ... |
import React from 'react';
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
articles: [],
comments: []
};
}
render() {
return (
<div className="app">
<h1>My Blog</h1>
<Articles articles={this.state.articles} />
<Comments comments={this.state.comments} />
<ArticleForm ... |
package com.peony.demo.config.core;
/**
* Created by jiangmin.wu on 17/7/20.
*/
public interface IConfig<K> {
K getId();
}
|
#ifndef INCLUDED_CORE_PROGRAM_STATE_H
#define INCLUDED_CORE_PROGRAM_STATE_H
#include "platform/singleton.h"
#include "platform/i_platform.h"
#include "actor.h"
#include "soldier_properties.h"
#include "platform/export.h"
#include "game_modes.h"
namespace core {
struct ClientData
{
int32_t mClientId;
std::stri... |
<filename>src/js/collections.js
import '../scss/collections.scss';
import Header from '../components/header/index';
import NoContentTip from '../components/no_content_tip/index';
import NewsItem from '../components/news_item/index';
import tools from '../utils/tools';
const header = new Header(),
noContentTip ... |
<filename>src/main/scala/com/github/kright/habrareader/utils/DateUtils.scala<gh_stars>0
package com.github.kright.habrareader.utils
import java.text.SimpleDateFormat
import java.util.{Calendar, Date}
import io.circe.syntax._
import io.circe.{Decoder, Encoder}
object DateUtils {
//todo may be rm this, store date a... |
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, World!'
if __name__ == '__main__':
app.run() |
<reponame>coderextreme/XREngine
import { $indexBytes, $indexType, $serializeShadow, $storeBase, $storeFlattened, $tagStore, createShadow } from "./Storage.js"
import { $componentMap, addComponent, hasComponent } from "./Component.js"
import { $entityArray, $entitySparseSet, addEntity, eidToWorld } from "./Entity.js"
im... |
#include "../../includes/bonus/cub3d_bonus.h"
void render_item(t_game *game)
{
int color;
game->pos.x = game->file.width - 153;
game->pos_item.x = 163;
while (game->pos.x < game->file.width)
{
game->pos.y = 80;
game->pos_item.y = 0;
while (game->pos.y < 160)
{
color = get_color_item(&game->item_tex[ga... |
package simplesettings
import (
"fmt"
"sync"
)
// SettingsSection is a structure to hold key-value pairs and process them as settings values
type SettingsSection struct {
lock sync.RWMutex
Values map[string]*settingsValue
}
func newSettingsSection() *SettingsSection {
ss := &SettingsSection{}
ss.Values = mak... |
from typing import List
class Node:
def __init__(self, value):
self.value = value
self.neighbour_list = []
self.parent_node = None
def traverse_graph(curr_node: Node) -> List[Node]:
open_nodes = []
closed_nodes = []
open_nodes.append(curr_node)
while open_nodes:
c... |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.one = void 0;
var one = {
"viewBox": "0 0 20 20",
"children": [{
"name": "path",
"attribs": {
"d": "M18,5H2C0.9,5,0,5.9,0,7v6c0,1.1,0.9,2,2,2h16c1.1,0,2-0.9,2-2V7C20,5.9,19.1,5,18,5z M18,13H2V7h16V13z M7,8H3v4h4V8z... |
package com.honyum.elevatorMan.hb;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter... |
cd /home/container
if [ "${GIT_CLONE}" == "true" ] || [ "${GIT_CLONE}" == "1" ]; then
if [ "$(ls -A /home/container)" ]; then
echo "Pulling Updates"
git pull
else
echo -e "/home/container is empty.\nCloning files into the directory."
git clone https://github.com/1tzemerald/SupportBot.git
fi
fi
sed -i '/... |
package com.springmvc.utils;
import java.sql.Date;
public class GLCPDateUtils {
public static Date getNowDate () {
Date date=new Date(System.currentTimeMillis());
return date;
}
public static void main (String args[]) {
System.out.println(GLCPDateUtils.getNowDate());
}
}
|
package org.anchorer.giraffe;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebView;
import android.webkit.WebViewClient;
/**
* An Activity with a WebView to load web page.
* Created by Anchorer on 16/9/14.
*/
public class WebActivit... |
<filename>schema/schema-definition.go<gh_stars>0
package schema
// SchemaDefinition represents a valid textual schema definition.
type SchemaDefinition struct {
RootColumn *ColumnDefinition
}
func ParseSchemaDefinition(schemaText string) (*SchemaDefinition, error) {
panic("implement me")
}
// String returns a text... |
<filename>libs/lib-Twitter.js
let RATE_LIMIT_REACHED = false
const _getDivsNb = (arg, cb) => cb(null, document.querySelectorAll("div.GridTimeline-items > div.Grid").length)
const _getFollowersNb = (arg, cb) => cb(null, document.querySelectorAll("div.GridTimeline div[data-test-selector=\"ProfileTimelineUser\"]").lengt... |
# install the config files for a component
#export COMPONENTS="vim tmux screen bash aws git sp3 gdb "
export COMPONENTS="vim tmux screen bash aws git gdb "
export THIS_DIR=`pwd`
export OS_TYPE=`uname -s`
export PLIST="vim tmux git gcc python"
create()
{
echo "create $1"
if [ $# -eq 0 ]; then
echo "no <args>"
ex... |
#text1 {
font-size: 18px;
font-family: Arial;
} |
#!/bin/bash -f
#*********************************************************************************************************
# Vivado (TM) v2018.2 (64-bit)
#
# Filename : ddr3_clk_gen.sh
# Simulator : Aldec Active-HDL Simulator
# Description : Simulation script for compiling, elaborating and verifying the project sou... |
#!/usr/bin/env bash
if [[ "$CI_BRANCH" == "master" || "$CI_BRANCH" == "2.x" ]]; then
PUBLISH=publish
mkdir -p ~/.bintray
cat > ~/.bintray/.credentials <<EOF
realm = Bintray API Realm
host = api.bintray.com
user = $BINTRAY_USERNAME
password = $BINTRAY_API_KEY
EOF
sbt ++$SCALA_VERSION "$PUBLISH"
fi
|
#include "duckdb/optimizer/join_order/relation.hpp"
#include "duckdb/common/string_util.hpp"
#include <algorithm>
#include <string>
using namespace duckdb;
using namespace std;
using RelationTreeNode = RelationSetManager::RelationTreeNode;
string RelationSet::ToString() const {
string result = "[";
result += Stri... |
use bytesize::ByteSize;
use std::fmt::Write;
fn format_file_sizes(sizes: Vec<(&str, u64)>) -> String {
let total_size: u64 = sizes.iter().map(|(_, size)| *size).sum();
format!("TOTAL: {}", ByteSize::b(total_size))
}
fn main() {
let file_sizes = vec![("file1.txt", 1024), ("file2.txt", 2048), ("file3.txt", ... |
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Field } from 'redux-form';
import { Hovedknapp } from 'nav-frontend-knapper';
import { getLedetekst, Utvidbar, SoknadOppsummering, VaerKlarOverAt } from '@navikt/digisyfo-npm';
import reduxFormSetup from '../utils/reduxFormSetup';
im... |
public List<Book> searchBooks(String query) {
List<Book> results = new ArrayList<>();
String queryLower = query.toLowerCase();
for (Book book : books) {
if (book.getTitle().toLowerCase().contains(queryLower) ||
book.getAuthor().toLowerCase().contains(queryLower) ||
book.getCa... |
const { Client } = require('discord.js');
const WOKCommands = require('wokcommands');
require('dotenv').config();
const client = new Client({
partials: ["MESSAGE", "REACTION"]
});
client.on('ready', () => {
console.log('Ready!');
client.user.setActivity(`${client.guilds.cache.size} servers`, { type: 'WATC... |
<reponame>TivonJJ/umi-plugin-better-theme
const hash = require('hash.js');
exports.genHashCode = content =>
hash
.sha256()
.update(content)
.digest('hex');
|
/*
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* Licensed under the MIT License.
*/
package ai.onnxruntime.providers;
/** Flags for the NNAPI provider. */
public enum NNAPIFlags implements OrtFlags {
USE_FP16(1), // NNAPI_FLAG_USE_FP16(0x001)
USE_NCHW(2), // NNAPI_FLAG_USE_NCHW(0x00... |
<reponame>smagill/opensphere-desktop<gh_stars>10-100
package io.opensphere.wfs.config;
import io.opensphere.core.common.connection.ServerConfiguration;
import io.opensphere.core.util.PausingTimeBudget;
import io.opensphere.server.customization.ServerCustomization;
import io.opensphere.server.services.ServerConnectionP... |
#!/bin/bash
set -e
function _base_json_grep {
local FILENAME="$1"
local MATCH="$2"
echo $(cat $FILENAME | bash ./scripts/JSON.sh -b | grep $MATCH)
}
function json_grep {
local FILENAME="$1"
local MATCH="$2"
local MATCHED=$(_base_json_grep $FILENAME $MATCH)
echo ${MATCHED:${#MATCH}:${#MATCHED}-${#MATCH... |
require 'active_support/inflector'
module JsonApi::Parameters
include ActiveSupport::Inflector
def jsonapify(params, naming_convention: :snake)
jsonapi_translate(params, naming_convention: naming_convention)
end
private
def jsonapi_translate(params, naming_convention:)
params = params.to_unsafe_h ... |
<reponame>J-env/pmr<gh_stars>0
import { Node } from '../prosemirror-model'
import { Selection } from './selection'
import { Transaction } from './transaction'
function bind(f, self) {
return !self || !f ? f : f.bind(self);
}
class FieldDesc {
constructor(name, desc, self) {
this.name = name;
this.init = ... |
<gh_stars>0
package dev.vankka.dependencydownload.dependency;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A maven dependency.
*/
@SuppressWarnings("unused") // API
public interface Dependency {
String MAVEN_PATH_FORMAT = "%s/%s/%s/%s";
/**
* The group id... |
import { Injectable } from '@angular/core';
import {Http,Headers} from "@angular/http";
import {Observable} from "rxjs";
@Injectable()
export class ValidationServiceService {
constructor (private http: Http) {}
// private instance variable to hold base url
private validationServerUrl = 'http://localhost:8080/... |
#!/bin/bash
export PATH="./local:../common:$PATH"
export PYTHONPATH="./src:../common/src:../../../src:$PYTHONPATH" |
<reponame>khaled-11/Botai
// Function to get Get Started Data for Page
const rp = require('request-promise');
module.exports = async (token) => {
var results;
try{
var options = {
method: 'GET',
uri: `https://graph.facebook.com/v9.0/me/messenger_profile?access_token=${token}&fields=greetin... |
<reponame>rbg001/WxJava<filename>starters/wx-java-mp-starter/src/main/java/com/binarywang/spring/starter/wxjava/mp/WxMpServiceAutoConfiguration.java<gh_stars>10-100
package com.binarywang.spring.starter.wxjava.mp;
import me.chanjar.weixin.mp.api.WxMpConfigStorage;
import me.chanjar.weixin.mp.api.WxMpService;
import me... |
<gh_stars>1-10
'''
The functions used by the build_download_data command to extract car
park dataand store it in CVS files.
'''
import json
import logging
from .util import epoch_to_text
logger = logging.getLogger(__name__)
# Data extractors receive a list of file names and a CSV writer object.
# They are expecte... |
export {default} from 'fetch-mock/es5/client';
|
# https://github.com/mattjj/my-oh-my-zsh/blob/master/history.zsh
#
# Sets history options.
#
# Authors:
# Robby Russell <robby@planetargon.com>
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# History file configuration
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
HISTSIZE=10000000
SAVEHIST=10000000
setopt BA... |
"""
Code illustration: 4.04
@ Tkinter GUI Application Development Blueprints
"""
class ChessError(Exception): pass
|
# platform = Mozilla Firefox
{{{ bash_firefox_cfg_setting("stig.cfg", "extensions.update.enabled", "false") }}}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.