text stringlengths 1 1.05M |
|---|
<reponame>mmvanheusden/ForgeHax
package dev.fiki.forgehax.asm.patches;
import dev.fiki.forgehax.api.asm.MapClass;
import dev.fiki.forgehax.api.asm.MapMethod;
import dev.fiki.forgehax.asm.hooks.ForgeHaxHooks;
import dev.fiki.forgehax.asm.hooks.PushHooks;
import dev.fiki.forgehax.asm.utils.ASMHelper;
import dev.fiki.for... |
<!DOCTYPE html>
<html>
<head>
<title>Stock Prices</title>
<script>
function getPrices() {
// Code to get stock prices
}
</script>
</head>
<body>
<h1>Stock Prices</h1>
<ul>
<li>Apple</li>
<li>Google</li>
<li>Microsoft</li>
<li>Tesla</li>
<li>Fac... |
<gh_stars>0
import java.util.*
public class TreeNode{
TreeNode left=null;
TreeNode right=null;
int val=0;
TreeNode(int val){
this.val=val;
}
}
|
from lxml import etree
def pt_dev_io_port_passthrough(board_etree, scenario_etree, allocation_etree):
# Parse XML trees
board_root = etree.fromstring(board_etree)
scenario_root = etree.fromstring(scenario_etree)
allocation_root = etree.fromstring(allocation_etree)
# Extract port information from X... |
public static void printArray(int[][] numbers) {
for (int i=0; i < numbers.length; i++) {
for (int j=0; j < numbers[i].length; j++) {
System.out.println(numbers[i][j]);
}
}
}
printArray(numbers); |
<reponame>osidorkin/Brunel<filename>etc/src/main/java/org/brunel/app/CookBookBuilder.java
/*
* Copyright (c) 2015 IBM Corporation and others.
*
* 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... |
<reponame>DPechetti/node_base_project<filename>src/infra/logging/logger.js
const pino = require('pino')({ prettyPrint: true });
module.exports = {
info: message => pino.info(message),
error: message => pino.error(message)
};
|
#!/bin/zsh
# My starter template for tmux layout
SESSION=`basename $PWD`
tmux -2 new-session -d -s $SESSION
# first window will contain vim + two terminals
tmux rename-window -t $SESSION:1 IDE
tmux split-window -v
tmux select-pane -t 1
tmux resize-pane -D 10
tmux select-pane -t 2
tmux split-window -h
tmux select-pane... |
package task
import (
"time"
)
type Meta struct {
Worker int `json:"worker"`
Timestamp time.Time `json:"timestamp"`
}
|
def xor_two_hex(hex_1, hex_2):
""" XOR two hex strings and return a hex string.
Strips the 0x prefix before returning the hex string.
"""
int_1 = int(hex_1, 16)
int_2 = int(hex_2, 16)
xor = int_1 ^ int_2
return hex(xor).lstrip('0x')
|
#!/bin/bash
function docker_tag_exists() {
EXISTS=$(curl -s https://hub.docker.com/v2/repositories/$1/tags/?page_size=10000 | jq -r "[.results | .[] | .name == \"$2\"] | any")
test $EXISTS = true
}
if docker_tag_exists svenruppert/maven-3.6.0-adopt-openj9 1.8.0-162; then
echo skip building, image already ... |
<filename>fj36-webservice/src/br/com/caelum/payfast/rest/PagamentoService.java
package br.com.caelum.payfast.rest;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
@ApplicationPath("/")
public class PagamentoService extends Application {
}
|
<filename>app/src/main/java/com/wizeline/recyclerview/di/AppBinder.java<gh_stars>1-10
package com.wizeline.recyclerview.di;
import com.wizeline.recyclerview.ui.main.MainActivity;
import com.wizeline.recyclerview.ui.main.MainModule;
import dagger.Module;
import dagger.android.ContributesAndroidInjector;
@Module
publi... |
// Given an index k, return the kth row of the Pascal's triangle.
//
//
// For example, given k = 3,
// Return [1,3,3,1].
//
//
//
// Note:
// Could you optimize your algorithm to use only O(k) extra space?
/**
* @param {number} rowIndex
* @return {number[]}
*/
var getRow = function(rowIndex) {
functi... |
'use strict';
export default class extends think.controller.base {
/**
* some base method in here
*/
async __before() {
await this.getConfig();
let thisUrl = this.http.module + "/" + this.http.controller + "/" + this.http.action;
//判断登陆
let userinfo = await this.sessio... |
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'plugin:@typescript-eslint/recommended',
],
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
rules: {
'@typescript-eslint/ban-ts-ignore': 0,
'@typescript-eslint/consistent-type-... |
#!/bin/sh
#
# Copyright 2018 The Prometheus 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 required by applicable law or agree... |
package benchmarks.CLEVER.divide.Eq;
public class oldV {
private int lib(int x, int y) { return x / y; }
public int client(int c, int d) {
if (d == 0) {
return 0;
}
return lib(c, d);
}
} |
<reponame>afialapis/dibi<filename>packages/conn/test/01.test_crud.js
import assert from 'assert'
import config from './config'
import {getConnection} from '../src'
let pgConn= undefined
const TEST_RECORDS= [
{name: 'Peter', description: 'A simple man', counter: 91},
{name: 'Harry', description: 'A dirty man' , co... |
class BankAccount:
def __init__(self, name):
self.name = name
self.balance = 0
self.account_number = ""
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
if self.balance >= amount:
self.balance -= amount
else:
... |
/*
* Copyright Amazon.com, Inc. or its affiliates. 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
*
... |
function createCharacterFrequencyTable(str) {
let table = {};
for (let char of str) {
if (table[char]) table[char]++;
else table[char] = 1;
}
return table;
}
const result = createCharacterFrequencyTable('Hello World');
console.log(result); // { H: 1, e: 1, l: 3, o: 2, W: 1, r: 1, d: 1 } |
<reponame>ecmwf/ecflow
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// Name : Request
// Author : Avi
// Revision : $Revision$
//
// Copyright 2009-2020 ECMWF.
// This software is licensed under the terms of the Apache Licence version 2.0
// which can be obtained at ht... |
#!/usr/bin/env bash
cd $(dirname $0)
PKI_BUILD_HOME="${PKI_BUILD_HOME:-./build/pki}";
PKI_DEPLOY_HOME="${PKI_DEPLOY_HOME:-./build/deploy/pki}";
BUILD_DIR="$PKI_BUILD_HOME"
BUILD_CA_DIR="$BUILD_DIR/CA"
ROOT_CA_NAME="root-ca"
DEPLOY_DIR="$PKI_DEPLOY_HOME/etc/etcd"
PREFIX="etcd"
if [ ! -f "$BUILD_CA_DIR/$ROOT_CA... |
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { FormItem, SurveyErrorStateMatcher, FormItemWidget } from '../index';
export class FormItemText extends FormItem {
hint: string;
}
@Component({
selector: 'ammo-form-item-text',
templateUrl: './form-item-text.component.html... |
#!/usr/bin/env bash
# A very simple case - Error in this detected by mgsmith@netgate
# Enable modstate and save running on a simple system without upgrade callback
# Upgrade yang revision, but no other (upgrade) changes
# Then start from running with modstate enabled and the new revision
# Magic line must be first in ... |
source ./lib/extended-oc.sh
PARAMS_FOLDER=./params/VENV/
PARAMS_FILE=admin-0.config
ARGS_FILE=${PARAMS_FOLDER}${PARAMS_FILE}
# ====================================================================================
# Order dependent
# No spaces
# Set these in the above config file
TOOLS_PROJECT=the-tools-project
TARGET_... |
def sort_abs(arr):
abs_arr = [abs(num) for num in arr]
abs_arr.sort(reverse=True)
return abs_arr
sort_abs([-5, 6, -2, 8, -7]) |
// Copyright (C) 2010, <NAME> <<EMAIL>>. All rights reserved.
package socketlog
import (
"bytes"
"net"
"net/url"
"sync"
l4g "github.com/ccpaging/nxlog4go"
"github.com/ccpaging/nxlog4go/cast"
"github.com/ccpaging/nxlog4go/driver"
"github.com/ccpaging/nxlog4go/patt"
)
// Appender is an Appender that sends ou... |
import { Model } from '@watheia/model';
import { findObjectById } from './find-object-by-id';
export function resolveReferenceField(
object: Model,
fieldName: string,
objects: Model[],
debugContext: { keyPath: (string | number)[]; stack: Model[] } = { keyPath: [], stack: [] }
) {
if (!(fieldName in object)) ... |
package net.johnewart.gearman.example;
import net.johnewart.gearman.client.GearmanFunction;
import net.johnewart.gearman.net.Connection;
import org.apache.commons.lang3.ArrayUtils;
import net.johnewart.gearman.client.GearmanWorkerPool;
import net.johnewart.gearman.common.Job;
import org.slf4j.Logger;
import org.slf4j.... |
<reponame>dmitric/studio
import ItemManager from './ItemManager.js'
import ASCIIQuadtreeShader from '../Shaders/ASCIIQuadtreeShader.js'
import ASCIIShader from '../Shaders/ASCIIShader.js'
import CircleQuadtreeShader from '../Shaders/CircleQuadtreeShader.js'
import CircleShader from '../Shaders/CircleShader.js'
import ... |
import Avatar from '@material-ui/core/Avatar';
import Button from '@material-ui/core/Button';
import Card from '@material-ui/core/Card';
import CardActions from '@material-ui/core/CardActions';
import CardContent from '@material-ui/core/CardContent';
import CardHeader from '@material-ui/core/CardHeader';
import { red }... |
#!/bin/bash
dieharder -d 101 -g 206 -S 1065277196
|
/*
* Copyright (C) 2013 salesforce.com, 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 ... |
/*
Jameleon - An automation testing tool..
Copyright (C) 2005 <NAME> (<EMAIL>)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or... |
import React from 'react'
import { css, StyledContainer } from '@generates/swag'
import Spreadsheet from '../components/Spreadsheet.js'
export default function NoDataPage () {
return (
<StyledContainer className={css({ fontFamily: 'sans-serif' })()}>
<h1>
swag-sheet
</h1>
<br />
... |
#!/bin/sh
set -e
cd $(dirname $0)
SCRIPT_DIR=$(pwd)
SCRIPT_NAME=$(dirname $0)
. ./utils/ensure_file.sh
if [ $(uname) = "Darwin" ]; then
NPROC=$(sysctl -n hw.ncpu)
else
NPROC=$(nproc)
fi
mkdir -p $HOME/tmp
cd $HOME/tmp
version=1.8.1
filename=googletest-release-${version}.tar.gz
folder=${filename%.tar.gz}
U... |
/*
* Copyright 2017 LinkedIn Corp. Licensed under the BSD 2-Clause License (the "License"). See License in the project root for license information.
*/
package com.linkedin.kafka.cruisecontrol.exception;
/**
* This exception indicates that the percentage of partitions modeled in the load monitor is not enough.
*/... |
#!/bin/bash
# LinuxGSM fix_sfc.sh function
# Author: Daniel Gibbs
# Website: https://linuxgsm.com
# Description: Resolves various issues with Zombie Master: Reborn.
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
if [ ! -f "${serverfiles}/bin/datacache.so" ]; then
ln -s "${serverfiles}/bin/dataca... |
import tensorflow as tf
# Create a recurrent neural network to generate a sequence
model = tf.keras.Sequential()
model.add(tf.keras.layers.LSTM(64, return_sequences=True, input_shape=(3, 1)))
model.add(tf.keras.layers.LSTM(64, activation='relu'))
model.add(tf.keras.layers.Dense(3))
# Define the optimizer
optimizer = ... |
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017 The Raven Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# What to do
sign=false
verify=false
build=false
setupenv=false
# Systems to build
li... |
var gulp = require('gulp');
var ngGulp = require('ng-gulp');
var gulpConnect = require('gulp-connect');
var path = require('path');
var cwd = process.cwd();
ngGulp(gulp, {
disableLiveReload: true,
devServerPort: 8080,
externals: {
'angular-material': 'window["angular-material"]',
'angular-u... |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# 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... |
#!/usr/bin/env bash
#
# 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 "Licen... |
"use strict";
const Koa = require("koa");
const Router = require("koa-router");
const Semver = require("..");
const request = require("supertest");
const _ = require("lodash");
const handler = (message = "handler", final = true) => (ctx, next) => {
ctx.body = (ctx.body || []).concat(message);
if (!final) return n... |
module.exports = {
requestShow() {
return 'from extend request';
}
} |
"""
Design a Python program to print out the first 10 prime numbers
"""
def get_prime_numbers(n):
prime_numbers = []
x = 2
while len(prime_numbers) < n:
is_prime = True
for num in prime_numbers:
if x % num == 0:
is_prime = False
break
if ... |
#! /bin/sh
#: Install sh-stdlib.
#: sh-stdlib is a standard library for shell.
_LOCAL="$HOME/.local"
_LOCAL_SUBDIRS='bin lib opt share'
# TODO: do we need to honor POSIXSH_STDLIB_HOME here?
_SHSTDLIB_HOME="${POSIXSH_STDLIB_HOME:-${_LOCAL}/lib/shell/sh}"
_DOWNLOAD_CACHE=/tmp
_URL_LATEST=https://github.com/ya55en/sh... |
import expect from 'expect';
import {getCurrentRefinements} from '../utils.js';
describe('currentRefinedValues', () => {
const firstRefinement = '#hierarchical-categories .item:nth-child(6)';
const secondRefinement = '#brands .item:nth-child(8)';
it('is empty', () => getCurrentRefinements()
.then(refinement... |
module.exports = {
compileProgram: require('./compileProgram'),
defaultValue: require('./defaultValue'),
extractAttributes: require('./extractAttributes'),
extractUniforms: require('./extractUniforms'),
generateUniformAccessObject: require('./generateUniformAccessObject'),
setPrecision: require(... |
var merge = require( "webpack-merge" );
var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");
var DEVELOPMENT = "DEVELOPMENT";
var PRODUCTION = "PRODUCTION";
var ENTRY_FILE = "./src/index.js";
// Detemine build env
var target = process.env.npm_lifecycle_... |
def findTriplets(arr):
triplets = []
for i in range(len(arr)):
for j in range(i+1, len(arr)):
for k in range(j+1, len(arr)):
if arr[i] + arr[j] + arr[k] == 0:
triplets.append((arr[i], arr[j], arr[k]))
return triplets |
#!/usr/bin/env bash
echo "" >> /etc/hosts
echo "192.168.1.122 entry entry.dev www.entry.dev" >> /etc/hosts
echo "192.168.1.124 maria maria.dev" >> /etc/hosts
apt-get update
apt-get upgrade -y
apt-get -qq install -y curl wget vim apache2 apache2-utils
a2enmod rewrite
a2enmod headers
a2dismod status
a2d... |
#!/usr/bin/python
## image-to-gcode 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 2 of the License, or (at your
## option) any later version. image-to-gcode is distributed in the hope
## t... |
import { useStaticQuery, graphql } from 'gatsby';
import getOgpImage from '../utils/get-ogp-image';
const useAllMarkdownRemarkForPopularList = (paths) => {
const { allStrapiArticle } = useStaticQuery(
graphql`
query AllMarkdownRemarkForPopular {
allStrapiArticle {
nodes {
... |
#!/bin/bash
CLIENTNAME=my-app
OUTPUT=$(docker exec keycloak /tmp/keycloak/create_client.sh $CLIENTNAME)
if [[ $OUTPUT == *"\"resource\" : \"$CLIENTNAME\""* ]]; then
echo "SUCCESS"
echo $OUTPUT
exit 0
else
echo "FAILURE"
echo "OUTPUT WAS: $OUTPUT"
exit 1
fi
|
#!/usr/bin/env bash
# increase the number of connections
echo "alter system set processes=250 scope=spfile;" | sqlplus -s SYSTEM/oracle
echo "alter system reset sessions scope=spfile sid='*';" | sqlplus -s SYSTEM/oracle
service oracle-xe restart
echo "alter system disable restricted session;" | sqlplus -s SYSTEM/oracle... |
import React from 'react';
export default class App extends React.Component {
state = {
products: [],
sortedProducts: [],
filteredProducts: [],
category: '',
sortMode: ''
};
componentDidMount() {
// fetch products from API
const products = [ ... ];
this.setState({
products: products,
sortedProducts: prod... |
import { calculateCost, Item } from './lib/calculateCost';
const apple: Item = {
id: 'apple',
displayName: 'Apple',
price: 60,
multiBuy: [2, 1],
};
const orange: Item = {
id: 'orange',
displayName: 'Orange',
price: 25,
multiBuy: [3, 2],
};
const basket = [apple, apple, orange, apple, ... |
#!/bin/bash
#==============================================================================
# emacs-config installation script
#
# 28 May 2021 -- Bob Yantosca -- yantosca@seas.harvard.edu
#==============================================================================
# Copy startup files ~/.emacs.d folder
# The user ... |
#include <unordered_map>
#include <memory>
#include <typeindex>
#include <stdexcept>
class Component {
public:
using SharedPtr = std::shared_ptr<Component>;
virtual ~Component() {}
};
class Entity {
public:
template <typename T>
void addComponent(Component::SharedPtr component) {
components[typeid(T)] = c... |
<filename>src/main/java/cn/gobyte/apply/service/user/UserService.java<gh_stars>1-10
package cn.gobyte.apply.service.user;
import cn.gobyte.apply.domain.ResponseBo;
import cn.gobyte.apply.pojo.user.User;
import cn.gobyte.apply.pojo.user.UserVo;
import cn.gobyte.apply.service.IService;
import org.springframework.stereot... |
<filename>lib/core/src/firebase/firestore/models/firemodel.ts
import * as admin from 'firebase-admin'
import { db, timestamp, serverTimestamp } from '../../core'
type CollectionReference = admin.firestore.CollectionReference;
type DocumentReference = admin.firestore.DocumentReference;
type DocumentSnapshot = admin.fir... |
#!/bin/bash
#
# Copyright (C) 2016 The CyanogenMod Project
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#
# Required!
export DEVICE=platina
export VENDOR=xiaomi
export DEVICE_BRINGUP_YEAR=2020
set -e
# Load extract_utils and do some sanity checks
MY_DIR="${BASH_SOURCE%/*}"... |
<filename>client/script.js
const generate = () => {
let message = quotes[Math.floor(Math.random() * (quotes.length - 1))];
document.querySelector('h2').textContent = `"${message}"`;
}
window.addEventListener('load', generate);
document.getElementById('btn__more-quotes').addEventListener('click', generate);
|
import random
def generate_random_string(length):
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
string = ""
for c in range(length):
string += random.choice(chars)
return string
random_string = generate_random_string(length) |
#!/bin/bash ../.port_include.sh
port=less
version=530
useconfigure="true"
files="http://ftp.gnu.org/gnu/less/less-${version}.tar.gz less-${version}.tar.gz
http://ftp.gnu.org/gnu/less/less-${version}.tar.gz.sig less-${version}.tar.gz.sig
https://ftp.gnu.org/gnu/gnu-keyring.gpg gnu-keyring.gpg"
depends="ncurses"
auth_ty... |
"use strict";
/* ***************************************************************************
*
* Copyright (c) 2021, the iexjs authors.
*
* This file is part of the iexjs library, distributed under the terms of
* the Apache License 2.0. The full license can be found in the LICENSE file.
*
*/
Object.defineProper... |
<reponame>msoxzw/toy-benchmark<filename>parallel.cpp
#include <cassert>
#include <chrono>
#include <execution>
#include <iostream>
#include <random>
#include <vector>
using namespace std;
int main() {
constexpr size_t N{100'000'000};
constexpr double working_set_GB{3.0 * N * sizeof(double) / exp2(30)};
r... |
<gh_stars>1000+
package socialcache
import (
"errors"
"sync"
. "github.com/Philipp15b/go-steam/protocol/steamlang"
. "github.com/Philipp15b/go-steam/steamid"
)
// Friends list is a thread safe map
// They can be iterated over like so:
// for id, friend := range client.Social.Friends.GetCopy() {
// log.Println... |
const tap = require("tap");
const test = tap.test;
const { getDom, getBooon } = require("./dom");
test("attr", t => {
t.plan(3);
const booon = getBooon();
const builder = booon.nodeBuilder("pre")
.attr("data-mol", "kid")
.id("joke");
t.equal(booon("p").html(builder.buildString()).find("... |
def ordenaVetor(a, b, c)
if (a < b)
a, b = b, a
end
if (b < c)
b, c = c, b
end
if (a < c)
a, c = c, a
end
return a, b, c
end
def verificaTriangulo(a, b, c)
if (a >= b + c) then
puts "NAO FORMA TRIANGULO"
else
if (a**2 == b**2 + c**2) then
puts "TRIANGULO RETANGULO"
end
if (a**2 > b**2 + ... |
let facade = require('gamecloud')
let {EntityType, IndexType} = facade.const
let fetch = require("node-fetch");
/**
* CP成功注册事件
* 主网下发CP注册通知,此时应该将CP记录插入数据库
* @param {Object} data.msg { cid, name, url, address, ip, cls, grate, wid, account }
*
* @description 如果不返回 Promise 的话,事件将不能充当同步事件使用,即使外围使用 await 也起不到阻塞作用
*/... |
import injectSheet, { Theme, WithStyles } from 'react-jss';
import { rule } from 'shared/helpers/style';
import { IProps } from './Metric';
const styles = ({ extra: theme }: Theme) => ({
root: rule({
minHeight: '100%',
display: 'flex',
}),
percent: rule({
display: 'flex',
padding: '0.5rem 0',
... |
#/bin/bash -e
while getopts p: flag
do
case "${flag}" in
p) passphrase=${OPTARG};;
esac
done
# generate a new ssh key pair
echo -e 'y' | ssh-keygen -f scratch -N $passphrase
# create base64 encoded versions of public & private ssh keys
priKey=$(base64 -w 0 ./scratch)
pubKey=$(base64 -w 0 ./scratch.pu... |
function filterCitiesByMultiple(cityArray, multiple) {
return cityArray.filter(city => parseInt(city.id) % multiple === 0);
}
// Test the function
const cities = [
{
"city": "Taipei City",
"id": "1"
},
{
"city": "New Taipei City",
"id": "5"
},
{
"city": "Keelung City",
"id": "2"
}... |
#!/bin/bash
set -e
set -x
# Builds blog and community into the site by cloning the website repo, copying blog/community dirs in, running hugo.
# Also builds previous versions unless BUILD_VERSIONS=no.
# - Results are written to site/ as normal.
# - Run as "./hack/build.sh serve" to run a local preview server on site/... |
#!/bin/bash
function list_envs() {
ACC_ID=`aws sts get-caller-identity --query "Account" --output text --profile $1`
echo "Listing Cloud9 PROFILE $1 / ACC_ID: $ACC_ID"
# export AWS_DEFAULT_REGION="us-east-1"
# cdk deploy iot-playground codepipeline devicedefender \
# --require-approval nev... |
<reponame>Judgeman/H2SpringFx
package de.judgeman.H2SpringFx.Tests.ServiceTests;
import de.judgeman.H2SpringFx.Services.LogService;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.springframework.boot.test.context.S... |
function reverseString(str) {
let reversedString = '';
for (let i = str.length -1; i >= 0; i--) {
reversedString += str[i];
}
return reversedString;
}
let userInputString = "hello";
let reversedString = reverseString(userInputString);
console.log(reversedString); // olleh |
import requests
from bs4 import BeautifulSoup
def scraper(url):
response = requests.get(url)
html = response.content
soup = BeautifulSoup(html, 'lxml')
job_links = soup.find_all('h2', class_='job-title')
jobs = []
for job_link in job_links:
job_url = job_link.find('a')['href']
job_title = job_l... |
-- Users
INSERT INTO users (username, email) VALUES ("trickster", "<EMAIL>");
INSERT INTO users (username, email) VALUES ("jokester", "<EMAIL>");
INSERT INTO users (username, email) VALUES ("sabotage", "<EMAIL>");
INSERT INTO users (username, email) VALUES ("Santa", "<EMAIL>");
INSERT INTO users (username, email) VALUE... |
package kata
/**
link: https://www.codewars.com/kata/585d7d5adb20cf33cb000235
*/
/** SITUATION:
There is an array with some numbers. All numbers are equal except for one. Try to find it!
findUniq([ 1, 1, 1, 2, 1, 1 ]) === 2
findUniq([ 0, 0, 0.55, 0, 0 ]) === 0.55
It’s guaranteed that array contains at least 3 number... |
module Chikyu::Sdk
# API抽象クラス
class ApiResource
def self.handle_response(path, params, res)
if res.success?
body = res.body
data = body.instance_of?(String) ? JSON.parse(body, symbolize_names: true) : body
if data[:has_error]
raise ApiExecuteError, "APIの実行に失敗: message=#{... |
<reponame>psema4/Atomic-OS
/*==================================================== -*- C++ -*-
* tcl.js "A Tcl implementation in Javascript"
*
* Patched for Atomic OS use by <NAME> 2011 (<http://psema4.github.com/Atomic-OS/>)
*
* Released under the same terms as Tcl itself.
* (BSD license found at <http://www.tcl.tk/sof... |
<reponame>totalgameplay/sittuyinai
#pragma strict
static class PieceValidMoves
{
private static var BlackAttackBoard : boolean[];
private static var blackKingPosition : byte;
private static var WhiteAttackBoard : boolean[];
private static var whiteKingPosition : byte;
private static function AnalyzeMovePawn(bo... |
<filename>model_team_list.go<gh_stars>0
/*
* The User API
*
* API to manage teams, members and tokens
*
* API version: 1.3.11 lucky-fremont
* Contact: <EMAIL>
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package userapi
import (
"encoding/json"
)
// TeamList struc... |
<gh_stars>0
import * as aws from '@pulumi/aws';
import * as awsx from '@pulumi/awsx';
import * as eks from '@pulumi/eks';
import * as pulumi from '@pulumi/pulumi';
import * as k8s from '@pulumi/kubernetes';
import * as kx from '@pulumi/kubernetesx';
import { Config, Output } from '@pulumi/pulumi';
import * as random fr... |
require('scss/index.scss');
import React from 'react';
import ReactDOM from 'react-dom';
import App from 'App.jsx';
ReactDOM.render(
<App />,
document.getElementById('app')
);
console.log('update');
|
require 'rails_helper'
require 'data_import/media'
RSpec.describe DataImport::Media do
subject { Class.new { include DataImport::Media }.new }
context 'without #get_media overridden' do
describe '#get_media' do
it 'should fail with an error message telling you to override' do
expect {
... |
<reponame>abircb/acquire-module
const should = require('should')
const acquire = require('../')
const path = require('path')
describe('relative file path', function() {
it('should locate the package', function() {
acquire('./test/test-node-modules/m1/a-node-module/lib/some-main-file.js', {
paths: '.'
}... |
#!/bin/bash
set +x
HELM_RELEASE_NAME="stardog-helm-tests"
NAMESPACE="stardog"
NUM_STARDOGS="3"
NUM_ZKS="3"
STARDOG_ADMIN=
STARDOG_IP=
function dependency_checks() {
echo "Checking for dependencies"
helm version >/dev/null 2>&1 || { echo >&2 "The helm tests require helm but it's not installed, exiting."; exit 1; ... |
def isCollision(circle1, circle2):
distance_between_centers = (((circle1["x"] - circle2["x"])**2) +
((circle1["y"] - circle2["y"])**2))**(1/2)
if distance_between_centers < circle1["r"] + circle2["r"]:
return True
else:
return False |
def extract_location_info(row):
properties = {
"ref": row["LocationNumber"],
"name": row["Name"],
"addr_full": row["ExtraData"]["Address"]["AddressNonStruct_Line1"],
"city": row["ExtraData"]["Address"]["Locality"],
"state": row["ExtraData"]["Address"]["Region"],
"post... |
class TicTacToe {
constructor() {
this.board = [
[null, null, null],
[null, null, null],
[null, null, null],
];
}
getBoard() {
return this.board;
}
placeMark(x, y, player) {
if (this.board[x][y] === null) {
this.board[x][y] = player;
... |
/*
* overload.sql
* Chapter 8, Oracle10g PL/SQL Programming
* by <NAME>, <NAME>, and <NAME>
*
* This version of InventoryOps demonstrates an overloaded procedure,
* StatusList.
*/
CREATE OR REPLACE PACKAGE InventoryOps AS
-- Modifies the inventory data for the specified book.
PROCEDURE UpdateISBN(p_ISBN I... |
<gh_stars>1-10
from setuptools import setup
version = open('VERSION').read().strip()
setup(name='r12',
version=version,
description='Low-level interface for ST Robotics R12 robotic arm.',
url='https://github.com/adamheins/r12',
author='<NAME>',
author_email='<EMAIL>',
license='MIT'... |
/*
* Copyright (c) 2016, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* 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/LICE... |
package view
import (
"github.com/ungerik/go-start/errs"
)
// IndirectURL encapsulates pointers to URL implementations.
// To break circular dependencies, addresses of URL implementing variables
// can be passed to this function that encapsulates it with an URL
// implementation that dereferences the pointers at run... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.