text stringlengths 1 1.05M |
|---|
def calculateLabelHeight():
# Constants for line edit height and label width
lineEditHeight = 30 # Example height of a line edit widget
labelWidth = GafferUI.PlugWidget.labelWidth() # Width of the label widget
# Calculate the height of the label widget based on vertical alignment
if GafferUI.Labe... |
#pragma once
#include "vector.hpp"
namespace frea {
namespace random {
template <class P, class RD>
P GenPlane(RD&& rd) {
// 中身は単位ベクトル + 原点との距離
const auto nml = GenVecUnit<typename P::vec_t>(rd);
const auto dist = rd();
return P(nml, dist);
}
}
}
|
<reponame>altraman12/TeslaTSA
//WARNING: This code runs on ALL pages, if it shouldn't, put it somewhere else
$(document).ready(function() {
$('.angled-border').angledBorder();
function stickScroll () {
var window_top = $(window).scrollTop();
var div_top = $('#nav').prev().height();
if (... |
def extract_columns_data(column_names, file_paths):
data_dict = {}
for file_path in file_paths:
file_name = file_path.split('/')[-1]
data_list = []
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
row_data = {}
for line in ... |
#!/bin/bash
set -e
# This script is a central controller that manages git commands via project specific commands.
# Each project will have a different branching strategy, so the creation of new branches will be configured
# by project specific commands.
# Project specific commands can be found in git command specifi... |
#!/bin/bash
set -euo pipefail
# Variables:
##### NOTE: THE BELOW VARIABLES MUST BE SET! ######
# Name of an S3 bucket to be created -- MUST BE GLOBALLY UNIQUE!
S3_BUCKET=MY-UNIQUE-BUCKETNAME
# AWS Account IDs
DEV_ACCOUNT_ID=123456789123
PROD_ACCOUNT_ID=123456789123
###### THESE VARIABLES CAN BE OPTIONALLY ADJUSTED ... |
"""Sends error message to the userinterface"""
def send_error_msg(error_type):
#Add encryption adn HMAC
print("Error reporting currently not supported.")
"""
network = connect_network(flash_light=False) #Connect to network
s = create_and_connect_socket(UPDATE_URL, UPDATE_PORT, UPDATE_HTTPS)
cont... |
<filename>x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_exploration/components/outlier_exploration/outlier_exploration.tsx
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you ... |
import functools
import json
from jwtAuthenticator.schemas.schema_user import validate_user
from jwtAuthenticator.models import db
from jwtAuthenticator.models import User
from flask.views import MethodView
from flask_jwt_extended import (
JWTManager,
create_access_token,
create_refresh_token,
jwt_requ... |
bash -c "npm start" |
module game {
export class ElsfkMap {
//行 Row 列 Column
row = 18
column = 10
//宽度 长宽高 都是一样
width = 50
private _map: Array<THREE.Vector3> = [] //顶点坐标
public initMap() {
//假设 是 左下 为0
// let row = this.row / 2
// let colum... |
base_url = $('#token').attr('base-url');//Extrae la base url del input token de la vista
function eliminarQuehacer(id,token) {
url = base_url.concat('/admin/pueblos_magicos/quehacer/eliminar');
$.ajax({
method: "POST",
url: url,
data:{
"id":id,
"_token":token
... |
/**
* Copyright (c) 2008 <NAME>. All rights reserved.
*
* This file is part of XBee-API.
*
* XBee-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (... |
class Vector:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
def magnitude(self):
return (self.x**2 + self.y **2 + self.z**2)**0.5
def normalize(self):
mag = self.magnitude()
return Vector(self.x/mag, self.y/mag, self.z/mag)
def __add__(self, other):
return Vector(self.x + other... |
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRI... |
<reponame>hmrc/claim-tax-refund-frontend
/*
* Copyright 2021 HM Revenue & Customs
*
* 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
*
... |
<reponame>Tiltification/sonic-tilt
//
// DispatcherSampleAppDelegate.h
// DispatcherSample
//
// Copyright (c) 2011 <NAME> (<EMAIL>)
//
// For information on usage and redistribution, and for a DISCLAIMER OF ALL
// WARRANTIES, see the file, "LICENSE.txt," in this distribution.
//
#import <UIKit/UIKit.h>
#import "... |
import React, {Component} from 'react';
import ListView from "./src/Components/ListView";
export default class App extends Component<Props> {
render() {
return (
<ListView/>
);
}
}
|
<gh_stars>0
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"code.google.com/p/mahonia"
)
var (
infile = "in.txt"
outfile = "out.txt"
src = "utf8"
dst = "tcvn3"
)
func main() {
flag.StringVar(&infile, "file", infile, "file")
flag.StringVar(&src, "src", src, "src")
flag.StringVar(&dst, "dst"... |
#Just to know the last time this was executed
import time
print time.ctime()
import h5py
from bisect import bisect_left
import matplotlib.pyplot as plt
from brianPlotter import *
from gupta_paper_further_formulas_brianversion19 import *
# *** ***
# Be sure to set correct b... |
#!/bin/sh
# Disable source following.
# shellcheck disable=SC1090,SC1091
# Disable optional arguments.
# shellcheck disable=SC2120
TEST_SCRIPT="$0"
TEST_DIR="$(dirname -- "$TEST_SCRIPT")"
. "$TEST_DIR/test_helpers"
oneTimeSetUp() {
th_oneTimeSetUp || return 1
TEST_ENVS_B_SETUP_FILE="$TEST_ENVS_VENV/B/$P... |
import random
# Generates a random integer between 0 and 1000
x = random.randint(0,1000)
print(x) |
#!/bin/sh
set -e # -e: exit on error
if [ ! "$(command -v chezmoi)" ]; then
bin_dir="$HOME/.local/bin"
chezmoi="$bin_dir/chezmoi"
if [ "$(command -v curl)" ]; then
sh -c "$(curl -fsLS https://git.io/chezmoi)" -- -b "$bin_dir"
elif [ "$(command -v wget)" ]; then
sh -c "$(wget -qO- https://git.io/chezmo... |
import { ref } from "vue";
import { Octokit } from "@octokit/rest";
const octokit = new Octokit({
auth: process.env.OCTOKIT_API_KEY,
userAgent: "brampijper",
Accept: "application/vnd.github.16.28.4.raw",
});
export default async function useGithubRepositories() {
async function fetchRepo() {
let repositor... |
#!/bin/bash -ex
if ! docker ps | grep mysql_autobet -q; then
source bin/devenv_start.sh
sleep 20
fi
java -jar target/autobet-0.1-SNAPSHOT-executable.jar stats -t PT10M
java -jar target/autobet-0.1-SNAPSHOT-executable.jar eval -t PT1M -s random
java -jar target/autobet-0.1-SNAPSHOT-executable.jar eval -t PT1M -s l... |
<gh_stars>1-10
#include <stdio.h>
int print(int n)
{
return printf("%d\n", n);
}
int read()
{
int n;
scanf("%d", &n);
return n;
}
|
import assert from 'assert'
import { fetchSongs, fetchSong } from '../scraper.js'
import { describe, it } from 'mocha'
import fs from 'fs/promises'
import path from 'path'
function assertSong (t, file, song) {
t.timeout(20000)
return fs.readFile(path.resolve('sources', 'wneen.com', 'test', file)).then(data => {
... |
package com.modesteam.urutau.service.persistence;
public enum OrderEnum {
ASC, DESC
}
|
The most efficient way to identify all the palindrome numbers between 1 to 10000 is to use the following logic: Starting from 1 to 10000, convert each number to a string and check if the reverse of the string is equal to the original string. If so, then the number is a palindrome number. |
#!/bin/bash
#
# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
#
set -ex
... |
package m.co.rh.id.anavigator.example.dialog;
import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import m.co.rh.id.anavigator.StatefulView;
import m.co.rh.id.anavigator.annotation.NavInject;
i... |
var zIndexes = {'auto':'auto'};
for (let i = 0; i < 100; i++) {
zIndexes[i] = i;
}
module.exports = {
purge: [
'./resources/**/*.blade.php',
'./resources/**/*.js',
'./resources/**/*.vue',
],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
zIndex: zIndexes
},
variants:... |
function calculateTotalCost(costs) {
totalCost = 0;
for (let i in costs) {
totalCost += costs[i];
}
return totalCost;
} |
<reponame>chnghia/gatsby_fresh_starter
import React from 'react'
const Footer = () => (
<footer className="footer footer-dark">
<div className="container">
<div className="columns">
<div className="column">
<div className="footer-logo">
<img src="assets/images/logos/fresh-whit... |
import React from 'react';
import { StyleSheet, Text, View, TextStyle } from 'react-native';
import { Button, Loading, primary } from '../../../../../packages/client/src/modules/common/components/native';
import { TranslateFunction } from '@gqlapp/i18n-client-react';
interface ViewProps {
t: TranslateFunction;
ch... |
import { initialize } from ".";
initialize();
|
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore /home/nico/d/d/wya/nr-commons.keystore commons/target/commons-1.0-SNAPSHOT.apk nrkeystorealias
zipalign -f -v 4 commons/target/commons-1.0-SNAPSHOT.apk commons/target/commons-1.0-SNAPSHOT_signed.apk
|
<gh_stars>0
import React, { useEffect, useState } from 'react'
import useStyles from "./Styles"
import {InputLabel ,Button ,FormControl , Input} from "@material-ui/core"
import Message from '../Message/Message'
import firebase from "firebase"
import {Link} from "react-router-dom"
function ChatHome({db}) {
const cla... |
#!/bin/bash
# run with sudo
# this file connects to wifi and handles the access point service
ROOT_DIR='/usr/local/mm-config'
SCRIPTS="$ROOT_DIR/bin"
# check if it has the right amount of commands
if [ $# != 1 ]; then
echo "usage: sudo bash $0 <wifi-name>"
exit 1
fi
# set the name of the wifi
WIFI_NAME=$1
# rea... |
#!/usr/bin/env bash
#!/bin/bash
g++ -std=gnu++1y -O2 -Wall apps/imdb/hash-server.c++ apps/imdb/hashprotocol.capnp.cc \
-lcapnpc -lcapnp-rpc -lcapnp -lkj-async -lkj -o hash-server
g++ -std=gnu++1y -O2 -Wall -D_GLIBCXX_USE_CXX11_ABI=0 apps/imdb/hash-client.c++ apps/imdb/hashprotocol.capnp.cc \
-lcapnpc -lcapn... |
def classify(height, weight, age):
# Load the model
model = Model()
# Get data to use as input
data = [height, weight, age]
# Use the model to predict the class
pred = model.predict(data)
return pred |
#!/bin/bash
set -e
echo "---- cleanup"
echo CentOS Provision Cleanup
sudo yum clean all
sudo rm -rf /var/lib/yum
sudo rm -rf /var/cache/yum
sudo rm -rf /tmp/*
|
package dao;
import conexao.Conexao;
import java.io.Serializable;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import sessao.SessionUtil;
publ... |
package org.apache.tapestry5.integration.app1.pages;
import org.apache.tapestry5.ComponentAction;
import org.apache.tapestry5.annotations.Environmental;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.services.FormSupport;
import java.util... |
<reponame>JsonMa/egg-city
'use strict';
// const request = require('supertest');
const mm = require('egg-mock');
const assert = require('assert');
describe('test api through input type', () => {
let app;
before(() => {
app = mm.app({
baseDir: 'apps/city-test',
});
return app.ready();
});
af... |
from pioneer.das.api.samples.annotations import *
from pioneer.das.api.samples.echo import Echo
from pioneer.das.api.samples.echo_xyzit import EchoXYZIT
from pioneer.das.api.samples.fast_trace import FastTrace
from pioneer.das.api.samples.image import Image
from pioneer.das.api.samples.image_cylinder import ImageCylind... |
kubectl delete pods healthy-monolith monolith secure-monolith
kubectl delete services monolith auth frontend hello
kubectl delete deployments auth frontend hello
kubectl delete secrets tls-certs
kubectl delete configmaps nginx-frontend-conf nginx-proxy-conf
|
#*******************************************************************************
# scripting.py
#
# <NAME> <<EMAIL>>
# 2012-07-19
#
# Blender addon development template.
#
#*******************************************************************************
bl_info = {
'name' : 'Addon Template',
'author' ... |
public class SecondMax {
public static int secondMaximum(int[] nums) {
int firstMax, secondMax;
// Initialize the two largest elements as the first and second elements
firstMax = secondMax = Integer.MIN_VALUE;
for (int i = 0; i < nums.length; i++) {
// If th... |
var logger = require('morgan');
var bodyParser = require('body-parser');
var override = require('method-override');
module.exports = function(app){
app.use(logger('dev'));
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
app.use(override());
}; |
def unique_values(pairs):
unique_set = set() # Use a set to store unique values
for pair in pairs:
unique_set.add(pair[1]) # Add the second element of each pair to the set
return list(unique_set) # Convert the set to a list and return |
#!/bin/bash
# Copyright (c) 2021, Mathias Lüdtke
# 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... |
<filename>test/Simple.java<gh_stars>1-10
public class Simple {
public static int size(long v, int radix) {
int size = 0;
for (long n = v; n != 0; n /= radix) ++size;
return size;
}
public static void main(String[] args) {
size(42, 10);
}
}
|
def find_common(a,b):
common = []
for element in a:
if element in b:
common.append(element)
return common |
<reponame>ahmetegesel/functional-mongo<gh_stars>1-10
import {
andThen, identity, ifElse, inc, isNil, pipe, uncurryN,
} from 'ramda';
import useCollection from './useCollection';
import dissolveFindParams from './internal/dissolveFindParams';
/**
* It can be either direct `predicate` as it is expected in correspond... |
#!/usr/bin/env bash
[[ -d editorconfig-eclipse ]] && rm -rf editorconfig-eclipse
git clone "https://github.com/ncjones/editorconfig-eclipse.git"
cd editorconfig-eclipse
git submodule init && git submodule update
mvn clean install
cd ../
[[ -d sk.eclipse.editorconfig.offline ]] && rm -rf sk.eclipse.editorconfig.offlin... |
<filename>src/project/java/reincarnation/Project.java<gh_stars>0
package reincarnation;
/*
* Copyright (C) 2020 Reincarnation Development Team
*
* Licensed under the MIT License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*... |
#include <iostream>
using namespace std;
bool search(string arr[], int n, string x)
{
int i;
for (i = 0; i < n; i++)
if (arr[i] == x)
return true;
return false;
}
int main()
{
string arr[] = {"apple", "mango", "grapes"};
int n = sizeof(arr) / sizeof(arr[0]);
string x = "mango";
if (search(a... |
#!/usr/bin/env bash
# Cause the script to exit if a single command fails
set -eo pipefail -v
pip install -r requirements/requirements.txt
pip install -r requirements/requirements-cv.txt
pip install -r requirements/requirements-nlp.txt
pip install -r requirements/requirements-dev.txt
pip install -r docs/requirements.t... |
def process_input(input_data, write_fn):
if isinstance(input_data, str):
write_fn(input_data)
else:
write_fn(str(input_data)) |
<filename>dynamic-support/src/main/java/com/pranavpandey/android/dynamic/support/model/DynamicRemoteTheme.java
/*
* Copyright 2018-2020 <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 Licens... |
<filename>toggle-boot-core/src/test/java/br/com/mballoni/autoconfigure/AutoConfigurationTest.java
package br.com.mballoni.autoconfigure;
import br.com.mballoni.autoconfigure.beans.NoOpFetcher;
import br.com.mballoni.autoconfigure.beans.NoOpStore;
import br.com.mballoni.toggleboot.Fetcher;
import br.com.mballoni.toggle... |
#!/bin/bash
set -o errexit
if [ ! "$1" ]; then
echo "This script requires either amd64 of arm64 as an argument"
exit 1
elif [ "$1" = "amd64" ]; then
#PLATFORM="$1"
REDHAT_PLATFORM="x86_64"
DIR_NAME="bpx-blockchain-linux-x64"
else
#PLATFORM="$1"
DIR_NAME="bpx-blockchain-linux-arm64"
fi
# If the env variable N... |
<filename>python/regularExpression/reTest.py<gh_stars>1-10
str1 = 'test python'
# 未使用正则表达式的查找
print(str1.find('1'))
print(str1.find('test'))
print(str1.startswith('test'))
# 使用正则表达式查找
import re
# 将正则表达式编译成pattern对象
# 使用r'test', r代表进行匹配的是元字符串
pa = re.compile(r'test') # pa已经成为一个pattern实例
print(type(pa))
ma = pa.matc... |
package de.ids_mannheim.korap.config;
import lombok.Getter;
/**
* @author hanl
* @date 15/07/15
*/
@Getter
public class URIParam extends ParamFields.Param {
private final String uriFragment;
private final Long uriExpiration;
public URIParam (String uri, Long expire) {
this.uriFragment = uri;... |
sudo apt-get -y install python3-pip unzip
if [ "$(pwd)" = "/home/vagrant" ]; then
VAGRANT=1
cd /vagrant
sudo apt-get -y install expect
else
VAGRANT=0
fi
pwd
PIP="pip3"
rm -fr $PWD/env
$PIP install virtualenv
virtualenv --python=python3 /vagrant/env
$PWD/env/bin/pip install -r requirements.txt
# Create... |
<filename>node_modules/react-icons-kit/fa/mobilePhone.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.mobilePhone = void 0;
var mobilePhone = {
"viewBox": "0 0 768 1792",
"children": [{
"name": "path",
"attribs": {
"d": "M464 1408q0-33-23.5-56.5t-56.5-23.5-56... |
class Triangle {
public:
int sideA;
int sideB;
int sideC;
int angleA;
int angleB;
int angleC;
Triangle(int a, int b, int c, int angleA, int angleB, int angleC) {
sideA = a;
sideB = b;
sideC = c;
this->angleA = angleA;
this->angleB = angleB;
th... |
package com.mrh0.createaddition.blocks.creative_energy;
import com.mrh0.createaddition.index.CATileEntities;
import com.mrh0.createaddition.shapes.CAShapes;
import com.simibubi.create.content.logistics.block.inventories.CrateBlock;
import com.simibubi.create.foundation.block.ITE;
import net.minecraft.core.Bloc... |
model = tf.keras.Sequential([
tf.keras.layers.Dense(20, activation='relu', input_shape=(4,)),
tf.keras.layers.Dense(10, activation='relu'),
tf.keras.layers.Dense(5, activation='relu'),
tf.keras.layers.Dense(3, activation='softmax')
]) |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, input_dim, output_dim):
super(Net, self).__init__()
self.fc1 = nn.Linear(input_dim, 64)
self.fc2 = nn.Linear(64, 64)
self.fc3 = nn.Linear(64, output_dim)
def forward(self, x):
x = F.relu(self.fc1(x))
x =... |
package com.g4mesoft.net.packet.server;
import java.util.UUID;
import com.g4mesoft.net.NetworkManager;
import com.g4mesoft.net.PacketByteBuffer;
import com.g4mesoft.net.client.ClientNetworkManager;
import com.g4mesoft.net.packet.Packet;
import com.g4mesoft.world.entity.EntityFacing;
public class S01PositionPacket ex... |
package cmd
import (
"errors"
"github.com/ekalinin/pbvm/utils"
"github.com/spf13/cobra"
)
// deleteCmd represents the delete command
var deleteCmd = &cobra.Command{
Aliases: []string{"rm"},
Use: "delete <version>",
Short: "Delete version",
Long: `Delete version. Version should be installed.`,
Args: ... |
<gh_stars>10-100
from __future__ import print_function, division, absolute_import, unicode_literals
from collections import OrderedDict
try:
from collections.abc import Mapping, Sequence, Hashable
except ImportError:
from collections import Mapping, Sequence, Hashable
import copy
import json
import six
class... |
//-------- js/HTMLForAvatarGUI.js --------
// Generated by CoffeeScript 1.12.2
(function () {
var HTMLForAvatarGUI, console, cwaenv, document, log, setTimeout;
cwaenv = this.getCWAEnv();
console = this.console;
document = this.document;
setTimeout = this.setTimeout;
log = console.log.bind(consol... |
const BaseItem = require('../entities/base')
module.exports = {
name: "ExtendZipkin",
canRunGlobal: ({compiler, registry}) => {
if (registry.services.length == 0)
{
if (!registry.findByNaming('cluster', ['sprt']))
{
return false;
}
}... |
<reponame>akhatua2/mern_stack<gh_stars>0
import React, {useState} from 'react';
import api from '../../services/api'
import { Container, Button, Form, FormGroup, Input, Label, Alert } from 'reactstrap';
export default function Register({history}) {
const [ email, setEmail] = useState("")
const [ password, set... |
{% extends '//mix/template/cmake.sh' %}
{% block fetch %}
https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
sha:b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5
{% endblock %}
{% block lib_deps %}
lib/c
lib/c++
{% endblock %}
|
module.exports = function getDefinePlugin(config) {
return {
__DEV__: JSON.stringify(JSON.parse(process.env.DEV || 'false')),
CONFIG: JSON.stringify(config),
}
} |
#!/bin/bash
PYTHON_EXECUTABLE=$(which python3)
LAMMPS_ROOT=$(${PYTHON_EXECUTABLE} -c 'import site; print(site.getsitepackages()[0])')/lammps/
cmake -S . -B build -DLAMMPS_ROOT=${LAMMPS_ROOT}
cmake --build build --target install
|
package org.terracottamc.world.leveldb;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.Options;
import org.iq80.leveldb.impl.Iq80DBFactory;
import org.terracottamc.math.Location;
import org.terracottamc.server.Server;
import org.terrac... |
Page({
data: {
username: '点击登录',
defaultUrl: '/images/yuyin5.png',
userTx: '',
userInfo: {},
gender: 1,
province: '',
},
onLoad: function(){
wx.setNavigationBarTitle({
title: '我的'
})
//当重新加载这个页面时,查看是否有已经登录的信息
let username = wx.getStorageSync('username'),
avater ... |
/*Function to check how many times an alpha-numeric character occurs in a string.
Case insensitive. */
let isAlphaNumeric = ( char ) => {
char = char.toString();
let id = char.charCodeAt( 0 );
if (
!( id > 47 && id < 58 ) && // if not numeric(0-9)
!( id > 64 && id < 91 ) && // if not letter(A-Z)
!( i... |
python transformers/examples/language-modeling/run_language_modeling.py --model_name_or_path train-outputs/512+0+512-STG/7-model --tokenizer_name model-configs/1024-config --eval_data_file ../data/wikitext-103-raw/wiki.valid.raw --output_dir eval-outputs/512+0+512-STG/7-512+0+512-NER-first-256 --do_eval --per_device_ev... |
# Make HTML notes version of slides
pandoc slides.md -o index.html -c css/notes.css \
--template=template.html -H header.html
# Make revealjs version of slides
pandoc --section-divs -t revealjs -s \
--template template.revealjs \
-o slides.html \
-H header.html \
slides.md
# # Automatically add an... |
#!/usr/bin/env bash
# collect meta info from images
# sadly no EXIF, but still great other info
# this is where the S3 bucket is mounted
IMAGES_LOCATION="./images"
OUT_LOCATION='./metadata'
while read i; do
f=$(echo "$i"| awk '{ print $NF }')
id="${f%.*}"
echo $id
exiftool -json -U -u "${IMAGES_LOCATION}/${... |
import mbuild as mb
def perform_energy_minimization(molecule, residue_name, forcefield_file, minimization_steps):
molecule.name = residue_name
print('molecule.name = ' + str(molecule.name))
molecule.energy_minimize(forcefield=forcefield_file, steps=minimization_steps)
return molecule
# Example usage
w... |
import time
class LCG:
def __init__(self, seed=time.time()):
self.set_seed_lcg(seed)
# Set a starting seed for LCG.
def set_seed_lcg(self, seed): # Timestamp as a seed for default.
global rand
rand = float(seed)
# Parameters taken from https://www.wikiwand.com/en/Numerical_R... |
<gh_stars>0
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package hermes.command.requete.channel;
import hermes.chat.controleur.Chatter;
import hermes.client.Client;
import hermes.client.ClientStatus;
import hermes.command.requete.base.Requete;
import hermes.protoc... |
import subprocess
import os
def encrypt_file(input_file, output_file, iv):
subprocess.run(['openssl', 'enc', '-aes-256-cbc', '-iv', iv, '-in', input_file, '-out', output_file])
def decrypt_file(input_file, output_file, iv):
subprocess.run(['openssl', 'enc', '-d', '-aes-256-cbc', '-iv', iv, '-in', input_file, ... |
def word_frequency(text):
# Convert the text to lowercase and remove punctuation
text = text.lower()
text = ''.join(char if char.isalnum() or char.isspace() else ' ' for char in text)
# Split the text into words
words = text.split()
# Create a dictionary to store word frequencies
word_freq... |
base_dir=$PWD
script_dir=`dirname $0`
# delete non-python files
find $1 -type f ! -name '*.py' -delete
# delete tests
find $1 -type d -name 'tests' -exec rm -rf {} +
# delete unnecessary
rm -rf $1/testing
rm -rf $1/drawing
rm -rf $1/readwrite
rm -rf $1/linalg
find $1/generators -type f ! -name 'random_graphs.py' ! -... |
package somind.dtlab.ingest.mqtt
import akka.actor.{ActorRef, ActorSystem, Props}
import akka.http.scaladsl.model.{ContentType, ContentTypes}
import akka.util.Timeout
import com.typesafe.config.{Config, ConfigFactory}
import com.typesafe.scalalogging.LazyLogging
import somind.dtlab.ingest.mqtt.observe.Observer
import ... |
const fs = require('fs');
const path = require('path');
const checkDirectory = (src, dst, callback) => {
fs.access(dst, fs.constants.F_OK, err => {
if (err) {
fs.mkdirSync(dst);
callback(src, dst);
} else {
callback(src, dst);
}
});
};
const copy = (src, dst) => {
const paths = fs.... |
class UpdateConfigModules < ActiveRecord::Migration
def self.up
add_index :config_modules, :smoke_test_id
add_index :config_modules, :type
add_index :config_modules, [:type, :smoke_test_id]
end
def self.down
remove_index :config_modules, :smoke_test_id
remove_index :config_modules, :type
... |
#ifndef H_LINGO_PLATFORM_ARCHITECTURE
#define H_LINGO_PLATFORM_ARCHITECTURE
// This header detects the processor architecture
// Generates a compile error when the architecture is not detected
// Processor types
#define LINGO_ARCHITECTURE_X86 0x0001
#define LINGO_ARCHITECTURE_X64 0... |
#! /bin/sh
export KSROOT=/koolshare
source $KSROOT/scripts/base.sh
eval `dbus export webrecord_`
cp -rf /tmp/webrecord/init.d/* $KSROOT/init.d/
cp -rf /tmp/webrecord/scripts/* $KSROOT/scripts/
cp -rf /tmp/webrecord/webs/* $KSROOT/webs/
cp /tmp/webrecord/uninstall.sh $KSROOT/scripts/uninstall_webrecord.sh
chmod +x $K... |
package minimumcost_spanning_tree;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
/**
*
* @author exponential-e
* 백준 10021번: Watering the Fields
*
* @see https://www.acmicpc.net/problem/10021
*
*/
public class Boj10021 {
p... |
<gh_stars>0
class CreateRegulars < ActiveRecord::Migration[5.2]
def change
create_table :regulars do |t|
t.references :tender, index: true
t.references :customer, index: true
t.timestamps
end
add_foreign_key :regulars, :users, column: :tender_id, primary_key: :id
add_foreign_key :re... |
#!/bin/bash
FILES=${1:-$(find ../rodinia -type f -name "*.spv")}
# Check all files
for FILE in $FILES; do
# Assemble
java -jar ../../dist/spirv-beehive-toolkit.jar -d $FILE -o proto/out.spvasm
java -jar ../../dist/spirv-beehive-toolkit.jar -d --tool asm -o proto/out.spv proto/out.spvasm
# Validate
if spirv-val ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.