text stringlengths 1 1.05M |
|---|
export declare const RESET: unique symbol;
|
function findLongestStringLength(arr) {
let longestLength = 0;
for (const str of arr) {
const length = str.length;
if (length > longestLength) {
longestLength = length;
}
}
return longestLength;
}
const length = findLongestStringLength(["Hello", "World", "This", "is... |
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${DIR}/../mc-build/
rm -rf robot-software
mkdir robot-software
mkdir robot-software/build
#cp common/test-common robot-software/build
cp $1 robot-software/build
find . -name \*.so* -exec cp {} ./robot-software/build \;
cp ..... |
#!/usr/bin/env bash
readonly EXTRA_PACKAGES="${EXTRA_PACKAGES:-}"
readonly DOCKER_ENABLED="${DOCKER_ENABLED:-}"
readonly CONSUL_CONFIG_DIR="${CONSUL_CONFIG_DIR:-/etc/consul.d}"
readonly CONSUL_ENABLED="${CONSUL_ENABLED:-}"
readonly CONSUL_EXTRA_ARGS="${CONSUL_EXTRA_ARGS:-}"
readonly VAULT_CONFIG_DIR="${VAULT_CONFIG_... |
public class PrimeFactors {
public static void main(String[] args) {
int n = 18;
System.out.print("Prime factors of "+ n + " are: ");
while(n % 2 == 0) {
System.out.print(2 + " ");
n /= 2;
}
for (int i = 3; i <= Math.sqrt(n); i += 2) {
... |
#!/bin/bash
K8S_NAMESPACE="${K8S_NAMESPACE:-istio-system}"
CERT_MANAGER_VERSION="${CERT_MANAGER_VERSION:-1.4.0}"
ISTIO_AGENT_IMAGE="${CERT_MANAGER_ISTIO_AGENT_IMAGE:-localhost:5000/cert-manager-istio-csr:v0.1.3}"
KUBECTL_BIN="${KUBECTL_BIN:-./bin/kubectl}"
HELM_BIN="${HELM_BIN:-./bin/helm}"
KIND_BIN="${KIND_BIN:-./bin... |
#!/bin/bash
gdb=0
valgrind=0
prefix=()
extend() {
if which "$1" &>/dev/null; then
prefix+=("$@")
else
# bailing out would be counted as a failure by test harnesses,
# ignore missing programs so that tests can be gracefully skipped
printf "warning: command '$1' not found\n" >&2
... |
<gh_stars>0
import { h, Component } from 'preact';
import { Input } from '@authenticator/form';
import { NullAppError } from '@authenticator/errors';
interface Props {
class?: string;
id: string;
label?: string;
error: NullAppError;
value: string;
placeholder?: string;
onChange: { (evt: Event, error: Nu... |
def round_value(value):
return round(value, 2)
def foo(x):
return round_value(x)
def bar(y):
return round_value(y) |
#!/usr/bin/env bash
#####download one image and visualize its segmentation results
#create directories for input&output data
img_dir='raw_data'
mkdir $img_dir
res_dir='results'
mkdir $res_dir
rect_dir='col_rect'
mkdir $res_dir/$rect_dir
visualization='visualization'
mkdir $res_dir/$visualization
#download one orgi... |
const mongoose = require('mongoose');
const { NOTE_CREATION, NOTE_UPDATE } = require('../helpers/constants');
const { formatQuery, formatQueryMiddlewareList } = require('./preHooks/validate');
const CustomerNoteHistorySchema = mongoose.Schema({
company: { type: mongoose.Schema.Types.ObjectId, ref: 'Company', require... |
/*
* Copyright 2014-2016 CyberVision, 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 o... |
export default()=>{};
//# sourceMappingURL=edgeTarget.prod.js.map |
<reponame>ziecik/rental-cars-rest-api<gh_stars>0
package com.example.rentalcarsrestapi.model.audit;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.jpa.domain.s... |
func isFunction(object: Any?, functionName: String, completion: @escaping (Bool) -> Void) {
// Implement the logic to check if the function exists within the object
// For example, if the object is a class instance, you can use reflection to check for the existence of the function
// Placeholder logic ... |
import logging
import tornado.web
REQUEST_ID_HEADER = 'X-Request-Id'
AUTH_USER_HEADER = 'X-Auth-User'
class LoggingApplication(tornado.web.Application):
def __init__(self, handlers=None, default_host="", transforms=None, **settings):
super(LoggingApplication, self).__init__(handlers, default_host, transfo... |
#!/bin/bash
# Copyright 2021 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
TANZU_BOM_DIR=${HOME}/.config/tanzu/tkg/bom
INSTALL_INSTRUCTIONS='See https://github.com/mikefarah/yq#install for installation instructions'
TKG_IMAGE_REPO=${TKG_IMAGE_REPO:-''}
TKG_BOM_IMAGE_TAG=${T... |
fpath=(/usr/local/share/zsh/site-functions $fpath)
autoload -U compinit
compinit -u
setopt auto_menu
setopt complete_in_word
setopt always_to_end
zstyle ':completion:*:*:*:*:*' menu select # menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*' # case insensitive search
zsty... |
package io.dronefleet.mavlink.common;
import io.dronefleet.mavlink.annotations.MavlinkFieldInfo;
import io.dronefleet.mavlink.annotations.MavlinkMessageBuilder;
import io.dronefleet.mavlink.annotations.MavlinkMessageInfo;
import io.dronefleet.mavlink.util.EnumValue;
import java.lang.Enum;
import java.lang.Object;
impo... |
#ifndef _WKT_KEYBOARD_EVENT_SYSTEM_H
#define _WKT_KEYBOARD_EVENT_SYSTEM_H
#include "ecs/System.h"
#include "components/KeyboardReceiver.h"
#include "components/KeyboardEventReceiver.h"
#include "input/KeyboardProxy.h"
#include <vector>
namespace wkt {
namespace systems
{
class KeyboardSystemBase
{
public:
void i... |
export interface Form {
name: string;
email: string;
message: string;
}
export interface State {
loading: boolean;
success: boolean;
error: boolean;
}
export enum ActionTypes {
SEND_MESSAGE_START = 'SEND_MESSAGE_START',
SEND_MESSAGE_SUCCESS = 'SEND_MESSAGE_SUCCESS',
SEND_MESSAGE_ERROR = 'SEND_MESSAG... |
#!/bin/bash -eu
echo -e '\033[33mCreating a nice looking StackStorm welcome message after SSH login ...\033[0m'
echo 'StackStorm \n \l' > /etc/issue
cat << 'EOF' > /etc/update-motd.d/00-header
#!/bin/sh
if [ -f /opt/stackstorm/st2/lib/python3.6/site-packages/st2common/__init__.py ]; then
# Get st2 version based o... |
#!/bin/bash
# configs/stm3220g-eval/nxwm/setenv.sh
#
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
# Author: Gregory Nutt <gnutt@nuttx.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistri... |
HCDIR=`dirname $(readlink -f "$0")`
dnf update --assumeyes
pkgs="autoconf \
bison \
flex \
gcc \
gcc-c++ \
libstdc++ \
libstdc++-static \
glibc-static \
git \
libtool \
make \
pkg-config \
protobuf-devel \
protobuf-compiler \
git \
wget \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
python3 \
libnl3-devel"
dnf in... |
import { ResolveTree } from "graphql-parse-resolve-info";
import { Attribute, Model, Relation } from "../types";
interface ModelArg {
baseModel: Model;
models: { [key: string]: Model };
tree: ResolveTree;
}
/**
* Convert a graphql selectionSet to
*
*/
export const graphFieldsToModel = ({
tree,
baseModel,... |
#!/bin/bash
set -euo pipefail
# You can execute this script with:
# bash <(curl -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -s 'https://raw.githubusercontent.com/alombarte/raspberry-osmc-automated/master/install.sh') /home/osmc/.raspberry-osmc-automated
if [ $# != 1 ]
then
echo "Installation of raspberry-osmc... |
<filename>src/components/primatives/modal.tsx<gh_stars>0
import React, { useEffect, useRef, useLayoutEffect } from "react"
import styled from "@emotion/styled"
const ModalOverlay = styled.div`
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.65);
display: flex;
padding: 1em;
... |
<reponame>init00/portfolio_site<filename>src/pages/index.js<gh_stars>0
import React, { Component } from "react"
import Navbar from '../components/UI/navigation/navbar/navbar'
import Banner from '../components/UI/banner/banner'
import Cards from '../components/UI/cards/cards'
import contentUrlMap from '../constants/cont... |
<reponame>wongoo/alipay-sdk-java-all<filename>src/main/java/com/alipay/api/domain/GFAOpenAPICommandReceipt.java<gh_stars>0
package com.alipay.api.domain;
import com.alipay.api.AlipayObject;
import com.alipay.api.internal.mapping.ApiField;
/**
* 业财受理指令回执信息
*
* @author auto create
* @since 1.0, 2020-08-27 ... |
#!/usr/bin/env bash
# Script to start / stop halOS.
#
# Parameter
# 1. start|stop
# 2. port
#
# What it does
# 1. Pull halOS (if necessary)
# 2. Start / stop halOS docker container
# 3. Create a network for talking to WildFly instances
NETWORK=halos-net
if [[ $# -lt 1 ]]
then
echo "Please use $0 sta... |
<!DOCTYPE html>
<html>
<head>
<title>User Profile</title>
</head>
<body>
<h1>User Profile</h1>
<p>Name: John Doe</p>
<p>Age: 28</p>
<p>Country: USA</p>
</body>
</html> |
def sum_prime_numbers(limit):
sum = 0
for num in range(2, limit + 1):
if all(num % i != 0 for i in range(2, num)):
sum += num
return sum
print(sum_prime_numbers(100)) |
<reponame>rjwittrock/WIT<filename>wit/src/MrPt.h
//==============================================================================
// WIT
//
// Based On:
//==============================================================================
// Constrained Materials Management and Production Planning Tool
//
// (C) Copyright I... |
<reponame>Crowntium/crowntium<gh_stars>1-10
// Aleth: Ethereum C++ client, tools and libraries.
// Copyright 2015-2019 Aleth Authors.
// Licensed under the GNU General Public License, Version 3.
/**
* Determines the PoW algorithm.
*/
#pragma once
#include <libethcore/BlockHeader.h>
#include <libdevcore/Guards.h>
n... |
karma start ../config/karma.conf.js *
|
# See the README.md
module Horcrux
VERSION = "0.1.2"
# Implements the optional methods of a Horcrux adapter.
module Methods
def self.included(klass)
klass.send :attr_reader, :client, :serializer
end
# Public: Sets up an adapter with the client.
#
# client - This is the object that ... |
package services.askde;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Duration;... |
<reponame>TheDadi/polyfill-library
'use strict';
const sinon = require('sinon');
module.exports = {
getPolyfillMeta: sinon.stub().resolves(),
listPolyfills: sinon.stub().resolves(),
getConfigAliases: sinon.stub().resolves(),
streamPolyfillSource: sinon.stub(),
};
|
/*
* 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 ... |
<reponame>AlvaWang/spring-may<gh_stars>0
package net.bambooslips.demo.jpa.service;
import net.bambooslips.demo.exception.CompetitionEntireNotFoundException;
import net.bambooslips.demo.exception.UnitEssentialNotFoundException;
import net.bambooslips.demo.jpa.model.CompetitionEntire;
import net.bambooslips.demo.jpa.mod... |
llvm_dir="/home/kazooie/local/llvm/master/bin"
#opt="${llvm_dir}/opt"
opt=opt
debug=""
#file="pocl_2mm_kernel1.ll"
file="pocl_noif_2mm_kernel1.ll"
dot_file="._pocl_kernel_mm2_kernel1.dot"
echo "POCL IR"
${opt} -dot-cfg ${file} > /dev/null 2>&1
dot -Tpdf ${dot_file} -o ${file}.pdf
printf "\n\n\n\n"
echo "VPlan IR wit... |
#!/bin/bash
# Take a PR from Github, merge it into master/stable and push that into presubmit-master/stable
# so that presubmit will merge it into master/stable if all the tests pass.
PR_NUMBER=$1
ORIGINAL_BRANCH=$(git rev-parse --abbrev-ref HEAD)
# Stash local changes first.
if [ "$(git status -s --untracked-files... |
HPARAMS_STR+="label_smoothing=0.," |
npm run-script build:prod
|
<filename>src/utils/api.js<gh_stars>1-10
export default function api() {
if (process.env.NODE_ENV !== "production") {
return 'http://localhost:3001';
}
return 'http://localhost:3001';
}
|
<gh_stars>0
// 报警类型
export const getAlarmType = state => {
return state.alarmType
}
// 菜单展开状态
export const getCollapsed = state => {
return state.collapsed
}
// 获取 deviceTypes
export const getDeviceTypes = state => {
return state.deviceTypes
}
// 获取 deviceRunningStatus
export const getDeviceRunningStatus = state ... |
<gh_stars>100-1000
package leetcode
// 路径总和
func hasPathSum(root *TreeNode, targetSum int) bool {
if root == nil {
return false
}
if root.Left == nil && root.Right == nil {
return targetSum == root.Val
}
return hasPathSum(root.Left, targetSum-root.Val) || hasPathSum(root.Right, targetSum-root.Val)
}
// 广度优先... |
#!/bin/sh
# Author KMS - Martin Dubois, ing.
# Product KmsBase
# File KmsLib/Clean.sh
# Usage ./Clean.sh
# CODE REVIEW 2019-07-19 KMS - Martin Dubois, ing.
echo Executing KmsLib/Clean.sh ...
# ===== Execution ===========================================================
rm -f ../Libraries/KmsLib.a
rm ... |
#!/bin/bash
rm -rf sensehat-demo.log
./sensehat-launcher.py &> sensehat-demo.log
|
<gh_stars>1-10
/**
* NUI Message Example
* SendNUIMessage({
* module = "weapon-state",
* data = {
* type = "",
* name = ""
* }
* })
*/
window.addEventListener("message", function (event) {
if (event.data.module == "weapon-state") {
const data = event.data.data
... |
Pod::Spec.new do |s|
s.name = "HPKeychain"
s.version = "0.0.1"
s.summary = "A lightweight but customisable networking stack written in Swift"
s.homepage = "https://panhans.dev/opensource/hpkeychain"
s.license = "MIT"
s.author = { "<NAME>" => "<EMAIL>" }
s.social_... |
SELECT hashtag, COUNT(*) AS count
FROM myTable
WHERE created_date > DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
GROUP BY hashtag
ORDER BY COUNT(*) DESC
LIMIT 10; |
/*
* Copyright 2002-2016 the original author or authors.
*
* 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
const deepEqual = require("fast-deep-equal");
const path = require("path");
const { EventEmitter } = require("events");
const errorStackRegExp =
/^(?:[^\s]*\s*\bat\s+)(?:(.*)\s+\()?((?:\/|[a-zA-Z]:\\)[^:)]+:(\d+)(?::(\d+))?)/;
module.exports = class Test extends EventEmitter {
constructor(name, cb) {
super();... |
export * from './keyword-grid-modal.component';
export * from './add-keyword.modal.component';
export * from './publications.modal.component';
export * from './edit-profile-modal.component';
export * from './contact.modal.component';
|
<gh_stars>1-10
var ExtractText = require('extract-text-webpack-plugin');
module.exports = {
entry: './src/index.js',
output: {
path: __dirname + '/build',
publicPath: '/build/',
filename: 'index.js',
},
devtool: 'source-map',
module: {
loaders: [
{test: /\.js$/, exclude: /node_modules/, loader: 'babel'... |
<gh_stars>1000+
from .controller import DagsterDaemonController
from .daemon import DagsterDaemon, SchedulerDaemon, get_default_daemon_logger
from .run_coordinator.queued_run_coordinator_daemon import QueuedRunCoordinatorDaemon
|
#!/bin/bash
###
# Script to run after pulling in changes to this repo; create directories and
# symlinks in local filesystem that we expect to manage.
###
_repo=$(pwd)
source bash/post_pull_functions.sh
create_symlinks () {
echo -n "Creating directories and symlinks for $(basename $_repo) "
echo "on behalf ... |
seen = set()
for item in array:
if "apple" in item:
if item not in seen:
print(item)
seen.add(item) |
<filename>src/index.js
// @flow
export const Avatar = require('./avatar').default;
export const AvatarToggle = require('./avatar-toggle').default;
export const DiaItem = require('./dia-item').default;
export const Countdown = require('./countdown').default;
export const HeaderBar = require('./header-bar').default;
expo... |
<filename>cpp/thread.cpp<gh_stars>1-10
#include "thread.h"
#include "list.h"
#include "pcb.h"
#include "SCHEDULE.H"
#include "lock.h"
#include "timer.h"
#include <iostream.h>
#include "idle.h"
#include "siglist.h"
ID Thread::getId () { return myPCB->getId(); }
ID Thread::getParentId() { return myPCB->pare... |
module Fog
module Compute
class OracleCloud
class Real
def create_ip_network (params)
if !params[:name].nil? && !params[:name].start_with?("/Compute-") then
# They haven't provided a well formed name, add their name in
params[:name] = "/Compute-#{@identity_domain}/#{... |
#!/bin/sh
#SOCKET_ERROR is defined as -1 on windows platform here is no need
sed -i 's/^#define SOCKET_ERROR 4/\/\/#define SOCKET_ERROR 4/' skynet-src/socket_server.h
#mingw 5.3 some header files are changed
sed -i 's/^#include \"sys\/socket.h\"/#include <sys\/socket.h> \r#include <time.h>/' platform/platform.h
#mi... |
<filename>src/main/java/com/alibaba/dubbo/spring/boot/listener/ConsumerSubscribeListener.java
package com.alibaba.dubbo.spring.boot.listener;
import java.util.Set;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.extension.Activate;
import com.alibaba.dubbo.common.utils.ConcurrentHashSet;
import c... |
<reponame>pjunior/titanium<filename>apps/apivalidator/Resources/tests/testinclude.js
// just a simple js to make sure the script is evaluated
window.TESTVAL = 100;
|
import {createStyles, Theme, WithStyles, withStyles} from '@material-ui/core';
import React, {ReactNode} from 'react';
import {assertElement, cssClasses} from '@age-online/lib-core';
import {elementTouched, TouchEventHandler} from './touch-event-handler';
import {IButtonsDown, noButtonsDown} from './buttons-down';
impo... |
#!/usr/bin/env bash
envr=github.com
user=eddo888
pass=$(passwords.py -e $envr -a git -u $user)
ppwd=$(basename $(dirname $(pwd)))
ownr=$(basename $(pwd))
echo $ppwd/$ownr >&2
if [ "$ppwd" != "github.com" ]
then
ownr=$user
fi
gitrepos.py -u $user -p $pass -o $ownr $*
|
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
# Given data
X_vector = [...] # Latitude coordinates
Y_vector = [...] # Longitude coordinates
Z_vector = [...] # Data values
num = ... # Number of points for the contour plot
kwargs = {...} # Optional parameters
# Create gr... |
<reponame>OSWeDev/oswedev
import { Component, Prop } from 'vue-property-decorator';
import ModuleDAO from '../../../../../../../../../shared/modules/DAO/ModuleDAO';
import ModuleVar from '../../../../../../../../../shared/modules/Var/ModuleVar';
import VarDataBaseVO from '../../../../../../../../../shared/modules/Var/v... |
#!/usr/bin/env bats
DOCKER_COMPOSE_FILE="${BATS_TEST_DIRNAME}/php-5.2_ini_igbinary_on.yml"
container() {
echo "$(docker-compose -f ${DOCKER_COMPOSE_FILE} ps php | grep php | awk '{ print $1 }')"
}
setup() {
docker-compose -f "${DOCKER_COMPOSE_FILE}" up -d
sleep 20
}
teardown() {
docker-compose -f "${DOCKER... |
<reponame>ujjwalguptaofficial/infinity
export declare const removeFirstSlace: (value: string) => string;
|
#!/bin/sh
set -e
ROOTDIR=dist
BUNDLE=${ROOTDIR}/CLH-Qt.app
CODESIGN=codesign
TEMPDIR=sign.temp
TEMPLIST=${TEMPDIR}/signatures.txt
OUT=signature.tar.gz
if [ ! -n "$1" ]; then
echo "usage: $0 <codesign args>"
echo "example: $0 -s MyIdentity"
exit 1
fi
rm -rf ${TEMPDIR} ${TEMPLIST}
mkdir -p ${TEMPDIR}
${CODESIGN... |
#! /usr/bin/env bash
A=($(< "${1:-3.txt}")); l=${#A[0]}; k=0; j=3; total=1; x=""
for i in "${A[@]}"; do x+=${i:k:1}; ((k=(k+j)%l)); done; x=${x//\.}
echo "3A: ${#x}"
idx2=$(seq 0 2 $((${#A[@]}-1)))
for j in 1 3 5 7; do x=""; k=0; for i in "${A[@]}"; do x+=${i:k:1}; ((k=(k+j)%l)); done; x=${x//\.}; total+="*${#x}"; done... |
add_lunch_combo cm_d2att-eng
|
import {range} from "../src/Sequence";
describe("range", () => {
it("should create range of numbers with step = 1", () => {
const numbers = range(0, 5).toArray();
expect(numbers).toEqual([0, 1, 2, 3, 4, 5]);
});
it("should create range of numbers with step = .5", () => {
const numb... |
package io.rapidpro.surveyor.ui;
import android.app.ProgressDialog;
import android.content.Context;
/**
* A blocking progress dialog
*/
public class BlockingProgress extends ProgressDialog {
public BlockingProgress(Context context, int title, int message, int total) {
super(context);
setTitle(... |
<gh_stars>0
import React from "react";
import Drawer from "@material-ui/core/Drawer";
import List from "@material-ui/core/List";
import ListItem from "@material-ui/core/ListItem";
import { scroller } from "react-scroll";
const MyDrawer = props => {
const scrollToComponent = component => {
scroller.scrollTo(compo... |
GIT=https://gitlab.redox-os.org/redox-os/orbutils.git
BINDIR=/ui/bin
DEPENDS="orbital"
|
<filename>src/mol-gl/shader/chunks/apply-marker-color.glsl.ts<gh_stars>0
export const apply_marker_color = `
float marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win
if (marker > 0.1) {
if (intMod(marker, 2.0) > 0.1) {
gl_FragColor.rgb = mix(uHighlightColor, gl_FragColo... |
text = "I saw 9 dogs, 7 cats, 5 goats, 10 sheep and 6 cows."
numbers = re.findall(r'\d+', text)
total = sum([int(x) for x in numbers])
print(total) # 37 |
from .api import BuienradarApi, AsyncBuienradarApi
class WeatherClient:
def fetch_weather_sync(self, location: str) -> dict:
try:
api = BuienradarApi()
return api.fetch_weather(location)
except Exception as e:
print(f"Error fetching weather data synchronously: {e... |
package vip
import (
"net"
"github.com/pkg/errors"
)
// LookupHost resolves dnsName and return an IP or an error
func lookupHost(dnsName string) (string, error) {
addrs, err := net.LookupHost(dnsName)
if err != nil {
return "", err
}
if len(addrs) == 0 {
return "", errors.Errorf("empty address for %s", dnsN... |
<reponame>el-dorado/bilibili-trend
export * from './helper'
export * from './factory'
export * from './extends/PGraphics'
|
package cache
import (
"fmt"
"strconv"
"sync"
"testing"
"time"
)
const (
lru_loops = 10
)
func forkLRUCacheForTest(size int) Cache {
return New(size).LRU().EvictedFunc(func(key, value interface{}) {
fmt.Printf("key:%v value:%v evicted.\n", key, value)
}).Expiration(1 * time.Second).Build()
}
func TestLRUG... |
import mongoose from "mongoose";
import { onError } from "../utils/response";
const validateObjectId = (req, res, next) => {
if (!mongoose.Types.ObjectId.isValid(req.params.id)) {
return onError(res, 404, "Not Found");
}
next();
};
export default validateObjectId;
|
<filename>src/main/java/cn/wwl/radio/executor/functions/FakeCaseOpenFunction.java
package cn.wwl.radio.executor.functions;
import cn.wwl.radio.executor.ConsoleFunction;
import cn.wwl.radio.network.SocketTransfer;
import cn.wwl.radio.utils.FakeCaseManager;
import java.util.List;
public class FakeCaseOpenFunction impl... |
const fs=require('fs')
fs.writeFileSync('Append.txt','I am learning Node.js')
fs.appendFileSync('Append.txt',' \nThis is my first program in Node.js')
|
<reponame>thegoldenmule/boX<gh_stars>1-10
/**
* Author: thegoldenmule
* Date: 8/9/13
*/
(function (global) {
"use strict";
var AnimationCurveEditor = function () {
var scope = this;
scope.canvas = null;
scope.context = null;
// set up a default
scope._animationCurv... |
#!/bin/bash
# Check if a branch name is provided as an argument
if [ -z "$1" ]; then
echo "You must specify the branch to keep"
exit 1 # Return an error code
fi
# Check if the specified branch exists
if ! git rev-parse --verify "$1" >/dev/null 2>&1; then
echo "Branch '$1' does not exist"
exit 1 # Return an ... |
class Converter:
def __init__(self, base_currency):
self.base_currency = base_currency
self.rates = self.get_rates()
def get_rates(self):
# code to get the exchange rates from a web API
def convert(self, target_currency, amount):
return amount / self.rates[target_currency... |
#!/bin/sh
#source "$(realpath $(dirname $0))/emsdk_inc.sh"
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/emsdk_inc.sh"
[ -f $(dirname $0)/colors.sh ] && source $(dirname $0)/colors.sh
PLATFORM="emscripten"
SRC_DIR="external/equilibria-cpp/external/boost-sdk"
INSTALL_DIR="build/boost"
SRC... |
<gh_stars>10-100
# Starting omnifocus
# Rehearsal --------------------------------------------------------------
# through /usr/bin/osascript 0.020000 0.050000 3.560000 ( 4.665417)
# through appscript 0.060000 0.090000 0.150000 ( 0.135597)
# -----------------------------------------------------... |
/* Exit Games Common - C++ Client Lib
* Copyright (C) 2004-2020 by Exit Games GmbH. All rights reserved.
* http://www.photonengine.com
* mailto:<EMAIL>
*/
#pragma once
#include "Common-cpp/inc/defines.h"
#ifdef _EG_UNIX_PLATFORM
int getTimeUnix(void);
# ifdef _EG_ANDROID_PLATFORM
size_t EG_wcslen(const EG_C... |
<gh_stars>0
package com.qht.rest;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.qht.RequestObject;
import com.qht.ResultObject;
import com.qht.biz.ChapterBiz;
import com.qht.common.util.BeanUtil;
import com.qht.dto.CourseChapterDto;
import com.qht.dto.CourseIntroParameter;
import c... |
# generated by Git for Windows
test -f ~/.profile && . ~/.profile
test -f ~/.bashrc && . ~/.bashrc
|
#!/bin/sh
. ${BUILDPACK_TEST_RUNNER_HOME}/lib/test_utils.sh
WRAPPER_DIR=${BUILDPACK_HOME}/opt/wrapper
installWrapper() {
cp -r "$WRAPPER_DIR"/* ${BUILD_DIR}
}
testCompileWithoutWrapper()
{
cat > ${BUILD_DIR}/build.gradle <<EOF
task stage << {
println "${expected_stage_output}"
}
EOF
compile
assertCapture... |
import { Line, Subcommand } from "https://deno.land/x/line@v0.1.1/mod.ts";
class Hello extends Subcommand {
public signature = "hello [string]";
public description = "Say hello [string].";
public handle(): void {
const name = this.getArgumentValue("string");
if (!name) return console.error("Name not sp... |
from scapy.all import DUID_LL
class ServerManager:
def __init__(self, pg0_remote_mac):
self.pg0 = NetworkInterface(pg0_remote_mac)
self.server_duid = DUID_LL(lladdr=self.pg0.remote_mac) # Initialize server_duid attribute with DUID_LL format
def admin_up(self):
# Implement the method t... |
<filename>build/watch.js<gh_stars>0
import BuildProcessBuildStage from "./buildProcessBuildStage"
new BuildProcessBuildStage(false)
|
import html
# define string
string = '" is a quote.'
# convert HTML entities to characters
converted_string = html.unescape(string)
# print converted string
print('Converted string:', converted_string) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.