text
stringlengths
1
1.05M
#!/bin/bash (set -o igncr) 2>/dev/null && set -o igncr; # this comment is required # The above line ensures that the script can be run on Cygwin/Linux even with Windows CRNL # # Run 'mkdocs serve' on port 8000 (default) # Make sure the MkDocs version is consistent with the documentation content # - require that at lea...
class Main { constructor() { } public run() { if (!Detector.webgl) { Detector.addGetWebGLMessage(null); } else { App.run() // App.viewOther(ExpConfig.Game_SceneJump) } } }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.software_pages = void 0; var software_pages = { "viewBox": "0 0 64 64", "children": [{ "name": "g", "attribs": {}, "children": [{ "name": "polygon", "attribs": { "fill": "none", "stroke": ...
class URLSanitizer: @classmethod def _get_sanitized_url(cls, url): # Remove query parameters if '?' in url: url = url.split('?')[0] # Remove fragments if '#' in url: url = url.split('#')[0] # Remove trailing slashes if url.endswith('/'): ...
/****************************************************************************** * * Copyright(c) 2013 Realtek Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free So...
<filename>bin/cmd/publish.js let helper = require("../../src/util/helper"); module.exports = { command: "publish", desc: "publish project", paras: ["[name]"], fn: function (params) { let name = params[0]; return require("../../index").publish(helper.getAppInfo(process.cwd(), name, false...
<filename>CoordenacaoFacil/models/Abstract.py from CoordenacaoFacil import db class Abstract(): def __init__(self, code="", name="", createdAt=""): self.code = code self.name = name self.createdAt = createdAt def create(self, abstract=None): db.abstracts.insert({ "...
/* * Copyright 2014-present Open Networking Foundation * * 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 appli...
mkdir -p /env mkdir -p /etc/solr/conf echo "HOSTNAME=$HOSTNAME" > /env/hostname.env genvsubst --env /env --any --sub $BUILD_TEMPLATES_DIR/solr/conf --out=/etc/solr/conf genvsubst --env /env --any --sub $BUILD_TEMPLATES_DIR/solr/bin --out=/usr/lib/solr/bin
module PoolParty module Remote # Select a list of instances based on their status def nodes(hsh={}) # _nodes[hsh] ||= list_of_instances.select_with_hash(hsh) end # Select the list of instances, either based on the neighborhoods # loaded from /etc/poolparty/neighborhood.json ...
#!/bin/bash # # This library holds golang related utility functions. # os::golang::verify_go_version ensure the go tool exists and is a viable version. function os::golang::verify_go_version() { os::util::ensure::system_binary_exists 'go' local go_version go_version=($(go version)) if [[ "${go_version[2]}" != go1...
override func willTransition(to presentationStyle: MSMessagesAppPresentationStyle) { // Called before the extension transitions to a new presentation style. switch presentationStyle { case .compact: // Logic for handling transition to compact presentation style // Prepare fo...
const sort = (arr) => { for (let i = 0; i < arr.length; i++) { let min = i; for (let j = i + 1; j < arr.length; j++) { if (arr[j] < arr[min]) { min = j; } } if (min !== i) { let temp = arr[i]; arr[i] = arr[min]; arr[min] = temp; } } return arr; } console.log(sort([7, 5, 9, 3, 1]));
#!/usr/bin/env bash set -xeo pipefail if [[ "$(pwd)" == "$(cd "$(dirname "$0")"; pwd -P)" ]]; then echo "Can only be executed from project root!" exit 1 fi declare -x OC_TEST_ALT_HOME [[ -z "${OC_TEST_ALT_HOME}" ]] && OC_TEST_ALT_HOME=1 pushd tests/acceptance ./run.sh "$@" popd
<filename>lib/poolparty/core/array.rb =begin rdoc Array extensions =end require "enumerator" class Array def to_os map {|a| a.to_os } end def collect_with_index &block self.enum_for(:each_with_index).collect &block end def runnable(quiet=true) self.join(" \n ").runnable(quiet) end d...
import re string = "This movie was released in 1980" # search for substring of 4 digits result = re.search(r'\d{4}', string) # print the year if result: print(result.group())
package io.latent.storm.rabbitmq; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import backtype.storm.tuple.Tuple; /** * This interface describes an object that will perform the work of mapping * incoming {@link Tuple}s to {@link Message} objects for posting on a RabbitMQ * exchange...
import React from 'react'; import { IntlProvider as ReactIntlProvider } from 'react-intl'; import { connect } from 'react-redux'; // import { actions as routingActions } from '../../modules/routing'; import translation from '../../../messages/translations.json'; import { query } from '../../utils/url'; const defaultLo...
package ExerciciosExtras.exercicios.orientacaoaobjeto; public class Processador { String nomeProcessador; double qtdMaxProcessamento; double qtdEmProcessamento = 0; Computador computador; Processador(Computador computador, String processador, double qtdMaxProcessamento) { this.computador ...
import random def generate_password(character_list, min_length): password = '' for i in range(min_length): password += random.choice(character_list) return password if __name__ == '__main__': character_list = ['a', 'b', 'c', 'd', 'e','1','2','3','4','5'] min_length = 8 password = generate_password...
#!/bin/bash # LICENSE UPL 1.0 # # Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved. # # Since: Mar, 2020 # Author: mohammed.qureshi@oracle.com # Description: Checks the status of Oracle Database and Locks # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. # export ORACLE_SID=${ORACLE_SID^^...
import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader, Dataset import torchvision.datasets as dset import torchvision.transforms as transforms # Step 1: Define a custom dataset class class SiameseDataset(Dataset): def __init__(self, image_folder_dataset, transfo...
class MechanismManager { constructor() { this.supportedMechanisms = new Set(); } addMechanism(mechanism) { this.supportedMechanisms.add(mechanism); } removeMechanism(mechanism) { this.supportedMechanisms.delete(mechanism); } isMechanismSupported(mechanism) { return this.supportedMechani...
import os from ray.tune.result import EXPR_PROGRESS_FILE from ray.tune.logger import CSVLogger class PathmindCSVLogger(CSVLogger): def __init__(self, logdir): """Initialize the PathmindCSVLogger. Args: logdir (str): The directory where the log file will be created or appended to. ...
def format_package_name(pkgname): pkgname = pkgname.strip().lower() if pkgname.startswith("lib"): pkgname = pkgname[3:] elif pkgname.startswith("python-"): pkgname = pkgname[7:] elif pkgname.startswith("ruby-"): pkgname = pkgname[5:] return pkgname
#!/bin/bash remote= for arg; do [[ "$arg" =~ :.*/$ ]] && remote=$arg && continue case "$arg" in *) exit 1;; esac done [ "$remote" ] || exit 1 self=$(readlink -e "$0") || exit 1 self=$(dirname "${self}") || exit 1 rsync --inplace --delete --out-format="%t %o %f ... %n" --filter=". ${self}/rs-filt...
# ASX FlexUnit Runner mxmlc asx_test/src/asx_test.mxml \ -output=asx_test/bin/asx_test.swf \ -debug=true \ -sp+=asx/src \ -sp+=asx_test/src \ -library-path+=asx_test/libs # ASX SpecRunner # mxmlc specs/AsxSpecRunner.mxml \ # -output=bin/AsxSpecs.swf \ # -debug=true \ # -sp specs \ # -sp src \ # -sp ../spectacular...
# some unit tests for the bytecode decoding from pypy.jit.metainterp import pyjitpl from pypy.jit.metainterp import jitprof from pypy.jit.metainterp.history import BoxInt, ConstInt from pypy.jit.metainterp.history import History from pypy.jit.metainterp.resoperation import ResOperation, rop from pypy.jit.metainterp.o...
REM FILE NAME: tab_rep.sql REM LOCATION: Object Management\Tables\Reports REM FUNCTION: Document table extended parameters REM TESTED ON: 8.0.4.1, 8.1.5, 8.1.7, 9.0.1 REM PLATFORM: non-specific REM REQUIRES: dba_tables REM REM This is a part of the Knowledge Xpert for Oracle Administration library. REM Cop...
#!/bin/sh . /scripts/A-config.sh echo Restarting local firewire capture... sudo killall dvsource-firewire sudo killall -9 dvsource-firewire sudo killall dvgrab sudo killall -9 dvgrab sleep 2 sudo dvsource-firewire -c 1 -h $DVHOST -p $DVPORT & sudo dvsource-firewire -h $DVHOST -p $DVPORT
package com.ulfy.master.ui.view; import android.content.Context; import android.util.AttributeSet; import android.view.View; import com.ulfy.android.mvvm.IViewModel; import com.ulfy.android.ui_injection.Layout; import com.ulfy.android.ui_injection.ViewClick; import com.ulfy.master.R; import com.ulfy.master.applicatio...
CREATE TABLE departments ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, budget NUMERIC NOT NULL ); CREATE TABLE employees ( id SERIAL PRIMARY KEY, name TEXT NOT NULL, salary NUMERIC NOT NULL, dept_id INTEGER REFERENCES departments(id) );
#!/bin/sh ../../src/pipeline/config/bootstrap.sh gerardo 070615 43000 43100
def main(): while True: print("1. SSH弱口令爆破") print("2. MySQL弱口令爆破") print("输入exit退出") user_input = input("请选择操作: ") if user_input == "1": print("开始SSH弱口令爆破") # Add code to initiate SSH brute force attack elif user_input == "2"...
#include <stdlib.h> // ORACLE INT foo(INT, INT, INT, ADDR, ADDR, INT, ADDR, INT, ADDR, INT) int foo(int r1, int r2, int r3, int* r4, int* r5, int r6, int* stack1, int stack2, int* stack3, int stack4) { return r1 + r2 + r3 + *r4 + *r5 + r6 + *stack1 + stack2 + *stack3 + stack4; } int main() { ...
db.collection.find({ field: { $gt: givenValue } });
import os class DirectoryTraversal: def __init__(self, path, files=[]): self.path = path self.files = files def traverse_files(self, extension): result = [] for root, _, filenames in os.walk(self.path): for filename in filenames: if filename.endswith...
package dev.arkav.openoryx.net.data; import dev.arkav.openoryx.net.packets.StatType; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; public class StatData implements DataPacket { public byte statType = 0; public int statValue; public String stringStatValue; public ...
const io = require('socket.io'); const port = process.env.PORT || 3001; const server = io(port, () => { console.log('port connected and running on ', port) });
package com.digirati.taxman.rest.server.infrastructure.web; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Produces; import javax.ws.rs.core.UriInfo; /** * An application wide thread-local context that maintains the active URI for the ...
@test "parcel bundle should include necessary code (no tree-shaking)" { run grep -q span dist/Example.bs.js [ "$status" -eq 0 ] run grep -q "hello" dist/Example.bs.js [ "$status" -eq 0 ] } @test "parcel bundle should include unnecessary code (no tree-shaking)" { run grep -q blockquote dist/Example.bs.js [...
<!DOCTYPE html> <html> <head> <title>Online Store</title> </head> <body> <h1>Online Store</h1> <form> <select id="filterPrice"> <option value="ascending">Price (Low to High)</option> <option value="descending">Price (High to Low)</option> </select> <select id="filterCategory"> <option value="all">All Categorie...
<gh_stars>1-10 /** * Copyright © 2016-2021 The Thingsboard 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 * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requi...
#!/bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin ROOT_MOUNT=/mnt/root ROOT_IMAGE_PCR=9 IP=$(which ip) LN=$(which ln) MKDIR=$(which mkdir) MKNOD=$(which mknod) MKTEMP=$(which mktemp) MODPROBE=$(which modprobe) MOUNT=$(which mount) SLEEP=$(which sleep) [ -z "$CONSOLE" ] && CONSOLE="/dev/console" # debug logging failure se...
package com.cetekot.jokes.persistence.entity; import lombok.Data; import javax.persistence.*; import java.text.MessageFormat; /** * Copyright: Copyright (c) 2020 * * @author Andrei 'cetekot' Larin * @version 1.0 */ @Entity @Table( name = "jokes" ) @Data public class Joke { @Id @Column( name = "id" )...
<reponame>fernetjs/beaglejs require("blanket")(["/lib/scraper.js", "/lib/bone.js", "/lib/beagle.js"]); var expect = require('expect.js'), request = require('request'), beagle = require('../lib/beagle.js'), Bone = require('../lib/bone.js'); var host = "http://localhost:3000/"; describe('BeagleJS', function(){ ...
<gh_stars>10-100 // auto generated by kmigrator // KMIGRATOR:0017_auto_20200627_1032:<KEY> exports.up = async (knex) => { await knex.raw(` BEGIN; -- -- Alter field user on forgotpasswordaction -- SET CONSTRAINTS "ForgotPasswordAction_user_3c52ec86_fk_User_id" IMMEDIATE; ALTER TABLE "ForgotPasswordAction" DROP ...
<filename>admin/src/pages/Customers.js import React from 'react'; import { Table, TableHeader, TableCell, TableFooter, TableContainer, Input, Card, CardBody, Pagination, } from '@windmill/react-ui'; import useAsync from '../hooks/useAsync'; import useFilter from '../hooks/useFilter'; import NotFound ...
#!/usr/bin/env sh test_file=$1 python $test_file --local_rank $SLURM_PROCID --world_size $SLURM_NPROCS --host $HOST --port 29500
#!/bin/sh # base16-shell (https://github.com/chriskempson/base16-shell) # Base16 Shell template by Chris Kempson (http://chriskempson.com) # Mexico Light scheme by Sheldon Johnson color00="f8/f8/f8" # Base 00 - Black color01="ab/46/42" # Base 08 - Red color02="53/89/47" # Base 0B - Green color03="f7/9a/0e" # Base 0A -...
const crypto = require('crypto'); function encryptDataAes256(plainText, secretKey) { const iv = crypto.randomBytes(16); // Random initialization vector const salt = crypto.randomBytes(64); // Salt should be as large as possible const key = crypto.pbkdf2Sync(Buffer.from(secretKey), salt, 2145, 32, 'sha512'); // Key ...
<reponame>gaunthan/design-patterns-by-golang<gh_stars>0 package observer import "fmt" func ExampleObserver() { weather := NewSubject() joe := NewObserver("joe") weather.attach(joe) tom := NewObserver("tom") weather.attach(tom) weather.notify("today is sunshiny") fmt.Println("---") weather.detach(joe) weath...
package cfg.cmd; import java.util.List; import cfg.serialize.FieldRangeType; import cfg.serialize.OutputDataFormat; import cfg.serialize.OutputType; import cfg.serialize.SerializeDataUtil; import cfg.serialize.exceptions.SheetDataException; import cfg.serialize.exceptions.SheetDefineException; import cfg.source.Workb...
<filename>tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SaxTemplateParser.java // 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/L...
class WelcomesController < ApplicationController def index @welcomes = Welcome.all end def new @welcome = Welcome.new end def create @welcome =Welcome.new(welcome_params) if @welcome.save flash[:notice] = "saved successfully" redirect_to welcomes_path else flash[:error] = @welcom...
/** * 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...
for i in range(1, 21): if i % 2 == 0: print(i)
using System; namespace RandomNumberGenerator { class Program { static void Main(string[]args) { Random random = new Random(); int lower = 0; int upper = 10; for (int i = 0; i < 10; i++) { Console.WriteLine(random.Next...
#!/bin/bash # # Copyright 2019 The Bazel Authors. 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...
public class CustomerController : Controller { private readonly CustomerContext _context; public CustomerController(CustomerContext context) { _context = context; } [HttpGet] public async Task<ActionResult<IEnumerable<Customer>>> GetCustomerDetails() { return await _context...
static app -a 0.0.0.0 -H "{\"Cache-Control\": \"no-cache, must-revalidate\"}"
<reponame>RenukaGurumurthy/Gooru-Core-API<gh_stars>0 ///////////////////////////////////////////////////////////// // ResourceProcessor.java // gooru-api // Created by Gooru on 2014 // Copyright (c) 2014 Gooru. All rights reserved. // http://www.goorulearning.org/ // Permission is hereby granted, free of charge, to any...
<gh_stars>0 module ImazenLicensing class V2IdLicenseText < V2LicenseText def self.supported_kinds ['id'] end def validate super # validates Owner and Id field require_values :kind, ['id'] require_values :is_public, ['false'] require_lowercase_alphanumeric(:id, 8) ...
<reponame>1aurabrown/ervell<filename>react/components/ChannelMetadata/components/ChannelBreadcrumb/index.js import React, { Component } from 'react'; import { propType } from 'graphql-anywhere'; import styled from 'styled-components'; import channelBreadcrumbFragment from 'react/components/ChannelMetadata/components/C...
port=$1 if !([[ -n $port ]];) then echo No port argument provided. exit fi pid=$(lsof -t -i4TCP:$port) if [[ -n $pid ]]; then echo Killing $pid on port: $port kill -9 $pid else echo Port $port is free fi
<filename>app/controllers/clickHandler.server.js var Users = require('../models/users.js') function ClickHandler() { this.getClicks = function(req, res) { Users.findOne({'github.id': req.user.github.id}, {_id: 0}).exec(function(err, result) { if (err) throw err; res.json(result.nbrClicks); }) ...
The error is that the variable names x and y are not defined. The code should be changed to use the variables X and Y that were passed to the function. def multiply(X,Y): # Function to multiply two numbers print(X*Y) # Changed x to X and y to Y
package resources const ( NodepoolPrefix = "kon-nodepool" NodepoolLabel = "k11n.dev/nodepool" AppLabel = "k11n.dev/app" TargetLabel = "k11n.dev/target" BuildRegistryLabel = "k11n.dev/buildRegistry" BuildImageLabel = "k11n.dev/buildImage" BuildLabel = "k11n.dev/build" BuildT...
<gh_stars>0 package com.study.basic.nio; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.Objects; /** * <Description> * * @author hushiye * @since 9/6/21 15:59 */ publ...
#!/bin/bash scriptPath="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" cd $scriptPath sh ./service-discovery/shells/build.sh sh ./user-service/shells/build.sh sh ./product-service/shells/build.sh
function setSessionStorage(){ var userCompany = document.getElementById('company').value; var firstName = document.getElementById('fname').value; var lastName = document.getElementById('lname').value; var address = document.getElementById('address').value; var city = document.getElementById('city')....
protected void doDecode(MessageContext messageContext) throws MessageDecodingException { if (!(messageContext instanceof SAMLMessageContext)) { log.error("Invalid message context type, this decoder only supports SAMLMessageContext"); throw new MessageDecodingException( "Invalid messa...
import { Extension } from '../models/index'; import { ExtensionUtility } from './extensionUtility'; import { SharedService } from '../services/shared.service'; export declare class RowMoveManagerExtension implements Extension { private extensionUtility; private sharedService; private _eventHandler; priv...
<filename>lib/deck.rb<gh_stars>0 class Deck attr_reader :cards def initialize(cards) @cards = cards end end
<filename>2d/src/test/java/de/bitbrain/braingdx/tmx/TiledMapManagerTest.java /* Copyright 2017 <NAME> * * 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/licens...
#! /usr/bin/env sh export PYTHONPATH="src:$PYTHONPATH" python3 -m pytest tests $@
// For keybind handling -- Created by <NAME> https://aerilym.github.io/ //NOTE pressing shift and = is actualy shift and + as well as just pressing +, as when you hold shift it changes the = key to +, this happens to all keys with a shift option. //NOTE the + symbol in the keybinds indicated a key combination, so shif...
#include <windows.h> #include <string> std::wstring ExePath() { WCHAR buffer[MAX_PATH]; GetModuleFileNameW(NULL, buffer, MAX_PATH); return std::wstring(buffer); } std::wstring DirPath() { std::wstring exepath = ExePath(); std::wstring::size_type pos = exepath.find_last_of(L"\\/"); return exepath.sub...
/* TRANSITIONS */ const swup = new Swup(); /* NAVIGATION MENU */ const hamburger = document.querySelector(".hamburger"); const navMenu = document.querySelector(".nav-menu"); hamburger.addEventListener("click", mobileMenu); function mobileMenu() { hamburger.classList.toggle("active"); navMenu.classList.togg...
<filename>C++/LAB3/EulerLoop.h // // EulerLoop.h // LAB3 // // Created by <NAME> on 27.05.2018. // Copyright © 2018 <NAME>. All rights reserved. // #ifndef EulerLoop_h #define EulerLoop_h #endif /* EulerLoop_h */
<filename>lang/py/cookbook/v2/02/bench.py #! /usr/bin/env python # -*- coding:UTF-8 -*- import time def timeo(fun, n=10): start = time.clock() for i in xrange(n): fun() end = time.clock() thetime = end - start return fun.__name__, thetime import os def linecount_wc(): return int(os.popen('wc...
def sum_range(start, end): total = 0 for i in range(start,end + 1): total += i return total # Test the function print(sum_range(1, 10)) # Output: 55
<filename>resources/js/app.js /** * First we will load all of this project's JavaScript dependencies which * includes Vue and other libraries. It is a great starting point when * building robust, powerful web applications using Vue and Laravel. */ require('./bootstrap'); window.Vue = require('vue'); /** * Th...
#!/bin/bash dieharder -d 203 -g 209 -S 2105767049
<gh_stars>1-10 // @noflow // Does not fully mock members // Add properties & functions as necessary export const clipboard = {writeText: s => {}} export const remote = {BrowserWindow: {}, Menu: {}} export const crashReporter = {} export const shell = {} export const ipcRenderer = {} export const globalShortcut = {} exp...
<gh_stars>0 /** * Displays a generic and consistent error message in the UI * @param props Error data */ export function ErrorMessage(props) { if (!props || !props.message) { return null; } // TODO: could add logic here from more props return ( <div className="mt-4 ale...
if [ "${1}." != '-ho.' ]; then echo "Making build/bin/newsamp using generated .cpp source." srcFiles=(./testSamples/newsamp/gen-cpp/txtToBin/src/boma/*.cpp) g++ -std=c++17 -O0 -g -Wall -Wextra testSamples/newsamp/main.cpp ${srcFiles[@]} -ItestSamples/newsamp -o build/bin/newsamp -lhumon else echo "Makin...
function xyHeatmap(data,stylename,media,plotpadding,legAlign,yAlign,breaks){ console.log(breaks) var titleYoffset = d3.select("#"+media+"Title").node().getBBox().height var subtitleYoffset=d3.select("#"+media+"Subtitle").node().getBBox().height; // return the series names from the first row of the sp...
import java.util.Scanner; import java.lang.System; import java.lang.System; import java.util.concurrent.Semaphore; import java.util.LinkedList; import java.util.Queue; class semaphores{ Queue <Process> queue; Process p; Semaphore ss ; private static Semaphore s; public semaphores(){ s = new Semaphore(1) ; ...
def calculate_shares_to_trade(current_portfolio_value, target_percentage, asset_price): target_value = current_portfolio_value * target_percentage target_shares = target_value / asset_price return target_shares # Calculate the number of shares to trade current_portfolio_value = 50000 target_percentage = 0....
from bs4 import BeautifulSoup def parse_headings(html): # create a BS object soup = BeautifulSoup(html, 'html.parser') # use BS to extract the headings headings = soup.find_all(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']) # append all headings to a list headings_list = [] for heading in headings: head...
<reponame>xfyre/tapestry-5 // ASM: a very small and fast Java bytecode manipulation framework // Copyright (c) 2000-2011 INRIA, France Telecom // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met...
def split_into_words(string): result = [] # Split the string into words words = string.split(' ') # add each word to the result list for word in words: result.append(word) return result
#!/usr/bin/env bash set -ex cd "$(dirname "${BASH_SOURCE[0]}")" docker build -t "${IMAGE:-sourcegraph/redis-cache}" .
<reponame>hosituan2012/ant-dashboard<filename>src/app/routes/routes.module.ts import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { LoginPageComponent } from './login-page/login-page.component'; // import { AccountPageComponent } from './account-page/account-page.component';...
// evmone: Fast Ethereum Virtual Machine implementation // Copyright 2022 The evmone Authors. // SPDX-License-Identifier: Apache-2.0 #include <evmone/eof.hpp> #include <gtest/gtest.h> #include <test/utils/utils.hpp> using namespace evmone; TEST(eof, code_begin) { EOF1Header header1{1, 0}; EXPECT_EQ(header1.c...
package com.webrdaniel.collectmydata.utils; import android.content.Context; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; public class KeyboardUtils { public static void hideKeyboard(Context activity, EditText editText) { InputMethodManager inputMethodManager = (InputMet...
import { IContext } from 'overmind'; import { createActionsHook, createEffectsHook, // createReactionHook, createStateHook, } from 'overmind-react'; import { state } from './state'; import * as actions from './actions'; import * as effects from './effects'; export const config = { state, actions, effects...
import React from 'react'; import ReactTable from 'react-table'; class App extends React.Component { constructor(props) { super(props); this.state = { students: [] } } componentDidMount() { fetch('http://localhost:3000/students') .then(res => res.json()) .then(data => this.setS...
<reponame>wuximing/dsshop import {getList} from '@/api/seckill' import moment from 'moment' export default { data() { return { scrollLeft: 0, TabCur: 0, times: [], list: [], time: '', page: 1, loading: false, loadingType: 'more', }; }, onLoad(options){ let that = this; this.setNav() ...