blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
4
115
path
stringlengths
2
970
src_encoding
stringclasses
28 values
length_bytes
int64
31
5.38M
score
float64
2.52
5.28
int_score
int64
3
5
detected_licenses
listlengths
0
161
license_type
stringclasses
2 values
text
stringlengths
31
5.39M
download_success
bool
1 class
c15f3116cf234db818896cdf278522c323d37da9
Shell
thewebsitenursery/Lazy-SSL-Certs-Webfaction
/lazysslcerts-webfaction
UTF-8
4,952
4.09375
4
[]
no_license
#!/bin/bash # Lazysslcertsonwebfaction # This adds even more automation to the quite brilliant letsencrypt-webfaction script # Completely automating the process of generaing, comfirming and installing SSL Certificates from Letsencrypy / Certbot. # Certificates will be installed for example.com & www.example.com from the given domain example.com # Original letsencrypt-webfaction by https://github.com/will-in-wi/letsencrypt-webfaction # This little addition by thewebsitenursery.com https://github.com/thewebsitenursery # The only assumption I make is that you have a ~/bash_profile # if you dont then simply type "touch ~/.bash_profile" before running this script ############################################################################## # Set continue to false by default CONTINUE=false # Clear the screen and ask some questions clear # Install Base letsencrypt-webfaction script if not done so already echo '' echo 'Have you already installed the base letsencrypt-webfaction script to your webfaction $HOME folder?' echo 'If the folder $HOME/.letsencrypt_webfaction already exists then you most probably have' echo '(Yes / No)' echo "" read -r response if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then echo "OK, lets get started" sleep 2 ./lazygetdata sleep 5 echo "Press any key to finish" read any_key && exit 2>/dev/null & fi if ! $CONTINUE; then echo "OK not a problem, lets do it now" echo "Firstly, I will make a back up of your ~/.bash_profile called ~/.bash_profilebackup" cp ~/.bash_profile ~/.bash_profilebackup echo "Creating the folder .letsencrypt_webfaction and installing the base script using ruby gems" GEM_HOME=$HOME/.letsencrypt_webfaction/gems RUBYLIB=$GEM_HOME/lib gem2.2 install letsencrypt_webfaction echo '' sleep 2 echo"Adding some lines to your ~/.bash_profile" echo -e ' \n \n # This is the letsencrypt_webfaction PATH information \n \n function letsencrypt_webfaction { \n PATH=$PATH:$GEM_HOME/bin GEM_HOME=$HOME/.letsencrypt_webfaction/gems RUBYLIB=$GEM_HOME/lib ruby2.2 \n $HOME/.letsencrypt_webfaction/gems/bin/letsencrypt_webfaction $* \n } \n \n' >> ~/.bash_profile echo "" echo "Ok all done" if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then echo "" echo "OK, lets get started" fi sleep 1 echo '' echo 'Letsencrypt-webfaction automates certification from Letsencrypt' echo 'for example.com & wwww.example.com for webapps hosted on Webfaction' echo '' echo "To base letsencrypt-webfaction script needs just 3 pieces of information" echo '' echo "Your email address, the name of your app in your ~/webapps folder & the domain name." echo '' sleep 2 echo "Firstly, what email address do you want the certification confirmation to be sent?" read account_email echo '' echo "Webfaction Support will be sent the Letsencrypt certificates to install, confirmation will be sent to: $account_email" echo '' sleep 2 echo "Secondly, what is the domain? ie. example.com" echo '' echo 'REMEMBER: "example.com" creates certificates for example.com and www.example.com' read the_domain echo '' echo "Certificates will be generated for $the_domain & wwww.$the_domain" echo "" sleep 2 echo 'Lastly, what is the applications name in your webapps directory ie. ~/webapps/my_app_name' read my_app_name mkdir -p ~/webapps/$my_app_name/publicdir echo "" echo "############################# PLEASE NOTE ###################################" echo "#################################################################################" echo "# #" echo "# A new directory has been created at $the_domain/publicdir #" echo "# #" echo "# Letsencrypt will use code in the directory to confirm ownership #" echo "# If you delete the folder the certificates will not be generated #" echo "# After certificates are installed by webfaction you can delete the folder #" echo "# #" echo "#################################################################################" sleep 2 echo "" echo "Please confirm the data for $the_domain is correct as, it will run like so:" echo "" echo "letsencrypt_webfaction --account $account_email --domains $the_domain,www.$the_domain --public ~/webapps/$my_app_name/publicdir/" echo "" echo "Is the information above correct? Yes/No?" echo "" read -r response if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]; then echo "ok, here we go" echo "" letsencrypt_webfaction --account $account_email --domains $the_domain,www.$the_domain --public ~/webapps/$my_app_name/publicdir/ fi if ! $CONTINUE; then rm -rf ~/webapps/$my_app_name/publicdir && echo "OK, No problem, the directory at $the_domain/public_dir has been deleted" echo "" echo "Please try again if needed" echo"" Sleep 2 exit 2>/dev/null & fi
true
a1871c64d76390b4c3ebeff4ff832b75730bda82
Shell
cashcat96/BlondedChecker
/filter.sh
UTF-8
677
2.71875
3
[ "MIT" ]
permissive
#!/bin/sh # THIS SCRIPT FILTERS OUT LINES THAT CHANGE FREQUENTLY ON BLONDED.CO # if you find another line that comes up constantly, simply add another line, using the other lines as examples sed -i '/android/d' index.html sed -i '/favicon/d' index.html sed -i '/index.js/d' index.html sed -i '/ms-icon/d' index.html sed -i '/themeCityHash/d' index.html sed -i '/token/d' index.html sed -i '/reqid/d' index.html sed -i '/Token/d' index.html sed -i '/sha256/d' index.html sed -i '/font/d' index.html sed -i '/apple-touch/d' index.html sed -i '/og:/d' index.html #the og: has to deal with what displays in the browser as the name of the site #echo "the filter script has run"
true
954388f64514b3ea55778857cb7b2e577ebe8f98
Shell
shivanjalisangale30/LinuxPreparation
/for1.sh
UTF-8
302
3.078125
3
[]
no_license
#!/bin/bash -x RateperHr=10; isfulltimeEmployee=1; isparttimeEmployee=2; for (( DAY=1; DAY<=20; DAY++ )) do employeecheck=$(( RANDOM % 3)) case $empcheck in $isfulltimeEmployee) Hrs=5; ;; $isparttimeEmployee) Hrs=6; ;; *) Hrs=0; ;; esac salary=$(($RateperHr*$Hrs)) echo $salary done printf "\n"
true
aa2cd746f23f60c5e35ff643c7482d2229c01a66
Shell
TGNThump/dotfiles
/bash/.bash_aliases
UTF-8
635
3.203125
3
[]
no_license
function path(){ echo $PATH | tr : '\n' } function git(){ local root=`command git rev-parse --show-toplevel` if [[ -d "$root/.git/svn" ]]; then case "$1" in push) command git svn dcommit --rmdir return ;; pull) command git svn rebase return ;; esac fi command git "$@" } function up() { cd $(eval printf '../'%.0s {1..$1}) && pwd; } function weather() { curl -s http://wttr.in/$2; } alias cls=clear # WSL specific shotcurts if [ -x "$(command -v cmd.exe)" ]; then alias sublime='"/mnt/c/Program Files/Sublime Text 3/subl.exe"' alias explorer=explorer.exe fi
true
30acba78b7d7177e428f2e1220caff9fe41fbb8b
Shell
iplanetcn/script
/gradle/update_gradle_wrapper_properties.sh
UTF-8
313
3.375
3
[]
no_license
#!/bin/bash # Copies the master versions.gradle file to each sample, to make them # compatible with Android Studio's "Import sample" feature. for line in `find . -name 'gradle-wrapper.jar'` do p=$(dirname "${line}"); echo "Copying gradle-wrapper.properties -> ${p}"; cp gradle-wrapper.properties "$p" done
true
a19584b37227a6a1707badc9c226f15a82102759
Shell
GoogleChromeLabs/chromeos_smart_card_connector
/third_party/webports/src/src/ports/tcl/build.sh
UTF-8
1,170
2.75
3
[ "LGPL-2.1-only", "LGPL-2.0-or-later", "Apache-2.0", "GPL-2.0-or-later", "LicenseRef-scancode-mit-old-style", "MPL-1.1", "ImageMagick", "MIT", "LicenseRef-scancode-warranty-disclaimer", "GFDL-1.2-only", "BSD-3-Clause", "LicenseRef-scancode-other-permissive", "GPL-1.0-or-later", "Libpng", "LicenseRef-scancode-on2-patent", "LicenseRef-scancode-greg-roelofs", "LicenseRef-scancode-unknown-license-reference", "WxWindows-exception-3.1", "GPL-2.0-only", "BSL-1.0", "LGPL-2.0-only", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown" ]
permissive
# Copyright (c) 2014 The Native Client Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. NACL_CONFIGURE_PATH=${SRC_DIR}/unix/configure NACLPORTS_CPPFLAGS="-Dmain=nacl_main" export LIBS="${NACL_CLI_MAIN_LIB}" MAKE_TARGETS="binaries" INSTALL_TARGETS="install-binaries" # Disable fallbacks for broken libc's that kick in for # cross-compiles since autoconf can't run target binaries. # The fallbacks seem to be non-general. export tcl_cv_strtod_buggy=ok export ac_cv_func_strtod=yes export ac_cv_func_memmove=yes export tcl_cv_strtod_unbroken=ok # Prevent non-cross compile clean parts of the build from assuming the host # system influences things (needed for OSX). export tcl_cv_sys_version=Generic if [ "${NACL_SHARED}" = "1" ]; then NACLPORTS_CFLAGS+=" -fPIC" fi EnableGlibcCompat if [ "${NACL_LIBC}" = "newlib" ]; then NACLPORTS_CPPFLAGS+=" -DHAVE_STRLCPY=1" EXTRA_CONFIGURE_ARGS+=" --enable-shared=no" EXTRA_CONFIGURE_ARGS+=" --enable-load=no" export tcl_cv_strtoul_unbroken=ok fi if [ "${NACL_LIBC}" = "bionic" ]; then NACLPORTS_CPPFLAGS+=" -DHAVE_STRLCPY=1" fi
true
c5f667426e98b6b5c250730647c2953cb731c38d
Shell
adnikiforov/action-reek
/entrypoint.sh
UTF-8
488
3.046875
3
[ "MIT" ]
permissive
#!/bin/sh version() { if [ -n "$1" ]; then echo "-v $1" fi } cd "$GITHUB_WORKSPACE" export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}" gem install -N reek $(version $INPUT_REEK_VERSION) reek --single-line . ${INPUT_REEK_FLAGS} \ | reviewdog -f=reek \ -name="${INPUT_TOOL_NAME}" \ -reporter="${INPUT_REPORTER}" \ -filter-mode="${INPUT_FILTER_MODE}" \ -fail-on-error="${INPUT_FAIL_ON_ERROR}" \ -level="${INPUT_LEVEL}" \ ${INPUT_REVIEWDOG_FLAGS}
true
af97249c4e2d7eaf054e04d6635c829d75a0d93e
Shell
satyanarayan-rao/star_protocol_enhancer_cooperativity
/download_reference_genome.sh
UTF-8
372
3.078125
3
[]
no_license
#!/bin/bash cwd=`pwd` mkdir -p ref_genome/dm3 cd ref_genome/dm3 echo "Downloading dm3 reference genome...\n" if [[ $OSTYPE == 'darwin'* ]]; then curl -JLO https://hgdownload.cse.ucsc.edu/goldenPath/dm3/bigZips/dm3.fa.gz else wget https://hgdownload.cse.ucsc.edu/goldenPath/dm3/bigZips/dm3.fa.gz fi gunzip dm3.fa.gz echo "Download and unzipping finished!" cd $cwd
true
5337d772169dfa433b35b41e3886a55e695eaef9
Shell
cynsky/noaadata
/scripts/stellwagen-shipreport.bash
UTF-8
1,241
3.859375
4
[ "Apache-2.0" ]
permissive
#!/bin/bash # Process one day of USCG AIS data... focused on just that stations that the stellwagen bank cares about # r003669947 - NOAA/Cape Cod # r000006099 - Volpe Center # To be determined - NOAA/Cape Ann # We also use Fisher Island East (r003669959) if [ $# != 1 ]; then echo "ERROR: must specify 1 argument the N-AIS log file:" echo " $0 filefile" echo echo "Note: The filename must conform to 'foo-bar-YYYY-MM-DD' for proper date extraction" echo echo "For example:" echo " $0 uscg-logs-2007-01-01" exit $EXIT_FAILURE fi filename=$1 day=`echo $filename | cut -d '-' -f 3,4,5` # First decimation of the data #egrep '^[$!]AIVDM,2,[12],[0-9]?,[AB],[^*]*[0-9A-F][0-9A-F],[a-zA-Z0-9,]*(r003669947|r000006099|r003669959)' egrep '^[$!]AIVDM,2,[12],[0-9]?,[AB],' $filename | egrep 'r003669947|r000006099|r003669959' > 1.tmp for station in r000006099 r003669947 r003669959; do echo Processing station: $station rm -f $station-5.tmp $station-5.csv grep $station 1.tmp | egrep -A 1 '^[$!]AIVDM,2,1,[0-9]?,[AB],5' > $station-5.tmp ./merge5.py $station-5.tmp | sort -nu > $station-5.csv done cat r003669947-5.csv r000006099-5.csv r003669959-5.csv | sort -u > vessels-$day.csv rm -f *.tmp
true
b7d82856059c003a2ed1207d082bd1baed022890
Shell
delkyd/alfheim_linux-PKGBUILDS
/aterm/PKGBUILD
UTF-8
1,147
2.625
3
[]
no_license
# Maintainer: Brian Biduock <bidulock@openss7.org> pkgname=aterm pkgver=1.0.1 pkgrel=6 pkgdesc="An xterm replacement with transparency support" arch=('i686' 'x86_64') url="http://aterm.sourceforge.net/" license=('GPL') depends=('librsvg' 'libjpeg-turbo' 'libxinerama') makedepends=('libxt') source=("http://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.bz2" "aterm.png" "aterm.desktop") md5sums=('c2eede028e1011e0ec7035cf319c9b5a' '059c69fad0ea2dc03d1e64023481e827' '0de3ff0a366d1fe1caf2b07c436af9cf') sha1sums=('a975753b415306a0734efc3773de8a86129bb54b' 'afd78f13fdba838e4bc2ce450a02f5152a4aa1f2' '52dc5abfebacba14c8702deae67390013f046218') build() { cd "${srcdir}/${pkgname}-${pkgver}" ./configure --prefix=/usr --enable-transparency=yes \ --enable-background-image --enable-fading --enable-menubar \ --enable-graphics make } package() { cd "${srcdir}/${pkgname}-${pkgver}" make DESTDIR="${pkgdir}" install install -Dm644 "$srcdir/aterm.png" "$pkgdir/usr/share/pixmaps/aterm.png" install -Dm644 "$srcdir/aterm.desktop" "$pkgdir/usr/share/applications/aterm.desktop" }
true
d5fd00a8ad4213d8f41c6b2be0c3cc11f75466de
Shell
a-kravts/st_prata_ex
/Ch16/Ch16Ex2/test_Ch16Ex2.sh
UTF-8
597
3.109375
3
[]
no_license
#!/bin/sh #filename: test_Ch16Ex2.sh #author: Aleksandr Kravtsov while read num_1 num_2 res_val ; do res=`./Ch16Ex2 $num_1 $num_2` if [ "$res_val" != "$res" ] ; then echo TEST $num_1 $num_2 FAILED: echo "expected $res_val," echo "got $res" fi done << END 1 2 1.333333333333 0 0 0.000000000000 5 99 9.519230769231 50 999 95.233555767398 1 '' Error: incorrect arguments "" 1 Error: incorrect arguments 1 2e308 Error: incorrect arguments 2e308 1 Error: incorrect arguments 2e308 2e308 Error: incorrect arguments END
true
913752cf6242bfd9332d48cf219f3ee297cd4481
Shell
sparameswaran/edge-gen
/templates/jobs/component/templates/component.sh.erb
UTF-8
2,187
3.421875
3
[]
no_license
#!/bin/bash SCRIPT_DIR=$(dirname $0) . $SCRIPT_DIR/init.sh log_debug "Kicking off $1 action for COMPONENT_NAME job with user: `whoami` " # If the vm got recreated or restarted, the /etc/hosts would have lost the changes sudo sed -i.bak "s/^127.0.0.1 localhost /127.0.0.1 localhost\n${LOCAL_HOST_IP} /1;s/^::1/#::1/" /etc/hosts sudo rm /etc/hosts.bak case $1 in start) log_debug "Starting {{component['name'] }} ..." {% for sub_component in component['sub_components'] %} #DEPENDENT_COMPONENTS_START_TAG ${APIGEE_SERVICE} {{sub_component}} start {% endfor %} {% if 'monitoring' in product['enabled_groups'] %} #if [ "${HAS_MONITORING}" == "true" ]; then $APIGEE_SERVICE apigee-telegraf start #fi {% endif %} ${APIGEE_SERVICE} {{component['name']}} start # Copy over pid file from apigee location to bosh location with some delay # There seemed to be some race condition in edge-router when start off the java process is slow or something # and bosh monit kicks off the restart very fast even as the apigee-service tries to bring up new instance ${APIGEE_SERVICE} {{component['name']}} wait_for_ready log_debug "Done with start of {{component['name']}}..." #fi ;; stop) log_debug "Stopping {{component['name']}}" {% for sub_component in component['sub_components'] %} #DEPENDENT_COMPONENTS_STOP_TAG ${APIGEE_SERVICE} {{sub_component}} stop {% endfor %} ${APIGEE_SERVICE} {{component['name']}} stop {% if 'monitoring' in product['enabled_groups'] %} #if [ "${HAS_MONITORING}" == "true" ]; then $APIGEE_SERVICE apigee-telegraf stop #fi {% endif %} ${APIGEE_SERVICE} {{component['name']}} status if [ $? -ne 0 ]; then log_debug "apigee-service stopped {{component['name']}} successfully." else log_debug "ERROR: apigee-service did not stop {{component['name']}}." ${APIGEE_SERVICE} {{component['name']}} kill log_debug "Killed {{component['name']}} using apigee-service" fi ;; *) echo "Usage: $0 {start|stop}" ;; esac
true
7893be226cb4d1d91b0d783445139020516b3da9
Shell
rdodson41/dot-files
/.bash_profile
UTF-8
172
3
3
[]
no_license
#!/usr/bin/env bash if [[ -f "${HOME}/.bashrc" ]]; then source "${HOME}/.bashrc" fi if [[ -s "${HOME}/.rvm/scripts/rvm" ]]; then source "${HOME}/.rvm/scripts/rvm" fi
true
c6b3510fecd46f0ca63902d73aa23b89bb019848
Shell
serkixenos/peerplays
/docker/peerplaysentry.sh
UTF-8
2,403
3.390625
3
[ "MIT" ]
permissive
#!/bin/bash PEERPLAYSD="/usr/local/bin/witness_node" # For blockchain download VERSION=`cat /etc/peerplays/version` ## Supported Environmental Variables # # * $PEERPLAYSD_SEED_NODES # * $PEERPLAYSD_RPC_ENDPOINT # * $PEERPLAYSD_PLUGINS # * $PEERPLAYSD_REPLAY # * $PEERPLAYSD_RESYNC # * $PEERPLAYSD_P2P_ENDPOINT # * $PEERPLAYSD_WITNESS_ID # * $PEERPLAYSD_PRIVATE_KEY # * $PEERPLAYSD_DEBUG_PRIVATE_KEY # * $PEERPLAYSD_TRACK_ACCOUNTS # * $PEERPLAYSD_PARTIAL_OPERATIONS # * $PEERPLAYSD_MAX_OPS_PER_ACCOUNT # * $PEERPLAYSD_TRUSTED_NODE # ARGS="" # Translate environmental variables if [[ ! -z "$PEERPLAYSD_SEED_NODES" ]]; then for NODE in $PEERPLAYSD_SEED_NODES ; do ARGS+=" --seed-node=$NODE" done fi if [[ ! -z "$PEERPLAYSD_RPC_ENDPOINT" ]]; then ARGS+=" --rpc-endpoint=${PEERPLAYSD_RPC_ENDPOINT}" fi if [[ ! -z "$PEERPLAYSD_REPLAY" ]]; then ARGS+=" --replay-blockchain" fi if [[ ! -z "$PEERPLAYSD_RESYNC" ]]; then ARGS+=" --resync-blockchain" fi if [[ ! -z "$PEERPLAYSD_P2P_ENDPOINT" ]]; then ARGS+=" --p2p-endpoint=${PEERPLAYSD_P2P_ENDPOINT}" fi if [[ ! -z "$PEERPLAYSD_WITNESS_ID" ]]; then ARGS+=" --witness-id=$PEERPLAYSD_WITNESS_ID" fi if [[ ! -z "$PEERPLAYSD_PRIVATE_KEY" ]]; then ARGS+=" --private-key=$PEERPLAYSD_PRIVATE_KEY" fi if [[ ! -z "$PEERPLAYSD_DEBUG_PRIVATE_KEY" ]]; then ARGS+=" --debug-private-key=$PEERPLAYSD_DEBUG_PRIVATE_KEY" fi if [[ ! -z "$PEERPLAYSD_TRACK_ACCOUNTS" ]]; then for ACCOUNT in $PEERPLAYSD_TRACK_ACCOUNTS ; do ARGS+=" --track-account=$ACCOUNT" done fi if [[ ! -z "$PEERPLAYSD_PARTIAL_OPERATIONS" ]]; then ARGS+=" --partial-operations=${PEERPLAYSD_PARTIAL_OPERATIONS}" fi if [[ ! -z "$PEERPLAYSD_MAX_OPS_PER_ACCOUNT" ]]; then ARGS+=" --max-ops-per-account=${PEERPLAYSD_MAX_OPS_PER_ACCOUNT}" fi if [[ ! -z "$PEERPLAYSD_TRUSTED_NODE" ]]; then ARGS+=" --trusted-node=${PEERPLAYSD_TRUSTED_NODE}" fi ## Link the peerplays config file into home ## This link has been created in Dockerfile, already ln -f -s /etc/peerplays/config.ini /var/lib/peerplays # Plugins need to be provided in a space-separated list, which # makes it necessary to write it like this if [[ ! -z "$PEERPLAYSD_PLUGINS" ]]; then $PEERPLAYSD --data-dir ${HOME} ${ARGS} ${PEERPLAYSD_ARGS} --plugins "${PEERPLAYSD_PLUGINS}" else $PEERPLAYSD --data-dir ${HOME} ${ARGS} ${PEERPLAYSD_ARGS} fi
true
da4f3a4ba78e5cce517be946367b8ad20a839205
Shell
recepkandemir/opticks
/examples/Geant4/CerenkovMinimal/go.sh
UTF-8
3,353
3.421875
3
[ "Apache-2.0" ]
permissive
#!/bin/bash -l ## ## Copyright (c) 2019 Opticks Team. All Rights Reserved. ## ## This file is part of Opticks ## (see https://bitbucket.org/simoncblyth/opticks). ## ## Licensed under the Apache License, Version 2.0 (the "License"); ## you may not use this file except in compliance with the License. ## You may obtain a copy of the License at ## ## http://www.apache.org/licenses/LICENSE-2.0 ## ## Unless required by applicable law or agreed to in writing, software ## distributed under the License is distributed on an "AS IS" BASIS, ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ## See the License for the specific language governing permissions and ## limitations under the License. ## notes(){ cat << EON go-cmake-with-source-tree for developers who are building examples against an Opticks from source install (without bothering to go via a release) go-cmake-from-install-tree prototype-ing approach for users who are building examples against an Opticks binary release The distinction between these two modes comes primarily from the pfx. Check the libs in use with ldd on the executable. There is a further difference in the need for -DOPTICKS_PREFIX for the source build. This is necessary to set the runtime path for the executables to find their libs. Check the libs in use with : ldd exe Check the runpath with : chrpath exe EON } opticks- sdir=$(pwd) name=$(basename $sdir) bdir=/tmp/$USER/opticks/examples/$name/build idir=/tmp/$USER/opticks/examples/$name msg="=== $BASH_SOURCE :" go-cmake-with-source-tree() { local pfx=$1 local sdir=$2 local idir=$3 cmake $sdir \ -DCMAKE_FIND_DEBUG_MODE=0 \ -DCMAKE_BUILD_TYPE=Debug \ -DOPTICKS_PREFIX=$pfx \ -DCMAKE_MODULE_PATH=$(opticks-home)/cmake/Modules \ -DCMAKE_INSTALL_PREFIX=$idir \ $* # -DCMAKE_PREFIX_PATH="$pfx/externals;$pfx" \ } go-cmake-from-install-tree() { local pfx=$1 local sdir=$2 local idir=$3 cmake $sdir \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_PREFIX_PATH="$pfx/externals;$pfx" \ -DCMAKE_MODULE_PATH=$pfx/cmake/Modules \ -DCMAKE_INSTALL_PREFIX=$idir \ $* } go-cmake-notes(){ cat << EON To explicitly select the Geant4 if you have multiple, try:: -DGeant4_DIR=$(opticks-prefix)_externals/g4/lib/Geant4-10.4.2 #go-cmake-with-source-tree $pfx $sdir $idir #go-cmake-from-install-tree $pfx $sdir $idir EON } pfx=$(opticks-;opticks-prefix) info(){ cat << EOI pfx : $pfx idir : $idir bdir : $bdir exe : $exe EOI } info rm -rf $bdir if [ ! -d "$bdir" ]; then mkdir -p $bdir && cd $bdir om- om-cmake $sdir else cd $bdir fi pwd make rc=$? [ "$rc" != "0" ] && exit $rc make install setup=$pfx/bin/opticks-setup.sh [ ! -f $setup ] && echo "$msg MISSING setup script $setup : create with bash function opticks-setup-generate " && return 1 source $setup exe=$(which CerenkovMinimal) echo $exe ls -l $exe if [ -n "$DEBUG" ]; then case $(uname) in Linux) gdb $exe ;; Darwin) lldb $exe ;; esac else $exe fi if [ "$(uname)" == "Linux" ]; then echo ldd $exe ldd $exe echo chrpath $exe chrpath $exe elif [ "$(uname)" == "Darwin" ]; then otool -L $exe fi info
true
0b80c6e201808b0840e5e7fe087ebb0f583203f8
Shell
hgomez/transblocker
/ovpnc.sh
UTF-8
2,860
3.96875
4
[]
no_license
#!/bin/sh # # Startup script for openvpn client # # Possible exit codes # 5: Unable to load ovpn configuration file # 7: Unable to access openvpn client binary # ############################################################################################# # Configuration for stand alone execution # #Path to OpenvPN Client binary: openvpnsa=/usr/sbin/openvpn # #Path to OpenVPN client config file directory (where .ovpn are stored): ovpndirsa="/volume1/Scripts/transblocker" # # Client config filename: ovpnfilesa="SlickAmsterdam.ovpn" ############################################################################################# echo "Begin of ovpnc.sh" KERNEL_MODULES="x_tables.ko ip_tables.ko iptable_filter.ko nf_conntrack.ko nf_defrag_ipv4.ko nf_conntrack_ipv4.ko nf_nat.ko iptable_nat.ko ipt_REDIRECT.ko xt_multiport.ko xt_tcpudp.ko xt_state.ko ipt_MASQUERADE.ko tun.ko" SERVICE="ovpnc" # check if running in stand alone mode or sourced through transblocker script if [ -z "$(echo $interface)" ] then echo "Running in stand alone mode" && CONF_DIR=$ovpndirsa && OPENVPN_CONF=$ovpnfilesa else echo "Running inside transblocker" && CONF_DIR=$ovpndir && OPENVPN_CONF=$ovpnfile && openvpnsa=$openvpn fi # Making sure .ovpn client file is available if [ -f $CONF_DIR/$OPENVPN_CONF ] then echo "Using OpenVpn client configuration:" && echo $CONF_DIR/$OPENVPN_CONF else echo $CONF_DIR"/"$OPENVPN_CONF" doesn't seems to exist. Exiting" && echo "Verify your ovpn path in transblocker.conf. Error 5." && exit 5; fi # Making sure OpenVpn Client binary is available if [ -f $openvpn ] then echo "Using OpenVPN Client:" && echo $CONF_DIR"/"$OPENVPN_CONF else echo $openvpn "binary doesn't seems to exist. Exiting" && echo "Verify your 'openvpn' variable in transblocker.conf. Error 5." && exit 7; fi reverse_modules() { local modules=$1 local mod local ret="" for mod in $modules; do ret="$mod $ret" done echo $ret } unload_module() { local modules=`reverse_modules "${KERNEL_MODULES}"` /usr/syno/bin/iptablestool --rmmod $SERVICE $modules } case "$1" in start) echo 1 > /proc/sys/net/ipv4/ip_forward # Make device if not present (not devfs) if [ ! -c /dev/net/tun ]; then # Make /dev/net directory if needed if [ ! -d /dev/net ]; then mkdir -m 755 /dev/net fi mknod /dev/net/tun c 10 200 fi /usr/syno/bin/iptablestool --insmod $SERVICE ${KERNEL_MODULES} echo "Starting openvpn client..." /usr/sbin/openvpn --daemon --cd ${CONF_DIR} --config ${OPENVPN_CONF} --writepid /var/run/ovpn_client.pid ;; stop) echo "Stopping openvpn client..." /bin/kill `cat /var/run/ovpn_client.pid` 2>/dev/null sleep 2 unload_module; ;; unload) unload_module; ;; *) echo "Usage of ovpnc.sh: $0 {start conf|stop}" return 1 esac return # [EOF]
true
4e35537965e429bbb377c1b055d926988f60f6b7
Shell
stefannica/catapult
/backend/caasp4os/lib/skuba.sh
UTF-8
5,211
3.875
4
[ "Apache-2.0" ]
permissive
#!/usr/bin/env bash # Functions to interact with a container that includes the client caasp4 # binaries and terraform _set_env_vars() { JSON=$(skuba_container terraform output -json) LB="$(echo "$JSON" | jq -r '.ip_load_balancer.value|to_entries|map(.value)|@tsv')" export LB MASTERS="$(echo "$JSON" | jq -r '.ip_masters.value|to_entries|map(.value)|@tsv')" export MASTERS WORKERS="$(echo "$JSON" | jq -r '.ip_workers.value|to_entries|map(.value)|@tsv')" export WORKERS ALL="$MASTERS $WORKERS" export ALL } _define_node_group() { _set_env_vars case "$1" in "all") GROUP="$ALL" ;; "masters") GROUP="$MASTERS" ;; "workers") GROUP="$WORKERS" ;; *) GROUP="$1" ;; esac } DEBUG_MODE=${DEBUG_MODE:-false} if [ $DEBUG_MODE = true ]; then DEBUG=1 else DEBUG=0 fi skuba_container() { # Usage: # skuba_container <commands to run in a punctured container> local app_path="$PWD" if [[ "$1" == "$CLUSTER_NAME" ]]; then local app_path="$PWD/$1" shift fi docker run -i --rm \ -v "$app_path":/app:rw \ -v "$(dirname "$SSH_AUTH_SOCK")":"$(dirname "$SSH_AUTH_SOCK")" \ -v "/etc/passwd:/etc/passwd:ro" \ --env-file <( env| cut -f1 -d= ) \ -e SSH_AUTH_SOCK="$SSH_AUTH_SOCK" \ -u "$(id -u)":"$(id -g)" \ skuba/$CAASP_VER "$@" } _ssh2() { local host=$1 shift ssh -o UserKnownHostsFile=/dev/null \ -o StrictHostKeyChecking=no \ -F /dev/null \ -o LogLevel=ERROR \ "sles@$host" "$@" } skuba_wait_ssh() { # Usage: # wait_ssh <target> timeout=$2 local target="${1:-all}" _define_node_group "$target" for n in $GROUP; do secs=0 set +e _ssh2 $n exit while test $? -gt 0 do if [ $secs -gt $timeout ] ; then echo "Timeout while waiting for $n" exit 2 else sleep 5 secs=$(( secs + 5 )) _ssh2 $n exit fi done set -e done } skuba_reboots() { # usage: # reboots disable local action="${1:-disable}" if [[ "$action" == "disable" ]]; then kubectl -n kube-system annotate ds kured weave.works/kured-node-lock='{"nodeid":"manual"}' else kubectl -n kube-system annotate ds kured weave.works/kured-node-lock- fi } skuba_run_cmd() { # Usage: # run_cmd <target> "sudo ..." # run_cmd all "sudo ..." # run_cmd masters "sudo ..." local target="${1:-all}" _define_node_group "$target" for n in $GROUP; do _ssh2 "$n" "$@" done } skuba_use_scp() { # Usage: # use_scp <target> <src_files> <dest_files> # use_scp masters <src_files> <dest_files> # use_scp workers <src_files> <dest_files> local target="${1:-all}" _define_node_group "$target" SRC="$2" DEST="$3" local options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -F /dev/null -o LogLevel=ERROR -r" for n in $GROUP; do scp "$options" "$SRC" sles@$n:"$DEST" done } skuba_show_images() { kubectl get pods --all-namespaces -o jsonpath="{.items[*].spec.containers[*].image}" | tr -s '[[:space:]]' '\n' } skuba_updates() { # Usage: # updates <target> <action> # updates all disable local target="${1:-all}" local action="${2:-disable}" _define_node_group "$target" for n in $GROUP; do _ssh2 "$n" "sudo systemctl $action --now skuba-update.timer" done } _init_control_plane() { if ! [[ -d "$CLUSTER_NAME" ]]; then skuba_container skuba cluster init --control-plane "$LB" "$CLUSTER_NAME" fi } _deploy_masters() { local i=0 for n in $1; do local j j="$(printf "%03g" $i)" if [[ $i -eq 0 ]]; then skuba_container "$CLUSTER_NAME" skuba node bootstrap --user sles --sudo --target "$n" "master$j" -v "$DEBUG" wait fi if [[ $i -ne 0 ]]; then skuba_container "$CLUSTER_NAME" skuba node join --role master --user sles --sudo --target "$n" "master$j" -v "$DEBUG" wait fi ((++i)) done } _deploy_workers() { local i=0 for n in $1; do local j j="$(printf "%03g" $i)" (skuba_container "$CLUSTER_NAME" skuba node join --role worker --user sles --sudo --target "$n" "worker$j" -v "$DEBUG") & wait ((++i)) done } skuba_deploy() { # Usage: deploy set -x _set_env_vars _init_control_plane pushd "$(pwd)"/ || exit _deploy_masters "$MASTERS" _deploy_workers "$WORKERS" KUBECONFIG="" skuba_container $CLUSTER_NAME skuba cluster status } skuba_node_upgrade() { # Usage: # skuba_node_upgrade <target> # skuba_node_upgrade all # skuba_node_upgrade masters # skuba_node_upgrade workers local target="${1:-all}" _define_node_group "$target" local i=0 for n in $GROUP; do skuba_container "$CLUSTER_NAME" skuba node upgrade \ apply --user sles --sudo --target "$n" -v "$DEBUG" done }
true
cfaea168b6b4dd3a41a0475dd156b02164fdfb26
Shell
brandonchinn178/hive
/.circleci/run-remote-build-deps.sh
UTF-8
552
2.890625
3
[]
no_license
#!/bin/bash set -eux -o pipefail # unpack files tar xf repo.tar.gz if [[ -f ghcjs-cache.tar.gz ]]; then tar xf ghcjs-cache.tar.gz sudo mv usr-bin/* /usr/local/bin/ sudo mv usr-lib/* /usr/local/lib/ rm ghcjs-cache.tar.gz fi sudo chown -R $USER:$USER /usr/local/ scripts/install-system-deps.sh stack build alex happy ghcjs/stack.sh setup ghcjs/stack.sh build --only-dependencies # pack cache cp -r /usr/local/bin/ usr-bin cp -r /usr/local/lib/ usr-lib tar czf ghcjs-cache.tar.gz \ .stack \ .ghcjs \ usr-bin \ usr-lib
true
86de2a670b044659a4e9d8acd43b9f613ee08eca
Shell
Chrismarsh/SnowCast
/NWP_Forcing/Util/sub_set_grib2_files.sh
UTF-8
494
3.578125
4
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/bin/bash # Uses wgrib2 to subset all .grib2 files within input dir # Using the hardcoded lat/lon bounds below grib2_dir=$1 # Path to folder containing grib2 files cd $grib2_dir shopt -s nullglob # Ignore no matches case for f in *.grib2; do # Get file namebase filename="${f%.*}" # Subset /home/nwayand/custom/wgrib2/wgrib2 $f -small_grib -144.72657:-48.457035 40.794405:71.5921 $filename"_SUB.grib2" # Clean up rm $f done echo "Done Subsetting grib2 files"
true
6d29866ae73a24355bfe95b99953c613f0aba3f5
Shell
doutriaux1/uvcdat
/exsrc/ioapi.sh
UTF-8
647
2.984375
3
[]
no_license
#!/bin/sh BUILD=`pwd` export BUILD PACKAGE="ioapi" . ./prolog.sh FC=`${prefix}/${version}/bin/python ${BUILD}/detect_fortran.py` export FC (cd ioapi*/ioapi; \ # build the library make -f Makefile.nocpl; \ # go to the object/lib directory # and run ranlib (only needed for Darwin) # but doesn't effect the build cd ../neutral_g77; \ ranlib libioapi.a; \ # copy the library to pyIoapi contrib package # and the installation directory (prefix) # echo "Copying IOAPI library to pyIoapi package" ; \ # cp libioapi.a ../../../../contrib/pyIoapi/Src/lib_external; \ cp libioapi.a ${prefix}/Externals/lib; )
true
c94d0de40cf12283cbd6df28c77f143b63c740c8
Shell
freifunk-stuttgart/ffs-make-gateway
/make-gwkeys
UTF-8
768
3.3125
3
[]
no_license
#! /bin/bash # Macht vpn Keys # Musterkeys müssen in PFADGW liegen # Beispiel für Musterkey # key "1024867fc96beb7407544b6ff6984e8bfca156fefff0c8829754c76a45cb6de5"; # remote "gw07n01.gw.freifunk-stuttgart.de" vpns=$* if [ -z ${vpns:0:1} ]; then echo "VPNs fehlen!" exit 1 fi GWS="gw04n04" PFAD=~/peers-ffs PFADGW=~/peers-gw for vpn in $vpns; do for gw in $GWS; do if [ ! -d $PFAD/vpn$vpn/bb/ ]; then mkdir -p $PFAD/vpn$vpn/bb/ fi if [ ! -d $PFAD/vpn$vpn/peers/ ]; then mkdir -p $PFAD/vpn$vpn/peers/ touch $PFAD/vpn$vpn/peers/.dummy fi if [ ! -e $PFAD/vpn$vpn/bb/${gw}s$vpn ]; then echo "$PFAD/vpn$vpn/bb/${gw}s$vpn" cat <<-EOF >$PFAD/vpn$vpn/bb/${gw}s$vpn #MAC: 02:00:38:$vpn:${gw:2:2}:${gw:5:2} $(cat $PFADGW/$gw) port $((9040 + ${vpn#0})); EOF fi done done
true
9ea643ae52a344fb2770f5a6c56cde0b5681b48a
Shell
brontosaurusrex/postbang
/bin/printVolCont
UTF-8
1,680
3.359375
3
[]
no_license
#!/bin/bash # printVolCont # continuously print alsa master volume as ascii slider ─────│───── ☐ Ξ · ‖ • # to be used with tint2 executor like: #execp_command = printVolCont #execp_continuous = 1 # awk, bc needed # 2017 by bronto, fixed by o9000 (echo ""; stdbuf -oL alsactl monitor) | while read do debug="--true" volPercents=$(awk -F"[^0-9]*" '/dB/ { print $3 }' <(amixer sget Master)) mute=$(awk -F"[][]" '/dB/ { print $6 }' <(amixer sget Master)) if (( volPercents > 100 )); then volPercents=100 fi if (( volPercents < 0 )); then volPercents=0 fi chars="20" fil="─" pos="│" pos=" $volPercents " # Enable this to have a display like ─────50───── # if mute if [ "$mute" == "off" ]; then pos=" ___ " fi [ "$debug" = true ] && { echo "$pos pos" ;} [ "$debug" = true ] && { echo "$volPercents volPercents" ;} faktor=$(echo "scale=2;$chars/100" | bc) vol=$(echo "scale=0;($volPercents*$faktor+0.5)/1" | bc -l) [ "$debug" = true ] && { echo "$vol vol" ;} postloop=$(echo "$chars-$vol" | bc) if (( vol == chars )); then postloop=0 fi preloop=$(echo "$vol-1" | bc) if (( vol == 0 )); then preloop=0 postloop=$(echo "$chars-$vol-1" | bc) fi [ "$debug" = true ] && { echo "$preloop preloop" ;} [ "$debug" = true ] && { echo "$postloop postloop" ;} for i in $(seq 1 $preloop); do printf "%s" "$fil" done printf "%s" "$pos" for i in $(seq 1 $postloop); do printf "%s" "$fil" done printf "\n" done
true
926247889168c21f3681f3da33d00e26ddc74c07
Shell
KazAoyama/KaigoSystem
/E-LIFE/CARE_KOJINJOUHOU/CGI/KOJINJYOUHOU_SHOUSAI_KIHON.EXCEL
UTF-8
6,451
3.34375
3
[]
no_license
#!/bin/bash # # KIHONJOUHOU_ICHIRAN.EXCEL # 基本情報一覧 エクセル出力用CGI # # Written by K.Aoyama :20131228 #-------------------------------------------------------------- # ログ source /home/hands/E-LIFE/UNEI/CGI/UNEI.INI &> /dev/null source /home/hands/.bashrc &> /dev/null mkdir -p ${log_dir}/$(date +%Y%m%d) exec 2> ${log_dir}/$(date +%Y%m%d)/LOG.$(basename ${0}).$HOSTNAME.$(date +%Y%m%d) ; set -xv #-------------------------------------------------------------- #-------------------------------------------------------------- rm -f $tmp-* #-------------------------------------------------------------- #-------------------------------------------------------------- function error_exit { rm -f $tmp-* exit 0 } #-------------------------------------------------------------- #-------------------------------------------------------------- # 変数の定義 namedata="$1" data="$2" # 必要な値の取得 eval $(name-source ${namedata}) #-------------------------------------------------------------- # ユーザー名取得 #[ ! -z "$USER_ID" ] && USER_NAME="$(grep "^$USER_ID " ${tbl_dir}/JYUGYOIN_NAME | awk '{print $2}')" USERID="$(nameread "userid" $namedata)" USERNAME="$(awk '$1=="'${USERID}'"{print $2}' ${tbl_dir}/JYUUGYOUIN_MASTER/USER_MASTER | head -1)" SHISETSUID="$(nameread "shisetsu" $namedata)" if [ $(echo "${SHISETSUID}" | awk '$1~/^1/{print substr($1,1,1)}') = "1" ] ; then SHISETSUNAME="$(awk '$1=="'${SHISETSUID}'"{print $2}' ${tbl_dir}/JIGYOUSHO_MASTER/JIGYOUSHO_GROUP_MASTER | head -1)" else SHISETSUNAME="$(awk '$1=="'${SHISETSUID}'"{print $2}' ${tbl_dir}/SHISETSU_MASTER/SHISETSU_KIHON | head -1)" fi #-------------------------------------------------------------- # 表示順による並び替え awk '$1=="KIHON"' ${data} | delf 1 > $tmp-listdata # 1:利用者(入居者)ID 2:利用者(入居者)氏名 3:利用者(入居者)氏名カナ 4:性別 5:和暦:元号 # 6:和暦:誕生年 7:和暦:誕生月 8:和暦:誕生日 9:西暦:生年月日 10:感染症 # 11:入居前郵便番号 12:入居前住所 13:現郵便番号 14:現住所 15:携帯電話番号 # 16:E-MAILアドレス 17:趣味特技 18:備考 # sed 's/_/@/g' > $tmp-listdata #------------------------------------------------------------------------------------ #検索項目それぞれ # ##ケアマネ名 #if [ "${Caremaneger}" != "_" -a "${Caremaneger}" != "" ] ;then # cat ${tbl_dir}/JYUUGYOUIN_MASTER/USER_KIHON | # awk '$(NF-2)!="9"{print $1,$2}' | # join0 key=1 <(echo ${Caremaneger}) - | # self 2 > ${tmp}-caremane #else # : > ${tmp}-caremane #fi # ##施設名 if [ "${NYUUKYOSHISETSUNAME}" != "_" -a "${NYUUKYOSHISETSUNAME}" != "" ] ;then echo ${NYUUKYOSHISETSUNAME} > ${tmp}-shisetsu else : > ${tmp}-shisetsu fi ##建屋名 if [ ${NYUUKYOTATEYANAME} != "_" -a "${NYUUKYOTATEYANAME}" != "" ] ;then echo ${NYUUKYOTATEYANAME} > ${tmp}-tateya else : > ${tmp}-tateya fi # ##フロア if [ ${NYUUKYOFLOOR} != "_" -a "${NYUUKYOFLOOR}" != "" ] ;then echo ${NYUUKYOFLOOR} > ${tmp}-floor else : > ${tmp}-floor fi ##ユニット if [ ${NYUUKYOUNITNAME} != "_" -a "${NYUUKYOUNITNAME}" != "" ] ;then echo ${NYUUKYOUNITNAME} > ${tmp}-unit else : > ${tmp}-unit fi #居室 if [ ${NYUUKYOKYOSHITSU} != "_" -a "${NYUUKYOKYOSHITSU}" != "" ] ;then echo ${NYUUKYOKYOSHITSU} > ${tmp}-kyoshitsu else : > ${tmp}-kyoshitsu fi ##性別 Seibetsu=$(self 4 $tmp-listdata) if [ ${Seibetsu} == "1" ] ;then echo "男" elif [ ${Seibetsu} == "2" ] ;then echo "女" else echo "全て" fi > ${tmp}-seibetsu #生年月日 #元号読み替え # 元号 SeinengappiGengou=$(self 5 $tmp-listdata) cat ${tbl_dir}/ZEIRITSU_GENGOU_MASTER/GENGOU | # 1:ID 2:元号名 3:西暦年月From 4:西暦年月To awk '$(NF-2)!="9"{print $1,$2}' | join0 key=1 <(echo ${SeinengappiGengou}) - | self 2 > $tmp-gengou gengoumei=$(cat $tmp-gengou) awk '{print "'${gengoumei}'"$6"年"$7"月"$8"日"}' $tmp-listdata > ${tmp}-seinengappi #年齢 if [ ${Nenrei} != "_" -a "${Nenrei}" != "" ] ;then echo ${Nenrei} > ${tmp}-nenrei else : > ${tmp}-Nenrei fi #感染症 cat << FIN > $tmp-kansenshou_jyunbi 1 なし 2 HCV 3 HBV 4 梅毒 5 HIV FIN join0 key=1 <(echo ${Kansenshou}) $tmp-kansenshou_jyunbi | self 2 > ${tmp}-kansenshou # #--------------------------------------------------------------------------------------- #-------------------------------------------------------------f- # 入力データのチェック # Excel出力 download_dir=$home_dir/UNEI/DOWNLOAD # 以前に作成したExcelは削除 #rm -f ${download_dir}/${download_dir}/kihon_ichiran_mimoto_*_download.xls TEMPLA=${home_dir}/UNEI/TEMPLATE/KOJINJYOUHOU_SHOUSAI_KIHON_TMP.xls Ehexcel < ${TEMPLA} 1 b3 $tmp-shisetsu \ 1 b4 ${tmp}-tateya \ 1 b5 ${tmp}-floor \ 1 b6 $tmp-unit \ 1 b7 ${tmp}-kyoshitsu \ 1 b10 ${tmp}-seibetsu \ 1 b11 ${tmp}-seinengappi \ 1 b12 ${tmp}-nenrei \ 1 b13 ${tmp}-kansenshou \ 1 a31 ${tmp}-listdata > ${download_dir}/kojinjyouhou_shousai_kihon_$$_download.xls # 1 h7 ${tmp}-seinegappi_to \ #echo -e 'Content-Type: text/html; charset=UTF-8;\n\n' cat << EOF > ${tmp}-html.html <HTML> <HEAD> <SCRIPT type="text/javascript" language="Javascript"> //<![CDATA[ window.onload=init function init(){ $ON_LOAD window.open("/E-LIFE/UNEI/DOWNLOAD//kojinjyouhou_shousai_kihon_$$_download.xls","_self"); } //]]> </SCRIPT> </HEAD> </HTML> EOF # ファイル名をはく cat ${tmp}-html.html ## 終了 rm -f $tmp-* exit 0
true
441b8d464509146c051daf3655f59ebab2fa4309
Shell
ghsecuritylab/tysdk_for_bk7231t
/build_app.sh
UTF-8
3,534
3
3
[]
no_license
#!/bin/sh if [ -z "$1" ];then echo "please input the app bin name(no suffix \".bin\")!!!" exit 1 else APP_BIN_NAME=$1 fi if [ -z "$2" ];then echo "please input the app sw version(for example:the format is "1.1.1")!!!" exit 1 else USER_SW_VER=$2 fi # "1.0.1" #NUM_PY = 101 # $3 compile parameter command as user set,for example clean and so on. ${APP_BIN_NAME}_${USER_SW_VER}_crc_basic.bin USER_DEF_CMD=$3 echo "" echo "start..." echo "" set -e for i in `find project/tuya_user/$APP_BIN_NAME/src -type d` do echo $i rm -rf $i/*.o done for i in `find project/tuya_common/src -type d` do echo $i rm -rf $i/*.o done make APP_BIN_NAME=$APP_BIN_NAME USER_SW_VER=$USER_SW_VER $USER_DEF_CMD -C ./ cp project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_${USER_SW_VER}.bin tools/generate/ cd tools/generate/ ./encrypt ${APP_BIN_NAME}_${USER_SW_VER}.bin 510fb093 a3cbeadc 5993a17e c7adeb03 10000 python mpytools.py ${APP_BIN_NAME}_${USER_SW_VER}_enc.bin ./beken_packager config.json cp all_1.00.bin ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_QIO_${USER_SW_VER}.bin rm all_1.00.bin cp ${APP_BIN_NAME}_${USER_SW_VER}_enc_uart_1.00.bin ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_uart_${USER_SW_VER}.bin rm ${APP_BIN_NAME}_${USER_SW_VER}_enc_uart_1.00.bin #generate ota file ./rt_ota_packaging_tool_cli -f ${APP_BIN_NAME}_${USER_SW_VER}.bin -v $CURRENT_TIME -o ${APP_BIN_NAME}_${USER_SW_VER}.rbl -p app -c gzip -s aes -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF ./package.bin ${APP_BIN_NAME}_${USER_SW_VER}.rbl ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_ug_${USER_SW_VER}.bin $USER_SW_VER rm ${APP_BIN_NAME}_${USER_SW_VER}.rbl rm ${APP_BIN_NAME}_${USER_SW_VER}.bin echo "ug_file size:" ls -l ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_ug_${USER_SW_VER}.bin | awk '{print $5}' if [ `ls -l ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_ug_${USER_SW_VER}.bin | awk '{print $5}'` -gt 679936 ];then echo "*********************************************************************" echo "*********************************************************************" echo "********************bk7231_${APP_BIN_NAME}_$USER_SW_VER.bin**********" echo "************************** too large ********************************" echo "*********************************************************************" echo "*********************************************************************" echo "**********************COMPILE FAILED*********************************" rm ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_ug_${USER_SW_VER}.bin rm ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_uart_${USER_SW_VER}.bin rm ../../project/tuya_user/$APP_BIN_NAME/output/$USER_SW_VER/${APP_BIN_NAME}_QIO_${USER_SW_VER}.bin exit 1 fi cd - echo "*************************************************************************" echo "*************************************************************************" echo "*************************************************************************" echo "**********************bk7231_${APP_BIN_NAME}_$USER_SW_VER.bin*********************" echo "*************************************************************************" echo "**********************COMPILE SUCCESS************************************" echo "*************************************************************************"
true
c1f748850b40cd613c861071f86596ebd21251d3
Shell
puzzloholic/tvlk-assessment
/challenge-1/github-stats.sh
UTF-8
1,708
3.515625
4
[]
no_license
#!/bin/bash stats(){ check_limit_reset(){ RATE_LIMIT_RESET=$(curl -s "$GITHUB_HOST/rate_limit" \ -H "Accept: application/vnd.github.v3+json" \ | jq -r '.rate.reset') } check_limit_remaining(){ RATE_LIMIT_REMAINING=$(curl -s "$GITHUB_HOST/rate_limit" \ -H "Accept: application/vnd.github.v3+json" \ | jq -r '.rate.remaining') if [ $RATE_LIMIT_REMAINING -lt 1 ]; then check_limit_reset echo "Rate limit exceeded, sleeping until $(date -d @$RATE_LIMIT_RESET)" SLEEP_TIME=$(( $RATE_LIMIT_RESET - $(date +%s) + 3 )) sleep $SLEEP_TIME fi } REPO_NAME=$1 check_limit_remaining REPO_INFO=$(curl -s "$GITHUB_HOST/repos/$REPO_NAME" \ -H "Accept: application/vnd.github.v3+json") if echo $REPO_INFO | jq -e 'has("message")' > /dev/null; then echo -n $REPO_NAME": " echo $REPO_INFO | jq -r '.message' else check_limit_remaining LATEST_COMMIT_INFO=$(curl -s "$GITHUB_HOST/repos/$REPO_NAME/commits?per_page=1" \ -H "Accept: application/vnd.github.v3+json") CLONE_URL=$(echo "$REPO_INFO" | jq -r '.clone_url') COMMIT_DATE=$(echo "$LATEST_COMMIT_INFO" | jq -r '.[].commit.author.date') COMMIT_AUTHOR=$(echo "$LATEST_COMMIT_INFO" | jq -r '.[].commit.author.name') echo $REPO_NAME","$CLONE_URL","$COMMIT_DATE","$COMMIT_AUTHOR fi } # N=4 # i=0 GITHUB_HOST=https://api.github.com # if [ -f repos.txt ]; then # fi echo "repo_name,clone_url,commit_date,commit_author" while read REPO_NAME; do stats "$REPO_NAME" # ((i=i%N)); ((i++==0)) && wait done < /data/repos.txt
true
db1451c92b0119052fb11db6364af01f6cc61753
Shell
macmichael01/terminal-config
/bash/plugins/files.plugins.bash
UTF-8
294
3.40625
3
[]
no_license
#!/usr/bin/env bash # Off by default # if [ $(id -u) != 0 ]; then # umask 0077 # else # umask 0022 # fi mkcd() { # about make a directory and cd into it # param path to create # example $ mkcd foo # example $ mkcd /tmp/img/photos/large mkdir -p "$*" cd "$*" }
true
8fe5f2e27dfdfb381077834b8742fe92c06dbf48
Shell
dlaststark/machine-learning-projects
/Programming Language Detection/Experiment-2/Dataset/Train/UNIX-Shell/binary-search-1.sh
UTF-8
213
3.40625
3
[]
no_license
#!/bin/ksh # This should work on any clone of Bourne Shell, ksh is the fastest. value=$1; [ -z "$value" ] && exit array=() size=0 while IFS= read -r line; do size=$(($size + 1)) array[${#array[*]}]=$line done
true
43609235469817997012b81f52222d56ed3a82b1
Shell
AkhtarZainab/BridgeLabz
/Loops/mx-min.sh
UTF-8
394
3.390625
3
[]
no_license
#!/bin/bash -x echo "Enter Size(N)" read N i=1 max=0 while [ $i -le $N ] do let "num = $RANDOM % 900 + 100" if [ $i -eq 1 ] #set first number as max then max=$num min=$num elif [ $num -gt $max ] then max=$num elif [ $num -le $min ] then min=$num fi i=$((i + 1)) #increment i by 1 done echo $max echo $min
true
bb78a0de2b3d87ba344561a53f51eb346f23e042
Shell
jamesallardice/dotfiles
/bin/setup
UTF-8
1,815
3.734375
4
[]
no_license
#!/usr/bin/env bash # Ask for the administrator password upfront. sudo -v # Useful variables. CREATE_DIRS=(~/dev) SCRIPT_PATH=$(cd $(dirname $0); pwd -P) # Install Homebrew. This is the recommended installation method from # http://brew.sh/ but is subject to change. It is recommended that you check # that page for updates to the command before running this script. if [[ ! "$(which brew)" ]]; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" fi # Install stable version of rvm with Ruby. curl -sSL https://get.rvm.io | bash -s stable --ruby # Install software from Homebrew. ${SCRIPT_PATH}/install-homebrew-formulae ${SCRIPT_PATH}/install-homebrew-casks # Install software from the Mac App Store. ${SCRIPT_PATH}/install-app-store # Install Ruby gems. ${SCRIPT_PATH}/install-gems # Configure Xcode after installation. Without this the "active developer # directory" points to a Command Line Tools instance rather than Xcode itself. sudo xcode-select -s /Applications/Xcode.app/Contents/Developer # Add Homebrew Zsh to shells and switch to it. sudo sh -c "echo "$(brew --prefix)/bin/zsh" >> /etc/shells" sudo chsh -s "$(brew --prefix)/bin/zsh" $USER # Install Oh My Zsh. sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" # Make useful directories. for dir in "${CREATE_DIRS[@]}"; do if [ ! -d "$dir" ]; then mkdir $dir fi done # Copy dotfiles to the home directory. cp -r copy/home/. ~/ # Install fonts. The fonts included in this repository include Powerline fonts # from https://github.com/powerline/fonts which are required for the desired # Vim setup. cp -r copy/fonts/. ~/Library/Fonts/ # Set up Vim and install plugins. vim +PlugInstall +qall # Configure OS X. sudo ${SCRIPT_PATH}/osx
true
907e369bdf56b13ef1ce912ec80ccce48bbe2885
Shell
kimvanwyk/docker-torguard-openvpn
/openvpn.sh
UTF-8
482
2.984375
3
[ "MIT" ]
permissive
#!/bin/sh set -e -u -o pipefail if [ -n "$REGION" ]; then sed -i "s|up /etc/openvpn/update-resolv-conf|up /etc/openvpn/up.sh|g" TorGuard.${REGION}.ovpn sed -i "s|down /etc/openvpn/update-resolv-conf|up /etc/openvpn/down.sh|g" TorGuard.${REGION}.ovpn set -- "$@" '--config' "TorGuard.${REGION}.ovpn" fi if [ -n "$USERNAME" -a -n "$PASSWORD" ]; then echo "$USERNAME" > auth.conf echo "$PASSWORD" >> auth.conf set -- "$@" '--auth-user-pass' 'auth.conf' fi openvpn "$@"
true
409433da482dcb50e4f63d09fa6e4c1838b1c81f
Shell
maplatform/srcpl2015
/grafs/longitud-de-negociacion.sh
UTF-8
1,608
3.421875
3
[]
no_license
#!/bin/bash # Generar datos #nagen=$(head -n 1 ./info |tail -n 1 | awk '{print $1}') #it=$(head -n 2 ./info |tail -n 1 | awk '{print $1}') #st=$(head -n 3 ./info |tail -n 1 | awk '{print $1}') path=$1 cd $path echo "Estoy en: "$PWD # Generar datos file=longitud-de-negociacion rm -f $file.txt #cd ../salida #for (( e=0; e<$pruebas; e=e+1 )) for e in *; do echo -e -n $(tail -n 1 $e/agente0 |awk '{print $1}')' \n' >> "../grafs/"$file.txt done cd ../grafs # Graficar min_max_prom=$(awk 'NR == 1 { max=$1; min=$1; sum=0 } { if ($1>max) max=$1; if ($1<min) min=$1; sum+=$1;} END {printf "%d %d %.2f", min, max, sum/NR}' $file.txt) min=$(echo $min_max_prom | awk '{print $1}') max=$(echo $min_max_prom | awk '{print $2}') prom=$(echo $min_max_prom | awk '{print $3}') echo e $e min $min, max $max, prom $prom gnuplot <<- EOF set title "Longitud de las negociaciones , Estrategia $st" set xlabel "Longitud (cantidad de rondas)" set ylabel "Cantidad de negociaciones" n=20 #number of intervals # width=($max-$min)/n #interval width width=.5 set yrange [0:12] set xrange [$min-1.5*width:$max+1.5*width] set parametric set dummy t set trange [0:12] set terminal png set key font ",20" set boxwidth width*0.8 set style fill solid 0.5 set tics out nomirror set output "$file.png" bin(x,width)=width*floor(x/width) plot '$file.txt' u (bin(\$1,width)):(1.0) smooth freq with boxes lw 3 lt rgb "black" notitle, \ $prom, t lt 2 lc rgb "black" lw 1 title "Mean $prom" EOF
true
658d41cae6d9eeb2358ff69b1ee77d807c285672
Shell
jerubball/HackerRank
/LinuxShell/TextProcessing/tr1.sh
UTF-8
300
3.109375
3
[ "Unlicense" ]
permissive
#!/bin/bash # HackerRank LinuxShell TextProcessing 15 # https://www.hackerrank.com/challenges/text-processing-tr-1/problem # Author: Hasol tr "()" "[]" #while true #do # read i # if [[ "$i" == "" ]] # then # break # fi # i="${i//(/[}" # i="${i//)/]}" # echo "$i" #done
true
5c5be5308d223b421fd9b372d7b5098e2abfb3e2
Shell
c0d1007/viperpython
/Docker/nginxconfig/gencert.sh
UTF-8
589
3.265625
3
[ "BSD-3-Clause" ]
permissive
#!/bin/sh # create self-signed server certificate: read -p "Enter your domain [www.example.com]: " DOMAIN echo "Create server key..." openssl genrsa -des3 -out ssl.key 2048 echo "Create server certificate signing request..." SUBJECT="/C=US/ST=Mars/L=iTranswarp/O=iTranswarp/OU=iTranswarp/CN=$DOMAIN" openssl req -new -subj $SUBJECT -key ssl.key -out ssl.csr echo "Remove password..." mv ssl.key ssl.origin.key openssl rsa -in ssl.origin.key -out ssl.key echo "Sign SSL certificate..." openssl x509 -req -days 3650 -in ssl.csr -signkey ssl.key -out ssl.crt echo "Update certificate success"
true
cfe7ff7b25965c5635e1b8834e3d21a540d15765
Shell
adjackura/guest-test-infra
/container_images/pytest/example/run.sh
UTF-8
1,385
3.28125
3
[ "Apache-2.0" ]
permissive
#!/bin/bash # Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -ex # Change to the directory of this script. cd "$(dirname "$(readlink -f "$0")")" pushd .. docker build . -t pytest popd rm -rf artifacts && mkdir artifacts docker run \ `# The first mount contains the repository that's being tested. In this example, we're` \ `# assuming that *this* is the root of the repository. The root is important since ` \ `# in-repo dependencies are expressed as an absolute path from the root of the repository.` \ --volume "$(pwd):/project:ro" \ --workdir /project \ `# After the test runs, check the "artifacts" directory for test results.` \ --volume "$(pwd)/artifacts:/artifacts" \ --env ARTIFACTS=/artifacts \ `# The argument to "pytest" is the path to the Python package that will be tested.` \ pytest src/application
true
5ba47ac82155c82ee1c5141e381cfa39506cf40d
Shell
KhairulIzwan/caffe
/prerequisites.sh
UTF-8
4,289
3.765625
4
[ "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
#!/usr/bin/env bash # References # https://stackoverflow.com/questions/12137431/test-if-a-command-outputs-an-empty-string # https://linuxhint.com/apt_cache_search_packages/ # https://itsfoss.com/unable-to-locate-package-error-ubuntu/ # https://www.tecmint.com/assign-linux-command-output-to-variable/#:~:text=shell%20scripting%20purpose.-,To%20store%20the%20output%20of%20a%20command%20in%20a%20variable,command%20%5Boption%20...%5D # https://linuxconfig.org/how-to-use-arrays-in-bash-script#h3-adding-elements-to-an-array # https://linuxize.com/post/bash-if-else-statement/ # Define ANSI Color Code NC='\033[0m' # No Color BLACK='\033[0;30m' DARKGRAY='\033[1;30m' RED='\033[0;31m' LIGHTRED='\033[1;31m' GREEN='\033[0;32m' LIGHTGREEN='\033[1;32m' BROWN='\033[0;33m' YELLOW='\033[1;33m' BLUE='\033[0;34m' LIGHTBLUE='\033[1;34m' PURPLE='\033[0;35m' LIGHTPURPLE='\033[1;35m' CYAN='\033[0;36m' LIGHTCYAN='\033[1;36m' LIGHTGRAY='\033[0;37m' WHITE='\033[1;37m' # Installing Prerequisites echo -e "Installing Prerequisites" #sudo apt-get install libopencv-dev python-opencv #sudo apt-get install libopenblas-dev #sudo apt-get install libatlas-base-dev #sudo apt-get install libboost-all-dev #sudo apt-get install python-pip python-dev build-essential #sudo pip install --upgrade pip #pip install protobuf # Declare a Prerequisites array declare -a P_StringArray=("libopencv-dev" "python-opencv" "libopenblas-dev" "libatlas-base-dev" "libboost-all-dev" "python-pip" "python-dev" "build-essential") declare -a P_pip_StringArray=("protobuf") # Declare a Prerequisites (valid/non-valid) array declare -a P_Valid_StringArray declare -a P_InValid_StringArray declare -a P_pip_Valid_StringArray declare -a P_pip_InValid_StringArray # Read the array values with space for val in "${P_StringArray[@]}"; do if [[ $(sudo apt-cache search $val) ]]; then if [[ $? -eq 0 ]] then sudo apt-get install $val P_Valid_StringArray+="$val," fi else P_InValid_StringArray+="$val," fi done # Read the array values with space for val in "${P_pip_StringArray[@]}"; do # if [[ $(sudo apt-cache search $val) ]]; # then # if [[ $? -eq 0 ]] # then python -m pip install $val P_pip_Valid_StringArray+="$val," # fi # else # P_InValid_StringArray+="$val," # fi done # Iterating comma separated string values Field_Separator=$IFS # set comma as internal field separator for the string list IFS=, echo -e "${LIGHTCYAN}Prerequisites Checklist${NC}" for val in $P_Valid_StringArray; do echo -e "[ ${GREEN}\xE2\x9C\x94${NC} ] sudo apt-get install $val" done for val in $P_InValid_StringArray; do echo -e "[ ${RED}\xE2\x9D\x8C${NC} ] sudo apt-get install $val" done for val in $P_pip_Valid_StringArray; do echo -e "[ ${GREEN}\xE2\x9C\x94${NC} ] python -m pip install $val" done IFS=$Field_Separator ## Declare a General Dependencies array #declare -a GD_StringArray=("sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler" "sudo apt-get install the python-dev" "sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev" "sudo apt-get install abbbbc") ## Read the array values with space #for val in "${GD_StringArray[@]}"; do # $val # wait # if [[ $? -eq 1 ]] # then # GD_Success_StringArray+="$val," # else # GD_Failed_StringArray+="$val," # fi #done ## Declare a General Dependencies (success/failed) array #declare -a GD_Success_StringArray #declare -a GD_Failed_StringArray ## Iterating comma separated string values #Field_Separator=$IFS ## set comma as internal field separator for the string list #IFS=, #for val in $GD_Success_StringArray; do # echo -e "[ ${GREEN}\xE2\x9C\x94${NC} ] $val" #done #for val in $GD_Failed_StringArray; do # echo -e "[ ${RED}\xE2\x9D\x8C${NC} ] $val" #done #IFS=$Field_Separator #while read -r line #do # echo "$line" #done < <(find "E: Unable to locate package" -type f) #sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler #sudo apt-get install the python-dev #sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev #sudo apt-get update & #wait #echo -e "Job 1 exited with status $?" #echo "$?" #if [[ $? -eq 0 ]] #then # echo -e "Job 1 exited with status $?" #else # echo -e "Hurm!" #fi
true
f35c75b7ee51f12ab1fd13da2694926fb6d74d44
Shell
DorianVasco/videojs-responsive-dash
/Creation Tools/encode2cinemagraph.sh
UTF-8
3,938
3.375
3
[]
no_license
#!/bin/bash echo "============================================" echo "==== MEGA CINEMAGRAPH THUMBNAIL CREATOR ====" echo "============================================" echo "== creates scaled and cropped videothumbs ==" echo "============================================" cd "$(dirname "$0")" # get input file per drag and drop read -p "Drag input file here: " inputFile #echo „Datei::$inputFile::“ # remove "" or '' inputFile=${inputFile%\"} inputFile=${inputFile#\"} inputFile=${inputFile%\'} inputFile=${inputFile#\'} # remove leading whitespace inputFile=${inputFile##*( )} # remove trailing whitespace inputFile=${inputFile%%*( )} #echo "stripped: $inputFile" inputFilename="${inputFile##*/}" inputName="${inputFilename%.*}" inputPath="$(dirname "$inputFile")" tempPath="$inputPath/tmp-output-$(date +%s%3N)" outputPath="$inputPath/Output" # create output directory mkdir "$outputPath" mkdir "$tempPath" vScale=400 vBitrate=300 # set average bitrate let tmp=$vBitrate/6 let vMax=$vBitrate+$tmp echo "======================" echo "== start encoding.. ==" echo "======================" #ffmpeg -y -i "%inputFile%" -vcodec libvpx -b:v %vBitrate%k -maxrate %vMax%k -bufsize %vMax%k -vf "scale=-2:%vScale%" -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -map 0 "%outputPath%\%inputFileName%.webm" #ffmpeg -i movie.file -vcodec libvpx -b:v 600k -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -vf scale=480:-1 -map 0 out.webm #echo creating MP4.. #ffmpeg -y -i "%inputFile%" -c:v libx264 -b:v %vBitrate%k -maxrate %vMax%k -bufsize %vMax%k -vf "scale=-2:%vScale%" "%outputPath%\%inputFileName%.mp4" #./ffmpeg.exe -y -i "$inputFile" -vcodec libvpx -b:v "${vBitrate}k" -maxrate "${vMax}k" -bufsize "${vMax}k" -vf "scale=-2:$vScale" -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -map 0 "$outputPath/$inputFileName.webm" #-vcodec libx264 -b:v %vBitrate%k -maxrate %vMax%k -bufsize %vMax%k -vf "scale=-2:%vScale%" "%outputPath%\%inputFileName%.mp4" if [[ "$OSTYPE" == "msys" ]]; then cmdFfmpeg="./bin/win/ffmpeg.exe" cmdMp4box="./bin/win/mp4box.exe" else cmdFfmpeg="./bin/mac/ffmpeg" cmdMp4box="./bin/mac/MP4Box" fi echo "Encoding video to large and small sizes" $cmdFfmpeg -y -i "$inputFile" -threads 0 -vcodec libvpx -b:v "${vBitrate}k" -maxrate "${vBitrate}k" -bufsize "${vBitrate}k" -vf "scale=-2:$vScale, crop=$vScale:$vScale" -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -map 0 "$outputPath/${inputName}-thumb.webm" \ -vcodec libx264 -preset veryslow -b:v "${vBitrate}k" -maxrate "${vBitrate}k" -bufsize "${vBitrate}k" -vf "scale=-2:$vScale, crop=$vScale:$vScale" "$outputPath/${inputName}-thumb.mp4" \ -c:v libx264 -preset veryslow -g 30 -b:v 2800k -maxrate 3200k -bufsize 2000k -vf "scale=-2:1080" "$tempPath/$inputName-1080.mp4" \ -c:v libx264 -preset veryslow -g 30 -b:v 2000k -maxrate 2400k -bufsize 2000k -vf "scale=-2:720" "$tempPath/$inputName-720.mp4" \ -c:v libx264 -preset veryslow -g 30 -b:v 900k -maxrate 1200k -bufsize 900k -vf "scale=-2:540" "$tempPath/$inputName-540.mp4" \ -c:v libx264 -preset veryslow -g 30 -b:v 300k -maxrate 400k -bufsize 300k -vf "scale=-2:320" "$tempPath/$inputName-320.mp4" \ -c:v libx264 -preset veryslow -b:v 1500k -maxrate 2000k -bufsize 1024k -vf "scale=-2:540" "$outputPath/$inputName.mp4" \ -c:v libvpx -b:v 1500k -maxrate 2000k -bufsize 1024k -vf "scale=-2:540" -acodec libvorbis -ac 2 -b:a 96k -ar 44100 -map 0 "$outputPath/${inputName}.webm" echo "Creating still images.." $cmdFfmpeg -y -ss 2 -i "$inputFile" -threads 0 -vf "select=gt(scene\,0.2)" -frames:v 1 -vsync vfr -vf "fps=fps=1/20" -vf "scale=-2:$vScale, crop=$vScale:$vScale" "$outputPath/${inputName}-thumb.jpg" $cmdMp4box -dash 2000 -rap -frag-rap -profile onDemand -out "$outputPath/$inputName.mpd" "$tempPath/$inputName-320.mp4#video" "$tempPath/$inputName-540.mp4#video" "$tempPath/$inputName-720.mp4#video" "$tempPath/$inputName-1080.mp4#video" rm -R "$tempPath" #:finish echo "FINISHED!"
true
d5a3349257afda8438fc00b3c79012934cc05f5c
Shell
delkyd/alfheim_linux-PKGBUILDS
/libgroove-git/PKGBUILD
UTF-8
1,768
2.90625
3
[]
no_license
# Maintainer: Jeremy "Ichimonji10" Audet <ichimonji10 at gmail dot com> # Contributor: epitron <chris@ill-logic.com> # Contributor: Jonjo McKay <jonjo@jonjomckay.com> pkgname=libgroove-git _pkgname=libgroove pkgver=4.3.0.70.gaed5104 pkgrel=1 pkgdesc='Library that provides decoding and encoding of audio on a playlist.' arch=(i686 x86_64) url='https://github.com/andrewrk/libgroove' license=(MIT) # chromaprint provides ffmpeg, but we want to pin a minimum version depends=(chromaprint 'ffmpeg>=3.0' libebur128 libsoundio) makedepends=(cmake yasm) provides=(libgroove) conflicts=(libgroove) options=('strip') source=('git+https://github.com/andrewrk/libgroove.git') sha256sums=('SKIP') pkgver() { cd "$_pkgname" git describe --always | sed 's/-/./g' } prepare() { # The version inserted in to libgroove.pc includes no hash. It is something # like "4.2.1". This matches what libgroove itself reports. version=$(cd "$_pkgname" && git describe --always --abbrev=0) sed \ -e 's|^libdir=$|libdir=/usr/lib|' \ -e 's|^includedir=$|includedir=/usr/include/groove|' \ -e "s|^Version:$|Version: ${version}|" \ "${srcdir}/${_pkgname}/doc/libgroove.pc" \ > "${srcdir}/libgroove.pc" } build() { mkdir -p "${srcdir}/${_pkgname}/build" cd "${srcdir}/${_pkgname}/build" cmake \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_INSTALL_PREFIX=/usr \ -D BUILD_EXAMPLE_PROGRAMS=OFF \ -D BUILD_STATIC_LIBS=OFF \ .. make } package() { make -C "${srcdir}/${_pkgname}/build" DESTDIR="${pkgdir}/" install install -Dm 644 "${srcdir}/${_pkgname}/LICENSE" \ "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" # Created in the `prepare` function. install -Dm 644 "${srcdir}/libgroove.pc" \ "${pkgdir}/usr/lib/pkgconfig/libgroove.pc" } # vim:set ts=2 sw=2 et:
true
06ad26170a60c7b1bdfed00e6d1eea3439a1b7bd
Shell
timbeynart/transcode
/src/resize_and_transcode.sh
UTF-8
1,201
3.390625
3
[]
no_license
#!/bin/sh width=1920 height=1080 echo "resizing $1 to 1920x1080 and ecoding to 4096k" if [ $# -ne 1 ] then echo 'provide an input file, moron. For example, resize.sh input/video.mp4' exit 1 fi #strip filename down to just the name, no ext, no path: xbase=`basename $1` name=${xbase%.*} ffmpeg -y -stats \ -i $1 \ -metadata title="$name" \ -pix_fmt yuv420p \ -vcodec libx264 \ -acodec libvo_aacenc \ -r 29.97 \ -level 3.1 \ -profile:v main \ -force_key_frames 60 \ -b:v 8500k \ -minrate 8500k \ -maxrate 8500k \ -bufsize 8000k \ -filter:v "scale=iw*sar:ih, scale=-1:$height, pad=$width:$height:($width-iw*min($width/iw\,$height/ih))/2:($height-ih*min($width/iw\,$height/ih))/2" \ "output/${name}_FHD.mp4" # -metadata title="The Title You Want" # # scale filter # i realized the non-square pixels were screwing up the scaler. use this first: scale=iw*sar:ih (from https://ffmpeg.org/pipermail/ffmpeg-user/2011-November/003203.html) # -filter:v "scale=iw*sar:ih, scale=iw*min($width/iw\,$height/ih):ih*min($width/iw\,$height/ih), pad=$width:$height:($width-iw*min($width/iw\,$height/ih))/2:($height-ih*min($width/iw\,$height/ih))/2" \ # not necessayr, use built in -size and -aspect options # #
true
107efe7e2d447fb09ce3658c02c18c1fa04c5040
Shell
ogm710811/design-test-app
/build.sh
UTF-8
19,266
3.390625
3
[]
no_license
#!/bin/bash function check_exit_code { # $1 = Exit code # $2 = Operation # $3 = Project if [[ -n $1 ]] && [[ $1 -gt 0 ]] then echo "@fox/$3 $2 failed with exit code $1" echo "Printing log of failed run" cat "./logs/$2-$3.log" else echo "@fox/$3 $2 completed successfully" fi } function exit_on_job_failure { # $1 = List of exit codes # $2 = List of PIDs for exit_code in $1 do if [[ ${exit_code} -gt 0 ]] then kill $2 2> /dev/null echo "Exiting due to job failures" exit 1 fi done } #npm config set fetch-retries 5 #NODE_EXTRA_CA_CERTS=`pwd`/UHG_Certificates.pem #npm install #cd node_modules/puppeteer/.local-chromium || exit #WORKING_DIR=`pwd` #CHROME_BIN=`find $WORKING_DIR -name "[Cc]hromium"` #export CHROME_BIN #cd ../../.. rm ./logs/*.log # Building Layer 1: No pre-requisites # - Linting - Could check this earlier (fail fast) or later (get as many failures as possible sooner, but longer to fail the build) echo "$(ng l state-management > ./logs/lint-state-management.log 2>&1 ; echo $?)" > EC_LINT_STATE_MANAGEMENT.var & PID_LINT_STATE_MANAGEMENT=$! echo "Linting @fox/state-management" echo "$(ng l rest-clients > ./logs/lint-rest-clients.log 2>&1 ; echo $?)" > EC_LINT_REST_CLIENTS.var & PID_LINT_REST_CLIENTS=$! echo "Linting @fox/rest-clients" echo "$(ng l test-support > ./logs/lint-test-support.log 2>&1 ; echo $?)" > EC_LINT_TEST_SUPPORT.var & PID_LINT_TEST_SUPPORT=$! echo "Linting @fox/test-support" echo "$(ng l login > ./logs/lint-login.log 2>&1 ; echo $?)" > EC_LINT_LOGIN.var & PID_LINT_LOGIN=$! echo "Linting @fox/login" echo "$(ng l file-maintenance > ./logs/lint-file-maintenance.log 2>&1 ; echo $?)" > EC_LINT_FILE_MAINTENANCE.var & PID_LINT_FILE_MAINTENANCE=$! echo "Linting @fox/file-maintenance" echo "$(ng l claim-pdf > ./logs/lint-claim-pdf.log 2>&1 ; echo $?)" > EC_LINT_CLAIM_PDF.var & PID_LINT_CLAIM_PDF=$! echo "Linting @fox/claim-pdf" echo "$(ng l eob-material-pdf > ./logs/lint-eob-material-pdf.log 2>&1 ; echo $?)" > EC_LINT_EOB_MATERIAL_PDF.var & PID_LINT_EOB_MATERIAL_PDF=$! echo "Linting @fox/eob-material-pdf" echo "$(ng l home > ./logs/lint-home.log 2>&1 ; echo $?)" > EC_LINT_HOME.var & PID_LINT_HOME=$! echo "Linting @fox/home" echo "$(ng l processing > ./logs/lint-processing.log 2>&1 ; echo $?)" > EC_LINT_PROCESSING.var & PID_LINT_PROCESSING=$! echo "Linting @fox/processing" echo "$(ng l quality-review > ./logs/lint-quality-review.log 2>&1 ; echo $?)" > EC_LINT_QUALITY_REVIEW.var & PID_LINT_QUALITY_REVIEW=$! echo "Linting @fox/quality-review" echo "$(ng l check-recovery > ./logs/lint-check-recovery.log 2>&1 ; echo $?)" > EC_LINT_CHECK_RECOVERY.var & PID_LINT_CHECK_RECOVERY=$! echo "Linting @fox/check-recovery" echo "$(ng l communication > ./logs/lint-communication.log 2>&1 ; echo $?)" > EC_LINT_COMMUNICATION.var & PID_LINT_COMMUNICATION=$! echo "Linting @fox/communication" echo "$(ng l member-info > ./logs/lint-member-info.log 2>&1 ; echo $?)" > EC_LINT_MEMBER_INFO.var & PID_LINT_MEMBER_INFO=$! echo "Linting @fox/member-info" echo "$(ng l shared > ./logs/lint-shared.log 2>&1 ; echo $?)" > EC_LINT_SHARED.var & PID_LINT_SHARED=$! echo "Linting @fox/shared" echo "$(ng l fox-ui-client > ./logs/lint-fox-ui-client.log 2>&1 ; echo $?)" > EC_LINT_FOX_UI_CLIENT.var & PID_LINT_FOX_UI_CLIENT=$! echo "Linting fox-ui-client" echo "$(ng l document-repository > ./logs/lint-document-repository.log 2>&1 ; echo $?)" > EC_LINT_DOCUMENT_REPOSITORY.var & PID_LINT_DOCUMENT_REPOSITORY=$! echo "Linting @fox/document-repository" # - End Linting- # - Build top project - state-management echo "$(ng b state-management > ./logs/build-state-management.log 2>&1 ; echo $?)" > EC_BUILD_STATE_MANAGEMENT.var & PID_BUILD_STATE_MANAGEMENT=$! echo "Building @fox/state-management" # Wait for the linting, then wait for the build wait ${PID_LINT_STATE_MANAGEMENT} ${PID_LINT_REST_CLIENTS} ${PID_LINT_TEST_SUPPORT} ${PID_LINT_SHARED} ${PID_LINT_LOGIN} ${PID_LINT_FILE_MAINTENANCE} ${PID_LINT_CLAIM_PDF} ${PID_LINT_EOB_MATERIAL_PDF} ${PID_LINT_HOME} ${PID_LINT_FOX_UI_CLIENT} ${PID_LINT_PROCESSING} ${PID_LINT_QUALITY_REVIEW} ${PID_LINT_COMMUNICATION} ${PID_LINT_DOCUMENT_REPOSITORY} ${PID_LINT_MEMBER_INFO} ${PID_LINT_CHECK_RECOVERY} EC_LINT_STATE_MANAGEMENT=$(cat EC_LINT_STATE_MANAGEMENT.var) EC_LINT_REST_CLIENTS=$(cat EC_LINT_REST_CLIENTS.var) EC_LINT_TEST_SUPPORT=$(cat EC_LINT_TEST_SUPPORT.var) EC_LINT_SHARED=$(cat EC_LINT_SHARED.var) EC_LINT_LOGIN=$(cat EC_LINT_LOGIN.var) EC_LINT_FILE_MAINTENANCE=$(cat EC_LINT_FILE_MAINTENANCE.var) EC_LINT_CLAIM_PDF=$(cat EC_LINT_CLAIM_PDF.var) EC_LINT_EOB_MATERIAL_PDF=$(cat EC_LINT_EOB_MATERIAL_PDF.var) EC_LINT_HOME=$(cat EC_LINT_HOME.var) EC_LINT_PROCESSING=$(cat EC_LINT_PROCESSING.var) EC_LINT_QUALITY_REVIEW=$(cat EC_LINT_QUALITY_REVIEW.var) EC_LINT_FOX_UI_CLIENT=$(cat EC_LINT_FOX_UI_CLIENT.var) EC_LINT_CHECK_RECOVERY=$(CAT EC_LINT_CHECK_RECOVERY.var) EC_LINT_DOCUMENT_REPOSITORY=$(cat EC_LINT_DOCUMENT_REPOSITORY.var) EC_LINT_COMMUNICATION=$(cat EC_LINT_COMMUNICATION.var) EC_LINT_MEMBER_INFO=$(cat EC_LINT_MEMBER_INFO.var) check_exit_code ${EC_LINT_STATE_MANAGEMENT} "lint" "state-management" check_exit_code ${EC_LINT_REST_CLIENTS} "lint" "rest-clients" check_exit_code ${EC_LINT_TEST_SUPPORT} "lint" "test-support" check_exit_code ${EC_LINT_SHARED} "lint" "shared" check_exit_code ${EC_LINT_LOGIN} "lint" "login" check_exit_code ${EC_LINT_FILE_MAINTENANCE} "lint" "file-maintenance" check_exit_code ${EC_LINT_CLAIM_PDF} "lint" "claim-pdf" check_exit_code ${EC_LINT_EOB_MATERIAL_PDF} "lint" "eob-material-pdf" check_exit_code ${EC_LINT_FOX_UI_CLIENT} "lint" "fox-ui-client" check_exit_code ${EC_LINT_HOME} "lint" "home" check_exit_code ${EC_LINT_PROCESSING} "lint" "processing" check_exit_code ${EC_LINT_QUALITY_REVIEW} "lint" "quality-review" check_exit_code ${EC_LINT_CHECK_RECOVERY} "lint" "check-recovery" check_exit_code ${EC_LINT_COMMUNICATION} "lint" "communication" check_exit_code ${EC_LINT_DOCUMENT_REPOSITORY} "lint" "document-repository" check_exit_code ${EC_LINT_MEMBER_INFO} "lint" "member-info" exit_on_job_failure \ "${EC_LINT_STATE_MANAGEMENT} ${EC_LINT_REST_CLIENTS} ${EC_LINT_TEST_SUPPORT} ${EC_LINT_SHARED} ${EC_LINT_LOGIN} ${EC_LINT_FILE_MAINTENANCE} ${EC_LINT_EOB_MATERIAL_PDF} ${EC_LINT_FOX_UI_CLIENT} ${EC_LINT_HOME} ${EC_LINT_PROCESSING} ${EC_LINT_QUALITY_REVIEW} ${EC_LINT_COMMUNICATION} ${EC_LINT_DOCUMENT_REPOSITORY} ${EC_LINT_MEMBER_INFO} ${EC_LINT_CHECK_RECOVERY}" \ "${PID_LINT_STATE_MANAGEMENT} ${PID_LINT_REST_CLIENTS} ${PID_LINT_TEST_SUPPORT} ${PID_LINT_SHARED} ${PID_LINT_LOGIN} ${PID_LINT_FILE_MAINTENANCE} ${PID_LINT_EOB_MATERIAL_PDF} ${PID_LINT_HOME} ${PID_LINT_FOX_UI_CLIENT} ${PID_BUILD_STATE_MANAGEMENT} ${PID_LINT_PROCESSING} ${PID_LINT_QUALITY_REVIEW} ${PID_LINT_COMMUNICATION} ${PID_LINT_DOCUMENT_REPOSITORY} ${PID_LINT_MEMBER_INFO} ${PID_LINT_CHECK_RECOVERY}" wait ${PID_BUILD_STATE_MANAGEMENT} EC_BUILD_STATE_MANAGEMENT=$(cat EC_LINT_STATE_MANAGEMENT.var) check_exit_code ${EC_BUILD_STATE_MANAGEMENT} "build" "state-management" exit_on_job_failure "${EC_BUILD_STATE_MANAGEMENT}" "${PID_BUILD_STATE_MANAGEMENT}" # - End build top project - # End Building Layer 1: No pre-requisites # Building Layer 2: Requires state-management echo "$(ng t state-management --passWithNoTests > ./logs/test-state-management.log 2>&1 ; echo $?)" > EC_TEST_STATE_MANAGEMENT.var & PID_TEST_STATE_MANAGEMENT=$! echo "Unit Testing @fox/state-management" echo "$(ng b rest-clients > ./logs/build-rest-clients.log 2>&1 ; echo $?)" > EC_BUILD_REST_CLIENTS.var & PID_BUILD_REST_CLIENTS=$! echo "Building @fox/rest-clients" wait ${PID_BUILD_REST_CLIENTS} ${PID_TEST_STATE_MANAGEMENT} EC_BUILD_REST_CLIENTS=$(cat EC_LINT_REST_CLIENTS.var) EC_TEST_STATE_MANAGEMENT=$(cat EC_TEST_STATE_MANAGEMENT.var) check_exit_code ${EC_BUILD_REST_CLIENTS} "build" "rest-clients" check_exit_code ${EC_TEST_STATE_MANAGEMENT} "test" "state-management" exit_on_job_failure "${EC_BUILD_REST_CLIENTS} ${EC_TEST_STATE_MANAGEMENT}" "${PID_BUILD_REST_CLIENTS} ${PID_TEST_STATE_MANAGEMENT}" ## End Building Layer 2: Requires state-management ## Building Layer 3: Requires rest-clients echo "$(ng t rest-clients --passWithNoTests > ./logs/test-rest-clients.log 2>&1 ; echo $?)" > EC_TEST_REST_CLIENTS.var & PID_TEST_REST_CLIENTS=$! echo "Unit Testing @fox/rest-clients" echo "$(ng b test-support > ./logs/build-test-support.log 2>&1 ; echo $?)" > EC_BUILD_TEST_SUPPORT.var & PID_BUILD_TEST_SUPPORT=$! echo "Building @fox/test-support" wait ${PID_BUILD_TEST_SUPPORT} ${PID_TEST_REST_CLIENTS} EC_BUILD_TEST_SUPPORT=$(cat EC_LINT_TEST_SUPPORT.var) EC_TEST_REST_CLIENTS=$(cat EC_TEST_REST_CLIENTS.var) check_exit_code ${EC_BUILD_TEST_SUPPORT} "build" "test-support" check_exit_code ${EC_TEST_REST_CLIENTS} "test" "rest-clients" exit_on_job_failure "${EC_TEST_REST_CLIENTS} ${EC_BUILD_TEST_SUPPORT}" "${PID_TEST_REST_CLIENTS} ${PID_BUILD_TEST_SUPPORT}" ## End Building Layer 3: Requires rest-clients ## Building Layer 4: Requires test-support echo "$(ng b shared > ./logs/build-shared.log 2>&1 ; echo $?)" > EC_BUILD_SHARED.var & PID_BUILD_SHARED=$! echo "Building @fox/shared" wait ${PID_BUILD_SHARED} EC_BUILD_SHARED=$(cat EC_BUILD_SHARED.var) check_exit_code ${EC_BUILD_SHARED} "build" "shared" exit_on_job_failure "${EC_BUILD_SHARED}" "${PID_BUILD_SHARED}" # End Building Layer 4: Requires test-support # Building Layer 5: Requires shared echo "$(ng t shared --passWithNoTests > ./logs/test-shared.log 2>&1 ; echo $?)" > EC_TEST_SHARED.var & PID_TEST_SHARED=$! echo "Unit Testing @fox/shared" echo "$(ng b login > ./logs/build-login.log 2>&1 ; echo $?)" > EC_BUILD_LOGIN.var & PID_BUILD_LOGIN=$! echo "Building @fox/login" echo "$(ng b file-maintenance > ./logs/build-file-maintenance.log 2>&1 ; echo $?)" > EC_BUILD_FILE_MAINTENANCE.var & PID_BUILD_FILE_MAINTENANCE=$! echo "Building @fox/file-maintenance" echo "$(ng b claim-pdf > ./logs/build-claim-pdf.log 2>&1 ; echo $?)" > EC_BUILD_CLAIM_PDF.var & PID_BUILD_CLAIM_PDF=$! echo "Building @fox/claim-pdf" echo "$(ng b eob-material-pdf > ./logs/build-eob-material-pdf.log 2>&1 ; echo $?)" > EC_BUILD_EOB_MATERIAL_PDF.var & PID_BUILD_EOB_MATERIAL_PDF=$! echo "Building @fox/eob-material-pdf" echo "$(ng b home > ./logs/build-home.log 2>&1 ; echo $?)" > EC_BUILD_HOME.var & PID_BUILD_HOME=$! echo "Building @fox/home" echo "$(ng b processing > ./logs/build-processing.log 2>&1 ; echo $?)" > EC_BUILD_PROCESSING.var & PID_BUILD_PROCESSING=$! echo "Building @fox/processing" echo "$(ng b communication > ./logs/build-communication.log 2>&1 ; echo $?)" > EC_BUILD_COMMUNICATION.var & PID_BUILD_COMMUNICATION=$! echo "Building @fox/communication" echo "$(ng b member-info > ./logs/build-member-info.log 2>&1 ; echo $?)" > EC_BUILD_MEMBER_INFO.var & PID_BUILD_MEMBER_INFO=$! echo "Building @fox/member-info" echo "$(ng b quality-review > ./logs/build-quality-review.log 2>&1 ; echo $?)" > EC_BUILD_QUALITY_REVIEW.var & PID_BUILD_QUALITY_REVIEW=$! echo "Building @fox/quality-review" echo "$(ng b document-repository > ./logs/build-document-repository.log 2>&1 ; echo $?)" > EC_BUILD_DOCUMENT_REPOSITORY.var & PID_BUILD_DOCUMENT_REPOSITORY=$! echo "Building @fox/document-repository" wait ${PID_BUILD_FILE_MAINTENANCE} ${PID_BUILD_DOCUMENT_REPOSITORY} ${PID_BUILD_LOGIN} ${PID_TEST_SHARED} ${PID_BUILD_CLAIM_PDF} ${PID_BUILD_EOB_MATERIAL_PDF} ${PID_BUILD_HOME} ${PID_BUILD_PROCESSING} ${PID_BUILD_QUALITY_REVIEW} ${PID_BUILD_COMMUNICATION} ${PID_BUILD_MEMBER_INFO} EC_BUILD_LOGIN=$(cat EC_BUILD_LOGIN.var) EC_BUILD_FILE_MAINTENANCE=$(cat EC_BUILD_FILE_MAINTENANCE.var) EC_BUILD_CLAIM_PDF=$(cat EC_BUILD_CLAIM_PDF.var) EC_TEST_SHARED=$(cat EC_TEST_SHARED.var) EC_BUILD_EOB_MATERIAL_PDF=$(cat EC_BUILD_EOB_MATERIAL_PDF.var) EC_BUILD_HOME=$(cat EC_BUILD_HOME.var) EC_BUILD_PROCESSING=$(cat EC_BUILD_PROCESSING.var) EC_BUILD_QUALITY_REVIEW=$(cat EC_BUILD_QUALITY_REVIEW.var) EC_BUILD_DOCUMENT_REPOSITORY=$(cat EC_BUILD_DOCUMENT_REPOSITORY.var) EC_BUILD_COMMUNICATION=$(cat EC_BUILD_COMMUNICATION.var) EC_BUILD_MEMBER_INFO=$(cat EC_BUILD_MEMBER_INFO.var) check_exit_code ${EC_BUILD_LOGIN} "build" "login" check_exit_code ${EC_BUILD_FILE_MAINTENANCE} "build" "file-maintenance" check_exit_code ${EC_BUILD_CLAIM_PDF} "build" "claim-pdf" check_exit_code ${EC_TEST_SHARED} "test" "shared" check_exit_code ${EC_BUILD_EOB_MATERIAL_PDF} "build" "eob-material-pdf" check_exit_code ${EC_BUILD_HOME} "build" "home" check_exit_code ${EC_BUILD_PROCESSING} "build" "processing" check_exit_code ${EC_BUILD_QUALITY_REVIEW} "build" "quality-review" check_exit_code ${EC_BUILD_DOCUMENT_REPOSITORY} "build" "document-repository" check_exit_code ${EC_BUILD_COMMUNICATION} "build" "communication" check_exit_code ${EC_BUILD_MEMBER_INFO} "build" "member-info" exit_on_job_failure \ "${EC_TEST_SHARED} ${EC_BUILD_LOGIN} ${EC_BUILD_FILE_MAINTENANCE} ${EC_BUILD_CLAIM_PDF} ${EC_BUILD_EOB_MATERIAL_PDF} ${EC_BUILD_HOME} ${EC_BUILD_PROCESSING} ${EC_BUILD_QUALITY_REVIEW} ${EC_BUILD_COMMUNICATION} ${EC_BUILD_DOCUMENT_REPOSITORY} ${EC_BUILD_MEMBER_INFO}" \ "${PID_TEST_SHARED} ${PID_BUILD_LOGIN} ${PID_BUILD_FILE_MAINTENANCE} ${PID_BUILD_CLAIM_PDF} ${PID_BUILD_EOB_MATERIAL_PDF} ${PID_BUILD_HOME} ${PID_BUILD_PROCESSING} ${PID_BUILD_QUALITY_REVIEW} ${PID_BUILD_COMMUNICATION} ${PID_BUILD_DOCUMENT_REPOSITORY} ${PID_BUILD_MEMBER_INFO}" ## End Building Layer 5: Requires shared echo "$(ng b check-recovery > ./logs/build-check-recovery.log 2>&1 ; echo $?)" > EC_BUILD_CHECK_RECOVERY.var & PID_BUILD_CHECK_RECOVERY=$! echo "Building @fox/check-recovery" wait ${PID_BUILD_CHECK_RECOVERY} EC_BUILD_CHECK_RECOVERY=$(cat EC_BUILD_CHECK_RECOVERY.var) check_exit_code ${EC_BUILD_CHECK_RECOVERY} "build" "check-recovery" exit_on_job_failure \ "${EC_BUILD_CHECK_RECOVERY}" \ "${PID_BUILD_CHECK_RECOVERY}" ## Building Layer 6: Requires feature modules echo "$(ng t login --passWithNoTests > ./logs/test-login.log 2>&1 ; echo $?)" > EC_TEST_LOGIN.var & PID_TEST_LOGIN=$! echo "Unit Testing @fox/login" echo "$(ng t file-maintenance --passWithNoTests > ./logs/test-file-maintenance.log 2>&1 ; echo $?)" > EC_TEST_FILE_MAINTENANCE.var & PID_TEST_FILE_MAINTENANCE=$! echo "Unit Testing @fox/file-maintenance" echo "$(ng t document-repository --passWithNoTests > ./logs/test-document-repository.log 2>&1 ; echo $?)" > EC_TEST_DOCUMENT_REPOSITORY.var & PID_TEST_DOCUMENT_REPOSITORY=$! echo "Unit Testing @fox/document-repository" echo "$(ng t claim-pdf --passWithNoTests > ./logs/test-claim-pdf.log 2>&1 ; echo $?)" > EC_TEST_CLAIM_PDF.var & PID_TEST_CLAIM_PDF=$! echo "Unit Testing @fox/claim-pdf" echo "$(ng t eob-material-pdf --passWithNoTests > ./logs/test-eob-material-pdf.log 2>&1 ; echo $?)" > EC_TEST_EOB_MATERIAL_PDF.var & PID_TEST_EOB_MATERIAL_PDF=$! echo "Unit Testing @fox/eob-material-pdf" echo "$(ng t home --passWithNoTests > ./logs/test-home.log 2>&1 ; echo $?)" > EC_TEST_HOME.var & PID_TEST_HOME=$! echo "Unit Testing @fox/home" echo "$(ng t processing --passWithNoTests > ./logs/test-processing.log 2>&1 ; echo $?)" > EC_TEST_PROCESSING.var & PID_TEST_PROCESSING=$! echo "Unit Testing @fox/processing" echo "$(ng t quality-review --passWithNoTests > ./logs/test-quality-review.log 2>&1 ; echo $?)" > EC_TEST_QUALITY_REVIEW.var & PID_TEST_QUALITY_REVIEW=$! echo "Unit Testing @fox/quality-review" echo "$(ng t check-recovery --passWithNoTests > ./logs/test-check-recovery.log 2>&1 ; echo $?)" > EC_TEST_CHECK_RECOVERY.var & PID_TEST_CHECK_RECOVERY=$! echo "Unit Testing @fox/check-recovery" echo "$(ng t communication --passWithNoTests > ./logs/test-communication.log 2>&1 ; echo $?)" > EC_TEST_COMMUNICATION.var & PID_TEST_COMMUNICATION=$! echo "Unit Testing @fox/communication" echo "$(ng t member-info --passWithNoTests > ./logs/test-member-info.log 2>&1 ; echo $?)" > EC_TEST_MEMBER_INFO.var & PID_TEST_MEMBER_INFO=$! echo "Unit Testing @fox/member-info" echo "$(ng t fox-ui-client --passWithNoTests > ./logs/test-fox-ui-client.log 2>&1 ; echo $?)" > EC_TEST_FOX_UI_CLIENT.var & PID_TEST_FOX_UI_CLIENT=$! echo "Unit Testing fox-ui-client" echo "$(ng e --protractor-config protractor-mock.conf.js --configuration=mock --port 4299 > ./logs/e2e-fox-ui.log 2>&1 ; echo $?)" > EC_E2E_FOX_UI.var & PID_E2E_FOX_UI=$! echo "E2E Testing FOX UI" echo "$(node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng b --prod=true > ./logs/build-fox-ui-client.log 2>&1 ; echo $?)" > EC_BUILD_FOX_UI_CLIENT.var & PID_BUILD_FOX_UI_CLIENT=$! echo "Building fox-ui-client" ## End Building Layer 6: Requires feature modules wait ${PID_TEST_FOX_UI_CLIENT} ${PID_TEST_LOGIN} ${PID_TEST_FILE_MAINTENANCE} ${PID_TEST_CLAIM_PDF} ${PID_TEST_HOME} ${PID_TEST_PROCESSING} ${PID_TEST_QUALITY_REVIEW} ${PID_TEST_DOCUMENT_REPOSITORY} ${PID_TEST_COMMUNICATION} ${PID_TEST_MEMBER_INFO} ${PID_TEST_CHECK_RECOVERY} EC_TEST_FOX_UI_CLIENT=$(cat EC_TEST_FOX_UI_CLIENT.var) EC_TEST_LOGIN=$(cat EC_TEST_LOGIN.var) EC_TEST_FILE_MAINTENANCE=$(cat EC_TEST_FILE_MAINTENANCE.var) EC_TEST_CLAIM_PDF=$(cat EC_TEST_CLAIM_PDF.var) EC_TEST_EOB_MATERIAL_PDF=$(cat EC_TEST_EOB_MATERIAL_PDF.var) EC_TEST_HOME=$(cat EC_TEST_HOME.var) EC_TEST_PROCESSING=$(cat EC_TEST_PROCESSING.var) EC_TEST_QUALITY_REVIEW=$(cat EC_TEST_QUALITY_REVIEW.var) EC_TEST_CHECK_RECOVERY=$(cat EC_TEST_CHECK_RECOVERY.var) EC_TEST_DOCUMENT_REPOSITORY=$(cat EC_TEST_DOCUMENT_REPOSITORY.var) EC_TEST_COMMUNICATION=$(cat EC_TEST_COMMUNICATION.var) EC_TEST_MEMBER_INFO=$(cat EC_TEST_MEMBER_INFO.var) check_exit_code ${EC_TEST_LOGIN} "test" "login" check_exit_code ${EC_TEST_FILE_MAINTENANCE} "test" "file-maintenance" check_exit_code ${EC_TEST_CLAIM_PDF} "test" "claim-pdf" check_exit_code ${EC_TEST_FOX_UI_CLIENT} "test" "fox-ui-client" check_exit_code ${EC_TEST_EOB_MATERIAL_PDF} "test" "eob-material-pdf" check_exit_code ${EC_TEST_HOME} "test" "home" check_exit_code ${EC_TEST_PROCESSING} "test" "processing" check_exit_code ${EC_TEST_QUALITY_REVIEW} "test" "quality-review" check_exit_code ${EC_TEST_CHECK_RECOVERY} "test" "check-recovery" check_exit_code ${EC_TEST_DOCUMENT_REPOSITORY} "test" "document-repository" check_exit_code ${EC_TEST_COMMUNICATION} "test" "communication" check_exit_code ${EC_TEST_MEMBER_INFO} "test" "member-info" exit_on_job_failure \ "${EC_TEST_LOGIN} ${EC_TEST_FILE_MAINTENANCE} ${EC_TEST_FOX_UI_CLIENT} ${EC_TEST_CLAIM_PDF} ${EC_TEST_EOB_MATERIAL_PDF} ${EC_TEST_HOME} ${EC_TEST_PROCESSING} ${EC_TEST_QUALITY_REVIEW} ${EC_TEST_DOCUMENT_REPOSITORY} ${EC_TEST_COMMUNICATION} ${EC_TEST_MEMBER_INFO} ${EC_TEST_CHECK_RECOVERY}" \ "${PID_TEST_LOGIN} ${PID_TEST_FILE_MAINTENANCE} ${PID_TEST_FOX_UI_CLIENT} ${PID_TEST_CLAIM_PDF} ${PID_TEST_EOB_MATERIAL_PDF} ${PID_TEST_HOME} ${PID_TEST_PROCESSING} ${PID_TEST_QUALITY_REVIEW} ${PID_TEST_DOCUMENT_REPOSITORY} ${PID_TEST_COMMUNICATION} ${PID_TEST_MEMBER_INFO} ${PID_TEST_CHECK_RECOVERY}" wait ${PID_E2E_FOX_UI} EC_E2E_FOX_UI=$(cat EC_E2E_FOX_UI.var) check_exit_code ${EC_E2E_FOX_UI} "e2e" "fox-ui" exit_on_job_failure "${EC_E2E_FOX_UI}" "${PID_E2E_FOX_UI}" echo "Waiting for completion" wait ${PID_BUILD_FOX_UI_CLIENT} EC_BUILD_FOX_UI_CLIENT=$(cat EC_BUILD_FOX_UI_CLIENT.var) check_exit_code ${EC_BUILD_FOX_UI_CLIENT} "build" "fox-ui-client" exit_on_job_failure "${EC_BUILD_FOX_UI_CLIENT}" "${PID_BUILD_FOX_UI_CLIENT}" ## Cleanup rm EC_*.var
true
f87e9cd512678f14dace6ca606fe64ee0b24d32c
Shell
sassoftware/rbm
/distro/preconfigure
UTF-8
1,458
2.6875
3
[ "Apache-2.0" ]
permissive
#!/bin/bash # # Copyright (c) SAS Institute 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 or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # pgsql_service=postgresql-updateservice . /etc/sysconfig/pgsql/$pgsql_service export PGDATA PGPORT createuser -SDRU postgres updateservice &>/dev/null createdb -U postgres -E utf8 -O updateservice updateservice &>/dev/null createdb -U postgres -E utf8 -O updateservice upsrv_app &>/dev/null cert_file=/etc/pki/tls/certs/localhost.crt key_file=/etc/pki/tls/private/localhost.key alt_file=/srv/rbuilder/pki/httpd.pem if [ ! -f $cert_file ] then /opt/rmake3/sbin/gencert-rmake -s \ -o $cert_file -O $key_file \ -e 3653 --CN="$(hostname)" \ --O='Auto-Generated' --OU='Default Self-sign Certificate' \ || exit 1 mkdir -p $(dirname $alt_file) tmp_file=$(mktemp --tmpdir=$(dirname $alt_file)) cat $cert_file $key_file > $tmp_file mv $tmp_file $alt_file fi python -mupsrv.conary_schema python -mupsrv.db.schema
true
4f99e490d05fa7d57e98ccfaa9b9b5290fcb6a5b
Shell
nju33/docker-ssl-certification
/check-req.sh
UTF-8
159
2.84375
3
[]
no_license
#!/bin/ash # 証明書の署名要求(CSR) if test `openssl req -text -noout -in "$1" > /dev/null` then echo "$1" is req else echo "$1" is not req fi
true
5f839053723d1974662e78fa8eeb6f8c8024af6b
Shell
coruzzilab/PhyloGeneious
/bin/run_pipeline_pbs.sh
UTF-8
6,217
3.171875
3
[ "MIT" ]
permissive
#!/bin/ksh # # Script for running OrthologID pipeline # This script makes use of PBS for job submission. # # Copyright (C) 2006-2012 Ernest K. Lee # # This file is part of OrthologID. # # OrthologID 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 # (at your option) any later version. # # OrthologID is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with OrthologID. If not, see <http://www.gnu.org/licenses/>. # # # Author: Ernest K Lee <elee@amnh.org> # # mod to run blastp+ by chuck zegar 10/2/2015 # My PBS queue PBSQ="cgsb-s" # Memory size of higher memory node needed for running mcl HIMEM="12GB" ##export OID_USER_DIR=`pwd` ##export OID_HOME=/home/cmz209/orthotnt/OID_nw3 if [[ -z $MY_SHELL ]]; then print -u2 "MY_SHELL not defined - won't restart properly" export MY_SHELL=$0 ## exit 1 fi print "will restart $MY_SHELL" $OID_HOME/bin/gettime.pl >starttime #module load mercurial/intel/2.1.2 #module load mcl/intel/12-068 #module load mafft/intel/6.864 # Check environment variables and user directory #if ! env | grep -q "^OID_HOME="; then # print -u2 "OID_HOME not defined ... exiting" # exit 1 #fi # Get version if [[ -f $OID_HOME/VERSION ]]; then OID_VERSION=$(<$OID_HOME/VERSION) else OID_VERSION="unknown" fi if [[ ! -f $OID_USER_DIR/procfiles.txt ]]; then cp $OID_HOME/config/procfiles.txt $OID_USER_DIR print "copied procfiles.txt from $OID_HOME" fi OID_BIN=$OID_HOME/bin print "oidbin $OID_BIN" #if [[ $# -eq 0 ]] && ! env | grep -q "^OID_USER_DIR="; then # print -u2 "Must specify run directory as argument or define OID_USER_DIR" # exit 1 #elif [[ $# -eq 1 ]]; then # export OID_USER_DIR="$1" #elif [[ $# -gt 1 ]]; then # print -u2 "Usage: $0 [ OID_USER_DIR ]" # exit 2 #fi #if [[ ! -d $OID_USER_DIR ]]; then # print -u2 "OID_USER_DIR \"$OID_USER_DIR\" is not a directory" # exit 1 #fi # Use dir name as run name OID_RUN=$(basename $OID_USER_DIR) print "== Starting OrthologID version $OID_VERSION pipeline ==" print "Run directory is $OID_USER_DIR" # Check/parse config file CONFIG=$OID_USER_DIR/config if [[ ! -f $CONFIG ]]; then print -u2 "Config file required -- a sample is $OID_HOME/config/config " print -u2 "... exiting" exit 1 fi set -A INGROUP $(grep INGROUP $CONFIG | cut -f2 -d=) set -A OUTGROUP $(grep OUTGROUP $CONFIG | cut -f2 -d=) NCPU=$(sed -n 's/^NCPU *= *\([0-9]*\).*/\1/p' $CONFIG) if [[ -z $NCPU ]]; then NCPU=1 fi MAXQS=$(sed -n 's/^MAXQS *= *\([0-9]*\).*/\1/p' $CONFIG) if [[ -z $MAXQS ]]; then MAXQS=1 fi date time # Setup BLAST database print "Setting up BLAST database ..." if [[ ! -d $OID_USER_DIR/blastdb ]]; then print -u2 "Sequence directory \"$OID_USER_DIR/blastdb\" does not exist ... exiting" exit 1 fi $OID_BIN/setup_blastdb.sh "${INGROUP[@]}" "${OUTGROUP[@]}" if [[ $? -ne 0 ]]; then print -u2 "Unable to setup BLAST db ... exiting" exit 1 fi date time # Create relevant directories if [[ ! -d $OID_USER_DIR/blast ]]; then mkdir $OID_USER_DIR/blast fi if [[ ! -d $OID_USER_DIR/data ]]; then mkdir $OID_USER_DIR/data fi if [[ ! -d $OID_USER_DIR/log/job ]]; then mkdir -p $OID_USER_DIR/log/job fi # Generate job script JOB_SCRIPT=$OID_USER_DIR/run_oid_job.sh cat <<EOF >$JOB_SCRIPT #!/bin/sh # # PBS job script for orthologid # #PBS -S /bin/bash #PBS -j oe #PBS -l mem=$HIMEM ##PBS -o /scratch/cmz209/orthotnt/oidTest9/log/job/ #PBS -o log/job/ #PBS -q $PBSQ #PBS -N $OID_RUN #PBS -V PATH=$OID_BIN:$PATH cd \$OID_USER_DIR date time orthologid.pl "\$arg1" "\$arg2" date time if [[ "\$arg1" == "-b" ]]; then touch blast/.\$arg2.done fi EOF # End job script chmod a+x $JOB_SCRIPT # All-all BLAST if [[ ! -s $OID_USER_DIR/blast/blastres.blst ]]; then cp $OID_USER_DIR/blastdb/combined.fa $OID_USER_DIR/blast $OID_HOME/bin/new_blast_parts.pl #make partn.faa (pgm estimates size # NPART = $(/bina/ls OID_USER_DIR/blast/*.* | grep -c ".faa") $OID_HOME/bin/qsblast.pl -g 16 -n 12 -w 12 -q $MAXQS # for i in "${INGROUP[@]}" "${OUTGROUP[@]}" ; do ## print "Submitting job for $i-against-all BLAST..." # qsub -l nodes=1:ppn=$NCPU,walltime=8:00:00 $JOB_SCRIPT -v arg1="-b",arg2="$i" # done # print "Waiting for BLAST jobs to finish ..." #date #time # while sleep 300; do # for i in "${INGROUP[@]}" "${OUTGROUP[@]}" ; do # if [[ ! -f $OID_USER_DIR/blast/.$i.done ]]; then # continue 2 # fi # done # break # done #date #time # print "Merging BLAST data ..." # $OID_BIN/orthologid.pl -B if ! [[ -f $OID_USER_DIR/blast/blastres.blst && -f $OID_USER_DIR/blast/genelen.blst ]]; then print -u2 "Error: failed to generate BLAST results database" exit 1 fi else print "All-aginst-all BLAST results exist ... skipping" fi date time # Create gene families if ! /bin/ls -d $OID_USER_DIR/data/[1-9] >/dev/null 2>&1; then print "Creating families ..." # if [[ -f $OID_USER_DIR/blast/clusters ]]; then # Clustering done, just create family directories $OID_HOME/bin/orthologid.pl -f # else # JOBID=$(qsub -l nodes=1:ppn=$NCPU,walltime=12:00:00 $JOB_SCRIPT -v arg1="-f" | grep '^[0-9]') # # Wait for clustering to finish # while sleep 60; do # if [[ $(qstat $JOBID 2>/dev/null | grep -c $JOBID) -eq 0 ]]; then # break # fi # done # fi if [[ $? -ne 0 ]]; then print -u2 "Family clustering failed!" exit 1 fi else print "Gene families already exist" fi print "running new job select" ## new job to grep all data subdir for Family size $OID_HOME/bin/rdfamdb.pl # rm log/job/schedone while [[ ! -f log/job/schedone ]]; do $OID_HOME/bin/orthologid.pl -s 'hello' if [[ ! -f log/job/schedone ]]; then print "orthologid.pl -s aborted before finish" date fi done; date time # Extract orthologs print "Extracting orthologs ..." $OID_BIN/orthologid.pl -O date time # Generate big matrix print 'Generating matrix ...' $OID_BIN/orth2matrix.pl date time
true
a1b3031cc7cb27d05e0f2eae1c6fc178e4c1da64
Shell
haardikdharma10/landscapeapp
/full_build.sh
UTF-8
1,141
2.96875
3
[ "Apache-2.0" ]
permissive
set -e rm -rf dist || true mkdir -p dist ./node_modules/.bin/babel-node tools/netlifyBuild.js echo "User-agent: *" > dist/robots.txt # comment below when about to test a googlebot rendering echo "Disallow: /" >> dist/robots.txt # This will increase a version and publish to an npm # If there is an existing package if [ "$BRANCH" = "master" ]; then git config --global user.email "info@cncf.io" git config --global user.name "CNCF-bot" git remote rm github 2>/dev/null || true git remote add github "https://$GITHUB_USER:$GITHUB_TOKEN@github.com/cncf/landscapeapp" git fetch github # git diff # Need to comment this when a diff is too large git checkout -- . npm version patch git commit -m 'Update to a new version [skip ci]' --allow-empty --amend git branch -D tmp || true git checkout -b tmp git push github HEAD:master git push github HEAD:master --tags --force echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc git diff npm -q publish || (sleep 5 && npm -q publish) || (sleep 30 && npm -q publish) echo 'Npm package published' ./node_modules/.bin/babel-node tools/netlifyTriggerHooks.js fi
true
7684cfbc024d87b796da0d2404789ac14ee59423
Shell
thiesgehrmann/FungalAssemblerPipeline
/pipeline_tools/shell_functions.sh
UTF-8
664
3.8125
4
[]
no_license
############################################################################### # cmpFastaSeqs # # Compare the FASTA sequences of two fasta files, ignoring case and headers # ############################################################################### function cmpFastaSeqs() { local f1="$1" local f2="$2"; h1=`cat "$f1" | tr '\\n' '|' | sort | cut -d\| -f2 | tr '[:upper:]' '[:lower:]' | md5sum | head -c 32` h2=`cat "$f2" | tr '\\n' '|' | sort | cut -d\| -f2 | tr '[:upper:]' '[:lower:]' | md5sum | head -c 32` if [ "$h1" != "$h2" ]; then echo "1" else echo "0" fi }
true
5a6aad0530bb7126c56604c490b88a48fd468ec7
Shell
GenNextTraining/GitHooks
/git-hooks-state.sh
UTF-8
663
3.84375
4
[]
no_license
#!/bin/sh HOOKSFOLDER='./hooks' error() { echo "Usage: $0 --enable-all" echo "Usage: $0 --disable-all" echo "Usage: $0 --enable [hooks/git-hook/name]" echo "Usage: $0 --disable [hooks/git-hook/name]" exit 1 } if [ -z "$1" ]; then error fi case $1 in "--enable-all") find $HOOKSFOLDER -type f -not -path '*/\.*' -exec chmod +x {} \; ;; "--disable-all") find $HOOKSFOLDER -type f -not -path '*/\.*' -exec chmod -x {} \; ;; "--enable") if [ -z "$2" ]; then error fi chmod +x $2;; "--disable") if [ -z "$2" ]; then error fi chmod -x $2;; *) error;; esac if [ $? -ne 0 ]; then exit 1 fi echo "Done."
true
1b4b1bec386e6367d998f74988829033c3fb8a35
Shell
paulo1410/Shell-Scripting
/backup-amazon.sh
UTF-8
364
3.21875
3
[]
no_license
#!/bin/bash CAMINHO_BACKUP=~/backup_mutillidae_amazon cd $CAMINHO_BACKUP data=$(date +%F) if [ ! -d $data ] then mkdir $data fi tabelas=$(mysql -u root mutillidae -e "show tables;" | grep -v Tables) for tabela in $tabelas do mysqldump -u root mutillidae $tabela > $CAMINHO_BACKUP/$data/$tabela.sql done aws s3 sync $CAMINHO_BACKUP s3://shellscript2
true
1fe83707a0cdd3b70a45942f804fce6d26558c86
Shell
nicolaspucci1989/proyecto_sdn
/funcionamiento/namespaces.sh
UTF-8
1,071
2.546875
3
[]
no_license
# Comportamiento tradicional como L2SWITCH: # ovs-ofctl add-flow OVS1 actions=NORMAL # crear namespaces ip netns add red ip netns add green # crear switch ovs-vsctl add-br OVS1 # crear interface virtual ethernet ip link add eth0-r type veth peer name veth-r # conectamos un extremo al namspace ip link set eth0-r netns red # conectamos el otro extremo al switch ovs-vsctl add-port OVS1 veth-r # repetimos para el otro namespace ip link add eth0-g type veth peer name veth-g ip link set eth0-g netns green ovs-vsctl add-port OVS1 veth-g # Levantar interfaces y asignar direcciones ip link set veth-r up ip netns exec red ip link set dev lo up ip netns exec red ip link set dev eth0-r up ip netns exec red ip address add 10.0.0.1/24 dev eth0-r ip link set dev veth-g up ip netns exec green ip link set dev lo up ip netns exec green ip link set dev eth0-g up # setear MAC ip netns exec red ip link set eth0-r address 00:00:00:00:00:01 ip netns exec green ip link set eth0-g address 00:00:00:00:00:02 # ping ip netns exec green ip address add 10.0.0.2/24 dev eth0-g
true
aed57ce212ec3b6017fe571e7a87872938ef5a2f
Shell
satmovi/ChargeMonk
/restart_server.sh
UTF-8
681
2.84375
3
[]
no_license
#!/usr/bin/env bash echo "Exporting environment variables" export PERL5LIB=./lib:$PERL5LIB export CHARGEMONK_HOME=/projects/chargemonk/ export CHARGEMONK_PORT=3000 export CHARGEMONK_HOST=0.0.0.0 echo 'pid ' `cat ./chargemonk.pid` ' found, killing it ... ' cat $CHARGEMONK_HOME/chargemonk.pid | xargs kill -9 perl -w $CHARGEMONK_HOME/script/chargemonk_server.pl --pidfile $CHARGEMONK_HOME/chargemonk.pid --host $CHARGEMONK_HOST --port $CHARGEMONK_PORT >> logs/chargemonk_error.log 2>&1 & sleep 3; pid=`cat $CHARGEMONK_HOME/chargemonk.pid` echo $pid; echo "Started process $pid. Application availble on http://localhost:$CHARGEMONK_PORT/, log is in logs/chargemonk_error.log"
true
404969cb02cbddb74aa1b70341e673660d7820c8
Shell
libingnan11/5OH
/src/old_code/prev_workflow/3_webpath.sh
UTF-8
1,611
3.1875
3
[]
no_license
#! /usr/bin/env bash #BSUB -J webpath #BSUB -o err-out/%J.%I.out #BSUB -e err-out/%J.%I.err set -o nounset -o pipefail -o errexit -x LSB_JOBINDEX=1 source config.sh trackfile=${WEBFOLDER}${PROJECTDIR}/tracks.txt if [[ ! -d ${WEBFOLDER}${PROJECTDIR} ]]; then mkdir ${WEBFOLDER}${PROJECTDIR} fi if [[ -f $trackfile ]]; then rm -r $trackfile touch $trackfile fi NAMEPREFIX="" for ((i=0; i<${numBarcodes}; i++)); do prefix=${BARCODES[$i]} NORM_BGFILE=$prefix.norm.bg NORM_POSBGFILE=$prefix.norm.pos.bg NORM_NEGBGFILE=$prefix.norm.neg.bg BIGWIG="$prefix.bw" BIGWIGPOS="$prefix.pos.bw" BIGWIGNEG="$prefix.neg.bw" bedGraphToBigWig $NORM_BGFILE $CHROMSIZES $BIGWIG bedGraphToBigWig $NORM_POSBGFILE $CHROMSIZES $BIGWIGPOS bedGraphToBigWig $NORM_NEGBGFILE $CHROMSIZES $BIGWIGNEG cp $BIGWIG ${WEBFOLDER}${PROJECTDIR}/. cp $BIGWIGPOS ${WEBFOLDER}${PROJECTDIR}/. cp $BIGWIGNEG ${WEBFOLDER}${PROJECTDIR}/. echo 'track type=bigWig name="'${NAMEPREFIX}''${prefix}_all'" description="'${DESCRS[$i]} all'" bigDataUrl="'${SANDBOX}${PROJECTDIR}/${BIGWIG}'" maxHeightPixels=50:35:25 visibility=full color='${COLORS[$i]} >> $trackfile echo 'track type=bigWig name="'${NAMEPREFIX}''${prefix}_pos'" description="'${DESCRS[$i]}_pos'" bigDataUrl="'${SANDBOX}${PROJECTDIR}/${BIGWIGPOS}'" maxHeightPixels=50:35:25 visibility=full color='${COLORS[$i]} >> $trackfile echo 'track type=bigWig name="'${NAMEPREFIX}''${prefix}_neg'" description="'${DESCRS[$i]}_neg'" bigDataUrl="'${SANDBOX}${PROJECTDIR}/${BIGWIGNEG}'" maxHeightPixels=50:35:25 visibility=full color='${COLORS[$i]} >> $trackfile done
true
bd354e00a3597dea1c49d99e69f26a3d42c11169
Shell
sebastianmanger/ethiopia-replication-poc
/nodes/district_one/setup.sh
UTF-8
1,857
2.765625
3
[]
no_license
#!/bin/sh # Setup this 'node' psql -U postgres -d test -c "SELECT pglogical.drop_node('district_one', true)" psql -U postgres -d test -c "SELECT pglogical.create_node( node_name := 'district_one', dsn := 'host=district_one port=5432 dbname=test user=replication' );" # Create a dummy table. # Note: this table has an additional column: 'tmp'. As this is not set in 'columns' for the replication set (see below) # this is not replicated --> this means that not all nodes must use an identical scheme - and the PHP application # which provides the schema changes may be newer on some nodes than on others. psql -U postgres -d test -c "DROP TABLE IF EXISTS slm" psql -U postgres -d test -c "CREATE TABLE slm ( uuid uuid primary key DEFAULT uuid_generate_v4(), public bool, name varchar(40), tmp varchar(40), parent uuid NULL );" # This is the data that is 'replicated' to all nodes that have a subscription to this node. psql -U postgres -d test -c "INSERT INTO slm values (uuid_generate_v4(), true, 'district one: first public entry', 'this is not in the replication');" psql -U postgres -d test -c "INSERT INTO slm values (uuid_generate_v4(), false, 'district one: first non-public entry', 'this not in the replication');" psql -U postgres -d test -c "INSERT INTO slm values (uuid_generate_v4(), true, 'district two: second public entry', 'this is in the replication, with parent', '4f6df35c-324e-461e-a6c3-95e36fb0392c');" # Provide data for 'subscribers' (in this case: region_one) psql -U postgres -d test -c "select pglogical.create_replication_set('replicate_db_test');" psql -U postgres -d test -c "select pglogical.replication_set_add_table( set_name := 'replicate_db_test', relation := 'slm', synchronize_data := true, row_filter := 'public = true', columns := array['uuid', 'name', 'parent'] );"
true
4b6cacc998e045c0a08ba87f139b169a21e2f409
Shell
dgarcia2/linux-scripts
/sumapro.sh
UTF-8
179
3.234375
3
[]
no_license
#!/bin/sh read -p "Introduce un numero: " numero1 read -p "Introduce otro numero: " numero2 resultado=`expr ${numero1} + ${numero2}` echo El resultado de la suma: ${resultado}
true
30931c0c57cb7a8f5a5ea5476ea5a910697a8599
Shell
pruje/ssh-notify
/uninstall.sh
UTF-8
682
3.515625
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
#!/bin/bash # # ssh-notify uninstall script # # MIT License # Copyright (c) 2017-2021 Jean Prunneaux # Website: https://github.com/pruje/ssh-notify # # load libbash source "$(dirname "$0")"/libbash/libbash.sh - &> /dev/null if [ $? != 0 ] ; then echo >&2 "internal error" exit 1 fi if [ "$lb_current_user" != root ] ; then lb_error "You must be root to uninstall ssh-notify" exit 1 fi # edit sshrc if [ -f /etc/ssh/sshrc ] ; then if ! lb_edit '/ssh-notify/d' /etc/ssh/sshrc ; then lb_error "sshrc cannot be changed" lb_exitcode=3 fi fi # delete sudoers file if ! rm -f /etc/sudoers.d/ssh-notify ; then lb_error "sudoers file cannot be deleted" lb_exitcode=3 fi lb_exit
true
9e093079024af77fb534da07d04faaf609468be7
Shell
mattiapenati/mk
/pkgs/metis/PKGBUILD
UTF-8
2,078
3.453125
3
[]
no_license
#!/bin/bash pkgname=metis pkgver=5 dstdir=$mkToolchainPkgs/$pkgname/$pkgver metisver=5.1.0 metisarchive=metis-$metisver.tar.gz metisurl=http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/$metisarchive metissum=4722c647024271540f2adcf83456ebdeb1b7d6a6 parmetisver=4.0.3 parmetisarchive=parmetis-$parmetisver.tar.gz parmetisurl=http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/$parmetisarchive parmetissum=e0df69b037dd43569d4e40076401498ee5aba264 build() { download $metisurl download $parmetisurl check $metisarchive $metissum check $parmetisarchive $parmetissum extract $metisarchive extract $parmetisarchive # fix metis version pushd parmetis-$parmetisver [[ -r $srcdir/parmetis-$parmetisver.patch ]] && \ patch -p1 -i $srcdir/parmetis-$parmetisver.patch rm -rf metis ln -sf ../metis-$metisver metis popd pushd parmetis-$parmetisver/build message "Configuring $pkgname" cmake -D CMAKE_INSTALL_PREFIX="$dstdir" \ -D CMAKE_SKIP_INSTALL_RPATH=ON \ -D CMAKE_SKIP_RPATH=ON \ -D CMAKE_BUILD_TYPE=Release \ -D SHARED=ON \ .. message "Compiling $pkgname" make popd } package() { make -C parmetis-$parmetisver/build install # cleaning strip $dstdir/bin strip $dstdir/lib # module if [[ "$mkTest" = "no" ]]; then install -vd $mkToolchainModules/$pkgname cat > $mkToolchainModules/$pkgname/$pkgver.lua << EOF -- -*- lua -*- whatis("Serial and parallel graph partitioning and fill-reducing ordering.") help([[ This package includes both the serial and parallel versions of METIS library, also known as METIS and ParMETIS respectively. They are install the in the directory "\$mkMetisPrefix", the dynamic libraries are located in "\$mkMetisLib" directory and headers files in "\$mkMetisInc". url: http://glaros.dtc.umn.edu/gkhome/views/metis ]]) setenv("mkMetisPrefix", "$dstdir") setenv("mkMetisLib", "$dstdir/lib") setenv("mkMetisInc", "$dstdir/include") prepend_path("PATH", "$dstdir/bin") prepend_path("LD_LIBRARY_PATH", "$dstdir/lib") EOF fi }
true
aa9dce84d4c42cd8248dfbb4da05c756e75036f4
Shell
ShalokShalom/plan.sh
/python2-docutils/plan.sh
UTF-8
827
2.65625
3
[ "Apache-2.0" ]
permissive
pkg_origin=cosmos pkg_name=python2-docutils pkgbase=docutils pkg_version=0.13.1 pkg_description="Set of tools for processing plaintext docs into formats such as HTML, XML, or LaTeX" pkg_upstream_url="http://docutils.sourceforge.net" pkg_license=('custom') pkg_deps=('python2') pkg_source=("http://downloads.sourceforge.net/docutils/docutils-$pkg_version.tar.gz") pkg_shasum=('ea4a893c633c788be9b8078b6b305d53') do_build() { python2 setup.py build } do_package() { python2 setup.py install --root=${CACHE_PATH} --optimize=1 for _f in ${CACHE_PATH}/usr/bin/*.py; do ln -s $(basename $_f) ${CACHE_PATH}/usr/bin/$(basename $_f .py) done install -D -m644 COPYING.txt ${CACHE_PATH}/usr/share/licenses/${pkg_name}/COPYING.txt install -D -m644 licenses/python* ${CACHE_PATH}/usr/share/licenses/${pkg_name}/ }
true
c0b12c297a8dce9cf5b7dfe4009b2a6051b0dfd9
Shell
MougninSLA/var
/www/scripts/add_blacklist.sh
UTF-8
513
3.046875
3
[]
no_license
#!/bin/bash #--------------------------------------------------------------------- #SYM #AJOUT D'UNE LIGNE DANS LA BLACKLIST #AUTEUR MOUGNIN SERGE #Date 14/11/2016 #--------------------------------------------------------------------- if test -z "$1"; then /bin/echo "Erreur ! Entrer en argument l'adresse à blacklister" else #Copie de la ligne /bin/echo "blacklist_from $1" >> /var/lists/blacklist.cf #Redemarrage de Spamassassin /etc/init.d/spamassassin restart fi
true
5b9a7fb43396117d98ebc5a9bddda019dbd7baf0
Shell
hyswqqsl/dbio
/src/csvs/cmall.sh
UTF-8
911
2.640625
3
[]
no_license
#! /bin/bash # Copyright (c) 2013 irondide. # description: Bash中操作MySQL数据库 # license: LGPL # author: the machine of awareness <machine.of.awareness@gmail.com> # version: 1.0 # date: 2013.08.29 # MySQL中导入导出数据时,使用CSV格式时的命令行参数 # CSV标准文档:RFC 4180 SQLCOM="-uroot -p8912737 cmall" IOPATH="/home/machine/workspace/jdee/dbio/src/csvs" TABS="xx_shop xx_merchant xx_merchant_category xx_product xx_merchant_product xx_system_product xx_product_category xx_product_display_category xx_product_product_image xx_area xx_brand xx_company xx_system_product_image xx_attribute xx_attribute_option xx_product_category_brand" for table in $TABS; do echo "desc $table" | /usr/bin/mysql $SQLCOM > $IOPATH/$table.csv mysqldump $SQLCOM $table > $IOPATH/$table.txt done
true
bf26acb6eb791d14c4192cd0f47c7513e142cf3c
Shell
dkwasny/DockerConfig
/build-images.sh
UTF-8
440
3.515625
4
[ "MIT" ]
permissive
#!/bin/bash SCRIPT_DIR="$(dirname $0)"; function build-dockerfile() { IMAGE_NAME="$1"; IMAGE_DIR="$SCRIPT_DIR/docker/$IMAGE_NAME"; docker build \ -f "$IMAGE_DIR/Dockerfile" \ -t "dkwasny/$IMAGE_NAME" \ "$IMAGE_DIR"; } # Build the base images in the proper order. build-dockerfile "base"; build-dockerfile "hadoop-base"; build-dockerfile "hive-base"; # Build all images. for i in $(ls docker); do build-dockerfile "$i"; done;
true
d2144ea1eb3579cf3ef0cffb60baa8726ee05338
Shell
FredKellerman/ZynqMP-FPGA-Linux
/scripts/build-linux-xlnx-v2019.2-zynqmp-fpga.sh
UTF-8
3,581
3.21875
3
[]
no_license
#!/bin/bash CURRENT_DIR=`pwd` LINUX_BUILD_DIR=linux-xlnx-v2019.2-zynqmp-fpga ## Download ATWILC3000 Linux Driver for Ultra96-V2 git clone https://github.com/Avnet/u96v2-wilc-driver.git ## Download Linux Kernel Source git clone --depth 1 -b xilinx-v2019.2.01 https://github.com/Xilinx/linux-xlnx.git $LINUX_BUILD_DIR cd $LINUX_BUILD_DIR git checkout -b linux-xlnx-v2019.2-zynqmp-fpga refs/tags/xilinx-v2019.2.01 ## Patch for linux-xlnx-v2019.2-zynqmp-fpga patch -p1 < ../files/linux-xlnx-v2019.2-zynqmp-fpga.diff git add --update git add arch/arm64/boot/dts/xilinx/zynqmp-uz3eg-iocc.dts git commit -m "[patch] for linux-xlnx-v2019.2-zynqmp-fpga." ## Patch for linux-xlnx-v2019.2-builddeb patch -p1 < ../files/linux-xlnx-v2019.2-builddeb.diff git add --update git commit -m "[update] scripts/package/builddeb to add tools/include and postinst script to header package." ## Patch for linux-xlnx-v2019.2-zynqmp-fpga-clk-divider patch -p1 < ../files/linux-xlnx-v2019.2-zynqmp-fpga-clk-divider.diff git add --update git commit -m "[fix] a bug where 0 was specified for clock divider settings" ## Add ATWILC3000 Linux Driver for Ultra96-V2 cp -r ../u96v2-wilc-driver/wilc drivers/staging/wilc3000/ patch -p1 < ../files/linux-xlnx-v2019.2-zynqmp-fpga-wilc3000.diff git add --update git add drivers/staging/wilc3000 git commit -m "[add] drivers/staging/wilc3000" ## Patch for Ultra96-V2 patch -p1 < ../files/linux-xlnx-v2019.2-zynqmp-fpga-ultra96v2.diff git add --update git add arch/arm64/boot/dts/xilinx/avnet-ultra96v2-rev1.dts git commit -m "[add] devicetree for Ultra96-V2." ## Patch for Xilinx APF Driver patch -p1 < ../files/linux-xlnx-v2019.2-zynqmp-fpga-apf.diff git add --update git commit -m "[add] Xilinx APF driver." ## Create tag and .version git tag -a xilinx-v2019.2-zynqmp-fpga-1 -m "release xilinx-v2019.2-zynqmp-fpga-1" echo 1 > .version ## Setup for Build export ARCH=arm64 export export CROSS_COMPILE=aarch64-linux-gnu- make xilinx_zynqmp_defconfig ## Build Linux Kernel and device tree export DTC_FLAGS=--symbols make deb-pkg ## Build kernel image and devicetree to target/UltraZed-EG-IOCC/boot/ cp arch/arm64/boot/Image ../target/UltraZed-EG-IOCC/boot/image-4.19.0-xlnx-v2019.2-zynqmp-fpga cp arch/arm64/boot/dts/xilinx/zynqmp-uz3eg-iocc.dtb ../target/UltraZed-EG-IOCC/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-uz3eg-iocc.dtb ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/UltraZed-EG-IOCC/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-uz3eg-iocc.dts ../target/UltraZed-EG-IOCC/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-uz3eg-iocc.dtb ## Build kernel image and devicetree to target/Ultra96/boot/ cp arch/arm64/boot/Image ../target/Ultra96/boot/image-4.19.0-xlnx-v2019.2-zynqmp-fpga cp arch/arm64/boot/dts/xilinx/avnet-ultra96-rev1.dtb ../target/Ultra96/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96.dtb ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/Ultra96/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96.dts ../target/Ultra96/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96.dtb ## Build kernel image and devicetree to target/Ultra96-V2/boot/ cp arch/arm64/boot/Image ../target/Ultra96-V2/boot/image-4.19.0-xlnx-v2019.2-zynqmp-fpga cp arch/arm64/boot/dts/xilinx/avnet-ultra96v2-rev1.dtb ../target/Ultra96-V2/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96v2.dtb ./scripts/dtc/dtc -I dtb -O dts --symbols -o ../target/Ultra96-V2/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96v2.dts ../target/Ultra96-V2/boot/devicetree-4.19.0-xlnx-v2019.2-zynqmp-fpga-ultra96v2.dtb cd ..
true
d8c626df2a7bd021c4654b555c1359426a27ad9b
Shell
umair-gujjar/ni
/dev/tests.sh
UTF-8
116,435
2.875
3
[ "MIT" ]
permissive
#!/bin/bash cd /tmp export NI_NO_MONITOR=yes #!/bin/bash lazytest_n=0 lazytest_fail=0 lazytest_case() { echo -ne '\r\033[J' echo -n "$1" | tr '\n' ' ' | head -c79 echo -ne '\r' # local actual="$(eval "$1"; echo "[exit code $?]")" # local expected="$(cat <&3; echo "[exit code $?]")" local actual="$(eval "$1")" local expected="$(cat <&3)" lazytest_n=$((lazytest_n + 1)) if [[ "$actual" = "$expected" ]]; then return 0 else lazytest_fail=$((lazytest_fail + 1)) echo -e "\033[J\033[1;31mFAIL\033[0;0m $*" echo -e "\033[1;31m$lazytest_file:$lazytest_line\033[0;0m" echo -e "EXPECTED\033[1;34m" echo "$expected" echo echo -e "\033[0;0mACTUAL\033[1;34m" echo "$actual" echo -e "\033[0;0m" return 1 fi } lazytest_end() { if ((lazytest_fail)); then echo -e "\r\033[J\033[1;31m$lazytest_n tests, $lazytest_fail failed\033[0;0m" exit 1 else echo -e "\r\033[J\033[1;32m$lazytest_n tests run, all passed\033[0;0m" exit 0 fi } cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='bugs/2016.0918.replicated-garbage.md' lazytest_line=653 lazytest_case 'ni //ni --dev/local-operate[ \ p'\''/(^\d+ )(.*)/ ? map r($2, $_), rl $1 : ()'\'' ,zA r-1 r10] ' 3<<'LAZYTEST_EOF' 0 # Resource layout map. 0 # ni is assembled by following the instructions here. This script is also 0 # included in the ni image itself so it can rebuild accordingly. 0 0 bootcode 0 resource core/boot/ni.map 0 0 resource core/boot/util.pl 0 resource core/boot/doc.pl 0 resource core/boot/dev.pl LAZYTEST_EOF lazytest_file='bugs/2017.0407.hash-constructors.md' lazytest_line=6 lazytest_case 'ni i[a 1 b] i[a 2] i[a 3 c] p'\''@lines = rea; %h = cb_ @lines; @sorted_keys = sort keys %h; r($_, $h{$_}) for @sorted_keys'\'' ' 3<<'LAZYTEST_EOF' 2 b 1 c 3 LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=12 lazytest_case 'ni n1p'\''wp "A4VA8VvvVVvvA4V", qw|RIFF 176436 WAVEfmt 16 1 2 44100 176400 4 16 data 176400|'\'' \ +n44100p'\''my $v = 32767 * sin a*440*tau/44100; wp "ss", $v, $v'\'' \ > test.wav ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=35 lazytest_case 'ni test.wav bp'\''rp "A4VA8VvvVVvvA4V" if bi == 0; # skip the header r rp"ss"'\'' r10 ' 3<<'LAZYTEST_EOF' 2052 2052 4097 4097 6126 6126 8130 8130 10103 10103 12036 12036 13921 13921 15752 15752 17521 17521 19222 19222 LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=54 lazytest_case 'ni test.wav bf'\''ss'\'' r-15r10 ' 3<<'LAZYTEST_EOF' 10103 10103 12036 12036 13921 13921 15752 15752 17521 17521 19222 19222 20846 20846 22389 22389 23844 23844 25205 25205 LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=71 lazytest_case 'ni test.wav bp'\''bi?r rp "ss":rb 44'\'' fA N'\''x = fft.fft(x, axis=0).real'\'' \ Wn rp'\''a <= 22050'\'' OB r5,qB.01 ' 3<<'LAZYTEST_EOF' 441 45263289.95 14941 755.22 7341 745.63 8461 667.75 12181 620.78 LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=98 lazytest_case 'ni nE4 op'\''wp"Nd", a, sin(a)'\'' > binary-lookup ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/binary.md' lazytest_line=118 lazytest_case 'ni nE4 eshuf p'\''^{ri $table, "<binary-lookup"} r a, sin(a), bsflookup $table, "N", 12, a, "x4d"'\'' \ rp'\''b ne c'\'' e'\''wc -l'\'' # any records have a failed lookup? ' 3<<'LAZYTEST_EOF' 0 LAZYTEST_EOF lazytest_file='doc/bloom.md' lazytest_line=32 lazytest_case 'ni nE4 rbA[i108 i571 i3491 zB45] ' 3<<'LAZYTEST_EOF' 108 571 3491 LAZYTEST_EOF lazytest_file='doc/bloom.md' lazytest_line=36 lazytest_case 'ni nE4 r^bA[nE4 rp'\''a != 61 && a != 108'\'' zB45] ' 3<<'LAZYTEST_EOF' 61 108 LAZYTEST_EOF lazytest_file='doc/bloom.md' lazytest_line=44 lazytest_case 'ni ::bloom[i108 i571 i3491 zB45] nE4 fAA rbA//:bloom ' 3<<'LAZYTEST_EOF' 108 108 571 571 3491 3491 LAZYTEST_EOF lazytest_file='doc/bloom.md' lazytest_line=53 lazytest_case 'ni ::bloom[i100 i101 i102 zB45] nE4 p'\''r a, a + 1'\'' rp'\''bloom_contains bloom, a'\'' ' 3<<'LAZYTEST_EOF' 100 101 101 102 102 103 LAZYTEST_EOF lazytest_file='doc/c.md' lazytest_line=11 lazytest_case 'cat > wcl.pl <<'\''EOF'\'' # Defines the "wcl" operator, which works like "wc -l" defoperator wcl => q{ exec_c99 indent(q{ #include <unistd.h> #include <stdio.h> int main(int argc, char **argv) { char buf[8192]; ssize_t got = 0; long lines = 0; unlink(argv[0]); while (got = read(0, buf, sizeof(buf))) while (--got) lines += buf[got] == '\''\n'\''; printf("%ld\n", lines); return 0; } }, -4); }; defshort '\''/wcl'\'' => pmap q{wcl_op}, pnone; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/c.md' lazytest_line=39 lazytest_case 'ni --lib wcl.pl n10 wcl ' 3<<'LAZYTEST_EOF' 10 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=11 lazytest_case 'ni n5 p'\''r a, a*2'\'' # generate two columns of numbers ' 3<<'LAZYTEST_EOF' 1 2 2 4 3 6 4 8 5 10 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=17 lazytest_case 'ni n5 p'\''r a, a*2'\'' ,s # sums only first column ' 3<<'LAZYTEST_EOF' 1 2 3 4 6 6 10 8 15 10 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=23 lazytest_case 'ni n5 p'\''r a, a*2'\'' ,sAB # sums both columns ' 3<<'LAZYTEST_EOF' 1 2 3 6 6 12 10 20 15 30 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=38 lazytest_case 'echo -e "The\ntide\nrises\nthe\ntide\nfalls" > tide.csv ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=39 lazytest_case 'cat tide.csv ' 3<<'LAZYTEST_EOF' The tide rises the tide falls LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=46 lazytest_case 'ni tide.csv ,z ' 3<<'LAZYTEST_EOF' 0 1 2 3 1 4 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=58 lazytest_case 'echo -e "The\ntide\nrises\nthe\ntide\nfalls" > tide.csv ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=59 lazytest_case 'cat tide.csv ' 3<<'LAZYTEST_EOF' The tide rises the tide falls LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=66 lazytest_case 'ni tide.csv ,h ' 3<<'LAZYTEST_EOF' 3967641545 2614616249 3746350261 865469908 2614616249 1943727641 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=79 lazytest_case 'ni tide.csv ,H ' 3<<'LAZYTEST_EOF' 0.923788534710184 0.608762784162536 0.872265142621472 0.201507915742695 0.608762784162536 0.452559357741848 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=95 lazytest_case 'ni n4 ,l ' 3<<'LAZYTEST_EOF' 0 0.693147180559945 1.09861228866811 1.38629436111989 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=100 lazytest_case 'ni n4 ,e ' 3<<'LAZYTEST_EOF' 2.71828182845905 7.38905609893065 20.0855369231877 54.5981500331442 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=110 lazytest_case 'ni n4 ,l2 ' 3<<'LAZYTEST_EOF' 0 0.999999999999998 1.58496250072115 2 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=115 lazytest_case 'ni n4 ,e2 ' 3<<'LAZYTEST_EOF' 2 4 7.99999999999999 16 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=152 lazytest_case 'ni n5 p'\''a*0.3'\'' # generate some non-integer numbers ' 3<<'LAZYTEST_EOF' 0.3 0.6 0.9 1.2 1.5 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=158 lazytest_case 'ni n5 p'\''a*0.3'\'' ,q # round to the nearest integer ' 3<<'LAZYTEST_EOF' 0 1 1 1 2 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=164 lazytest_case 'ni n5 p'\''a*0.3'\'' ,q.5 # round to the nearest 0.5 ' 3<<'LAZYTEST_EOF' 0.5 0.5 1 1 1.5 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=170 lazytest_case 'ni n6 ,q2 # round to the nearest multiple of 2 ' 3<<'LAZYTEST_EOF' 2 2 4 4 6 6 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=183 lazytest_case 'ni n05 ' 3<<'LAZYTEST_EOF' 0 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=189 lazytest_case 'ni n05 ,q4 ' 3<<'LAZYTEST_EOF' 0 0 4 4 4 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=203 lazytest_case 'ni n5 ,s # running sum ' 3<<'LAZYTEST_EOF' 1 3 6 10 15 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=209 lazytest_case 'ni n5 ,d # running difference ' 3<<'LAZYTEST_EOF' 1 1 1 1 1 LAZYTEST_EOF lazytest_file='doc/cell.md' lazytest_line=215 lazytest_case 'ni n5 ,a # running average ' 3<<'LAZYTEST_EOF' 1 1.5 2 2.5 3 LAZYTEST_EOF lazytest_file='doc/cheatsheet_op.md' lazytest_line=286 lazytest_case 'ni i[a b c d] i[a b x y] i[a b foo bar] YC ' 3<<'LAZYTEST_EOF' a b 0 0 c a b 0 1 d a b 1 0 x a b 1 1 y a b 2 0 foo a b 2 1 bar LAZYTEST_EOF lazytest_file='doc/cheatsheet_op.md' lazytest_line=302 lazytest_case 'ni i[a b 1 5] i[a b 100 500] i[a b -10 -20] \ i[c d 1 0] i[c d 1 1] \ NC'\''x = dot(x.T, x)'\'' ' 3<<'LAZYTEST_EOF' a b 10101 50205 a b 50205 250425 c d 2 1 c d 1 1 LAZYTEST_EOF lazytest_file='doc/cheatsheet_op.md' lazytest_line=316 lazytest_case 'ni i[a b c d] i[a b x y] i[a b foo bar] YC XC ' 3<<'LAZYTEST_EOF' a b c d a b x y a b foo bar LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=10 lazytest_case 'ni n5 # some data ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=16 lazytest_case 'ni ::foo[n5] # ...in a memory-resident closure ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=42 lazytest_case 'ni ::foo[n5] Cubuntu[//:foo] ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=48 lazytest_case 'ni ::foo[n5] Cubuntu[n1p'\''r split /\n/, foo'\''] ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF fi # $SKIP_DOCKER cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=60 lazytest_case 'rm -r /tmp/* || : ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=61 lazytest_case 'ni :@foo[n10] //@foo e[wc -l] # disk-backed data closure ' 3<<'LAZYTEST_EOF' 10 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=63 lazytest_case 'ls /tmp | wc -l ' 3<<'LAZYTEST_EOF' 0 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=65 lazytest_case 'ni :@foo[nE5] :@bar[nE4] //@foo //@bar gr9 ' 3<<'LAZYTEST_EOF' 1 1 10 10 100 100 1000 1000 10000 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=80 lazytest_case 'ni :@foo[nE6] \ n1p'\''open my $fh, "<", foo =~ /^file:\/\/(.*)/ or die $!; print while <$fh>;()'\'' e[wc -c] ' 3<<'LAZYTEST_EOF' 6888896 LAZYTEST_EOF if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=94 lazytest_case 'ni :@foo[nE5] :@bar[nE4] Cubuntu[//@foo //@bar gr9] ' 3<<'LAZYTEST_EOF' 1 1 10 10 100 100 1000 1000 10000 LAZYTEST_EOF lazytest_file='doc/closure.md' lazytest_line=104 lazytest_case 'ni :@foo[nE6] Cubuntu[ \ n1p'\''open my $fh, "<", foo =~ /^file:\/\/(.*)/ or die $!; print while <$fh>;()'\''] e[wc -c] ' 3<<'LAZYTEST_EOF' 6888896 LAZYTEST_EOF fi # $SKIP_DOCKER cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=15 lazytest_case 'ni n8p'\''r map a*$_, 1..8'\'' > mult-table ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=16 lazytest_case 'ni mult-table ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 2 4 6 8 10 12 14 16 3 6 9 12 15 18 21 24 4 8 12 16 20 24 28 32 5 10 15 20 25 30 35 40 6 12 18 24 30 36 42 48 7 14 21 28 35 42 49 56 8 16 24 32 40 48 56 64 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=31 lazytest_case 'ni mult-table fA # the first column ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=40 lazytest_case 'ni mult-table fDC # fourth, then third column ' 3<<'LAZYTEST_EOF' 4 3 8 6 12 9 16 12 20 15 24 18 28 21 32 24 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=49 lazytest_case 'ni mult-table fAA # first column, duplicated ' 3<<'LAZYTEST_EOF' 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=58 lazytest_case 'ni mult-table fA-D # first four columns ' 3<<'LAZYTEST_EOF' 1 2 3 4 2 4 6 8 3 6 9 12 4 8 12 16 5 10 15 20 6 12 18 24 7 14 21 28 8 16 24 32 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=74 lazytest_case 'ni mult-table fDA. # fourth, first, "and the rest (i.e. 5-8)" ' 3<<'LAZYTEST_EOF' 4 1 5 6 7 8 8 2 10 12 14 16 12 3 15 18 21 24 16 4 20 24 28 32 20 5 25 30 35 40 24 6 30 36 42 48 28 7 35 42 49 56 32 8 40 48 56 64 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=83 lazytest_case 'ni mult-table fBA. # an easy way to swap first two columns ' 3<<'LAZYTEST_EOF' 2 1 3 4 5 6 7 8 4 2 6 8 10 12 14 16 6 3 9 12 15 18 21 24 8 4 12 16 20 24 28 32 10 5 15 20 25 30 35 40 12 6 18 24 30 36 42 48 14 7 21 28 35 42 49 56 16 8 24 32 40 48 56 64 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=92 lazytest_case 'ni mult-table x # even easier (see below) ' 3<<'LAZYTEST_EOF' 2 1 3 4 5 6 7 8 4 2 6 8 10 12 14 16 6 3 9 12 15 18 21 24 8 4 12 16 20 24 28 32 10 5 15 20 25 30 35 40 12 6 18 24 30 36 42 48 14 7 21 28 35 42 49 56 16 8 24 32 40 48 56 64 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=107 lazytest_case 'ni mult-table xC r2 # swap third column into first position ' 3<<'LAZYTEST_EOF' 3 2 1 4 5 6 7 8 6 4 2 8 10 12 14 16 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=110 lazytest_case 'ni mult-table xGHr2 # swap seventh, eighth columns into first two ' 3<<'LAZYTEST_EOF' 7 8 3 4 5 6 1 2 14 16 6 8 10 12 2 4 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=113 lazytest_case 'ni mult-table xr2 # swap first two columns ' 3<<'LAZYTEST_EOF' 2 1 3 4 5 6 7 8 4 2 6 8 10 12 14 16 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=137 lazytest_case 'ni /etc/passwd r2F:: # F: followed by :, which is the split char ' 3<<'LAZYTEST_EOF' root x 0 0 root /root /bin/bash daemon x 1 1 daemon /usr/sbin /bin/sh LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=144 lazytest_case 'ni //ni r3 # some data ' 3<<'LAZYTEST_EOF' #!/usr/bin/env perl $ni::is_lib = caller(); $ni::self{license} = <<'_'; LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=152 lazytest_case 'ni //ni r3F/\\// # split on forward slashes ' 3<<'LAZYTEST_EOF' #! usr bin env perl $ni::is_lib = caller(); $ni::self{license} = <<'_'; LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=160 lazytest_case 'ni //ni r3FW # split on non-words ' 3<<'LAZYTEST_EOF' usr bin env perl ni is_lib caller ni self license _ LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=168 lazytest_case 'ni //ni r3FS # split on whitespace ' 3<<'LAZYTEST_EOF' #!/usr/bin/env perl $ni::is_lib = caller(); $ni::self{license} = <<'_'; LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=176 lazytest_case 'ni //ni r3Fm'\''/\/\w+/'\'' # words beginning with a slash ' 3<<'LAZYTEST_EOF' /usr /bin /env LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=188 lazytest_case 'ni //ni r3FW p'\''r a, b, uc(c), FR 3'\'' ' 3<<'LAZYTEST_EOF' usr BIN env perl ni IS_LIB caller ni SELF license _ LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=198 lazytest_case 'ni //ni r3FW vCpuc ' 3<<'LAZYTEST_EOF' usr BIN env perl ni IS_LIB caller ni SELF license _ LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=210 lazytest_case 'ni //ni r3FWfB ' 3<<'LAZYTEST_EOF' usr ni ni LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=214 lazytest_case 'ni //ni r3FWfB wn100 # right-join numbers ' 3<<'LAZYTEST_EOF' usr 1 ni 2 ni 3 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=218 lazytest_case 'ni //ni r3FWfB Wn100 # left-join numbers ' 3<<'LAZYTEST_EOF' 1 usr 2 ni 3 ni LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=229 lazytest_case 'ni //license Wn r~3 ' 3<<'LAZYTEST_EOF' 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 SOFTWARE. 21 LAZYTEST_EOF lazytest_file='doc/col.md' lazytest_line=233 lazytest_case 'ni nE5p'\''a*a'\'' Wn r~3 ' 3<<'LAZYTEST_EOF' 99998 9999600004 99999 9999800001 100000 10000000000 LAZYTEST_EOF # These tests only get run in environments where docker is installed # (centos 5 uses i386 libraries and doesn't support docker, for example). if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=14 lazytest_case 'ni nE4 Cubuntu[gr4] O ' 3<<'LAZYTEST_EOF' 1000 100 10 1 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=33 lazytest_case 'docker build -q -t ni-test/numpy - <<EOF > /dev/null FROM ubuntu RUN apt-get update RUN apt-get install -y python-numpy CMD /bin/bash EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=39 lazytest_case 'ni n100 Cni-test/numpy[N'\''x = x + 1'\''] r4 ' 3<<'LAZYTEST_EOF' 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=53 lazytest_case 'ni n100 CU+python-numpy+sbcl[N'\''x = x + 1'\'' l'\''(1+ a)'\''] r4 ' 3<<'LAZYTEST_EOF' 3 4 5 6 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=58 lazytest_case 'ni n100 CA+py-numpy@community+sbcl@testing[N'\''x = x + 1'\'' l'\''(1+ a)'\''] r4 ' 3<<'LAZYTEST_EOF' 3 4 5 6 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=70 lazytest_case 'docker run --detach -i --name ni-test-container ubuntu >/dev/null ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=71 lazytest_case 'ni Eni-test-container[n100g =\>/tmp/in-container Bn] r4 ' 3<<'LAZYTEST_EOF' 1 10 100 11 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=76 lazytest_case '[[ -e /tmp/in-container ]] || echo '\''file not in host (good)'\'' ' 3<<'LAZYTEST_EOF' file not in host (good) LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=78 lazytest_case 'ni Eni-test-container[/tmp/in-container] | wc -l ' 3<<'LAZYTEST_EOF' 100 LAZYTEST_EOF lazytest_file='doc/container.md' lazytest_line=80 lazytest_case 'docker rm -f ni-test-container >/dev/null ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF fi # $SKIP_DOCKER (lazytest condition) cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/extend.md' lazytest_line=6 lazytest_case 'mkdir my-library ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/extend.md' lazytest_line=7 lazytest_case 'echo my-lib.pl > my-library/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/extend.md' lazytest_line=8 lazytest_case 'cat > my-library/my-lib.pl <<'\''EOF'\'' defoperator count_lines => q{exec '\''wc'\'', '\''-l'\''}; defshort '\''/wc'\'', pmap q{count_lines_op}, pnone; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/extend.md' lazytest_line=12 lazytest_case 'ni --lib my-library n100wc ' 3<<'LAZYTEST_EOF' 100 LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=7 lazytest_case 'mkdir fractional ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=8 lazytest_case 'echo fractional.pl > fractional/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=9 lazytest_case 'cat >fractional/fractional.pl <<'\''EOF'\'' defexpander ['\''/frac'\'', n => pc integer, step => pc number], '\''n$n'\'', '\''pa * $step'\''; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=18 lazytest_case 'ni --lib fractional frac 10 .5 ' 3<<'LAZYTEST_EOF' 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=29 lazytest_case 'ni --lib fractional frac4.5 ' 3<<'LAZYTEST_EOF' 0.5 1 1.5 2 LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=39 lazytest_case 'ni --run '\''defexpander "/license-words", qw[//license FWpF_]'\'' \ license-words r10 ' 3<<'LAZYTEST_EOF' ni https github com spencertipping ni Copyright c 2016 Spencer LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=57 lazytest_case 'mkdir fractional2 ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=58 lazytest_case 'echo fractional2.pl > fractional2/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=59 lazytest_case 'cat >fractional2/fractional2.pl <<'\''EOF'\'' defexpander ['\''/frac'\'', n => pc integer, step => pc number], sub { my %args = @_; ("+n$args{n}", "pa * $args{step}"); }; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/fn.md' lazytest_line=66 lazytest_case 'ni --lib fractional2 frac 10 .5 ' 3<<'LAZYTEST_EOF' 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 LAZYTEST_EOF lazytest_file='doc/geohash.md' lazytest_line=21 lazytest_case 'ni nE4p'\''my ($lat, $lng) = (rand() * 180 - 90, rand() * 360 - 180); my $bits = int clip 1, 60, rand(61); my $b32_digits = int(($bits + 4) / 5); my $gh_base32 = ghe $lat, $lng, $b32_digits; # positive = letters my $gh_binary = ghe $lat, $lng, -$bits; # negative = bits my $gh2_b32 = ghe ghd($gh_base32), $b32_digits; my $gh2_bin = ghe ghd($gh_binary, $bits), -$bits; my $b32_ok = $gh2_b32 eq $gh_base32; my $bin_ok = $gh2_bin == $gh_binary; r $b32_ok ? "B32 OK" : "B32 FAIL $lat $lng $gh_base32 $gh2_b32"; r $bin_ok ? "BIN OK" : "BIN FAIL $lat $lng $gh_binary $gh2_bin"'\'' \ gcfB. ' 3<<'LAZYTEST_EOF' B32 OK BIN OK LAZYTEST_EOF # unit test setup; you won't have to run this if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF # more unit test setup start_time=0; until docker exec -i ni-test-hadoop \ /usr/local/hadoop/bin/hadoop fs -mkdir /test-dir; do if (( $(date +%s) - start_time > 60 )); then docker rm -f ni-test-hadoop >&2 docker run --detach -i -m 2G --name ni-test-hadoop \ sequenceiq/hadoop-docker \ /etc/bootstrap.sh -bash >&2 start_time=$(date +%s) fi done cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/hadoop.md' lazytest_line=88 lazytest_case 'NI_HADOOP=/usr/local/hadoop/bin/hadoop \ ni n5 Eni-test-hadoop [HS[p'\''r a, a*a'\''] _ _ \<] ' 3<<'LAZYTEST_EOF' 1 1 2 4 3 9 4 16 5 25 LAZYTEST_EOF lazytest_file='doc/hadoop.md' lazytest_line=100 lazytest_case 'ni n5 ^{hadoop/name=/usr/local/hadoop/bin/hadoop} \ Eni-test-hadoop [HS[p'\''r a, a*a'\''] _ [p'\''r a, b+1'\''] \<] o ' 3<<'LAZYTEST_EOF' 1 2 2 5 3 10 4 17 5 26 LAZYTEST_EOF lazytest_file='doc/hadoop.md' lazytest_line=112 lazytest_case 'ni //license ^{hadoop/name=/usr/local/hadoop/bin/hadoop} \ Eni-test-hadoop [HS[FW pF_] _ [fAcx] \<] r10 ' 3<<'LAZYTEST_EOF' 2016 1 A 1 ACTION 1 AN 1 AND 1 ANY 2 ARISING 1 AS 1 AUTHORS 1 BE 1 LAZYTEST_EOF lazytest_file='doc/hadoop.md' lazytest_line=132 lazytest_case 'ni //license ^{hadoop/name=/usr/local/hadoop/bin/hadoop \ hadoop/jobconf='\''mapred.map.tasks=10 mapred.reduce.tasks=4'\''} \ Eni-test-hadoop [HSFWpF_ _ fAcx \<] r10 ' 3<<'LAZYTEST_EOF' 2016 1 A 1 BE 1 BUT 1 FOR 2 INCLUDING 1 LIABILITY 1 LIABLE 1 OF 4 OR 7 LAZYTEST_EOF docker rm -f ni-test-hadoop >&2 fi # $SKIP_DOCKER (lazytest condition) cat <<'LAZYTEST_EOF' LAZYTEST_EOF Some of these tests require Docker, so skip if we don't have it if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/invariants.md' lazytest_line=8 lazytest_case 'ni n4E7 ,hA Cubuntu[o] uc ' 3<<'LAZYTEST_EOF' 39814375 LAZYTEST_EOF lazytest_file='doc/json.md' lazytest_line=18 lazytest_case 'ni //license FWp'\''json_encode [F_]'\'' r4 ' 3<<'LAZYTEST_EOF' ["ni","https","github","com","spencertipping","ni"] ["Copyright","c",2016,"Spencer","Tipping","MIT","license"] [] ["Permission","is","hereby","granted","free","of","charge","to","any","person","obtaining","a","copy"] LAZYTEST_EOF lazytest_file='doc/json.md' lazytest_line=28 lazytest_case 'ni //license FWp'\''json_encode [F_]'\'' p'\''r @{json_decode a}'\'' r4 ' 3<<'LAZYTEST_EOF' ni https github com spencertipping ni Copyright c 2016 Spencer Tipping MIT license Permission is hereby granted free of charge to any person obtaining a copy LAZYTEST_EOF lazytest_file='doc/json.md' lazytest_line=47 lazytest_case 'ni //license FWpF_ p'\''r pl 3'\'' \ p'\''json_encode {type => '\''trigram'\'', context => {w1 => a, w2 => b}, word => c}'\'' \>jsons ' 3<<'LAZYTEST_EOF' jsons LAZYTEST_EOF lazytest_file='doc/json.md' lazytest_line=52 lazytest_case 'ni jsons r5 ' 3<<'LAZYTEST_EOF' {"context":{"w1":"https","w2":"github"},"type":"trigram","word":"com"} {"context":{"w1":"github","w2":"com"},"type":"trigram","word":"spencertipping"} {"context":{"w1":"com","w2":"spencertipping"},"type":"trigram","word":"ni"} {"context":{"w1":"spencertipping","w2":"ni"},"type":"trigram","word":"Copyright"} {"context":{"w1":"ni","w2":"Copyright"},"type":"trigram","word":"c"} LAZYTEST_EOF lazytest_file='doc/json.md' lazytest_line=63 lazytest_case 'ni jsons D:w1,:w2,:word r5 ' 3<<'LAZYTEST_EOF' https github com github com spencertipping com spencertipping ni spencertipping ni Copyright ni Copyright c LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=6 lazytest_case 'ni n4l'\''(+ a 2)'\'' ' 3<<'LAZYTEST_EOF' 3 4 5 6 LAZYTEST_EOF if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=21 lazytest_case 'docker build -q -t ni-test/sbcl - <<EOF > /dev/null FROM ubuntu RUN apt-get update RUN apt-get install -y sbcl CMD /bin/bash EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=27 lazytest_case 'ni Cni-test/sbcl[n4l'\''(+ a 2)'\''] ' 3<<'LAZYTEST_EOF' 3 4 5 6 LAZYTEST_EOF fi # $HAVE_DOCKER cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=44 lazytest_case 'ni n4l'\''(r a (1+ a))'\'' # generate two columns ' 3<<'LAZYTEST_EOF' 1 2 2 3 3 4 4 5 LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=49 lazytest_case 'ni n4l'\''(r a (1+ a))'\'' l'\''(r (+ a b))'\'' # ... and sum them ' 3<<'LAZYTEST_EOF' 3 5 7 9 LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=63 lazytest_case 'ni n2l'\''a (+ a 100)'\'' # return without "r" ' 3<<'LAZYTEST_EOF' 1 101 2 102 LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=86 lazytest_case 'ni n10000l"(sr ('\''+ a))" ' 3<<'LAZYTEST_EOF' 50005000 LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=93 lazytest_case 'ni n4fAA l"(r (sr ('\''+ a) ('\''* b)))" ' 3<<'LAZYTEST_EOF' 10 24 LAZYTEST_EOF lazytest_file='doc/lisp.md' lazytest_line=108 lazytest_case 'ni /etc/passwd F::gG l"(r g (se (partial #'\''join #\,) a g))" ' 3<<'LAZYTEST_EOF' /bin/bash root /bin/false syslog /bin/sh backup,bin,daemon,games,gnats,irc,libuuid,list,lp,mail,man,news,nobody,proxy,sys,uucp,www-data /bin/sync sync LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=7 lazytest_case 'ni //ni FWr10 ' 3<<'LAZYTEST_EOF' usr bin env perl ni is_lib caller ni self license _ ni https github com spencertipping ni Copyright c 2016 Spencer Tipping MIT license Permission is hereby granted free of charge to any person obtaining a copy of this software and associated documentation files the Software to deal in the Software without restriction including without limitation the rights to use copy modify merge publish distribute sublicense and or sell LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=23 lazytest_case 'ni //ni FW Yr10 ' 3<<'LAZYTEST_EOF' 0 0 0 1 usr 0 2 bin 0 3 env 0 4 perl 1 0 1 1 ni 1 2 is_lib 1 3 caller 1 4 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=39 lazytest_case 'ni //ni FW fABCD Y X r10 ' 3<<'LAZYTEST_EOF' usr bin env ni is_lib caller ni self license ni https github com Copyright c 2016 Spencer Permission is hereby granted of this software and in the Software without to use copy modify LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=56 lazytest_case 'ni n010p'\''r 0, a%3, 1'\'' X ' 3<<'LAZYTEST_EOF' 4 3 3 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=64 lazytest_case 'ni i[a b] i[c d] pF_ ' 3<<'LAZYTEST_EOF' a b c d LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=74 lazytest_case 'ni i[a b] i[c d] pF_ Z2 ' 3<<'LAZYTEST_EOF' a b c d LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=86 lazytest_case 'ni n10p'\''r map a*$_, 1..10'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=97 lazytest_case 'ni n10p'\''r map a*$_, 1..10'\'' N'\''x = x + 1'\'' ' 3<<'LAZYTEST_EOF' 2 3 4 5 6 7 8 9 10 11 3 5 7 9 11 13 15 17 19 21 4 7 10 13 16 19 22 25 28 31 5 9 13 17 21 25 29 33 37 41 6 11 16 21 26 31 36 41 46 51 7 13 19 25 31 37 43 49 55 61 8 15 22 29 36 43 50 57 64 71 9 17 25 33 41 49 57 65 73 81 10 19 28 37 46 55 64 73 82 91 11 21 31 41 51 61 71 81 91 101 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=113 lazytest_case 'ni n4N'\''x = x.T'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=120 lazytest_case 'ni n4N'\''x = reshape(x, (-1))'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=134 lazytest_case 'ni //license plc FW Z1 p'\''r/(.)(.*)/'\'' g r10 ' 3<<'LAZYTEST_EOF' 2 016 a a a bove a ction a ll a n a nd a nd a nd LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=150 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' g r10 ' 3<<'LAZYTEST_EOF' 2 0 1 6 a a a b o v e a c t i o n a l l a n a n d a n d a n d LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=161 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' g YB r10 ' 3<<'LAZYTEST_EOF' 2 0 0 0 2 0 1 1 2 0 2 6 a 1 0 b a 1 1 o a 1 2 v a 1 3 e a 2 0 c a 2 1 t a 2 2 i LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=172 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' gYB fABD gcfBCDA r10 ' 3<<'LAZYTEST_EOF' 2 0 6 1 a 2 a b v 1 a c i 1 a l 1 a n 9 a r s 1 a s 1 a s o 1 a u h 1 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=191 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' \ gYBfABDgcfBCDA ,zC o XB r10 ' 3<<'LAZYTEST_EOF' a 2 a 1 a 1 a 1 a 9 a 1 a 1 1 a 1 b 2 b 1 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=208 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' \ gYBfABDgcfBCDA,zCo XB \ NB'\''x *= 2'\'' YB,qD.01XB r10 ' 3<<'LAZYTEST_EOF' a 0 4 0 0 0 0 0 a 0 0 2 0 0 0 0 a 0 0 0 2 0 0 0 a 0 2 0 0 0 0 0 a 0 18 0 0 0 0 0 a 0 0 0 0 2 0 0 a 0 2 0 0 0 2 0 a 0 0 0 0 0 0 2 b 0 4 b 0 2 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=226 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' \ gYBfABDgcfBCDA,zCo XB \ NB'\''x *= 2 x += 1'\'' r10 ' 3<<'LAZYTEST_EOF' a 1 5 1 1 1 1 1 a 1 1 3 1 1 1 1 a 1 1 1 3 1 1 1 a 1 3 1 1 1 1 1 a 1 19 1 1 1 1 1 a 1 1 1 1 3 1 1 a 1 3 1 1 1 3 1 a 1 1 1 1 1 1 3 b 1 5 b 1 3 LAZYTEST_EOF lazytest_file='doc/matrix.md' lazytest_line=245 lazytest_case 'ni //license plc FWpF_ p'\''r split//'\'' \ gYBfABDgcfBCDA,zCo XB \ NB'\''if True: x = x + 1'\'' r3 ' 3<<'LAZYTEST_EOF' a 1 3 1 1 1 1 1 a 1 1 2 1 1 1 1 a 1 1 1 2 1 1 1 LAZYTEST_EOF lazytest_file='doc/net.md' lazytest_line=6 lazytest_case 'nc -l 1400 <<'\''EOF'\'' > /dev/null & # an enterprise-grade web server HTTP/1.1 200 OK Content-length: 12 Hello world EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/net.md' lazytest_line=12 lazytest_case 'sleep 1; ni http://localhost:1400 n3 ' 3<<'LAZYTEST_EOF' Hello world 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=48 lazytest_case 'ni n5 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=61 lazytest_case 'ni n03 ' 3<<'LAZYTEST_EOF' 0 1 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=74 lazytest_case 'ni ihello ' 3<<'LAZYTEST_EOF' hello LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=81 lazytest_case 'ni i"hello there" ' 3<<'LAZYTEST_EOF' hello there LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=88 lazytest_case 'ni i[hello there new friend] ' 3<<'LAZYTEST_EOF' hello there new friend LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=97 lazytest_case 'ni n500 e'\''grep 22'\'' ' 3<<'LAZYTEST_EOF' 22 122 220 221 222 223 224 225 226 227 228 229 322 422 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=159 lazytest_case 'ni n5 \>five.txt ' 3<<'LAZYTEST_EOF' five.txt LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=170 lazytest_case 'ni n5 \>five.txt \< ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=231 lazytest_case 'ni n10 z \>ten.gz ' 3<<'LAZYTEST_EOF' ten.gz LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=258 lazytest_case 'ni n10 z \>ten.gz \< ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=287 lazytest_case 'ni n10 r3 ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=295 lazytest_case 'ni n10 r-3 ' 3<<'LAZYTEST_EOF' 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=308 lazytest_case 'ni n10 r~3 ' 3<<'LAZYTEST_EOF' 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=315 lazytest_case 'ni n10 r+3 ' 3<<'LAZYTEST_EOF' 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=324 lazytest_case 'ni n10 rx3 ' 3<<'LAZYTEST_EOF' 1 4 7 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=334 lazytest_case 'ni n20 r.15 ' 3<<'LAZYTEST_EOF' 1 9 11 12 14 15 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=351 lazytest_case 'ni ibubbles ibaubles ibarbaras F/[aeiou]+/ ' 3<<'LAZYTEST_EOF' b bbl s b bl s b rb r s LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=363 lazytest_case 'ni i~/bin/dependency/nightmare.jar FD ' 3<<'LAZYTEST_EOF' ~ bin dependency nightmare.jar LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=370 lazytest_case 'ni i"here is an example" FS ' 3<<'LAZYTEST_EOF' here is an example LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=377 lazytest_case 'ni ibread,eggs,milk i'\''fruit gushers,index cards'\'' FC ' 3<<'LAZYTEST_EOF' bread eggs milk fruit gushers index cards LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=385 lazytest_case 'ni i'\''"hello,there",one,two,three'\'' FV ' 3<<'LAZYTEST_EOF' hello,there one two three LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=392 lazytest_case 'ni i'\''this@#$$gets&(*&^split'\'' FW ' 3<<'LAZYTEST_EOF' this gets split LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=399 lazytest_case 'ni i'\''need|quotes|around|pipes|because|of|bash'\'' FP ' 3<<'LAZYTEST_EOF' need quotes around pipes because of bash LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=406 lazytest_case 'ni ibubbles ibaubles ibarbaras F:a ' 3<<'LAZYTEST_EOF' bubbles b ubles b rb r s LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=418 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" i"and I feel all right" FS ' 3<<'LAZYTEST_EOF' this is how we do it it's friday night and I feel all right LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=428 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fC ' 3<<'LAZYTEST_EOF' how night feel LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=438 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fAB ' 3<<'LAZYTEST_EOF' this is it's friday and I LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=448 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fAAC ' 3<<'LAZYTEST_EOF' this this how it's it's night and and feel LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=458 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fAD. ' 3<<'LAZYTEST_EOF' this we do it it's and all right LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=467 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fB-E ' 3<<'LAZYTEST_EOF' is how we do friday night I feel all right LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=477 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fCBAD ' 3<<'LAZYTEST_EOF' how is this we night friday it's feel I and all LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=487 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS f#2#1#0#3 ' 3<<'LAZYTEST_EOF' how is this we night friday it's feel I and all LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=497 lazytest_case 'ni i"this is how we do it" i"it'\''s friday night" \ i"and I feel all right" FS fA,#3. ' 3<<'LAZYTEST_EOF' this we do it it's and all right LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=513 lazytest_case 'ni i"Ain'\''t nobody dope as me" \ i"I'\''m dressed so fresh, so clean" \ i"So fresh and so clean, clean" FS ' 3<<'LAZYTEST_EOF' Ain't nobody dope as me I'm dressed so fresh, so clean So fresh and so clean, clean LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=524 lazytest_case 'ni i"Ain'\''t nobody dope as me" \ i"I'\''m dressed so fresh, so clean" \ i"So fresh and so clean, clean" FS x ' 3<<'LAZYTEST_EOF' nobody Ain't dope as me dressed I'm so fresh, so clean fresh So and so clean, clean LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=535 lazytest_case 'ni i"Ain'\''t nobody dope as me" \ i"I'\''m dressed so fresh, so clean" \ i"So fresh and so clean, clean" FS xD ' 3<<'LAZYTEST_EOF' as nobody dope Ain't me fresh, dressed so I'm so clean so fresh and So clean, clean LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=546 lazytest_case 'ni i"Ain'\''t nobody dope as me" \ i"I'\''m dressed so fresh, so clean" \ i"So fresh and so clean, clean" FS xEB ' 3<<'LAZYTEST_EOF' me nobody dope as Ain't so dressed so fresh, I'm clean clean, fresh and so So clean LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=563 lazytest_case 'ni ib ia ic g ' 3<<'LAZYTEST_EOF' a b c LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=572 lazytest_case 'ni ib ia ic gA- ' 3<<'LAZYTEST_EOF' c b a LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=581 lazytest_case 'ni i10 i5 i0.3 gAn ' 3<<'LAZYTEST_EOF' 0.3 5 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=591 lazytest_case 'ni i[b 6] i[b 3] i[a 2] i[a 1] i[c 4] i[c 5] i[a 0] gABn ' 3<<'LAZYTEST_EOF' a 0 a 1 a 2 b 3 b 6 c 4 c 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=604 lazytest_case 'ni i[b 0] i[b 4] i[a 2] i[a 1] i[c 4] i[c 0] i[a 0] gBnA ' 3<<'LAZYTEST_EOF' a 0 b 0 c 0 a 1 a 2 b 4 c 4 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=619 lazytest_case 'ni i[b 6] i[b 3] i[a 2] i[a 1] i[c 4] i[c 5] i[a 0] oB ' 3<<'LAZYTEST_EOF' a 0 a 1 a 2 b 3 c 4 c 5 b 6 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=630 lazytest_case 'ni i[b 6] i[b 3] i[a 2] i[a 1] i[c 4] i[c 5] i[a 0] OB ' 3<<'LAZYTEST_EOF' b 6 c 5 c 4 b 3 a 2 a 1 a 0 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=645 lazytest_case 'ni i[b 6] i[b 3] i[a 2] i[a 1] i[c 4] i[c 5] i[a 0] fAgu ' 3<<'LAZYTEST_EOF' a b c LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=655 lazytest_case 'ni i[b 6] i[b 3] i[a 2] i[a 1] i[c 4] i[c 5] i[a 0] fAgc ' 3<<'LAZYTEST_EOF' 3 a 2 b 2 c LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=671 lazytest_case 'ni i[b ba bar] i[b bi bif] i[b ba baz] \ i[q qa qat] i[q qu quux] i[b ba bake] \ i[u ub uber] gA \>tmp \< ' 3<<'LAZYTEST_EOF' b ba bake b ba bar b ba baz b bi bif q qa qat q qu quux u ub uber LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=686 lazytest_case 'ni i[b ba bar] i[b bi bif] i[b ba baz] \ i[q qa qat] i[q qu quux] i[b ba bake] \ i[u ub uber] gA \>tmp \< gB- ' 3<<'LAZYTEST_EOF' u ub uber q qu quux q qa qat b bi bif b ba bake b ba bar b ba baz LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=701 lazytest_case 'ni i[b ba bar] i[b bi bif] i[b ba baz] \ i[q qa qat] i[q qu quux] i[b ba bake] \ i[u ub uber] gA \>tmp \< ggAB- ' 3<<'LAZYTEST_EOF' b bi bif b ba bake b ba bar b ba baz q qu quux q qa qat u ub uber LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=739 lazytest_case 'ni i[foo bar] i[foo car] i[foo dar] i[that no] i[this yes] j[ i[foo mine] i[not here] i[this OK] i[this yipes] ] ' 3<<'LAZYTEST_EOF' foo bar mine foo car mine foo dar mine this yes OK this yes yipes LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=750 lazytest_case 'ni i[M N foo] i[M N bar] i[M O qux] i[X Y cat] i[X Z dog] \ jAB[ i[M N hi] i[X Y bye] ] ' 3<<'LAZYTEST_EOF' M N foo hi M N bar hi X Y cat bye LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=766 lazytest_case 'ni i[foo bar] i[foo car] i[that no] i[this yes] i[foo dar] \ J[ i[this yipes] i[this OK] i[foo mine] i[not here] ] ' 3<<'LAZYTEST_EOF' foo bar mine foo car mine that no this yes OK foo dar mine LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=787 lazytest_case 'ni i[one_column] i[two columns] i[three columns here] rB ' 3<<'LAZYTEST_EOF' two columns three columns here LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=797 lazytest_case 'ni i[one_column] i[two columns] i[three columns here] \ riA[ione_column ithree] ' 3<<'LAZYTEST_EOF' one_column three columns here LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=808 lazytest_case 'ni n500 r/22/ ' 3<<'LAZYTEST_EOF' 22 122 220 221 222 223 224 225 226 227 228 229 322 422 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=828 lazytest_case 'ni n1000 r-500 r'\''/^(\d)\1+$/'\'' ' 3<<'LAZYTEST_EOF' 555 666 777 888 999 LAZYTEST_EOF lazytest_file='doc/ni_by_example_1.md' lazytest_line=853 lazytest_case 'ni --explain n10 \>ten.txt \< ' 3<<'LAZYTEST_EOF' ["n",1,11] ["file_write","ten.txt"] ["file_read"] LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=67 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''a()'\'' ' 3<<'LAZYTEST_EOF' first foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=73 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''c'\'' ' 3<<'LAZYTEST_EOF' third baz LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=81 lazytest_case 'ni i[3 5 7] p'\''a + b + c'\'' ' 3<<'LAZYTEST_EOF' 15 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=86 lazytest_case 'ni i[easy speak] p'\''b . a'\'' ' 3<<'LAZYTEST_EOF' speakeasy LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=97 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''c, a'\'' ' 3<<'LAZYTEST_EOF' third first baz foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=113 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''r(c, a)'\'' ' 3<<'LAZYTEST_EOF' third first baz foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=121 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''r c, a'\'' ' 3<<'LAZYTEST_EOF' third first baz foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=136 lazytest_case 'ni i[first second third fourth fifth sixth] p'\''r F_(1..3)'\'' ' 3<<'LAZYTEST_EOF' second third fourth LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=143 lazytest_case 'ni i[first second third fourth fifth sixth] \ i[only two_fields ] p'\''r FM'\'' ' 3<<'LAZYTEST_EOF' 5 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=152 lazytest_case 'ni i[first second third fourth fifth sixth] p'\''r F_(3..FM)'\'' ' 3<<'LAZYTEST_EOF' fourth fifth sixth LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=159 lazytest_case 'ni i[first second third fourth fifth sixth] p'\''r FR 3'\'' ' 3<<'LAZYTEST_EOF' fourth fifth sixth LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=166 lazytest_case 'ni i[first second third fourth fifth sixth] p'\''r FT 3'\'' ' 3<<'LAZYTEST_EOF' first second third LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=178 lazytest_case 'ni p'\''r "foo" . "bar"'\'' ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=184 lazytest_case 'ni 1p'\''r "foo" . "bar"'\'' ' 3<<'LAZYTEST_EOF' foobar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=196 lazytest_case 'ni i1 i10 i100 i1000 p'\''r a, length(a)'\'' ' 3<<'LAZYTEST_EOF' 1 1 10 2 100 3 1000 4 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=208 lazytest_case 'ni i1 i10 i100 i1000 p'\''r a, length'\'' ' 3<<'LAZYTEST_EOF' 1 1 10 2 100 3 1000 4 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=221 lazytest_case 'ni i1 i10 i100 i1000 p'\''$_'\'' ' 3<<'LAZYTEST_EOF' 1 10 100 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=235 lazytest_case 'ni 1p'\''$x; ++$x'\'' ' 3<<'LAZYTEST_EOF' 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=240 lazytest_case 'ni 1p'\''@x; $x[3] = "yo"; r @x'\'' ' 3<<'LAZYTEST_EOF' yo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=250 lazytest_case 'ni 1p'\''@x; $x[3] = "yo"; exists $x[0] ? "yes" : "no"'\'' ' 3<<'LAZYTEST_EOF' no LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=255 lazytest_case 'ni 1p'\''%h = {"u" => "ok"}; exists $h["me"] ? "yes" : "no"'\'' ' 3<<'LAZYTEST_EOF' no LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=262 lazytest_case 'ni 1p'\''$x; defined $x ? "yes" : "no"'\'' ' 3<<'LAZYTEST_EOF' no LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=286 lazytest_case 'ni n5 p'\''my $x = a; {my $x = 100;} ++$x'\'' ' 3<<'LAZYTEST_EOF' 2 3 4 5 6 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=297 lazytest_case 'ni n5 p'\''my $y = a; {$x = 100;} ++$x'\'' ' 3<<'LAZYTEST_EOF' 101 101 101 101 101 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=309 lazytest_case 'ni n5 p'\''my $y = a; {my $x = 100;} defined $x ? "defined" : "not defined"'\'' ' 3<<'LAZYTEST_EOF' not defined not defined not defined not defined not defined LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=321 lazytest_case 'ni i[foo bar] p'\''my ($first, $second) = F_; r $second, $first'\'' ' 3<<'LAZYTEST_EOF' bar foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=328 lazytest_case 'ni i[foo bar baz qux qal] \ p'\''my ($first, $second, @rest) = F_; r $second, $first; r @rest'\'' ' 3<<'LAZYTEST_EOF' bar foo baz qux qal LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=345 lazytest_case 'ni n5p'\''^{$x = 10} $x += a; r a, $x'\'' ' 3<<'LAZYTEST_EOF' 1 11 2 13 3 16 4 20 5 25 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=356 lazytest_case 'ni n5p'\''$x = 10; $x += a; r a, $x'\'' ' 3<<'LAZYTEST_EOF' 1 11 2 12 3 13 4 14 5 15 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=369 lazytest_case 'ni n5p'\''^{$x = 10} $x += a; r a, $x'\'' p'\''r $x'\'' ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=380 lazytest_case 'ni i[faygo cola] i[orange juice] i[grape soda] i[orange crush] i[hawaiian punch] rp'\''^{%good_flavors = ("orange" => 1, "grape" => 1)} my $flavor = a; $good_flavors{$flavor}'\'' ' 3<<'LAZYTEST_EOF' orange juice grape soda orange crush LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=390 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''k'\'' ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=394 lazytest_case 'ni i[first second third] i[foo bar baz] p'\''r k'\'' ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=412 lazytest_case 'ni n3 rp'\''a'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=421 lazytest_case 'ni n03 rp'\''a'\'' ' 3<<'LAZYTEST_EOF' 1 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=429 lazytest_case 'ni n03 rp'\''r a'\'' ' 3<<'LAZYTEST_EOF' 0 1 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=441 lazytest_case 'ni n03 rp'\''r b'\'' ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=467 lazytest_case 'ni i37 p'\''if (a == 2) { r "input was 2" } elsif (a =~ /^[Qq]/ ) { r "input started with a Q" } else { r "I dunno" }'\'' ' 3<<'LAZYTEST_EOF' I dunno LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=478 lazytest_case 'ni i5 p'\''r "input = 5" if a == 5'\'' ' 3<<'LAZYTEST_EOF' input = 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=488 lazytest_case 'ni i5 p'\''r "input = 5" unless a != 5'\'' ' 3<<'LAZYTEST_EOF' input = 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=497 lazytest_case 'ni i6 p'\''a == 5 ? "input = 5" : "input != 5"'\'' ' 3<<'LAZYTEST_EOF' input != 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=543 lazytest_case 'ni ihello p'\''a =~ /^h/ ? "match" : "no match"'\'' ' 3<<'LAZYTEST_EOF' match LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=550 lazytest_case 'ni igoodbye p'\''a !~ /^h/ ? "negative match" : "positive match"'\'' ' 3<<'LAZYTEST_EOF' negative match LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=559 lazytest_case 'ni iabcdefgh p'\''my @v = a =~ /^(.)(.)/; r @v'\'' ' 3<<'LAZYTEST_EOF' a b LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=570 lazytest_case 'ni i/usr/bin p'\''m#^/usr/(.*)$#'\'' ' 3<<'LAZYTEST_EOF' bin LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=580 lazytest_case 'ni iabcdefgh p'\''tr/a-z/A-Z/'\'' ' 3<<'LAZYTEST_EOF' 8 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=585 lazytest_case 'ni iabcdefgh p'\''s/abc/ABC/'\'' ' 3<<'LAZYTEST_EOF' 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=595 lazytest_case 'ni iabcdefgh p'\''$v = tr/a-z/A-Z/; $v'\'' ' 3<<'LAZYTEST_EOF' 8 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=602 lazytest_case 'ni iabcdefgh p'\''tr/a-z/A-Z/; $_'\'' ' 3<<'LAZYTEST_EOF' ABCDEFGH LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=607 lazytest_case 'ni iabcdefgh p'\''s/abc/ABC/; $_'\'' ' 3<<'LAZYTEST_EOF' ABCdefgh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=619 lazytest_case 'ni 1p'\''$foo = "house"; "housecat" =~ /$foo/ ? "match" : "no match"'\'' ' 3<<'LAZYTEST_EOF' match LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=625 lazytest_case 'ni 1p'\''$foo = "house"; "cathouse" =~ /cat$foo/ ? "match" : "no match"'\'' ' 3<<'LAZYTEST_EOF' match LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=631 lazytest_case 'ni 1p'\''$foo = "house"; "housecat" =~ /${foo}cat/ ? "match" : "no match"'\'' ' 3<<'LAZYTEST_EOF' match LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=643 lazytest_case 'ni 1p'\''"foo" . "bar"'\'' ' 3<<'LAZYTEST_EOF' foobar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=653 lazytest_case 'ni 1p'\''my $x = "foo"; r "$x bar"'\'' ' 3<<'LAZYTEST_EOF' foo bar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=660 lazytest_case 'ni 1p'\''my $x = "foo"; r "${x}bar"'\'' ' 3<<'LAZYTEST_EOF' foobar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=667 lazytest_case 'ni ifoo p'\''r "${\a}bar"'\'' ' 3<<'LAZYTEST_EOF' foobar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=682 lazytest_case 'ni 1p'\'' "ab" == "cd" ? "equal" : "not equal"'\'' ' 3<<'LAZYTEST_EOF' equal LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=689 lazytest_case 'ni 1p'\'' "ab" eq "cd" ? "equal" : "not equal"'\'' ' 3<<'LAZYTEST_EOF' not equal LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=704 lazytest_case 'ni iabcdefgh p'\''r substr(a, 3), substr(a, 0, 3), substr(a, -2), substr(a, 0, -2)'\'' ' 3<<'LAZYTEST_EOF' defgh abc gh abcdef LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=715 lazytest_case 'ni iabcdefgh p'\''r /(.{5})$/, /^(.{3})/, /(.{2})$/, /^(.*)../'\'' ' 3<<'LAZYTEST_EOF' defgh abc gh abcdef LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=731 lazytest_case 'ni 1p'\''my @arr = (1, 2, 3); r @arr'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=740 lazytest_case 'ni 1p'\''my @arr = qw(1 2 3); r @arr'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=750 lazytest_case 'ni iabcd iefgh p'\''my @v = split /[cf]/; r @v'\'' ' 3<<'LAZYTEST_EOF' ab d e gh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=773 lazytest_case 'ni 1p'\''my $arr_ref = [1, 2, 3]; r @$arr_ref'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=781 lazytest_case 'ni 1p'\''my @arr = [1, 2, 3]; r @{$arr[0]}'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=791 lazytest_case 'ni iabcdefgh p'\''my $string= a; for (my $i=0; $i < length $string; $i++) {r substr($string, $i, 1) x 2;}'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=805 lazytest_case 'ni iabcdefgh p'\''for my $letter(split //, $_) {r $letter x 2}'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=819 lazytest_case 'ni iabcdefgh p'\''for(split //, $_) {r $_ x 2}'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=833 lazytest_case 'ni iabcdefgh p'\''for(split //, $_) {r $_ x 2} r $_'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh abcdefgh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=854 lazytest_case 'ni iabcdefgh p'\''r $_ x 2 for split //'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=870 lazytest_case 'ni iabcdefgh p'\''for my $letter(split //, $_) {if($letter eq "b") {next;} r $letter x 2}'\'' ' 3<<'LAZYTEST_EOF' aa cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=885 lazytest_case 'ni iabcdefgh p'\''for my $letter(split //, $_) {r $letter x 2; last if $letter ge "c"}'\'' ' 3<<'LAZYTEST_EOF' aa bb cc LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=898 lazytest_case 'ni iabcd iefgh p'\''join "__", split //'\'' ' 3<<'LAZYTEST_EOF' a__b__c__d e__f__g__h LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=908 lazytest_case 'ni iabcdefgh p'\''map {$_ x 2} split //'\'' ' 3<<'LAZYTEST_EOF' aa bb cc dd ee ff gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=922 lazytest_case 'ni iabcdefgh p'\''my @v = map {$_ x 2} split //; r $_'\'' ' 3<<'LAZYTEST_EOF' abcdefgh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=939 lazytest_case 'ni iabcdefgh p'\''my @v = grep /^[acgh]/, map {$_ x 2} split //, $_; @v'\'' ' 3<<'LAZYTEST_EOF' aa cc gg hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=949 lazytest_case 'ni iabcdefgh p'\''my @v = grep { ord(substr($_, 0, 1)) % 2 == 0} map { $_ x 2 } split //, $_; @v'\'' ' 3<<'LAZYTEST_EOF' bb dd ff hh LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=965 lazytest_case 'ni 1p'\''my @arr = (3, 5, 1); r reverse @arr'\'' ' 3<<'LAZYTEST_EOF' 1 5 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=972 lazytest_case 'ni 1p'\''my @arr = (3, 5, 1); r sort @arr'\'' ' 3<<'LAZYTEST_EOF' 1 3 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=977 lazytest_case 'ni 1p'\''@arr = qw[ foo bar baz ]; r sort @arr'\'' ' 3<<'LAZYTEST_EOF' bar baz foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=984 lazytest_case 'ni 1p'\''@arr = qw[ foo bar baz ]; r reverse sort @arr'\'' ' 3<<'LAZYTEST_EOF' foo baz bar LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=991 lazytest_case 'ni i[romeo juliet rosencrantz guildenstern] p'\''r sort F_'\'' ' 3<<'LAZYTEST_EOF' F_ LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1002 lazytest_case 'ni i[romeo juliet rosencrantz guildenstern] p'\''r sort +F_'\'' ' 3<<'LAZYTEST_EOF' guildenstern juliet romeo rosencrantz LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1009 lazytest_case 'ni i[romeo juliet rosencrantz guildenstern] \ p'\''my @arr = F_; r sort @arr'\'' ' 3<<'LAZYTEST_EOF' guildenstern juliet romeo rosencrantz LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1022 lazytest_case 'ni i[romeo juliet rosencrantz guildenstern hero leander] \ p'\''my @arr = F_; r sort {length $a <=> length $b } F_'\'' ' 3<<'LAZYTEST_EOF' hero romeo juliet leander rosencrantz guildenstern LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1030 lazytest_case 'ni i[romeo juliet rosencrantz guildenstern hero leander] \ p'\''my @arr = F_; r sort {length $b <=> length $a } F_'\'' ' 3<<'LAZYTEST_EOF' guildenstern rosencrantz leander juliet romeo hero LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1043 lazytest_case 'ni 1p'\''my @x = (1, 2); my $y = "yo"; my @z = ("good", "bye"); map {$_ x 2} @x, $y, @z'\'' ' 3<<'LAZYTEST_EOF' 11 22 yoyo goodgood byebye LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1061 lazytest_case 'ni 1p'\''my %h = ("x" => 1); r $h{"x"}'\'' ' 3<<'LAZYTEST_EOF' 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1068 lazytest_case 'ni 1p'\''my %h = ("x", 1); r $h{"x"}'\'' ' 3<<'LAZYTEST_EOF' 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1076 lazytest_case 'ni 1p'\''my @arr = qw[foo 1 bar 2]; my %h = @arr; r $h{"bar"}'\'' ' 3<<'LAZYTEST_EOF' 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1085 lazytest_case 'ni 1p'\''my %h = ("foo" => 1, "bar" => 2); r sort keys %h'\'' ' 3<<'LAZYTEST_EOF' bar foo LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1092 lazytest_case 'ni 1p'\''my %h = ("foo" => 1, "bar" => 2, "baz" => 3); my @ks = keys %h; my @vs = values %h; my $same_order = 1; for(my $i = 0; $i <= $#ks; $i++) { if($h{$ks[i]} != $vs[i]) {$same_order = 0; last} } r $same_order ? "Same order" : "Different order"'\'' ' 3<<'LAZYTEST_EOF' Same order LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1140 lazytest_case 'ni 1p'\''125 >> 3'\'' ' 3<<'LAZYTEST_EOF' 15 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1145 lazytest_case 'ni 1p'\''int(125/2**3)'\'' ' 3<<'LAZYTEST_EOF' 15 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1153 lazytest_case 'ni 1p'\''125 << 3'\'' ' 3<<'LAZYTEST_EOF' 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1169 lazytest_case 'ni 1p'\''r 0x3 + 0xa, 0x3 + 0xA'\'' ' 3<<'LAZYTEST_EOF' 13 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1178 lazytest_case 'ni 1p'\''r 0x3 & 0xa, 0x3 | 0xa'\'' ' 3<<'LAZYTEST_EOF' 2 11 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1186 lazytest_case 'ni 1p'\''r 3 & 10, 3 | 10'\'' ' 3<<'LAZYTEST_EOF' 2 11 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1198 lazytest_case 'ni 1p'\''my $v1="5"; r $v1 * 3, $v1 x 3, $v1 . " golden rings"'\'' ' 3<<'LAZYTEST_EOF' 15 555 5 golden rings LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1205 lazytest_case 'ni 1p'\''my $v2="4.3" * "6.7"; r $v2'\'' ' 3<<'LAZYTEST_EOF' 28.81 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1212 lazytest_case 'ni 1p'\''my $v1="hi"; r $v1 * 3, $v1 x 3, $v1 . " golden rings"'\'' ' 3<<'LAZYTEST_EOF' 0 hihihi hi golden rings LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1217 lazytest_case 'ni 1p'\''my $v1="3.14hi"; r $v1 * 3, $v1 x 3, $v1 . " golden rings"'\'' ' 3<<'LAZYTEST_EOF' 9.42 3.14hi3.14hi3.14hi 3.14hi golden rings LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1222 lazytest_case 'ni 1p'\''my $v1="3.1E17"; r $v1 * 3, $v1 x 3, $v1 . " golden rings"'\'' ' 3<<'LAZYTEST_EOF' 930000000000000000 3.1E173.1E173.1E17 3.1E17 golden rings LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1232 lazytest_case 'ni n3p'\''r a, one'\'' ' 3<<'LAZYTEST_EOF' 1 one 2 one 3 one LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1243 lazytest_case 'ni 1p'\''my %h = ("foo" => 32); $h{foo}'\'' ' 3<<'LAZYTEST_EOF' 32 LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1257 lazytest_case 'ni ifoo p'\''my %h = ("foo" => 32, "a" => "hello"); $h{a}'\'' ' 3<<'LAZYTEST_EOF' hello LAZYTEST_EOF lazytest_file='doc/ni_by_example_2.md' lazytest_line=1265 lazytest_case 'ni ifoo p'\''my %h = ("foo" => 32); $h{+a}'\'' ' 3<<'LAZYTEST_EOF' 32 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=47 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg(a, b, 7)'\'' ' 3<<'LAZYTEST_EOF' 9q5cc25 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=53 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg(a, b, -35)'\'' ' 3<<'LAZYTEST_EOF' 10407488581 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=60 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg(a, b)'\'' ' 3<<'LAZYTEST_EOF' 9q5cc25twby7 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=67 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, 9'\'' ' 3<<'LAZYTEST_EOF' 9q5cc25tw LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=83 lazytest_case 'ni i[34.058566 -118.416526] p'\''r gll llg a, b'\'' ' 3<<'LAZYTEST_EOF' 34.058565851301 -118.416526280344 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=88 lazytest_case 'ni i[34.058566 -118.416526] p'\''r gll llg(a, b, -41), 41'\'' ' 3<<'LAZYTEST_EOF' 34.0584754943848 -118.416652679443 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=104 lazytest_case 'ni 1p'\''r gb3 349217367909022597, 60; r gb3 g3b "9q5cc25tufw5", 60;'\'' ' 3<<'LAZYTEST_EOF' 9q5cc25tufw5 9q5cc25tufw5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=115 lazytest_case 'ni 1p'\''r ghb "95qc"'\'' ' 3<<'LAZYTEST_EOF' 18.6328123323619 18.45703125 -125.156250335276 -125.5078125 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=123 lazytest_case 'ni 1p'\''gh_dist "95qcc25y", "95qccdnv", mi'\'' ' 3<<'LAZYTEST_EOF' 1.23981551084308 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=130 lazytest_case 'ni 1p'\''gh_dist "95qcc25y", "95qccdnv"'\'' ' 3<<'LAZYTEST_EOF' 1.99516661267524 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=139 lazytest_case 'ni 1p'\''lat_lon_dist 31.21984, 121.41619, 34.058686, -118.416762'\'' ' 3<<'LAZYTEST_EOF' 10426.7380460312 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=155 lazytest_case 'ni 1p'\''tpe(2017, 1, 22, 8, 5, 13)'\'' ' 3<<'LAZYTEST_EOF' 1485072313 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=162 lazytest_case 'ni 1p'\''tpe("mdYHMS", 1, 22, 2017, 8, 5, 13)'\'' ' 3<<'LAZYTEST_EOF' 1485072313 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=171 lazytest_case 'ni 1p'\''r tep tpe 2017, 1, 22, 8, 5, 13'\'' ' 3<<'LAZYTEST_EOF' 2017 1 22 8 5 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=184 lazytest_case 'ni i[34.058566 -118.416526] \ p'\''my $epoch_time = 1485079513; my $tz_offset = tsec(a, b); my @local_time_parts = tep($epoch_time + $tz_offset); r @local_time_parts'\'' ' 3<<'LAZYTEST_EOF' 2017 1 22 2 41 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=199 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b'\'' \ p'\''my $epoch_time = 1485079513; my @local_time_parts = tep ghl($epoch_time, a); r @local_time_parts'\'' ' 3<<'LAZYTEST_EOF' 2017 1 22 2 41 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=207 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, -60'\'' \ p'\''my $epoch_time = 1485079513; my @local_time_parts = tep gh6l($epoch_time, a); r @local_time_parts'\'' ' 3<<'LAZYTEST_EOF' 2017 1 22 2 41 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=222 lazytest_case 'ni i2017-06-24T18:23:47+00:00 i2017-06-24T19:23:47+01:00 \ i2017-06-24T15:23:47-03:00 i2017-06-24T13:08:47-05:15 \ i20170624T152347-0300 i20170624T182347Z \ i2017-06-24T18:23:47+00:00 i"2017-06-24 18:23:47.683" p'\''i2e a'\'' ' 3<<'LAZYTEST_EOF' 1498328627 1498328627 1498328627 1498328627 1498328627 1498328627 1498328627 1498328627 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=239 lazytest_case 'ni i2017-06-24T18:23:47+00:00 p'\''i2e a'\'' \ p'\''r e2i a; r e2i a, -1.5; r e2i a, "+3"; r e2i a, "-05:45"'\'' ' 3<<'LAZYTEST_EOF' 2017-06-24T18:23:47Z 2017-06-24T16:53:47-01:30 2017-06-24T21:23:47+03:00 2017-06-24T12:38:47-05:45 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=251 lazytest_case 'ni i2017-06-24T18:23:47+00:00 p'\''i2e a'\'' \ p'\''r e2i a; r e2i a, -1.5; r e2i a, "+3"; r e2i a, "-05:45"'\'' p'\''i2e a'\'' ' 3<<'LAZYTEST_EOF' 1498328627 1498328627 1498328627 1498328627 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=264 lazytest_case 'ni 1p'\''r tpi tep(tpe(2018, 1, 14, 9, 12, 31)), "Z"'\'' ' 3<<'LAZYTEST_EOF' 2018-01-14T09:12:31Z LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=271 lazytest_case 'ni 1p'\''r i2e tpi tep(1515801233), "Z"'\'' ' 3<<'LAZYTEST_EOF' 1515801233 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=281 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, -60'\'' \ p'\''my $epoch_time = 1485079513; dow gh6l($epoch_time, a)'\'' ' 3<<'LAZYTEST_EOF' Sun LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=287 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, -60'\'' \ p'\''my $epoch_time = 1485079513; hod gh6l($epoch_time, a)'\'' ' 3<<'LAZYTEST_EOF' 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=293 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, -60'\'' \ p'\''my $epoch_time = 1485079513; how gh6l($epoch_time, a)'\'' ' 3<<'LAZYTEST_EOF' Sun_02 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=299 lazytest_case 'ni i[34.058566 -118.416526] p'\''llg a, b, -60'\'' \ p'\''my $epoch_time = 1485079513; ym gh6l($epoch_time, a)'\'' ' 3<<'LAZYTEST_EOF' 2017-01 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=309 lazytest_case 'ni i1494110651 p'\''r tep ttd(a); r tep tth(a); r tep tt15(a); r tep ttm(a); r tep a'\'' ' 3<<'LAZYTEST_EOF' 2017 5 6 0 0 0 2017 5 6 22 0 0 2017 5 6 22 30 0 2017 5 6 22 44 0 2017 5 6 22 44 11 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=347 lazytest_case 'ni n10p'\''r rw {a < 7}'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=356 lazytest_case 'ni n10p'\''r ru {a % 4 == 0}'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=363 lazytest_case 'ni n10p'\''r re {int(a**2/30)}'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=376 lazytest_case 'ni i[j can] i[j you] i[j feel] \ i[k the] i[k love] i[l tonight] \ p'\''my @lines = re {a}; r @lines;'\'' ' 3<<'LAZYTEST_EOF' j can j you j feel k the k love l tonight LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=389 lazytest_case 'ni i[j can] i[j you] i[j feel] \ i[k the] i[k love] i[l tonight] \ p'\''my @lines = re {a}; r b_(@lines)'\'' ' 3<<'LAZYTEST_EOF' can you feel the love tonight LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=402 lazytest_case 'ni i[j can] i[j you] i[j feel] \ i[k the] i[k love] i[l tonight] \ p'\''my @lines = rea; r b_ @lines'\'' ' 3<<'LAZYTEST_EOF' can you feel the love tonight LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=413 lazytest_case 'ni i[j can] i[j you] i[j feel] \ i[k the] i[k love] i[l tonight] \ p'\''r b_ rea'\'' ' 3<<'LAZYTEST_EOF' can you feel the love tonight LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=424 lazytest_case 'ni i[j can] i[j you] i[j feel] \ i[k the] i[k love] i[l tonight] \ p'\''my @lines = rea; r b_ @lines; r a_ @lines'\'' ' 3<<'LAZYTEST_EOF' can you feel j j j the love k k tonight l LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=442 lazytest_case 'ni i[a x first] i[a x second] \ i[a y third] i[b y fourth] p'\''r c_ rea'\'' ' 3<<'LAZYTEST_EOF' first second third fourth LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=453 lazytest_case 'ni i[a x first] i[a x second] \ i[a y third] i[b y fourth] p'\''r c_ re {b}'\'' ' 3<<'LAZYTEST_EOF' first second third fourth LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=462 lazytest_case 'ni i[a x first] i[a x second] \ i[a y third] i[b y fourth] p'\''r c_ reb'\'' ' 3<<'LAZYTEST_EOF' first second third fourth LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=478 lazytest_case 'ni ::data[n5] 1p'\''a_ data'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=491 lazytest_case 'ni i[m 1 x] i[m 2 y s t] \ i[m 3 yo] i[n 5 who] i[n 6 let the dogs] p'\''r b__ rea'\'' ' 3<<'LAZYTEST_EOF' 1 x 2 y s t 3 yo 5 who 6 let the dogs LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=511 lazytest_case 'ni i[1 2 3] p'\''r min F_; r max F_'\'' ' 3<<'LAZYTEST_EOF' 1 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=517 lazytest_case 'ni i[c a b] p'\''r minstr F_; r maxstr F_'\'' ' 3<<'LAZYTEST_EOF' a c LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=536 lazytest_case 'ni i[2 3 4] p'\''r sum(F_), prod(F_), mean(F_)'\'' ' 3<<'LAZYTEST_EOF' 9 24 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=545 lazytest_case 'ni i[a c b c c a] p'\''my @uniqs = uniq F_; r sort @uniqs'\'' ' 3<<'LAZYTEST_EOF' a b c LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=552 lazytest_case 'ni i[a c b c c a] p'\''my %h = %{freqs F_}; r($_, $h{$_}) for sort keys %h'\'' ' 3<<'LAZYTEST_EOF' a 2 b 1 c 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=567 lazytest_case 'ni i[2 3 4] p'\''r any {$_ > 3} F_; r all {$_ > 3} F_'\'' ' 3<<'LAZYTEST_EOF' 1 0 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=577 lazytest_case 'ni i[aa bbb c] p'\''r argmax {length} F_; r argmin {length} F_'\'' ' 3<<'LAZYTEST_EOF' bbb c LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=585 lazytest_case 'ni i[aa bbb c ddd e] p'\''r argmax {length} F_; r argmin {length} F_'\'' ' 3<<'LAZYTEST_EOF' bbb c LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=595 lazytest_case 'ni 1p'\''my @ks = ("u", "v"); my @vs = (1, 10); r zip \@ks, \@vs'\'' ' 3<<'LAZYTEST_EOF' u 1 v 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=602 lazytest_case 'ni 1p'\''my @ks = ("u", "v"); my @vs = (1, 10); my %h = zip \@ks, \@vs; r $h{"v"}'\'' ' 3<<'LAZYTEST_EOF' 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=610 lazytest_case 'ni 1p'\''my @ks = ("u", "v"); my @vs = (1, 10); my @ws =("foo", "bar"); r zip \@ks, \@vs, \@ws'\'' ' 3<<'LAZYTEST_EOF' u 1 foo v 10 bar LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=619 lazytest_case 'ni 1p'\''my @ks = ("u", "v"); my @vs = (1, 10, "nope", 100, 1000,); r zip \@ks, \@vs'\'' ' 3<<'LAZYTEST_EOF' u 1 v 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=629 lazytest_case 'ni 1p'\''cart [10, 20], [1, 2, 3]'\'' ' 3<<'LAZYTEST_EOF' 10 1 10 2 10 3 20 1 20 2 20 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=654 lazytest_case 'ni i[1 2 3 4 5 6 7] p'\''r take 3, F_; r drop 3, F_'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=662 lazytest_case 'ni i[1 2 3 4 5 6 7] p'\''r take_while {$_ < 3} F_; r drop_while {$_ < 3} F_'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=679 lazytest_case 'ni i[a 1] i[b 2] i[foo bar] \ p'\''my @lines = rw {1}; my %h = ab_ @lines; my @sorted_keys = sort keys %h; r @sorted_keys; r map {$h{$_}} @sorted_keys'\'' ' 3<<'LAZYTEST_EOF' a b foo 1 2 bar LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=690 lazytest_case 'ni i[a 1] i[b 2] i[foo bar] \ p'\''my @lines = rw {1}; my %h = ab_ @lines; my @sorted_keys = sort keys %h; r @sorted_keys; r @h{@sorted_keys}'\'' ' 3<<'LAZYTEST_EOF' a b foo 1 2 bar LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=701 lazytest_case 'ni ::passwords[idragon i12345] i[try this] i[123 fails] \ i[dragon does work] i[12345 also works] \ i[other ones] i[also fail] \ rp'\''^{%h = ab_ passwords} exists($h{+a})'\'' ' 3<<'LAZYTEST_EOF' dragon does work 12345 also works LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=719 lazytest_case 'ni i[x k 3] i[x j 2] i[y m 4] i[y p 8] i[y n 1] p'\''r acS rea'\'' ' 3<<'LAZYTEST_EOF' x 5 y 13 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=727 lazytest_case 'ni i[y m 4 foo] i[y p 8] i[y n 1 bar] \ p'\''%h = dcSNN rea; @sorted_keys = kbv_dsc %h; r($_, $h{$_}) for @sorted_keys'\'' ' 3<<'LAZYTEST_EOF' foo 4 bar 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=741 lazytest_case 'ni i[x k 3] i[x j 2] i[y m 4] i[y p 8] i[y n 1] i[z u 0] \ p'\''r acS rea'\'' p'\''r kbv_dsc(ab_ rl(3))'\'' ' 3<<'LAZYTEST_EOF' y x z LAZYTEST_EOF lazytest_file='doc/ni_by_example_3.md' lazytest_line=748 lazytest_case 'ni i[x k 3] i[x j 2] i[y m 4] i[y p 8] i[y n 1] i[z u 0] \ p'\''r acS rea'\'' p'\''r kbv_asc(ab_ rl(3))'\'' ' 3<<'LAZYTEST_EOF' z x y LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=35 lazytest_case 'ni ::five[n5] n3p'\''r a, five'\'' ' 3<<'LAZYTEST_EOF' 1 12345 2 12345 3 12345 LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=43 lazytest_case 'ni --explain ::five[n5] n3p'\''r a, five'\'' ' 3<<'LAZYTEST_EOF' ["memory_data_closure","five",[["n",1,6]]] ["n",1,4] ["perl_mapper","r a, five"] LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=56 lazytest_case 'ni ::five[n5] | ni n3p'\''r a, five'\'' ' 3<<'LAZYTEST_EOF' 1 five 2 five 3 five LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=272 lazytest_case 'ni ::five[n5] //ni | perl - 1p'\''five'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=493 lazytest_case 'ni n1000 rs5 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=547 lazytest_case 'ni i0edd9c94-24d8-4a3e-b8fb-a33c37386ae1 p'\''h2b64 a'\'' ' 3<<'LAZYTEST_EOF' Dt2clCTYSj64+6M8Nzhq4# LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=554 lazytest_case 'ni i0edd9c94-24d8-4a3e-b8fb-a33c37386ae1 p'\''b642h h2b64 a'\'' ' 3<<'LAZYTEST_EOF' 0edd9c9424d84a3eb8fba33c37386ae1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_4.md' lazytest_line=561 lazytest_case 'ni i0edd9c94-24d8-4a3e-b8fb-a33c37386ae1 p'\''hyphenate_uuid b642h h2b64 a'\'' ' 3<<'LAZYTEST_EOF' 0edd9c94-24d8-4a3e-b8fb-a33c37386ae1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=84 lazytest_case 'ni n3 ^[n05 fAA] ' 3<<'LAZYTEST_EOF' 0 0 1 1 2 2 3 3 4 4 1 2 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=97 lazytest_case 'ni n3 +[n05 fAA] ' 3<<'LAZYTEST_EOF' 1 2 3 0 0 1 1 2 2 3 3 4 4 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=133 lazytest_case 'ni n10 =[r5 \>short] r3fAA ' 3<<'LAZYTEST_EOF' 1 1 2 2 3 3 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=140 lazytest_case 'ni short ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=165 lazytest_case 'ni //license w[n3p'\''a*a'\''] ' 3<<'LAZYTEST_EOF' ni: https://github.com/spencertipping/ni 1 Copyright (c) 2016 Spencer Tipping | MIT license 4 9 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=176 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' Wn ' 3<<'LAZYTEST_EOF' 1 a 2 b 3 c 4 d 5 e LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=190 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' Wn p'\''r a, uc(b)'\'' ' 3<<'LAZYTEST_EOF' 1 A 2 B 3 C 4 D 5 E LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=201 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' Wn vBpuc ' 3<<'LAZYTEST_EOF' 1 A 2 B 3 C 4 D 5 E LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=234 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' :letters gA- wn gA ' 3<<'LAZYTEST_EOF' a 5 b 4 c 3 d 2 e 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=245 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' :letters gA- wn gA +[letters] ' 3<<'LAZYTEST_EOF' a 5 b 4 c 3 d 2 e 1 a b c d e LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=261 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' :letters gA- wn gA +[letters] wn ' 3<<'LAZYTEST_EOF' a 5 1 b 4 2 c 3 3 d 2 4 e 1 5 a 6 b 7 c 8 d 9 e 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=278 lazytest_case 'ni 1p'\''"a".."e"'\'' p'\''split / /'\'' :letters gA- wn gA +[letters] wn gABn ' 3<<'LAZYTEST_EOF' a 5 1 a 6 b 4 2 b 7 c 3 3 c 8 d 2 4 d 9 e 1 5 e 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=304 lazytest_case 'ni //license FW Y r10 ' 3<<'LAZYTEST_EOF' 0 0 ni 0 1 https 0 2 github 0 3 com 0 4 spencertipping 0 5 ni 1 0 Copyright 1 1 c 1 2 2016 1 3 Spencer LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=321 lazytest_case 'ni //license FW Y r10 X ' 3<<'LAZYTEST_EOF' ni https github com spencertipping ni Copyright c 2016 Spencer LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=330 lazytest_case 'ni 1p'\''"a".."l"'\'' Z4 ' 3<<'LAZYTEST_EOF' a b c d e f g h i j k l LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=389 lazytest_case 'ni nE4 fAAA ,aA ,sB ,dC r~1 ' 3<<'LAZYTEST_EOF' 5000.5 50005000 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=414 lazytest_case 'ni n3p'\''r map a*$_, 1..3'\'' N'\''x = x + 1'\'' ' 3<<'LAZYTEST_EOF' 2 3 4 3 5 7 4 7 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=421 lazytest_case 'ni n5p'\''r map a . $_, 1..3'\'' N'\''x = x.T'\'' ' 3<<'LAZYTEST_EOF' 11 21 31 41 51 12 22 32 42 52 13 23 33 43 53 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=436 lazytest_case 'ni i[1 0] i[1 1] N'\''x = dot(x, x.T)'\'' ' 3<<'LAZYTEST_EOF' 1 1 1 2 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=483 lazytest_case 'ni n4m'\''r a, ai + 1'\'' ' 3<<'LAZYTEST_EOF' 1 2 2 3 3 4 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=494 lazytest_case 'ni //license FWr2m'\''r fields[0..3]'\'' ' 3<<'LAZYTEST_EOF' ni https github com Copyright c 2016 Spencer LAZYTEST_EOF lazytest_file='doc/ni_by_example_5.md' lazytest_line=511 lazytest_case 'ni n4fAA l"(r (sr ('\''+ a) ('\''* b)))" ' 3<<'LAZYTEST_EOF' 10 24 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=53 lazytest_case 'ni n5 \>n1.3E5 ' 3<<'LAZYTEST_EOF' n1.3E5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=58 lazytest_case 'ni n1.3E5 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=118 lazytest_case 'ni n5p'\''^{@x}; push @x, 2*a; undef; END{r join " and ", @x}'\'' ' 3<<'LAZYTEST_EOF' 2 and 4 and 6 and 8 and 10 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=154 lazytest_case 'ni n3p'\''*v = sub {$_[0] x 4}; &v(a)'\'' ' 3<<'LAZYTEST_EOF' 1111 2222 3333 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=165 lazytest_case 'ni 1p'\''sub yo {"hi " . $_[0]} yo a'\'' ' 3<<'LAZYTEST_EOF' hi 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=183 lazytest_case 'ni n1E5p'\''sr {$_[0] + a} 0'\'' ' 3<<'LAZYTEST_EOF' 5000050000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=196 lazytest_case 'ni n1E1p'\''r sr {$_[0] + a, $_[1] * a, $_[2] . a} 0, 1, ""'\'' ' 3<<'LAZYTEST_EOF' 55 3628800 12345678910 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=220 lazytest_case 'ni n1000p'\''se {$_[0] + a} sub {length}, 0'\'' ' 3<<'LAZYTEST_EOF' 45 4905 494550 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=230 lazytest_case 'ni n1000p'\''r length a, se {$_[0] + a} sub {length}, 0'\'' ' 3<<'LAZYTEST_EOF' 1 45 2 4905 3 494550 4 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=242 lazytest_case 'ni n1000p'\''sub len($) {length $_}; r len a, se {$_[0] + a} \&len, 0'\'' ' 3<<'LAZYTEST_EOF' 1 45 2 4905 3 494550 4 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=257 lazytest_case 'ni n1000p'\''r a, length a'\'' p'\''r b, se {$_[0] + a} \&b, 0'\'' ' 3<<'LAZYTEST_EOF' 1 45 2 4905 3 494550 4 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=268 lazytest_case 'ni n1000p'\''r length a, a'\'' p'\''r a, sea {$_[0] + b} 0'\'' ' 3<<'LAZYTEST_EOF' 1 45 2 4905 3 494550 4 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=281 lazytest_case 'ni n100p'\''my ($sum, $n, $min, $max) = sr {$_[0] + a, $_[1] + 1, min($_[2], a), max($_[3], a)} 0, 0, a, a; r $sum, $sum / $n, $min, $max'\'' ' 3<<'LAZYTEST_EOF' 5050 50.5 1 100 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=291 lazytest_case 'ni n100p'\''r rc \&sr, rsum "a", rmean "a", rmin "a", rmax "a"'\'' ' 3<<'LAZYTEST_EOF' 5050 50.5 1 100 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=323 lazytest_case 'rm -f numbers # prevent ni from reusing any existing file ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=324 lazytest_case 'ni nE6gr4 :numbers ' 3<<'LAZYTEST_EOF' 1 10 100 1000 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=335 lazytest_case 'ni nE6gr4 :numbers O ' 3<<'LAZYTEST_EOF' 1000 100 10 1 LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=393 lazytest_case 'ni n10 =[\>ten.txt] z\>ten.gz ' 3<<'LAZYTEST_EOF' ten.gz LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=404 lazytest_case 'ni --explain n10 =[\>ten.txt] z\>ten.gz ' 3<<'LAZYTEST_EOF' ["n",1,11] ["divert",["file_write","ten.txt"]] ["sh","gzip"] ["file_write","ten.gz"] LAZYTEST_EOF lazytest_file='doc/ni_by_example_6.md' lazytest_line=511 lazytest_case 'ni --explain /usr/share/dict/words rx40 r10 p'\''r substr(a, 0, 3), substr(a, 3, 3), substr(a, 6)'\'' ' 3<<'LAZYTEST_EOF' ["cat","/usr/share/dict/words"] ["row_every",40] ["head","-n",10] ["perl_mapper","r substr(a, 0, 3), substr(a, 3, 3), substr(a, 6)"] LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=14 lazytest_case 'ni n5p'\''a * a'\'' # square some numbers ' 3<<'LAZYTEST_EOF' 1 4 9 16 25 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=26 lazytest_case 'ni ::plfoo[n4p'\''a*a'\''] //:plfoo ' 3<<'LAZYTEST_EOF' 1 4 9 16 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=38 lazytest_case 'ni +p'\''1..5'\'' # nothing happens here ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=39 lazytest_case 'ni +n1p'\''1..5'\'' # the single input row causes `p` to run ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=45 lazytest_case 'ni 1p'\''"hello"'\'' # 1 == n1 ' 3<<'LAZYTEST_EOF' hello LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=57 lazytest_case 'ni n4p'\''r a, a + 1'\'' # generate two columns ' 3<<'LAZYTEST_EOF' 1 2 2 3 3 4 4 5 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=62 lazytest_case 'ni n4p'\''r a, a + 1'\'' p'\''r a + b'\'' # ... and sum them ' 3<<'LAZYTEST_EOF' 3 5 7 9 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=87 lazytest_case 'ni /etc/passwd F::r3 ' 3<<'LAZYTEST_EOF' root x 0 0 root /root /bin/bash daemon x 1 1 daemon /usr/sbin /bin/sh bin x 2 2 bin /bin /bin/sh LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=91 lazytest_case 'ni /etc/passwd F::r3p'\''r F_ 0..3'\'' ' 3<<'LAZYTEST_EOF' root x 0 0 daemon x 1 1 bin x 2 2 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=95 lazytest_case 'ni /etc/passwd F::r3p'\''r F_ 1..3'\'' ' 3<<'LAZYTEST_EOF' x 0 0 x 1 1 x 2 2 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=99 lazytest_case 'ni /etc/passwd F::r3p'\''r scalar F_'\'' # number of fields ' 3<<'LAZYTEST_EOF' 7 7 7 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=109 lazytest_case 'ni /etc/passwd F::r3p'\''r F_ 3..FM'\'' ' 3<<'LAZYTEST_EOF' 0 root /root /bin/bash 1 daemon /usr/sbin /bin/sh 2 bin /bin /bin/sh LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=113 lazytest_case 'ni /etc/passwd F::r3p'\''r FR 3'\'' # FR(n) == F_(n..FM) ' 3<<'LAZYTEST_EOF' 0 root /root /bin/bash 1 daemon /usr/sbin /bin/sh 2 bin /bin /bin/sh LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=139 lazytest_case 'ni n2p'\''a, a + 100'\'' # return without "r" ' 3<<'LAZYTEST_EOF' 1 101 2 102 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=144 lazytest_case 'ni n2p'\''r a, a + 100'\'' # use "r" for side effect, return () ' 3<<'LAZYTEST_EOF' 1 101 2 102 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=147 lazytest_case 'ni n3p'\''r $_ for 1..a'\'' # use r imperatively, implicit return ' 3<<'LAZYTEST_EOF' 1 1 2 1 2 3 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=159 lazytest_case 'ni n3p'\''[a, a+1, a+2]'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 2 3 4 3 4 5 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=170 lazytest_case 'cat > functions.pm <<'\''EOF'\'' package ni::pl; # important! this is the package where your perl code runs sub normalize { my $sum = sum @_; # required code can call back into ni functions map $_ / ($sum || 1), @_; } EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=178 lazytest_case 'ni pRfunctions.pm 1p'\''r normalize 1, 2, 5'\'' ' 3<<'LAZYTEST_EOF' 0.125 0.25 0.625 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=215 lazytest_case 'nc -l 3001 <<'\''EOF'\'' > /dev/null & HTTP/1.1 200 OK Content-Length: 54 package ni::pl; sub this_worked { r "it worked", @_ } EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=222 lazytest_case 'sleep 1 ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=223 lazytest_case 'ni pRhttp://localhost:3001 1p'\''this_worked 5, 6, 7'\'' ' 3<<'LAZYTEST_EOF' it worked 5 6 7 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=240 lazytest_case 'ni n10p'\''r ru {a%4 == 0}'\'' # read forward until a multiple of 4 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=251 lazytest_case 'ni n10p'\''r map a*$_, 1..10'\'' =\>mult-table ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=262 lazytest_case 'ni mult-table p'\''r g_ ru {a%4 == 0}'\'' # extract seventh column from each line ' 3<<'LAZYTEST_EOF' 7 14 21 28 35 42 49 56 63 70 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=279 lazytest_case 'ni ::squares[n100p'\''100 - a'\'' p'\''r a, a*a'\''] \ n5p'\''^{@sq{a_ squares} = b_ squares} $sq{a()}'\'' ' 3<<'LAZYTEST_EOF' 1 4 9 16 25 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=293 lazytest_case 'ni ::squares[n100p'\''100 - a'\'' p'\''r a, a*a'\''] n5p'\''^{%sq = ab_ squares} $sq{a()}'\'' ' 3<<'LAZYTEST_EOF' 1 4 9 16 25 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=314 lazytest_case 'ni n100p'\''sum rw {1}'\'' ' 3<<'LAZYTEST_EOF' 5050 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=316 lazytest_case 'ni n10p'\''prod rw {1}'\'' ' 3<<'LAZYTEST_EOF' 3628800 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=318 lazytest_case 'ni n100p'\''mean rw {1}'\'' ' 3<<'LAZYTEST_EOF' 50.5 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=326 lazytest_case 'ni n1p'\''cart [1,2], [1,2,3], ["a","b"]'\'' ' 3<<'LAZYTEST_EOF' 1 1 a 1 1 b 1 2 a 1 2 b 1 3 a 1 3 b 2 1 a 2 1 b 2 2 a 2 2 b 2 3 a 2 3 b LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=357 lazytest_case 'ni n10000p'\''sr {$_[0] + a} 0'\'' ' 3<<'LAZYTEST_EOF' 50005000 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=375 lazytest_case 'ni /etc/passwd F::gGp'\''r g, se {"$_[0]," . a} \&g, ""'\'' ' 3<<'LAZYTEST_EOF' /bin/bash ,root /bin/false ,syslog /bin/sh ,backup,bin,daemon,games,gnats,irc,libuuid,list,lp,mail,man,news,nobody,proxy,sys,uucp,www-data /bin/sync ,sync LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=396 lazytest_case 'ni n100p'\''my ($sum, $n, $min, $max) = sr {$_[0] + a, $_[1] + 1, min($_[2], a), max($_[2], a)} 0, 0, a, a; r $sum, $sum / $n, $min, $max'\'' ' 3<<'LAZYTEST_EOF' 5050 50.5 1 100 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=406 lazytest_case 'ni n100p'\''r rc \&sr, rsum "a", rmean "a", rmin "a", rmax "a"'\'' ' 3<<'LAZYTEST_EOF' 5050 50.5 1 100 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=434 lazytest_case 'ni /etc/passwd FWpsplit// r/[a-z]/ \ p'\''my %freqs = %{rc \&sr, rfn q{ ++${%1}{a()} && %1 }, {}}; map r($_, $freqs{$_}), sort keys %freqs'\'' ' 3<<'LAZYTEST_EOF' a 39 b 36 c 14 d 13 e 17 f 1 g 11 h 20 i 46 k 3 l 19 m 14 n 50 o 25 p 15 r 24 s 51 t 15 u 17 v 12 w 12 x 23 y 12 LAZYTEST_EOF lazytest_file='doc/perl.md' lazytest_line=482 lazytest_case 'ni /etc/passwd FWpsplit// r/[a-z]/gcx ' 3<<'LAZYTEST_EOF' a 39 b 36 c 14 d 13 e 17 f 1 g 11 h 20 i 46 k 3 l 19 m 14 n 50 o 25 p 15 r 24 s 51 t 15 u 17 v 12 w 12 x 23 y 12 LAZYTEST_EOF # All of these tests require Docker, so skip if we don't have it if ! [[ $SKIP_DOCKER ]]; then cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/pyspark.md' lazytest_line=13 lazytest_case 'ni Cgettyimages/spark[PL[n10] \<o] ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF fi # $SKIP_DOCKER cat <<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=19 lazytest_case 'ni n10r3 # take first 3 ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=23 lazytest_case 'ni n10r~3 # take last 3 ' 3<<'LAZYTEST_EOF' 8 9 10 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=27 lazytest_case 'ni n10r-7 # drop first 7 ' 3<<'LAZYTEST_EOF' 8 9 10 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=40 lazytest_case 'ni n10 rs3 ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=48 lazytest_case 'ni n10000rx4000 # take the 1st of every 4000 rows ' 3<<'LAZYTEST_EOF' 1 4001 8001 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=52 lazytest_case 'ni n10000r.0002 # sample uniformly, P(row) = 0.0002 ' 3<<'LAZYTEST_EOF' 1 6823 8921 9509 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=80 lazytest_case 'ni n10000r/[42]000$/ ' 3<<'LAZYTEST_EOF' 2000 4000 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=83 lazytest_case 'ni n1000r/[^1]$/r3 ' 3<<'LAZYTEST_EOF' 2 3 4 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=98 lazytest_case 'ni n10000rp'\''$_ % 100 == 42'\'' r3 ' 3<<'LAZYTEST_EOF' 42 142 242 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=117 lazytest_case 'ni n1000p'\''r/(.)(.*)/'\'' r15 # until 10, the second field is empty ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 1 0 1 1 1 2 1 3 1 4 1 5 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=133 lazytest_case 'ni n1000p'\''r/(.)(.*)/'\'' rB r8 # rB = "rows for which field B exists" ' 3<<'LAZYTEST_EOF' 1 0 1 1 1 2 1 3 1 4 1 5 1 6 1 7 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=145 lazytest_case 'ni n10rB | wc -l # no field B here, so no output ' 3<<'LAZYTEST_EOF' 0 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=150 lazytest_case 'ni n10p'\''r a; ""'\'' rA | wc -l # remove blank lines ' 3<<'LAZYTEST_EOF' 10 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=160 lazytest_case 'ni n100 riA[n4 p'\''a*2'\''] # intersect column A with values from n4 p'\''a*2'\'' ' 3<<'LAZYTEST_EOF' 2 4 6 8 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=170 lazytest_case 'ni n10 rIAn5 ' 3<<'LAZYTEST_EOF' 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=183 lazytest_case 'ni n100n10gr4 # g = '\''group'\'' ' 3<<'LAZYTEST_EOF' 1 1 10 10 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=188 lazytest_case 'ni n100n100gur4 # u = '\''uniq'\'' ' 3<<'LAZYTEST_EOF' 1 10 100 11 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=202 lazytest_case 'ni n100or3 # o = '\''order'\'': sort numeric ascending ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=206 lazytest_case 'ni n100Or3 # O = '\''reverse order'\'' ' 3<<'LAZYTEST_EOF' 100 99 98 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=219 lazytest_case 'ni n100p'\''r a, sin(a), log(a)'\'' > data # generate multicolumn data ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=220 lazytest_case 'ni data r4 ' 3<<'LAZYTEST_EOF' 1 0.841470984807897 0 2 0.909297426825682 0.693147180559945 3 0.141120008059867 1.09861228866811 4 -0.756802495307928 1.38629436111989 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=231 lazytest_case 'ni data oBr4 ' 3<<'LAZYTEST_EOF' 11 -0.999990206550703 2.39789527279837 55 -0.99975517335862 4.00733318523247 99 -0.999206834186354 4.59511985013459 80 -0.993888653923375 4.38202663467388 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=243 lazytest_case 'ni data oBg r4 # '\''g'\'' is a modifier of B, not another sort ' 3<<'LAZYTEST_EOF' 11 -0.999990206550703 2.39789527279837 55 -0.99975517335862 4.00733318523247 99 -0.999206834186354 4.59511985013459 80 -0.993888653923375 4.38202663467388 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=248 lazytest_case 'ni data oB g r4 # '\''g'\'' is a sorting operator ' 3<<'LAZYTEST_EOF' 1 0.841470984807897 0 10 -0.54402111088937 2.30258509299405 100 -0.506365641109759 4.60517018598809 11 -0.999990206550703 2.39789527279837 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=260 lazytest_case 'ni i{foo,bar,bif,baz,quux,uber,bake} p'\''r length, a'\'' ggAB ' 3<<'LAZYTEST_EOF' 3 bar 3 baz 3 bif 3 foo 4 bake 4 quux 4 uber LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=274 lazytest_case 'ni i{foo,bar,bif,baz,quux,uber,bake} p'\''r length, a'\'' ggAB- ' 3<<'LAZYTEST_EOF' 3 foo 3 bif 3 baz 3 bar 4 uber 4 quux 4 bake LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=282 lazytest_case 'ni n10p'\''r "a", a'\'' ggABn- r4 ' 3<<'LAZYTEST_EOF' a 10 a 9 a 8 a 7 LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=295 lazytest_case 'ni //license FWpF_ > word-list ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=296 lazytest_case 'ni word-list cr10 # unsorted count ' 3<<'LAZYTEST_EOF' 1 ni 1 https 1 github 1 com 1 spencertipping 1 ni 1 Copyright 1 c 1 2016 1 Spencer LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=307 lazytest_case 'ni word-list gcr10 # sort first to group words ' 3<<'LAZYTEST_EOF' 1 2016 1 A 1 ACTION 1 AN 1 AND 2 ANY 1 ARISING 1 AS 1 AUTHORS 1 BE LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=318 lazytest_case 'ni word-list gcOr10 # by descending count ' 3<<'LAZYTEST_EOF' 7 to 7 the 7 OR 6 THE 5 Software 4 of 4 and 4 OF 4 IN 3 SOFTWARE LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=335 lazytest_case 'ni i[foo bar] i[foo car] i[foo dar] i[that no] i[this yes] \ j[ i[foo mine] i[not here] i[this OK] i[this yipes] ] ' 3<<'LAZYTEST_EOF' foo bar mine foo car mine foo dar mine this yes OK this yes yipes LAZYTEST_EOF lazytest_file='doc/row.md' lazytest_line=347 lazytest_case 'ni i[M N foo] i[M N bar] i[M O qux] i[X Y cat] i[X Z dog] \ jAB[ i[M N hi] i[X Y bye] ] ' 3<<'LAZYTEST_EOF' M N foo hi M N bar hi X Y cat bye LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=9 lazytest_case 'ni n5m'\''ai * ai'\'' # square some numbers ' 3<<'LAZYTEST_EOF' 1 4 9 16 25 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=20 lazytest_case 'ni ::rbfoo[n4m'\''ai*ai'\''] //:rbfoo ' 3<<'LAZYTEST_EOF' 1 4 9 16 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=37 lazytest_case 'ni n4m'\''r a, ai + 1'\'' # generate two columns ' 3<<'LAZYTEST_EOF' 1 2 2 3 3 4 4 5 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=42 lazytest_case 'ni n4m'\''r a, ai + 1'\'' m'\''r ai + bi'\'' # ... and sum them ' 3<<'LAZYTEST_EOF' 3 5 7 9 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=58 lazytest_case 'ni /etc/passwd F::r3 ' 3<<'LAZYTEST_EOF' root x 0 0 root /root /bin/bash daemon x 1 1 daemon /usr/sbin /bin/sh bin x 2 2 bin /bin /bin/sh LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=62 lazytest_case 'ni /etc/passwd F::r3m'\''r fields[0..3]'\'' ' 3<<'LAZYTEST_EOF' root x 0 0 daemon x 1 1 bin x 2 2 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=66 lazytest_case 'ni /etc/passwd F::r3m'\''r fields[1..3]'\'' ' 3<<'LAZYTEST_EOF' x 0 0 x 1 1 x 2 2 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=70 lazytest_case 'ni /etc/passwd F::r3m'\''r fields.size'\'' ' 3<<'LAZYTEST_EOF' 7 7 7 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=83 lazytest_case 'ni n2m'\''[a, ai + 100]'\'' # multiple lines ' 3<<'LAZYTEST_EOF' 1 101 2 102 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=88 lazytest_case 'ni n2m'\''r a, ai + 100'\'' # multiple columns ' 3<<'LAZYTEST_EOF' 1 101 2 102 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=104 lazytest_case 'ni n10m'\''r ru {|l| l.ai%4 == 0}'\'' # read forward until a multiple of 4 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=114 lazytest_case 'ni n10m'\''r (1..10).map {|x| ai*x}'\'' =\>mult-table ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 6 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 4 8 12 16 20 24 28 32 36 40 5 10 15 20 25 30 35 40 45 50 6 12 18 24 30 36 42 48 54 60 7 14 21 28 35 42 49 56 63 70 8 16 24 32 40 48 56 64 72 80 9 18 27 36 45 54 63 72 81 90 10 20 30 40 50 60 70 80 90 100 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=130 lazytest_case 'ni mult-table m'\''r ru {|l| l.ai%4 == 0}.map(&:g)'\'' # access column G ' 3<<'LAZYTEST_EOF' 7 14 21 28 35 42 49 56 63 70 LAZYTEST_EOF lazytest_file='doc/ruby.md' lazytest_line=139 lazytest_case 'ni mult-table m'\''r ru {|l| l.ai%4 == 0}.g'\'' ' 3<<'LAZYTEST_EOF' 7 14 21 28 35 42 49 56 63 70 LAZYTEST_EOF lazytest_file='doc/scale.md' lazytest_line=6 lazytest_case 'ni nE6 p'\''sin(a/100)'\'' rp'\''a >= 0'\'' =\>slow-sine-table e[wc -l] ' 3<<'LAZYTEST_EOF' 500141 LAZYTEST_EOF lazytest_file='doc/scale.md' lazytest_line=15 lazytest_case 'ni nE6 S4[p'\''sin(a/100)'\'' rp'\''a >= 0'\''] =\>parallel-sine-table e[wc -l] ' 3<<'LAZYTEST_EOF' 500141 LAZYTEST_EOF lazytest_file='doc/scale.md' lazytest_line=17 lazytest_case 'diff <(ni slow-sine-table o) <(ni parallel-sine-table o) | head -n10 ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=11 lazytest_case 'mkdir echo-script ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=12 lazytest_case 'echo echo.pl >> echo-script/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=13 lazytest_case 'echo echo.sh >> echo-script/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=14 lazytest_case 'cat > echo-script/echo.sh <<'\''EOF'\'' #!/bin/sh echo "$@" EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=18 lazytest_case 'cat > echo-script/echo.pl <<'\''EOF'\'' defshort '\''/echo'\'' => pmap q{script_op '\''echo-script'\'', "./echo.sh $_"}, shell_command; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=27 lazytest_case 'ni --lib echo-script echo[1 2 3] ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=34 lazytest_case 'mkdir -p echo2/bin ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=35 lazytest_case '{ echo echo2.pl; echo bin/echo2; } > echo2/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=36 lazytest_case 'cat > echo2/echo2.pl <<'\''EOF'\'' defshort '\''/echo2'\'' => pmap q{script_op '\''echo2'\'', "bin/echo2 $_"}, shell_command; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=40 lazytest_case 'cat > echo2/bin/echo2 <<'\''EOF'\'' #!/bin/sh echo "$# argument(s)" echo "$@" EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/script.md' lazytest_line=52 lazytest_case 'ni --lib echo2 echo2'\''foo bar'\'' ' 3<<'LAZYTEST_EOF' 2 argument(s) foo bar LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=6 lazytest_case 'mkdir sqlite-profile ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=7 lazytest_case 'echo sqlite.pl > sqlite-profile/lib ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=8 lazytest_case 'cat > sqlite-profile/sqlite.pl <<'\''EOF'\'' defoperator sqlite => q{ my ($db, $query) = @_; exec '\''sqlite'\'', '\''-separator'\'', "\t", $db, $query; }; defsqlprofile S => pmap q{sqlite_op $$_[0], $$_[1]}, pseq pc filename, sql_query; EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=21 lazytest_case 'sqlite test.db <<'\''EOF'\'' CREATE TABLE foo(x int, y int); INSERT INTO foo(x, y) VALUES (1, 2); INSERT INTO foo(x, y) VALUES (3, 4); INSERT INTO foo(x, y) VALUES (5, 6); EOF ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=27 lazytest_case 'ni --lib sqlite-profile QStest.db foo[rx=3] ' 3<<'LAZYTEST_EOF' 3 4 LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=29 lazytest_case 'ni --lib sqlite-profile QStest.db foo rx=3 ' 3<<'LAZYTEST_EOF' 3 4 LAZYTEST_EOF lazytest_file='doc/sql.md' lazytest_line=31 lazytest_case 'ni --lib sqlite-profile QStest.db foo Ox ' 3<<'LAZYTEST_EOF' 5 6 3 4 1 2 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=6 lazytest_case 'echo test > foo ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=7 lazytest_case 'ni foo ' 3<<'LAZYTEST_EOF' test LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=14 lazytest_case 'ni foo foo ' 3<<'LAZYTEST_EOF' test test LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=23 lazytest_case 'echo test | gzip > fooz ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=24 lazytest_case 'ni fooz ' 3<<'LAZYTEST_EOF' test LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=26 lazytest_case 'cat fooz | ni ' 3<<'LAZYTEST_EOF' test LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=39 lazytest_case 'ni n4 # integer generator ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=44 lazytest_case 'ni n04 # integer generator, zero-based ' 3<<'LAZYTEST_EOF' 0 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=71 lazytest_case 'ni ::word[1p'\''pretty'\''] n3 w[np'\''r word'\''] ' 3<<'LAZYTEST_EOF' 1 pretty 2 pretty 3 pretty LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=82 lazytest_case 'ni ifoo # literal text ' 3<<'LAZYTEST_EOF' foo LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=84 lazytest_case 'ni i[foo bar] # literal two-column text ' 3<<'LAZYTEST_EOF' foo bar LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=86 lazytest_case 'ni i[ foo[] [bar] ] # literal two-column text with brackets ' 3<<'LAZYTEST_EOF' foo[] [bar] LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=93 lazytest_case 'ni ::word[ipretty] n3 w[np'\''r word'\''] ' 3<<'LAZYTEST_EOF' 1 pretty 2 pretty 3 pretty LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=101 lazytest_case 'ni e'\''seq 4'\'' # output of shell command "seq 4" ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=111 lazytest_case 'ni 1p'\''hi'\'' +1p'\''there'\'' ' 3<<'LAZYTEST_EOF' hi there LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=121 lazytest_case 'ni 1p'\''hi'\''1p'\''there'\'' ' 3<<'LAZYTEST_EOF' hi1pthere LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=135 lazytest_case 'ni n3 | sort ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=139 lazytest_case 'ni n3 e'\''sort'\'' # without +, e acts as a filter ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=143 lazytest_case 'ni n3e'\''sort -r'\'' ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=147 lazytest_case 'ni n3e[ sort -r ] # easy way to quote arguments ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=151 lazytest_case 'ni n3e[sort -r] ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=160 lazytest_case 'ni n3 g # g = sort ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=164 lazytest_case 'ni n3g # no need for whitespace ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=168 lazytest_case 'ni n3gA- # reverse-sort by first field ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=172 lazytest_case 'ni n3O # NOTE: capital O, not zero; more typical reverse numeric sort ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=192 lazytest_case 'mkdir test-dir ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=193 lazytest_case 'touch test-dir/{a,b,c} ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=194 lazytest_case 'ni e'\''ls test-dir/*'\'' # e'\'''\'' sends its command through sh -c ' 3<<'LAZYTEST_EOF' test-dir/a test-dir/b test-dir/c LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=198 lazytest_case 'ni e[ls test-dir/*] 2>/dev/null || : # e[] uses exec() directly; no wildcard expansion ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=199 lazytest_case 'ni e[ ls test-dir/* ] # using whitespace avoids this problem ' 3<<'LAZYTEST_EOF' test-dir/a test-dir/b test-dir/c LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=238 lazytest_case '{ echo hello; echo world; } > hw ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=239 lazytest_case 'ni n3 +hw ' 3<<'LAZYTEST_EOF' 1 2 3 hello world LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=245 lazytest_case 'ni n3 ^hw ' 3<<'LAZYTEST_EOF' hello world 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=251 lazytest_case 'ni hw =e[wc -l] # output from '\''wc -l'\'' is gone ' 3<<'LAZYTEST_EOF' hello world LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=260 lazytest_case 'ni n4 # integer generator ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=265 lazytest_case 'ni n04 # integer generator, zero-based ' 3<<'LAZYTEST_EOF' 0 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=270 lazytest_case 'ni ifoo # literal text ' 3<<'LAZYTEST_EOF' foo LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=281 lazytest_case 'ni n3 e'\''sort'\'' ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=285 lazytest_case 'ni n3e'\''sort -r'\'' ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=289 lazytest_case 'ni n3e[sort -r] ' 3<<'LAZYTEST_EOF' 3 2 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=312 lazytest_case 'mkdir test-dir ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=313 lazytest_case 'touch test-dir/{a,b,c} ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=314 lazytest_case 'ni e'\''ls test-dir/*'\'' # e'\'''\'' sends its command through sh -c ' 3<<'LAZYTEST_EOF' test-dir/a test-dir/b test-dir/c LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=318 lazytest_case 'ni e[ls test-dir/*] 2>/dev/null || : # e[] uses exec() directly; no wildcard expansion ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=319 lazytest_case 'ni e[ ls test-dir/* ] # using whitespace avoids this problem ' 3<<'LAZYTEST_EOF' test-dir/a test-dir/b test-dir/c LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=329 lazytest_case 'ni n3 >file # nothing goes to the terminal ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=330 lazytest_case 'ni file ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=339 lazytest_case 'ni n3 \>file2 # writes the filename to the terminal ' 3<<'LAZYTEST_EOF' file2 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=341 lazytest_case 'ni file2 ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=345 lazytest_case 'ni n3 =\>file3 # eats the filename because \> happens inside = ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=349 lazytest_case 'ni file3 ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=359 lazytest_case 'ni n4 \>file3 \< ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=373 lazytest_case '{ echo foo; echo bar; } > file1 ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=374 lazytest_case 'echo bif > file2 ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=375 lazytest_case 'ni ifile1 ifile2 \< # regular file-read on multiple files ' 3<<'LAZYTEST_EOF' foo bar bif LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=379 lazytest_case 'ni ifile1 ifile2 W\< # prepend-file read on multiple files ' 3<<'LAZYTEST_EOF' file1 foo file1 bar file2 bif LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=389 lazytest_case 'ni ifile1 ifile2 W\< p'\''r a.".txt", b'\'' W\> ' 3<<'LAZYTEST_EOF' file1.txt file2.txt LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=392 lazytest_case 'cat file1.txt ' 3<<'LAZYTEST_EOF' foo bar LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=395 lazytest_case 'cat file2.txt ' 3<<'LAZYTEST_EOF' bif LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=402 lazytest_case 'ni ifile1 ifile2 W\< p'\''r a.".txt2", b'\'' W\>p'\''uc'\'' ' 3<<'LAZYTEST_EOF' file1.txt2 file2.txt2 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=405 lazytest_case 'cat file1.txt2 ' 3<<'LAZYTEST_EOF' FOO BAR LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=408 lazytest_case 'cat file2.txt2 ' 3<<'LAZYTEST_EOF' BIF LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=416 lazytest_case 'ni n3z >file3.gz ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=417 lazytest_case 'zcat file3.gz ' 3<<'LAZYTEST_EOF' 1 2 3 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=426 lazytest_case 'ni igzip z | gzip -dc # gzip by default ' 3<<'LAZYTEST_EOF' gzip LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=428 lazytest_case 'ni igzip zg | gzip -dc # explicitly specify ' 3<<'LAZYTEST_EOF' gzip LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=430 lazytest_case 'ni igzip zg9 | gzip -dc # specify compression level ' 3<<'LAZYTEST_EOF' gzip LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=432 lazytest_case 'ni ixz zx | xz -dc ' 3<<'LAZYTEST_EOF' xz LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=434 lazytest_case 'ni ilzo zo | lzop -dc ' 3<<'LAZYTEST_EOF' lzo LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=436 lazytest_case 'ni ibzip2 zb | bzip2 -dc ' 3<<'LAZYTEST_EOF' bzip2 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=452 lazytest_case 'ni n4 z zd ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=457 lazytest_case 'ni n4 zd ' 3<<'LAZYTEST_EOF' 1 2 3 4 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=468 lazytest_case 'ni n4 zn | wc -c ' 3<<'LAZYTEST_EOF' 0 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=477 lazytest_case 'ni n1000000gr4 ' 3<<'LAZYTEST_EOF' 1 10 100 1000 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=488 lazytest_case 'ni n1000000gr4 :numbers ' 3<<'LAZYTEST_EOF' 1 10 100 1000 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=498 lazytest_case 'ni n1000000gr4 :numbers O ' 3<<'LAZYTEST_EOF' 1000 100 10 1 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=509 lazytest_case 'echo '\''checkpointed'\'' > numbers ' 3<<'LAZYTEST_EOF' LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=510 lazytest_case 'ni n1000000gr4 :numbers O ' 3<<'LAZYTEST_EOF' checkpointed LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=518 lazytest_case 'ni n100000z :biglist r+5 ' 3<<'LAZYTEST_EOF' 99996 99997 99998 99999 100000 LAZYTEST_EOF lazytest_file='doc/stream.md' lazytest_line=524 lazytest_case 'ni n100000z :biglist r+5 ' 3<<'LAZYTEST_EOF' 99996 99997 99998 99999 100000 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=14 lazytest_case 'ni n1000000 =\>not-a-million-things r5 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=20 lazytest_case 'echo $(( $(cat not-a-million-things 2>/dev/null | wc -l) < 1000000 )) ' 3<<'LAZYTEST_EOF' 1 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=52 lazytest_case 'ni n1000000 =\>a-million-things gr5 ' 3<<'LAZYTEST_EOF' 1 10 100 1000 10000 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=58 lazytest_case 'wc -l < a-million-things ' 3<<'LAZYTEST_EOF' 1000000 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=66 lazytest_case 'ni n1000000 :a-million-things-2 r5 ' 3<<'LAZYTEST_EOF' 1 2 3 4 5 LAZYTEST_EOF lazytest_file='doc/warnings.md' lazytest_line=72 lazytest_case 'wc -l < a-million-things-2 ' 3<<'LAZYTEST_EOF' 1000000 LAZYTEST_EOF lazytest_end
true
6f80a165758225cfa4302fbea8b82f6581cf7a38
Shell
snsinfu/ftrap
/tests/test_sighup_on_file_change.sh
UTF-8
473
3.03125
3
[ "BSL-1.0" ]
permissive
testcase "SIGHUP is sent on file change" # Single file echo "" > testfile_1.conf ( sleep 1 echo "change" >> testfile_1.conf ) & ftrap -f testfile_1.conf sh -c 'trap "exit 10" HUP; sleep 2' assert $? -eq 10 # Multiple files echo "" > testfile_1.conf echo "" > testfile_2.conf ( sleep 1 echo "change" >> testfile_2.conf ) & ftrap -f testfile_1.conf -f testfile_2.conf sh -c 'trap "exit 10" HUP; sleep 2' assert $? -eq 10 rm testfile_1.conf testfile_2.conf
true
8fe791d7cdc933294a6dca53413ae8e597a4891b
Shell
AGhost-7/docker-dev
/images/py-dev/bashrc-additions.sh
UTF-8
391
3.46875
3
[ "MIT" ]
permissive
# Utility function which automatically load the virtualenv on new tmux # panes. envbind() { if [ "$1" == "-r" ]; then if [ -f ~/.envbindrc ]; then source "$(cat ~/.envbindrc)/bin/activate" fi elif [ -f "$1/bin/activate" ] && [[ "$1/bin/activate" == /* ]]; then echo "$1" > ~/.envbindrc elif [ -f "$PWD/$1/bin/activate" ]; then echo "$PWD/$1" > ~/.envbindrc fi } envbind -r
true
2e9a19a336b2148b0cd5e526cad63afa47a77acc
Shell
lih/book
/completions/book.mark.shf
UTF-8
143
2.703125
3
[]
no_license
#!/bin/bash function C.book.isMark() { [ -f "$1/CMD" ]; } function C.book.mark() { C.fileIn C.book.isMark ~/bookmarks "$@"; } C.book.mark "$@"
true
8479c32fa1bfde11da6babbe4d3dfffb101cb61c
Shell
kayoo123/divers
/rsync_baie
UTF-8
3,854
3.75
4
[]
no_license
#!/bin/bash # # Script de sauvegarde des baies # ## ## Initialisation des variables de supervision ## CFGFILE="/root/admin/backup_baie/backup_baie.cfg" LOGFILE="/root/admin/backup_baie/backup_baie-$(date +%Y%m%d).log" EXCLUDE_DIRS="lost+found" #RSYNC_OPTS="-a -u -x --exclude='$EXCLUDE_DIRS' --delete --inplace --stats --dry-run" RSYNC_OPTS="-a -u -x --exclude='$EXCLUDE_DIRS' --delete --inplace --stats" MYHOSTNAME=$(hostname -s) ERROR_STATUS=0 SSH_KEY="/root/.ssh/id_dsa_gs" ## ## Declaration des fonctions ## function check_err { if [ $? -ne 0 ]; then echo "ERROR : probleme rencontre lors de la synchronisation des baies sur $MYHOSTNAME" ERROR_STATUS=1 fi } function check_for_running_backup { if pgrep rsync 2>&1 > /dev/null; then echo "ERROR : synchronisation des baies sur $MYHOSTNAME non lance: un processus rsync est deja en cours." ERROR_STATUS=1 send_status_to_reporting_host send_mail_report exit 1 fi } function send_status_to_reporting_host { REPORTING_HOST=aadmu202v REPORTING_DIR=/irsn/local01/infouni/audit/$MYHOSTNAME/supervision REPORTING_LOG_FILE=/tmp/$(basename $0).log echo $(/bin/date "+%a %d %B") > $REPORTING_LOG_FILE if [ $ERROR_STATUS -eq 0 ]; then echo $(basename $0) $MYHOSTNAME "OK" >> $REPORTING_LOG_FILE; else echo $(basename $0) $MYHOSTNAME "FAILED" >> $REPORTING_LOG_FILE; fi scp -i $SSH_KEY $REPORTING_LOG_FILE $REPORTING_HOST:$REPORTING_DIR && rm $REPORTING_LOG_FILE } function send_mail_report { if [ $ERROR_STATUS -eq 0 ]; then SUBJECT="[REPORTING SAUVEGARDE] $MYHOSTNAME : Synchronisation des baies OK" else SUBJECT="[REPORTING SAUVEGARDE] $MYHOSTNAME : Synchronisation des baies FAILED" fi # (cat $LOGFILE | mail -s "$SUBJECT" root) && rm $LOGFILE } function do_backup { echo "" echo "[$(date +"%d/%m/%Y %H:%M")] *************** debut synchronisation partition $SRC_DIR ***************" echo "" for subdir in $(ls $SRC_DIR); do if [ -d $SRC_DIR/$subdir ]; then if [ $(expr match "$EXCLUDE_DIRS" ".*$subdir.*") -eq 0 ] ; then if [ ! -d $DST_DIR/$subdir ]; then mkdir -p $DST_DIR/$subdir; fi echo "[$(date +"%d/%m/%Y %H:%M")] Debut de synchronisation du repertoire $subdir" rsync $RSYNC_OPTS $SRC_DIR/$subdir $DST_DIR/ | sed -e 's/^/ /' check_err echo "[$(date +"%d/%m/%Y %H:%M")] Fin de synchronisation du repertoire $subdir" echo "" else echo "" echo "[$(date +"%d/%m/%Y %H:%M")] INFO : le repertoire $subdir a ete ignore" echo "" fi fi done echo "" echo "[$(date +"%d/%m/%Y %H:%M")] *************** fin synchronisation partition $SRC_DIR ***************" echo "" } ## ## Redirection de la sortie vers le fichier de log ## exec &> $LOGFILE ## ## Debut du script ## check_for_running_backup echo "[$(date +"%d/%m/%Y %H:%M")] INFO : debut de synchro le $(date +"%d/%m/%Y") a $(date +"%H:%M")" # Pour chaque ligne du fichier de config .... for line in $(cat $CFGFILE |grep -v '#') do SRC_DIR=$(echo $line | awk -F'|' '{print $1}') DST_DIR=$(echo $line | awk -F'|' '{print $2}') # on verifie si le repertoire a synchroniser existe if [ -d $SRC_DIR ]; then # on verifie si le point de montage du repertoire de destination existe if [ -d $DST_DIR ]; then # on lance la synchronisation do_backup # maintenant que l'on a termine, on peut demonter la partition de backup else echo "[$(date +"%d/%m/%Y %H:%M")] ERROR : le point de montage $DST_DIR n'existe pas" fi else echo "[$(date +"%d/%m/%Y %H:%M")] ERROR : le repertoire $SRC_DIR mentionne dans le fichier $CFGFILE n'existe pas" fi done echo "[$(date +"%d/%m/%Y %H:%M")] INFO : fin de synchro le $(date +"%d/%m/%Y") a $(date +"%H:%M")" send_status_to_reporting_host send_mail_report
true
1ea9ceafdd4d17835a098519b039710e5747b795
Shell
mgglcode/chromebook-linux-script
/crc7/hd-install.sh
UTF-8
8,438
3.765625
4
[]
no_license
#!/bin/bash #hd-install.sh # derived from install-ubuntu-1204-9.sh of chrubuntu # to be run on an acer c7 installing from a usb stick to hd, # or from hd to hd. # fw_type will always be developer for Mario. # Alex and ZGB need the developer BIOS installed though. cfg_install_to=/dev/sda debug_skip_mkfs=0 #1 skip creating ext4 fs on rootfs partition debug_skip_rootfs=0 #1 skip writing rootfs partition files debug_skip_modules=0 #1 skip extracting module files debug_show_mkfs=0 #0 skip showing mkfs result rootfsfile=fc19lxde.tgz function waitforflush() { fincnt=0 finstart=`date` while true do retv=`top -n1 -b | grep 'flush' | egrep -v 'S [ ]*0'` rets=`echo -n $retv` if [ "$retv" == "" ]; then fincnt=$(($fincnt + 1)) #echo " " found S0 ... $fincnt else fincnt=0 fi if [ $fincnt -gt 5 ]; then echo " " found S0 ... many times. idle. break fi sleep 1 done finfinish=`date` echo " waitforflush started $finstart" echo " waitforflush finished $finfinish" } #make sure it runs from bash on chronos if grep bash /proc/$$/exe > /dev/null ; then echo good running from bash else echo echo Bad running from non-bash echo Please use bash to run this script. echo exit 1 fi #check developer mode echo "" fw_type="`crossystem mainfw_type`" if [ ! "$fw_type" = "developer" ]; then echo "Your Chromebook is not running a developer BIOS!" echo " You need to run:" echo " sudo chromeos-firmwareupdate --mode=todev" echo " Then re-run this script." exit 1 else echo "You're running a developer BIOS. Good." fi # hwid lets us know if this is a Mario (Cr-48), Alex (Samsung Series 5), # ZGB (Acer), etc hwid="`crossystem hwid`" #PARROT PUFFIN F-D 0168 echo -e "Chomebook model is: $hwid\n" chromebook_arch="`uname -m`" if [ ! "$chromebook_arch" = "i686" ]; then echo -e " This version of Chrome OS isn't i686." echo "ERROR: non-i686 kernel is not supported" exit 1 else echo -e " and you're running a i686 version of Chrome OS! Good!\n" fi read -p " Press [Enter] to continue..." powerd_status="`initctl status powerd`" if [ ! "$powerd_status" = "powerd stop/waiting" ]; then echo -e "Stopping powerd to keep display from timing out..." initctl stop powerd fi powerm_status="`initctl status powerm`" if [ ! "$powerm_status" = "powerm stop/waiting" ]; then echo -e "Stopping powerm to keep display from timing out..." initctl stop powerm fi setterm -blank 0 echo "Check data/$rootfsfile..." (cd data && sha1sum -c conf-fc19lxde-sha1) if [ $? -ne 0 ]; then echo "Error sah1sum check rootfs file data/$rootfsfile" echo " Please try delete directory data and re-download data" exit 1 fi cp data/$rootfsfile . if [ ! -f $rootfsfile ]; then echo "ERROR: no $rootfsfile file" exit 1 fi if [ "$cfg_install_to" == "" ]; then target_disk="`rootdev -d -s`" echo "ERROR: not allowed to install to $target_disk" exit fi target_disk=$cfg_install_to target_rootfs="${target_disk}7" target_kern="${target_disk}6" echo " Target Kernel Partition: $target_kern" echo " Target Root FS: ${target_rootfs}" echo "" echo "Got ${target_disk} as the target device" echo "" echo " WARNING! All data on the kernel or rootfs partitions will be wiped out!" echo " WARNING! Continue at your own risk!" echo " WARNING! Or hit CTRL+C now to quit!" echo "" read -p " Press [Enter] to install fc19 on ${target_disk} ..." echo "" installstarttime=`date` date if grep $target_rootfs /proc/mounts ; then echo "ERROR: $target_rootfs mounted" exit 1 fi echo "Creating ext4 fs on ${target_rootfs}..." if [ $debug_skip_mkfs -eq 0 ]; then if [ $debug_show_mkfs -eq 0 ] ; then mkfs -t ext4 ${target_rootfs} > /dev/null else time mkfs -t ext4 ${target_rootfs} fi fi #Mount rootfs and copy cgpt and modules over echo "Mounting ${target_rootfs}..." if [ ! -d /tmp/urfs ]; then mkdir /tmp/urfs fi mount -t ext4 ${target_rootfs} /tmp/urfs df -h /tmp/urfs echo -n "Copying rootfs ... (may take 20 minutes or longer) ... " date tar zxf $rootfsfile --directory /tmp/urfs echo -n ' waitforflush ... (may take 20 minutes or longer) ... ' date waitforflush echo "Copying modules, firmware and binaries to ${target_rootfs}..." if [ ! -d /tmp/urfs/usr/bin ]; then echo -e "\nError mounted target with no /usr/bin\n\n" exit 1 else echo "Mounted ${target_rootfs} at /tmp/urfs ok" df -h /tmp/urfs #mario rootfs 5.0G total, 3.1G used, 1.7G availab. fi echo "Copying cgpt..." cp /usr/bin/cgpt /tmp/urfs/usr/bin/ chmod a+rx /tmp/urfs/usr/bin/cgpt echo -n "console=tty1 debug verbose root=${target_rootfs} " > kernel-config echo "rootwait rw lsm.module_locking=0" >> kernel-config echo "Checking kernel..." orig_root_part=`rootdev -s` if [ "$orig_root_part" == "/dev/sda5" ]; then orig_kern_part="/dev/sda4" elif [ "$orig_root_part" == "/dev/sda3" ]; then orig_kern_part="/dev/sda2" else echo "ERROR: unknown kernel partition $orig_root_part" exit 1 fi use_kernfs="kernel-partition" if [ -f $use_kernfs ]; then rm $use_kernfs; fi echo "Using kernel from $orig_kern_part as ${use_kernfs}_oldblb ..." dd if=$orig_kern_part of=$use_kernfs 2>/dev/null if [ $? -ne 0 ]; then echo "ERROR: failed extracting kernel from $orig_kern_part" exit 1 fi mv $use_kernfs ${use_kernfs}_oldblb vbutil_kernel --repack $use_kernfs \ --keyblock /usr/share/vboot/devkeys/kernel.keyblock \ --version 1 \ --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ --config kernel-config \ --oldblob ${use_kernfs}_oldblb > /dev/null if [ $? -ne 0 ]; then echo "ERROR: failed repacking kernel" exit 1 fi echo "Copying modules to /lib/modules..." if [ $debug_skip_modules -eq 0 ]; then if [ ! -d /tmp/urfs/lib/modules ]; then echo "ERROR: no /lib/modules/ on target" exit 1 fi cp -a /lib/modules/* /tmp/urfs/lib/modules/ fi echo "Modifying fstab..." mv /tmp/urfs/etc/fstab /tmp/urfs/etc/fstab-orig-inst echo "$target_rootfs / ext4 defaults 0 0" > /tmp/urfs/etc/fstab echo "fedora 19 install source: " > /tmp/urfs/root/note-install-source echo " boot Fedora-19-i386-netinst.iso then use net path " \ >> /tmp/urfs/root/note-install-source echo " http://<site>.com/<path>/releases/19/Everything/i386/os/ " \ >> /tmp/urfs/root/note-install-source echo "" >> /tmp/urfs/root/note-install-source echo "Using kernel from partition $orig_kern_part" \ >> /tmp/urfs/root/note-install-source echo "Sync ..." sync echo "Dismount rootfs ..." umount /tmp/urfs echo "Writing kernel $uer_kernfs to $target_kern ..." dd if=$use_kernfs of=${target_kern} 2>/dev/null if [ $? -ne 0 ]; then echo "ERROR: failed writing kernel to $target_kern" exit 1 fi #Set linux partition as top priority for next boot echo "Setting cgpt for disk ${target_disk}..." cgpt add -i 6 -P 5 -T 1 -S 1 ${target_disk} installfinishtime=`date` echo " Installation started at $installstarttime" echo " Installation finished at $installfinishtime" # reboot echo "" echo "going to reboot" echo "" echo "Things to do with the minimal fedora 19 lxde environment: " echo "" echo " Change root password. it is set to root temporary now." echo " Change user password. it is set to user temporary now." echo "" echo " Install KDE with: yum install kde-workspace " echo " Install touchpad package: yum install kcm_touchpad " echo " Install KDE network manager: " echo " yum install kde-plasma-networkmanagement " echo "" echo "sleep 10 seconds ... then reboot" sleep 10 echo "" reboot exit 0
true
0272c722deb2b2ea149ab96464c78737a749641e
Shell
wael2000/poc1
/04-quota.sh
UTF-8
1,170
3.40625
3
[]
no_license
if [ "$1" = "d" ] then echo " ======================================= | Red Hat | | OPENSHIFT - DEMO | ======================================= ./quota.sh d PROJECT_NAME 1 - delete existing quota oc delete quota QUOTA_NAME " echo "delete quota pod-quota for $2 project" echo "--------------------------------------" oc delete quota pod-quota -n $2 else echo " ======================================= | Red Hat | | OPENSHIFT - DEMO | ======================================= ./quota.sh PROJECT_NAME 1 - create quota for project oc create -f QUOTA_TEMPLATE.yaml -n PROJECT_NAME 2 - get existing quotas oc get quota -n PROJECT_NAME 3 - describe existing quota oc describe quota QUOTA_NAME " echo "create pod quota for $1 project" echo "--------------------------------------" oc create -f quota.yaml -n $1 echo "get list of quotas in $1 project" echo "--------------------------------------" oc get quota -n $1 echo "get details os quota " echo "--------------------------------------" oc describe quota pod-quota fi
true
dc6ba74547d99b887cf4b0ffd34ef7dc9732e2b6
Shell
volumio/volumio-plugins
/plugins/miscellanea/touch_display/install.sh
UTF-8
4,423
3.3125
3
[]
no_license
#!/bin/bash ID=$(awk '/VERSION_ID=/' /etc/*-release | sed 's/VERSION_ID=//' | sed 's/\"//g') if grep -q Raspberry /proc/cpuinfo; then # on Raspberry Pi hardware echo "Installing fake packages for kernel, bootloader and pi lib" wget https://repo.volumio.org/Volumio2/Binaries/arm/libraspberrypi0_0.0.1_all.deb wget https://repo.volumio.org/Volumio2/Binaries/arm/raspberrypi-bootloader_0.0.1_all.deb wget https://repo.volumio.org/Volumio2/Binaries/arm/raspberrypi-kernel_0.0.1_all.deb sudo dpkg -i libraspberrypi0_0.0.1_all.deb sudo dpkg -i raspberrypi-bootloader_0.0.1_all.deb sudo dpkg -i raspberrypi-kernel_0.0.1_all.deb rm libraspberrypi0_0.0.1_all.deb rm raspberrypi-bootloader_0.0.1_all.deb rm raspberrypi-kernel_0.0.1_all.deb echo "Putting on hold packages for kernel, bootloader and pi lib" sudo apt-mark hold libraspberrypi0 raspberrypi-bootloader raspberrypi-kernel echo "Installing Chromium dependencies" sudo apt-get update sudo apt-get -y install echo "Installing graphical environment" sudo DEBIAN_FRONTEND=noninteractive apt-get -y install xinit xorg openbox if [ "$ID" = "8" ]; then sudo apt-get -y install xserver-xorg-legacy fi echo "Installing Chromium" sudo apt-get -y install chromium-browser echo "Creating /etc/X11/xorg.conf.d dir" sudo mkdir /etc/X11/xorg.conf.d echo "Creating Xorg configuration file" sudo echo "# This file is managed by the Touch Display plugin: Do not alter! # It will be deleted when the Touch Display plugin gets uninstalled. Section \"InputClass\" Identifier \"Touch rotation\" MatchIsTouchscreen \"on\" MatchDevicePath \"/dev/input/event*\" MatchDriver \"libinput|evdev\" EndSection" > /etc/X11/xorg.conf.d/95-touch_display-plugin.conf else # on other hardware echo "Installing Chromium dependencies" sudo apt-get update sudo apt-get -y install echo "Installing graphical environment" sudo DEBIAN_FRONTEND=noninteractive apt-get install -y xinit xorg openbox echo "Installing Chromium" if [ "$ID" = "8" ]; then cd /home/volumio/ wget https://launchpadlibrarian.net/234969703/chromium-browser_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb wget https://launchpadlibrarian.net/234969705/chromium-codecs-ffmpeg-extra_48.0.2564.82-0ubuntu0.15.04.1.1193_armhf.deb sudo dpkg -i /home/volumio/chromium-*.deb sudo apt-get install -y -f sudo dpkg -i /home/volumio/chromium-*.deb rm /home/volumio/chromium-*.deb else sudo apt-get -y install chromium sudo ln -s /usr/bin/chromium /usr/bin/chromium-browser fi fi echo "Installing japanese, korean, chinese and taiwanese fonts" sudo apt-get -y install fonts-arphic-ukai fonts-arphic-gbsn00lp fonts-unfonts-core echo "Creating Kiosk data dir" mkdir /data/volumiokiosk chown volumio:volumio /data/volumiokiosk echo "Creating chromium kiosk start script" sudo echo "#!/bin/bash while true; do timeout 3 bash -c \"</dev/tcp/127.0.0.1/3000\" >/dev/null 2>&1 && break; done sed -i 's/\"exited_cleanly\":false/\"exited_cleanly\":true/' /data/volumiokiosk/Default/Preferences sed -i 's/\"exit_type\":\"Crashed\"/\"exit_type\":\"None\"/' /data/volumiokiosk/Default/Preferences if [ -L /data/volumiokiosk/SingletonCookie ]; then rm -rf /data/volumiokiosk/Singleton* fi openbox-session & while true; do /usr/bin/chromium-browser \\ --simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT' \\ --force-device-scale-factor=1 \\ --disable-pinch \\ --kiosk \\ --no-first-run \\ --noerrdialogs \\ --disable-3d-apis \\ --disable-breakpad \\ --disable-crash-reporter \\ --disable-infobars \\ --disable-session-crashed-bubble \\ --disable-translate \\ --user-data-dir='/data/volumiokiosk' \ http://localhost:3000 done" > /opt/volumiokiosk.sh sudo /bin/chmod +x /opt/volumiokiosk.sh echo "Creating Systemd Unit for Kiosk" sudo echo "[Unit] Description=Volumio Kiosk Wants=volumio.service After=volumio.service [Service] Type=simple User=volumio Group=volumio ExecStart=/usr/bin/startx /etc/X11/Xsession /opt/volumiokiosk.sh -- -nocursor [Install] WantedBy=multi-user.target " > /lib/systemd/system/volumio-kiosk.service sudo systemctl daemon-reload echo "Allowing volumio to start an xsession" sudo /bin/sed -i "s/allowed_users=console/allowed_users=anybody/" /etc/X11/Xwrapper.config #required to end the plugin install echo "plugininstallend"
true
ed9e35aaf7280c2713ef678bed84da2d3807b4a3
Shell
hunterwerlla/oneliners
/convertGitFilesFromCamelCaseToPascalCaseMac.sh
UTF-8
116
2.921875
3
[ "MIT" ]
permissive
#!/bin/bash for s in `ls -1`; do e=`echo $s | gsed 's/.*/\l&/'` e2=${e}"2" git mv $s $e2 git mv $e2 $e done
true
d56905fa0ba146661f58c97bc5f4c19b344e2be1
Shell
zhengchangsulab/pcrm2
/strip_files.sh
UTF-8
880
2.9375
3
[]
no_license
#!/bin/bash big_files=(`find . -maxdepth 1 -name "cluster*.overlap" -size +1024M`) for f in ${big_files[@]} do f_name=$(basename ${f}) #lfs migrate -c2 ${f_name} info=(`lfs getstripe ${f_name}|head -2|tail -1`) count=${info[1]} if [[ "${count}" -ne 2 ]];then pbs="run_strip_"${f_name}".pbs" echo -e ${pbs_header} > ${pbs} echo -e "lfs migrate -c10 ${f_name}" >> ${pbs} qsub ${pbs} fi #echo ${f_name} done big_files=(`find . -maxdepth 1 -name "cluster_*.overlap" -size +500M -size -1024M`) for f in ${big_files[@]} do f_name=$(basename ${f}) #lfs migrate -c2 ${f_name} info=(`lfs getstripe ${f_name}|head -2|tail -1`) count=${info[1]} if [[ "${count}" -ne 2 ]];then pbs="run_strip_"${f_name}".pbs" echo -e ${pbs_header} > ${pbs} echo -e "lfs migrate -c5 ${f_name}" >> ${pbs} qsub ${pbs} fi #echo ${f_name} done
true
fd97ba71a4bdb1f51563759956d96165804e84ea
Shell
slizaa/slizaa-rcp-workbench
/.travis/artifact-delete.sh
UTF-8
1,199
2.59375
3
[]
no_license
#!/bin/sh # ftp_ip=ftp.wuetherich.com ftp_port=21 target_dir=slizaa-rcp-workbench # for i in `curl --ssl -k -s -l ftp://"$user":"$password"@"$ftp_ip/$target_dir" | grep .jar`; do { echo "deleting $i"; curl --ssl -k ftp://"$user:$password"@"${ftp_ip}:${ftp_port}/$target_dir/${i}" -O --quote "DELE ${i}" }; done; for i in `curl --ssl -k -s -l ftp://"$user":"$password"@"$ftp_ip/$target_dir/plugins/" | grep .jar`; do { echo "deleting plugins/$i"; curl --ssl -k ftp://"$user:$password"@"${ftp_ip}:${ftp_port}/$target_dir/plugins/${i}" -O --quote "DELE $target_dir/plugins/${i}" }; done; for i in `curl --ssl -k -s -l ftp://"$user":"$password"@"$ftp_ip/$target_dir/features/" | grep .jar`; do { echo "deleting features/$i"; curl --ssl -k ftp://"$user:$password"@"${ftp_ip}:${ftp_port}/$target_dir/features/${i}" -O --quote "DELE $target_dir/features/${i}" }; done; for i in `curl --ssl -k -s -l ftp://"$user":"$password"@"$ftp_ip/$target_dir/releases/" | grep .zip`; do { echo "deleting releases/$i"; curl --ssl -k ftp://"$user:$password"@"${ftp_ip}:${ftp_port}/$target_dir/releases/${i}" -O --quote "DELE $target_dir/releases/${i}" }; done;
true
77dee1dfd8742c6f10b5d7c278cd04abbdb5e9bb
Shell
BeloVess/gewaechshaus
/scripts/gitc
UTF-8
160
2.890625
3
[]
no_license
#!/bin/bash if [ -z "$1" ]; then echo "Set comment" else git add . git commit -m "$(echo $@)" git push origin main git push gitlab main fi
true
eadae318e4479c52b25901b26132acb7606cc0a7
Shell
danial031193/rn-size-calculator
/.husky/commit-msg
UTF-8
693
3.53125
4
[]
no_license
#!/bin/sh . "$(dirname "$0")/_/husky.sh" # validate commit npx --no-install commitlint -g commitlint.config.js --edit "$1" LC_ALL=C local_branch="$(git rev-parse --abbrev-ref HEAD)" valid_branch_regex="^(feature|bugfix|improvement|hotfix)\/[a-z0-9-]+$" message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." # validate branch name # shellcheck disable=SC2039 if [ ! $local_branch =~ $valid_branch_regex ] && [ ! "$local_branch" == "staging" ] && [ ! "$local_branch" == "prod" ]; then echo "$message" exit 1 fi
true
b016c1b5ea6005e956302931a335a07ebda5394e
Shell
pombredanne/satori
/satori-testing-images/tcs-kernel/template/initrd/scripts/local-top/nbd
UTF-8
2,371
3.84375
4
[ "MIT" ]
permissive
#!/bin/sh # We don't have any prerequisites case $1 in prereqs) exit 0 ;; esac for x in $(cat /proc/cmdline); do case "$x" in nbddev=*) nbddev="${x#nbddev=}" ;; nbdroot=*) nbdroot="${x#nbdroot=}" ;; root=/dev/nbd*) nbddev="${x#root=}" ;; esac done # if nbd root is not requested exit early and silently if [ -z "$nbdroot" ] && [ -z "$nbddev" ] then exit 0 fi . /scripts/functions log_begin_msg "Setting up nbd-client" wait_for_udev configure_networking # Support setting stuff using DHCP by overloading 'option root-path' case "$nbdroot" in ''|dhcp) nbdroot=$ROOTPATH ;; esac nbdrootdev="$nbddev" nbdbasedev="${nbddev#/dev/}" case "$nbdroot" in *,*,*) nbdsrv="${nbdroot%%,*}" nbdport="${nbdroot%,*}" nbdport="${nbdport##*,}" # root= parameter overrides three-option nbdroot= parameter if [ -z "$nbdrootdev" ] then nbdbasedev="${nbdroot##*,}" nbdrootdev=/dev/$nbdbasedev fi ;; *,*) nbdsrv="${nbdroot%,*}" nbdport="${nbdroot#*,}" ;; \[*\]*) # [ipv6]:port/path nbdsrv=${nbdroot%\]*} nbdsrv=${nbdsrv#\[} nbdportpath=${nbdroot#\[$nbdsrv\]} nbdportpath=${nbdportpath#:} nbdport=${nbdportpath%%/*} nbdpath=${nbdportpath#$nbdport} ;; *) # ipv4:port/path nbdsrv=${nbdroot%%[:/]*} nbdportpath=${nbdroot#$nbdsrv} nbdportpath=${nbdportpath#:} nbdport=${nbdportpath%%/*} nbdpath=${nbdportpath#$nbdport} ;; esac case "$nbdport" in *[^0-9]*) # non-numeric characters, assume a name rather than a port nbdpath="$nbdport" unset nbdport ;; esac nbdrootdev=${nbdrootdev%p*} nbdbasedev=${nbdbasedev%p*} # If host is omitted, use ROOTSERVER from DHCP. case "$nbdsrv" in ''|dhcp) nbdsrv=$ROOTSERVER ;; esac if [ -z "$nbdsrv" ] || [ -z "$nbdrootdev" ] || ( [ -z "$nbdpath" ] && [ -z "$nbdport" ] ) then log_failure_msg "Insufficient information to set up nbd, quitting (nbdroot=$nbdroot, host=$nbdsrv, name=$nbdpath, port=$nbdport, nbd-device=$nbdrootdev)" exit 0 fi # Support defining an alternate launch script with env variable NBDCLIENT. NBDCLIENT=${NBDCLIENT:-/sbin/nbd-client} $NBDCLIENT $nbdsrv ${nbdpath:+-N} $nbdpath $nbdport $nbdrootdev -swap -persist # This should be removed once the cfq scheduler no longer deadlocks nbd # devices if grep -q '\[cfq\]' /sys/block/$nbdbasedev/queue/scheduler then echo deadline > /sys/block/$nbdbasedev/queue/scheduler fi
true
a0a73256a37235edf9dfc94c0dd71887ec3616ad
Shell
pri114/CSP2101_g
/assignment3/assignment.sh
UTF-8
15,956
4.03125
4
[]
no_license
#Priscilla Pitchen #Student No. 943222 #!/bin/bash # Store ECU webiste URL in the variable 'url' url=https://www.ecu.edu.au/service-centres/MACSC/gallery/gallery.php?folder=152 # Download website data and pipe output to the sed command. Parse out all lines that contain an image (-n disables auto print and -r removes whitespace ) # Substitute unwanted characters at the beginning and end of each line and print the new pattern after substitution. # Store output in the 'images.txt' file for later use throughout the script curl -s $url | sed -n -r '/<img/ { s/.{14}// s/.{17}$// p }' > webdata.txt # Create variables for colour to be used when outputting information to the screen RED='\033[00;31m' # Use ${RED} in the code CYAN='\033[00;36m' # Use ${CYAN} in the code BLUE='\033[00;34m' # Use ${BLUE} in the code NC='\033[00;0m' # Use ${NC} in the code ## FUNCTIONS: ///// # The exit option function gives the user a choice to end or continue the program at various points throughout the script. The argument '$1' will # be a message printed to the screen, followed by the option to exit or continue. If input is 'x' (case insensitive) Goodbye is printed to # the screen and the program will end. Otherwise the function will return '0' (true) exitopt() { local input echo -e "$1" echo -e "Press any key to continue or [x] to exit." read input if [[ $input = [xX] ]]; then echo 'Goodbye!' && exit 1 else return 0 fi } # The download function is used to download the requested file(s) by the user # The current working directory is stored in the variable 'rdir' and local variables created for 'rdir', 'input', 'image number' and 'folder'. # When the function is called the user is asked where to save the downloads and the response is stored in the variable 'folder' download() { printf "\n" local rdir local input local imageNum local folder rdir=$(pwd) read -p "Enter a folder name where the image(s) will be downloaded and saved: " folder printf "\n" # Start a for loop for every 'image url' saved in the text file argument '$1'. Pipe the output of the variable 'imgurl' into the sed command. # Everything up to '152/' and '.jpg' is replaced with nothing (leaving just the image number stored in the variable) for imgurl in $( cat $1 ); do imageNum=$( echo $imgurl | sed -e "s/.*152\///; s/\.jpg//" ) # If the file doesn't exist in the chosen folder run 'wget' to download the image from the server. Gather output into a file 'urlout.txt' for # later use (-o) and direct the download content to a specific directory path (-P). if ! [ -f "${rtdir}${folder}/$imageNum.jpg" ]; then wget -o urlout.txt $imgurl -P $folder # Create a variable 'filename'. Use sed to search 'urlout.txt' file for the line containing the word 'Saving'. Substitute all characters from # the beginning of the line to the first forward slash with nothing. Substitute the last character with nothing and print after substitution. # Input is from the 'urlout.txt' file and output is stored in the variable 'filename' filename=$( sed -n '/Saving/ { s/.*\///; s/.$// p }' urlout.txt ) # Create a variable 'filesize'. Pipe contents from the 'urlout.txt' file to the the sed command. Parse out the line with the word 'Length' # and pipe to the awk command to print the second field divided by 1,000 as a float to two decimal places. # Echo a message to the user with blue text and information from the output file saved when downloading. filesize=$( cat urlout.txt | sed -n '/Length/ p' | awk '{printf "%.2f", $2/1000}' ) echo -e "Downloading ${BLUE}$imageNum${NC}, with the file name ${BLUE}$filename${NC}, with a file size of ${BLUE}$filesize KB${NC}....File Download Complete." # If the file already exists let the user know and ask for confirmation to overwrite the file or proceed else echo -e "The file ${rtdir}${folder}/$imageNum.jpg already exists. Press any key to continue or [o] to overwrite: " read input # If the user inputs 'o' (case insensitive) proceed to download image from the server with wget command. # Gather output into a file 'urlout.txt' for later use (-o)and save the file with a given name (-O). # Move the downloaded file to the folder selected by the user. # Create the variables filename and filesize as in previous step and echo a message to the user with download information if [[ "$input" = [oO] ]]; then wget -o urlout.txt $imgurl -O $imageNum.jpg mv $imageNum.jpg $folder filename=$( sed -n '/Saving/ { s/.* //; s/^.//; s/.$// p }' urlout.txt ) filesize=$( cat urlout.txt | sed -n '/Length/ p' | awk '{printf "%.2f", $2/1000}' ) echo -e "Downloading ${BLUE}$imageNum${NC}, with the file name ${BLUE}$filename${NC}, with a file size of ${BLUE}$filesize KB${NC}....File Download Complete." # If the user doesn't input 'o' the program continues to the next iteration of the loop (if applicable) else continue fi fi done printf "\n" } ## SCRIPT: ///// # While true the program will continue in a loop until the user chooses to exit while true; do # Count (-c) the number of images (.jpg) stored in the file 'webdata.txt' and display the number of images and download options available imgCount="`grep -c '.jpg' webdata.txt`" echo -e "\nThe ECU Website Media Gallery has ${CYAN}$imgCount thumbnail images${NC} available for download:\n" # Pipe the output of the 'webdata.txt' file to sed. Substitue everything up to '152/' and '.jpg' with nothing, leaving just the image numbers. # Pipe output of sed to awk to print all image numbers in a table-like format evenly spaced (14 spaces) apart. cat webdata.txt | sed -n 's/.*152\///; s/.jpg//p' | awk '{printf "%-14s", $0} END {printf "\n\n"}' echo -e "Images can be downloaded in the following ways:\n \r1. Download a specific thumbnail \r2. Download ALL thumbnails \r3. Download images in a range (by the last 4 digits of the file name), e.g. all images between 1558 and 1569 \r4. Download a specified number of randomly chosen images\n" # Start a loop - while true ask the user to choose from one of the download options and store the selected number response in the variable 'selNum' while true; do read -p "Choose from the download options above by entering a number from 1-4: " selNum # If the 'selNum' variable contains no data call the 'exitopt' function if [[ -z "$selNum" ]]; then exitopt "${RED}Invalid Entry.${NC} Input required. Try again." # If the 'selNum' variable is an integer between 1 and 4 inclusive break out of the loop elif [[ "$selNum" =~ ^[1-4]$ ]]; then break # Otherwise if the 'selNum' variable is not empty and not an integer call the 'exitopt' function else exitopt "${RED}Invalid Entry.${NC} ${BLUE}$selNum${NC} is not a valid number. Try again." fi done # Create a case statement for download options case $selNum in ## Option 1: /// Download a SPECIFIC thumbnail image 1) # Start a loop - while true prompt the user to enter the image number to download while true; do read -p "Enter the thumbnail image number you want to download: " imageNum # If the 'imagelNum' variable is empty call the 'exitopt' function if [[ -z $imageNum ]]; then exitopt "${RED}Invalid Entry.${NC} Input required. Try again." # If the 'imageNum' variable doesn't contain 'DSC' at the start preceded by five digits call the 'exitopt' function elif ! [[ $imageNum =~ ^DSC[0-9]{5}$ ]]; then exitopt "${RED}Invalid Entry.${NC} ${BLUE}$imageNum${NC} is not a valid image number. Try again." # If the 'imageNum' variable is the right format quietly (-q) search for the image number in the 'webdata.txt' file else grep -q $imageNum webdata.txt #If the grep search returns a match (true) pipe the contents of the 'webdata.txt' file to the sed command. Parse out the lines matching # the 'imageNum' variable and print output to the 'images.txt' file. Call the download function with the 'images.txt' file as # argument '$1'.and break out of loop if [ $? -eq 0 ]; then cat webdata.txt | sed -n "/$imageNum/p" > images.txt download images.txt break # If the grep search returns false (1) call the 'exitopt' function else exitopt "${RED}Invalid Entry.${NC} The thumbnail ${BLUE}$imageNum${NC} does not exist. Try again." fi fi done # When the selected image has been downloaded and saved call the exitopt function to return to start or exit the program exitopt "\n${BLUE}Downloading Finished.${NC}" ;; ## Option 2: /// Download ALL thumbnail images 2) # Call the download function with the 'webdata.txt file' (containing all urls) download webdata.txt # When downloading of all images is complete call the exitopt function to return to start or exit the program exitopt "\n${BLUE}Downloading Finished.${NC}" ;; ## Option 3: /// Download images in a RANGE (by last 4 digits of the file name) 3) # Set a variable for word 'lowest' & 'highest' and create an array to hold the variables. Create the rangenum.txt file (>| overwrites # with a blank file if it already exists) and create a variable for the lowest limit 'lowLim' and set to zero low="LOWEST" high="HIGHEST" range=" $low $high " >| rangenum.txt lowLim=0 # Start a loop for every limit in the range (low/high) and while true prompt the user to select a number, storing response in the variable 'selNum' for limit in $range; do while true; do read -p "Enter the last four digits of the $limit image number in the range: " selLim # If the variable 'selLim' is empty call the 'exitopt' function if [[ -z $selLim ]]; then exitopt "${RED}Invalid Entry.${NC} Input required. Try again." # If the 'selLim' variable doesn't contain a four digit integer call the 'exitopt' function elif ! [[ $selLim =~ ^[0-9]{4}$ ]]; then exitopt "${RED}Invalid Entry.${NC} ${BLUE}$selLim${NC} is not a valid four digit number. Try again." # If the 'selLim' variable is the right format quietly (-q) search for the selected image number in the 'webdata.txt' file else grep -q DSC0${selLim} webdata.txt # If the grep search returns false (1) call the 'exitopt' function if ! [ $? -eq 0 ]; then exitopt "${RED}Invalid Entry.${NC} Thumbnail image ${BLUE}DSC0${selLim}${NC} does not exist. Try again." # If the grep search returns true (0), test if 'lowlim' is not less than the current 'selLim'. If true call exitopt function elif ! [[ $lowLim < $selLim ]]; then exitopt "${RED}Invalid Entry.${NC} ${BLUE}DSC0${selLim}${NC} is out of range (Input needs to be greater than the lower limit). Try again." # If 'lowlim' saved is less than the current 'selLim', echo output to the 'rangenum.txt file and break out of the loop else lowLim=$selLim echo DSC0${selLim} >> rangenum.txt break fi fi done done #Extract the contents of the 'rangenum.txt' file to store each image number in it's own variable. Using awk set the field seperator to a new line and # the record seperator to an empty space (file to be read as one record). Print the first field '$1' and store in the variable 'lowNum' and print the # second field '$2' in the variable 'highNum' lowNum=$(awk 'BEGIN { FS="\n"; RS=""} END {print $1}' ./rangenum.txt) highNum=$(awk 'BEGIN { FS="\n"; RS=""} END {print $2}' ./rangenum.txt) # Use sed to search for lines with matching patterns (-n disables auto print). Delete all lines from the first line to the line before the matching # pattern 'lowNum'. Print all lines from the line with the matching pattern 'highNum' to the end of the file. Print the line with 'hihgNum'. Input from # 'webdata.txt' file (containing all urls) and output stored in the 'images.txt' file. # Call the download function with the 'images.txt file' (containing only urls in range) as the first argument '$1' sed -n '/'$lowNum'/,$!d; /'$highNum'/,$!p; /'$highNum'/p' webdata.txt > images.txt download images.txt # When downloading images within the selected range is complete, call the exitopt function to return to start or exit the program exitopt "\n${BLUE}Downloading Finished.${NC}" ;; ## Option 4: /// Download a specified number of RANDOM images 4) # Start a loop and while true prompt the user to enter a number of images to download. Store the response in the variable 'randNum' while true; do read -p "Enter the number of images less than $imgCount that will be randomly selected for download: " randNum # if 'randNum' is an integer and less than the max number of images in the variable 'imgCount' than break out of the loop if [[ $randNum =~ ^[0-9]+$ ]] && [[ $randNum -lt $imgCount ]]; then break # if the variable 'randNum' is empty call the exitopt function elif [[ -z $randNum ]]; then exitopt "Input required. Try again" # If no conditions are met call the exitopt function else exitopt "${RED}Invalid Entry.${NC} ${BLUE}$randNum${NC} is not a valid number. Try again." fi done # Pipe the output of the 'webdata.txt' file to sed. Shuffle contents of the file. Parse out lines from the beginning of the file to # the $randNum' line and print output to 'images.txt' file. Call the download function with the 'images.txt file' (containing a # selected no. of random urls) as the first argument '$1' cat webdata.txt | shuf | sed -n '1,'$randNum'p' > images.txt download images.txt # When downloading of selected number of random images is complete call the exitopt function to return to start or exit the program exitopt "\n${BLUE}Downloading Finished.${NC}" ;; esac done exit 0
true
95c3485ef8eabc43deb131c12f7b0eaebf3fdc66
Shell
zznan0o0/AutoInstallShell
/lvs/lvs_example.sh
UTF-8
569
3.078125
3
[]
no_license
#!/bin/bash vip='192.168.1.100' mask='255.255.255.255' port='80' iface='eth1:1' rs1='192.168.0.3' rs2='192.168.0.4' case $1 in start) ifconfig $iface $vip netmask $mask broadcast $vip up iptables -F # 配置ipvs规则 ipvsadm -A -t ${vip}:${port} -s wrr ipvsadm -a -t ${vip}:${port} -r ${rs1} -g -w 1 ipvsadm -a -t ${vip}:${port} -r ${rs2} -g -w 1 #realserver不配置端口,dr模式不支持端口映射 ;; stop) ipvsadm -C ifconfig $iface down ;; *) echo "Usage $(basename $0) start|stop" exit 1 ;; esac
true
eb571ab87aba69072f537711398a9a5715933440
Shell
Corei13/amazon-api-bot
/scripts/setup.sh
UTF-8
851
2.75
3
[]
no_license
#!/bin/bash curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' apt-get update apt-get install -y git nodejs build-essential tcl google-chrome-stable supervisor cd /home/ubuntu/ git clone https://github.com/Corei13/amazon-api-bot.git cd amazon-api-bot npm install service supervisor stop cat > /etc/supervisor/conf.d/amazon-api-bot.conf << EOL [program:amazon-api-bot] directory = /home/ubuntu/amazon-api-bot command = npm run node src/cli autorestart = true stdout_logfile = /log/bot.log stderr_logfile = /log/bot.err environment = PORT=80, DAEMON=true, DEBUG=true, HEADLESS=true EOL mkdir /log service supervisor start
true
326917f7ae84b0709ec9775e0149f655a664ab0a
Shell
WOLVIE97/laughing-hipster
/autoupdates.sh
UTF-8
1,456
3.53125
4
[]
no_license
#!/bin/bash echo "To see CRON logs use:" echo "grep CRON /var/log/syslog" echo "To manually edit (or remove jobs):" echo "crontab -u root -e" echo "Installing cron if needed." apt-get -y -qq install cron echo "Creating update cron task at /update.sh" rm -f /update.sh echo " #!/bin/bash t=\`date +%Y%m%d%H%M%S\` echo \"update.sh Starting update \$t\" >> /updates.log apt-get -qq -y update echo \"update.sh Starting upgrade\" >> /updates.log apt-get upgrade -q -y >> /updates.log t=\`date +%Y%m%d%H%M%S\` echo \"update.sh Finishing \$t\" >> /updates.log " >> /update.sh chmod +x /update.sh echo "Creating dist-update cron task at /dist-update.sh" rm -f /dist-update.sh echo " #!/bin/bash t=\`date +%Y%m%d%H%M%S\` echo \"dist-update.sh Starting update \$t\" >> /updates.log apt-get -qq -y update echo \"dist-update.sh Starting dist-upgrade\" >> /updates.log apt-get dist-upgrade -q -y >> /updates.log t=\`date +%Y%m%d%H%M%S\` echo \"dist-update.sh Finishing \$t\" >> /updates.log echo 'dist-update.sh Restarting...' >> /updates.log /sbin/shutdown -r now " >> /dist-update.sh chmod +x /dist-update.sh echo "Adding update.sh task every 15mins besides 3 or 4 AM." line="*/15 0-2,5-23 * * * /update.sh" (crontab -u root -l; echo "$line" ) | crontab -u root - echo "Adding dist-update.sh task every day at 3:15 AM." line="15 3 * * * /dist-update.sh" (crontab -u root -l; echo "$line" ) | crontab -u root - echo "Restarting cron." service cron restart
true
b6860437291a505d9a1bca829fef87f6cef6f593
Shell
joelin/ceph-single-install
/cephInstall.sh
UTF-8
2,545
3.234375
3
[]
no_license
set -x mkdir -p ~/ceph-install/install-$(date +%Y%m%d%H%M%S) && cd $_ # offline OFF_LINE=false # version of CEPH and OS ## jewel kraken luminous CEPH_VERSION=jewel ## el7(centos) rhel7(redhat) OS_DISTRO=el7 # monitor IP MON_IP=192.168.80.100 # public network PUBLIC_NETWORK=192.168.80.0/24 #mirror of ceph download ## aliyun https://mirrors.aliyun.com/ceph ## ceph https://download.ceph.com ## 163 http://mirrors.163.com/ceph ## local http://localhost/ceph BASE_URL=http://mirrors.163.com/ceph #osd disk list OSD_DISK=(/dev/sdb /dev/sdc /dev/sdd) HOST=$(hostname -s) if [[ $OFF_LINE ]]; then if [[ ! -f /etc/yum.repos.d/epel.repo ]] ; then echo "warn epel repo not found!!!" fi else #epel #required rpm curl http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm -o epel-release-7-9.noarch.rpm rpm -ivh epel-release-7-9.noarch.rpm fi #the repo for install ceph-deploy cat <<EOF > /etc/yum.repos.d/ceph-deploy.repo [ceph-deploy] name=ceph-deploy baseurl=${BASE_URL}/rpm-${CEPH_VERSION}/${OS_DISTRO}/noarch enabled=1 priority=0 gpgcheck=0 gpgkey=${BASE_URL}/keys/release.asc EOF # ceph-deploy conf for local repo cat <<EOF > cephdeploy.conf [ceph-local] name=Ceph packages baseurl=${BASE_URL}/rpm-${CEPH_VERSION}/${OS_DISTRO}/x86_64 enabled=1 priority=0 gpgcheck=0 gpgkey=${BASE_URL}/keys/release.asc default=True extra-repos = ceph-local EOF #update rpm yum -y update && yum -y install ceph-deploy #clean env ceph_clean () { ceph-deploy purge $HOST ceph-deploy purgedata $HOST ceph-deploy forgetkeys } ceph_clean #init node ceph-deploy new $HOST #set repo ceph-deploy repo ceph-local $HOST #replace the ip addr for dev id when init sed -i 's#mon_host.*#mon_host = '${MON_IP}'#' ceph.conf #add conf for ceph #osd cat <<EOF >> ceph.conf public_network = ${PUBLIC_NETWORK} osd_journal_size = 1024 osd_pool_default_size = 2 osd_crush_chooseleaf_type = 0 EOF if [[ $CEPH_VERSION == "luminous" ]]; then #add mgr module cat <<EOF >> ceph.conf [mgr] mgr_modules = dashboard EOF fi # install node ceph-deploy install $HOST #init monitor ceph-deploy mon create-initial #install osd for i in ${OSD_DISK[@]} do ceph-deploy osd prepare ${HOST}:${i} ceph-deploy osd activate ${HOST}:${i}1 done #admin ceph-deploy admin $HOST sudo chmod +r /etc/ceph/ceph.client.admin.keyring if [[ $CEPH_VERSION == "luminous" ]]; then # set dashboard ip ceph config-key put mgr/dashboard/server_addr $MON_IP #restart mgr systemctl restart ceph-mgr@$HOST echo "http://"$MON_IP:7000 dashboard url fi
true
3d8d7df1c3d310973d5249059c24547ac93bd62f
Shell
saimizi/devkit
/tools/git_tree
UTF-8
6,600
3.4375
3
[]
no_license
#!/bin/bash check_op_name(){ local op local op_name local ops local tp local pkg op=$1 op_name=$2 pkg=$3 ops="unknown" if [ "x$op" = "x" ];then return 1 fi if [ "x$op_name" = "x" ];then return 1 fi if [ "x$pkg" = "x" ];then return 1 fi ops=`git branch | sed "s/\*//g"` ops="$ops `git ls-remote 2>/dev/null | grep refs | grep heads | awk '{print $2}' | awk 'BEGIN{FS="/"}{print $NF}'`" ops="$ops `git tag`" ops="$ops `git ls-remote 2>/dev/null | grep refs | grep tags | awk '{print $2}' | awk 'BEGIN{FS="/"}{print $NF}' | grep -v "}$"`" if [ "x$ops" = "xunknown" ];then echo "Bad operations: $op." return 1 fi for tp in $ops do if [ $tp = $op_name ];then echo "Error: \"$op_name\" already exists in $pkg" return 1 fi done # Modification check should not be used, for patch mechanism maybe used... # tp=`git status | grep modified` # if [ "x$tp" != "x" ];then # echo "Error: $pkg is modified, commit and push it first." # return 1 # fi tp=`LANG=C git status | grep "ahead of"` if [ "x$tp" != "x" ];then echo "Error: $pkg is ahead of the remote repository, push it first." return 1 fi return 0 } num_of_str(){ echo $# } get_package(){ local cname local pname local tp local tmp local ver local mkfile local pkgtype mkfile= pkgtype= cname=`echo $1 | sed "s/^BR2_PACKAGE_//"` if [ "x$cname" = "x" ];then return fi pname=`echo $cname | tr '[:upper:]' '[:lower:]'` if [ -d buildroot/package/${pname} ];then mkfile=buildroot/package/${pname}/${pname}.mk pkgtype="OSS" fi if [ -d bconf/package/${pname} ];then pkgtype="BF" mkfile=bconf/package/${pname}/${pname}.mk fi if [ "x$mkfile" = "x" ];then return fi if [ ! -f $mkfile ];then return fi tmp=`grep -nr "${cname}_SITE[[:blank:]]*=" $mkfile | awk 'BEGIN{FS="="}{print $2}' | sed "s/ //g"` if ! [[ $tmp =~ "BR2_BF_GIT_SERVER" ]];then pkgtype="OSS" fi ver=`grep -nr "^${cname}_VERSION[[:blank:]]*=" $mkfile | awk 'BEGIN{FS="="}{print $2}' | sed "s/ //g"` if [ "x$ver" = "x" ];then return fi tmp=`num_of_str $ver` if [ $tmp -gt 1 ];then ver="?" fi if [[ "x$ver" =~ "\$" ]];then ver="?" fi echo ${pname}%${ver}%${pkgtype} } do_git(){ local config_file local op local op_name local pkgs local tmp local present_branch local rp local mkfile local sha local result local pkgtype local ver local tp local p local here local name local cname local pname result=OK op= op_name=$2 if [ ! -f .smake ];then echo "No \".smake\" found." echo "Make sure run this tool at the top directroy of a configured tree." return fi if [ "x$op_name" = "x" ];then echo "No branch/tag name specified." return fi config_file=`cat .smake | sed "s/_defconfig$//"` if [ "x$1" = "xbranch" ];then op_name=${config_file}_B_${op_name} echo "Create branch $op_name for $config_file." echo op=$1 fi if [ "x$1" = "xtag" ];then op_name=${config_file}_T_${op_name} echo "Create tag $op_name for $config_file." echo op=$1 fi if [ "x$op" = "x" ];then echo "Invalid operation." return fi echo "Check package buildroot" check_op_name $op $op_name "buildroot" if [ $? -ne 0 ];then return fi pkgs=`cat .config | grep "^BR2_PACKAGE_BF_.*=y$" | sed "s/=y$//" | sed "s/ //g"` if [ "x$pkgs" = "x" ];then return fi for p in $pkgs do rp=`get_package $p` if [ "x$rp" = "x" ];then continue fi pname=`echo $rp | awk 'BEGIN{FS="%"}{print $1}'` ver=`echo $rp | awk 'BEGIN{FS="%"}{print $2}'` pkgtype=`echo $rp | awk 'BEGIN{FS="%"}{print $3}'` name=${pname}-${ver} if [ "x$pkgtype" = "xOSS" ];then continue fi echo "Check package ${pname}" if [ ! -d "build/${name}" ];then echo "No ${name} found in build directory." return fi here=`pwd` cd build/${name} check_op_name $op $op_name $name if [ $? -ne 0 ];then cd $here return fi cd $here tmp="$tmp $name" done pkgs=$tmp present_branch=`git branch | awk '{print $2}'` git checkout -b $op_name if [ $? -ne 0 ];then echo "Failed to create branch $op_name" return fi for p in $pkgs do name=$p pname=`echo $name | awk 'BEGIN{FS="-"}{print $1}'` ver=`echo $name | awk 'BEGIN{FS="-"}{print $2}'` cname=`echo $pname | tr '[:lower:]' '[:upper:]'` mkfile="bconf/package/${pname}/${pname}.mk" cd build/$name if [ $op = "branch" ];then echo "Creating branch $op_name for $p" git checkout -b $op_name if [ $? -ne 0 ];then echo "Failed to create branch $op_name for $p" result=NG cd $here break fi echo "Push branch $op_name to remote" git push origin $op_name if [ $? -ne 0 ];then echo "Failed to push branch $op_name to $site_path" result=NG cd $here break fi fi if [ $op = "tag" ];then echo "Creating tag $op_name for $p" git tag $op_name if [ $? -ne 0 ];then echo "Failed to create litght-weight tag $op_name for $p" result=NG cd $here break fi echo "Push tag $op_name to remote" git push origin $op_name if [ $? -ne 0 ];then echo "Failed to tag branch $op_name to remote repository." result=NG cd $here break fi fi cd $here echo "Update mkfile $mkfile for $op $op_name" sed -i "s/${cname}_VERSION[[:blank:]]*=[[:blank:]]*${ver}/${cname}_VERSION = ${op_name}/" $mkfile git add $mkfile echo echo done if [ "x$result" = "xOK" ];then #Clean other configuration file echo "Clean configuration file other than ${config_file}_defconfig." tmp=`ls bconf/configs` for tp in $tmp do if [ "$tp" != "${config_file}_defconfig" ];then git rm bconf/configs/$tp fi done git commit -m "New branch for $op $op_name." git push origin $op_name fi git checkout $present_branch } show_version(){ local pkgs local p local tp local name local ver local pkg_type if [ ! -e .config ];then return fi oss_result= bf_result= pkgs=`cat .config | grep "^BR2_PACKAGE_.*=y$" | sed "s/=y$//" | sed "s/ //g"` if [ "x$pkgs" = "x" ];then return fi echo "Packages version info" echo "------------------------" for p in $pkgs do tp=`get_package $p` if [ "x$tp" = "x" ];then continue fi name=`echo $tp | awk 'BEGIN{FS="%"}{print $1}'` ver=`echo $tp | awk 'BEGIN{FS="%"}{print $2}'` pkg_type=`echo $tp | awk 'BEGIN{FS="%"}{print $3}'` if [ "x$name" = "x" ];then continue fi if [ "x$ver" = "x" ];then continue fi printf "\t%-20s\t: %-3s : %s\n" $name $pkg_type $ver continue done } git_tree_tag(){ do_git tag $1 } git_tree_branch(){ do_git branch $1 }
true
fdac702c8612c9110a978578c99c9973341a1d2d
Shell
MorningCoffeeZombie/SourceGameScripts
/swapMicSpams.sh
UTF-8
16,632
3.625
4
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
#!/bin/bash # Audio MUST BE: 16 bit format, Mono (not stereo), and 22050Hz # Text effects BOLDFONT=$(tput bold) NORMALFONT=$(tput sgr0) RED='\033[0;31m' YELLOW='\033[1;33m' GREEN='\033[0;32m' NC='\033[0m' # No Color SCRIPTLOCATION=$(pwd) # Call Font Scripts # ${RED}My text here${NC} # This is a throw-away variable for tallying playcount and recording it to the .conf file MATH=0 # Save settings/stats locally # The $GAME var MUST be set to the full/proper name as this is also the top level name of the folder in which the voice_input.wav will reside source /swapMicSpams.conf function fn_check_conf(){ if [ ! -f "/swapMicSpams.conf" ]; then echo "Config file could not be found, creating a new one" sudo echo> /swapMicSpams.conf sudo printf "GAME=Counter-Strike Global Offensive\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND1=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND2=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND3=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND4=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND5=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND6=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND7=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND8=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND9=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND10=0\n" | sudo tee --append /swapMicSpams.conf sudo printf "SOUND11=0\n" | sudo tee --append /swapMicSpams.conf sudo chmod 777 /swapMicSpams.conf source /swapMicSpams.conf echo "New config file successfully created" fi } GAME="Counter-Strike Global Offensive" #fn_check_conf if [[ "${1,,}" = help* ]] || [ "${1,,}" = "/?" ] ; then printf "\n${GREEN}${BOLDFONT}CURRENT GAME:\t\t$GAME${NORMALFONT}${NC}\n" printf "${BOLDFONT}ARGUMENT\t\tDESCRIPTION${NORMALFONT}\n" printf "${BOLDFONT}help${NORMALFONT}\t\t\tDisplay this help text.\n" printf "${BOLDFONT}game${NORMALFONT}\t\t\tSwitch the game directory that sound clips are saved to.\n" printf "${BOLDFONT}mode${NORMALFONT}\t\t\tSwitch the game directory that sound clips are saved to.\n" fi if [[ "${1,,}" = gam* ]] || [[ "${1,,}" = mod* ]]; then if [ "${2,,}" = "csgo" ] || [ "${2,,}" = "" ]; then GAME="Counter-Strike Global Offensive" sudo printf "GAME=Counter-Strike Global Offensive\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "csgo" ] || [ "${2,,}" = "cs go" ]; then GAME="Counter-Strike Source" sudo printf "GAME=Counter-Strike Source\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "dod" ] || [ "${2,,}" = "dods" ]; then GAME="Day of Defeat Source" sudo printf "GAME=Day of Defeat Source\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "gmod" ] || [ "${2,,}" = "garrysmod" ]; then GAME="GarrysMod" sudo printf "GAME=GarrysMod\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "portal" ]; then GAME="Portal" sudo printf "GAME=Portal\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "l4d" ] || [[ "${2,,}" = lef* ]]; then GAME="left 4 dead" sudo printf "GAME=left 4 dead\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "tf2" ] || [[ "${2,,}" = team* ]]; then GAME="Team Fortress 2" sudo printf "GAME=Team Fortress 2\n" | sudo tee --append swapMicSpams.conf elif [ "${2,,}" = "hl2" ] || [[ "${2,,}" = half* ]]; then GAME="Half-Life 2" sudo printf "GAME=Team Fortress 2\n" | sudo tee --append swapMicSpams.conf fi fi # Catch errors if [ ! -d "/home/$USER/.steam/steam/steamapps/common/$GAME" ]; then printf "${RED}GAME NOT INSTALLED AS EXPECTED!${NC}\n" printf "${RED}EXITING SCRIPT${NC}\n" exit fi # Placing script in a loop so you don't have to reopen every time while true; do echo echo PS3="Which soundbyte would you like to que? " options=("ALLAHU AKBAR!" "Be Gone Thot" "Bill Cosby - Get Ready" "Bill Nye Chant" "BOOM HEADSHOT" "CSGO - Bomb Planted" "CSGO - CT Win" "CSGO - T Win" \ "Cant Hurt Me" "CHOCOLATE!" "Chris Hansen" "Concentrate" "Dab Distorted" "Dirty Jobs" "Discord - Message" "Discord - Incoming Call" \ "Discord - Joining (3x)" "Drinking Problem" "FBI Open Up" "Get To Choppa" "Gotcha Bitch" \ "I See Dead People" "Its My Money" "Kinky?!?" "Lahey - Clock's Tickin" "Lahey - Drunk/Sober Enough" \ "Lahey - I Condemn This" "Medic!" "Mr. Meeseeks" "My Leg" "Nice Reeeaal Nice" "OOF" "NOT THE BEES!" \ "Points Dont Matter" "Price Is Wrong" "Pull The Trigger" "IM THE MOUNTAIN" "RUN AWAY!" \ "Sam L Jackson - Look Like Bitch" "Sam L Jackson - Look Like Bitch Aggressive" "Sam L Jackson - Say What" \ "Sam L Jackson - Speak English" "Sausages" "Sexual Helicopter" "Virgin In House" "We Got Him" "WORLDSTAR!" \ "World Star - Mild" "Yakety Sax" "Zoidberg - Boooo" "Zoidberg - Scuddling" "Quit") select voiceinput in "${options[@]}" do case $voiceinput in "ALLAHU AKBAR!") cp $SCRIPTLOCATION/MicSpams/allahu_akbar_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Be Gone Thot") cp $SCRIPTLOCATION/MicSpams/be_gone_thot_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; #MATH=$(( $($BeGoneThot) + 1 )) #sudo sed -i '/BeGoneThot/ s/.*/BeGoneThot='$MATH'/' /swapMicSpams.conf "Bill Cosby - Get Ready") cp $SCRIPTLOCATION/MicSpams/bill_cosby_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Bill Nye Chant") cp $SCRIPTLOCATION/MicSpams/bill_nye_chant_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "BOOM HEADSHOT") cp $SCRIPTLOCATION/MicSpams/boom_headshot_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Cant Hurt Me") cp $SCRIPTLOCATION/MicSpams/cant_hurt_me_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "CHOCOLATE!") cp $SCRIPTLOCATION/MicSpams/chocolate_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Chris Hansen") cp $SCRIPTLOCATION/MicSpams/im_chris_hansen_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Concentrate") cp $SCRIPTLOCATION/MicSpams/concentrate_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "CSGO - Bomb Planted") cp $SCRIPTLOCATION/MicSpams/bomb_planted_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "CSGO - CT Win") cp $SCRIPTLOCATION/MicSpams/csgo_ct_win_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "CSGO - T Win") cp $SCRIPTLOCATION/MicSpams/csgo_t_win_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Dab Distorted") cp $SCRIPTLOCATION/MicSpams/dab_distorted_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Dirty Jobs") cp $SCRIPTLOCATION/MicSpams/dirty_jobs_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Discord - Message") cp $SCRIPTLOCATION/MicSpams/discord_message_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Discord - Incoming Call") cp $SCRIPTLOCATION/MicSpams/discord_incoming_call_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Discord - Joining (3x)") cp $SCRIPTLOCATION/MicSpams/discord_joining_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Drinking Problem") cp $SCRIPTLOCATION/MicSpams/drinking_problem_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "FBI Open Up") cp $SCRIPTLOCATION/MicSpams/fbi-open-up-sfx_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Get To Choppa") cp $SCRIPTLOCATION/MicSpams/get_to_choppa_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Gotcha Bitch") cp $SCRIPTLOCATION/MicSpams/gotcha_bitch_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "I See Dead People") cp $SCRIPTLOCATION/MicSpams/i_see_dead_people_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Its My Money") cp $SCRIPTLOCATION/MicSpams/its_my_money_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Kinky?!?") cp $SCRIPTLOCATION/MicSpams/kinky_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Lahey - Clock's Tickin") cp $SCRIPTLOCATION/MicSpams/lahey_clocks_tickin_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Lahey - Drunk/Sober Enough") cp $SCRIPTLOCATION/MicSpams/lahey_drunk_sober_enough_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Lahey - I Condemn This") cp $SCRIPTLOCATION/MicSpams/lahey_i_condemn_this_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Medic!") cp $SCRIPTLOCATION/MicSpams/medic_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Mr. Meeseeks") cp $SCRIPTLOCATION/MicSpams/mr_meeseeks_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "My Leg") cp $SCRIPTLOCATION/MicSpams/my_leg_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "NOT THE BEES!") cp $SCRIPTLOCATION/MicSpams/not_the_bees_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Nice Reeeaal Nice") cp $SCRIPTLOCATION/MicSpams/nice_real_nice_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "OOF") cp $SCRIPTLOCATION/MicSpams/oof_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Points Dont Matter") cp $SCRIPTLOCATION/MicSpams/points_dont_matter_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Price Is Wrong") cp $SCRIPTLOCATION/MicSpams/price_is_wrong.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Pull The Trigger") cp $SCRIPTLOCATION/MicSpams/pull_the_trigger_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "IM THE MOUNTAIN") cp $SCRIPTLOCATION/MicSpams/stoned_jesus_im_the_mountain_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "RUN AWAY!") cp $SCRIPTLOCATION/MicSpams/run_away_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sam L Jackson - Look Like Bitch") cp $SCRIPTLOCATION/MicSpams/sam_jackson_look_like_bitch_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sam L Jackson - Look Like Bitch Aggressive") cp $SCRIPTLOCATION/MicSpams/sam_jackson_look_like_bitch_aggressive_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sam L Jackson - Say What") cp $SCRIPTLOCATION/MicSpams/sam_jackson_say_what_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sam L Jackson - Speak English") cp $SCRIPTLOCATION/MicSpams/sam_jackson_speak_english_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sausages") cp $SCRIPTLOCATION/MicSpams/sausages_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Sexual Helicopter") cp $SCRIPTLOCATION/MicSpams/sexually_identify_helicopter_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Virgin In House") cp $SCRIPTLOCATION/MicSpams/22_yo_virgin_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "We Got Him") cp $SCRIPTLOCATION/MicSpams/we_got_him_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "WORLDSTAR!") cp $SCRIPTLOCATION/MicSpams/world_star_spam_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "World Star - Mild") cp $SCRIPTLOCATION/MicSpams/world_star_mild_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Yakety Sax") cp $SCRIPTLOCATION/MicSpams/yakety_sax_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Zoidberg - Boooo") cp $SCRIPTLOCATION/MicSpams/zoidberg_boo_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Zoidberg - Scuddling") cp $SCRIPTLOCATION/MicSpams/zoidberg_scuddling_voice_input.wav "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"; printf "${GREEN}${BOLDFONT}$voiceinput${NORMALFONT}${NC} entered"; break;; "Quit") exit;; *) echo "invalid option $REPLY";; esac done done #cp ../MicSpams/ "/home/$USER/.steam/steam/steamapps/common/$GAME/voice_input.wav"
true
66bb0fa3564c23ca7b4f1534e5541eb1ace51361
Shell
loggingroads/osm-export-script
/replicate.sh
UTF-8
1,841
3.9375
4
[]
no_license
#!/bin/bash # arguments are a list of country iso3 codes # useful in e.g. a crontab which asks to process several countries #The replication files are organized according to the url scheme: #http://planet.openstreetmap.org/replication/[day|hour|minute]/AAA/BBB/CCC.osc.gz #The AAA/BBB/CCC are equivalent to a sequence number, AAA*1000000 + BBB*1000 + CCC #The latest osm update file is stored with this sequence number in the filename #The current country file is stored with the most recent sequence number in the filename #This script just adds one to the sequence number and applies the relevant update file #TODO - what happens if file doesn't exist #TODO - how many updates to keep #TODO - Convert to o5m should already be done, with only highways #e.g: #osmconvert pbf/"$var".pbf -o="$var".o5m #osmfilter "$var".o5m --keep="highway=*" --out-o5m > $highway_file for var in "$@" do echo "processing ""$var" unset -v latest unset -v prefix prefix=current/"$var"_ # find the most recently updated country o5m file for country for file in "$prefix"*; do [[ $file -nt $latest ]] && latest=$file done echo $latest current_highway_file=$latest # get the seq number current_seq_str=${latest#$prefix} current_seq_no=${current_seq_str%".o5m"} echo "current: " $current_seq_no next_seq_no=$((10#$current_seq_no + 1)) echo "next: " $next_seq_no lpad_seq=$(printf "%0*d" 9 $next_seq_no) temp_updated_file=/tmp/"$var"_updated.o5m updated_highway_file=current/"$var"_"$lpad_seq".o5m polygon_file=poly/ne_"$var".poly # Apply a changefile osmconvert "$current_highway_file" minute_replication/"$lpad_seq".osc.gz -B=$polygon_file -o=$temp_updated_file osmfilter $temp_updated_file --keep="highway=*" --out-o5m > $updated_highway_file done
true
a699847b814ac4d79fce7a40ae94612254782cf8
Shell
delkyd/alfheim_linux-PKGBUILDS
/terbilang/PKGBUILD
UTF-8
765
2.609375
3
[]
no_license
# Maintainer: yadieet <yadieet@gmail.com> pkgname=terbilang pkgver=2.0 pkgrel=5 pkgdesc="Number-To-Text / Number-To-Words converter utility for Bahasa Indonesia or Indonesian Rupiah (IDR) currency." url="https://github.com/yadieet/c-programming-examples/tree/master/terbilang" license=('GPL3') source=("terbilang-$pkgver.c::https://raw.githubusercontent.com/yadieet/c-programming-examples/0fe2faaa614308003100a6b9fbb97eedbf61b6b2/terbilang/terbilang.c") sha256sums=('263750fdd42e0b4c6f1cc2eff2becf6b0b12cc874eb1b559135402df90c56f43') arch=('x86_64') depends=('gmp') build() { cd "$srcdir" gcc -Wall -Wextra -std=c11 -pedantic -o "ysa-terbilang" "terbilang-$pkgver.c" -lgmp } package() { cd "$srcdir" install -D -m755 ysa-terbilang ${pkgdir}/usr/bin/ysa-terbilang }
true
80ed8941ff24d3059f95111e45ebb053218f9f7d
Shell
ptsouth97/kali_scripts
/gaining_access/WPA/crack.sh
UTF-8
673
3.4375
3
[]
no_license
#!/bin/bash ######################### # WPA CRACK # ######################### # After capturing the handshake and generating a wordlist, use aircrack-ng to determine key for target access point # Aircrack goes through wordlist file and combines each password with the name of target access point to create PMK (Pairwise Master Key) # PMK uses pbkdf2 algorithm to encrypt and then compare PMK to handshake # aircrack-ng [HANDSHAKE FILE] -w [WORDLIST] # e.g., aircrack-ng is-01.cap -w list echo "What is the name of the file with the handshake?" read handshake echo "What is the name of the wordlist file?" read wordlist aircrack-ng $handshake -w $wordlist
true
65dd2c23d3523c67c17192b980c45d99cc49424d
Shell
Nilanshrajput/fastrelease
/action/publish/action.sh
UTF-8
872
3.390625
3
[ "Apache-2.0" ]
permissive
#!/bin/bash set -e echo "::group::Validate Information" function check_env() { if [ -z $(eval echo "\$$1") ]; then echo "Variable $1 not found. Exiting..." exit 1 fi } check_env "INPUT_TOKEN" echo "::add-mask::$INPUT_TOKEN" echo "::endgroup::" echo "::group::Configure Git" git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.name "github-actions[bot]" git config --global user.password "$INPUT_TOKEN" git remote remove origin git remote add origin "https://github-actions[bot]:$INPUT_TOKEN@github.com/${GITHUB_REPOSITORY}.git" echo "::endgroup::" echo "::group::Publish Release" echo $INPUT_TOKEN > token fastrelease_release echo "::endgroup::" echo "::group::Bump Version" make release git add settings.ini && git push echo "::endgroup::"
true
e893340ec8ed5eb5bf510da8acf7f7b8e0c71053
Shell
MBARI-ESP/ESP2Glinux
/esp/portmap/arminstall
UTF-8
549
3.21875
3
[]
no_license
#!/bin/sh # build & install portmap daemon for arm-linux -- 3/15/05 brent@mbari.org : ${ARMGCC:=/arm} : ${ARMSTRIP:=$ARMGCC/bin/strip} : ${TARGETTOP:=${2-/sbin}} : ${HOSTTOP:=${1-$HOME/armHost$TARGETTOP}} echo "Installing in $HOSTTOP" echo " for execution at $TARGETTOP on the ARM target" cd ${PORTMAPVERS-portmap_5beta} || exit 2 make clean all O="-Os -fomit-frame-pointer" CC=/arm/bin/gcc && $ARMSTRIP portmap && install -Dm 755 portmap $HOSTTOP/portmap || exit 1 echo "Done." echo "Ensure that an rpc user entry exist in in /etc/passwd and /etc/group"
true
19d9522a864ccc7d63216bb3a73ae4032b63942a
Shell
pgaba007/Shell-Scripts
/aman/salary.sh
UTF-8
454
3.46875
3
[]
no_license
echo "enter the number of salaries you want to enter" read n for (( i=0;i<$n;i++ )) do echo "enter the $((i+1)) salary:" read value a[i]=$value done echo "enetered salaries are: ${a[*]}" temp=0 for(( i=0;i<$n;i++ )) do for(( j=i;j<$n;j++ )) do if [[ ${a[i]} -gt ${a[j+1]} ]] then temp=${a[i]} a[i]=${a[j+1]} a[j+1]=$temp fi done done echo "salary in increasing order: ${a[*]}" echo "secnd highest: ${a[$n-1]}" echo "third highest: ${a[$n-2]}"
true
110a2bcbb56c31288d597130d7f20ae2697c34a1
Shell
mumblez/misc-scripts
/ldap/ldap-add-user.sh
UTF-8
1,936
3.6875
4
[]
no_license
#!/bin/bash # Add a new user to our apache DS LDAP directory # Need to ensure we trim and validate fields/input from rundeck # hopefully we won't have 2 users with the same names!!! die() { echo $* 1>&2 ; exit 1 ; } DIR=$(cd "$(dirname "$0")" && pwd) # VALIDATION # PATH=$PATH:/usr/local/openldap/sbin which tr > /dev/null || die "ERROR: tr needs to be installed" which slappasswd > /dev/null || die "ERROR: openldap needs to be installed" # SETTINGS # LDAPURL="ldaps://someserver:10636" BASEURL="ou=users,o=cl" LDAPOPTIONS="-x -H" # https://someserver/index.php?page=items&group=10&id=17 . $DIR/.ldapcreds USERPASS=@option.last_name@ USERPASSHASH=$(slappasswd -h {sha} -s $USERPASS) FNAME=$(echo @option.first_name@ | tr -d ' ') # aka givenName SNAME=$(echo @option.last_name@ | tr -d ' ') DISPLAYNAME="$FNAME $SNAME" DN="cn=$DISPLAYNAME,$BASEURL" LUID="$(echo "$FNAME.$SNAME" | tr [A-Z] [a-z])" EMAILDOMAIN="cognolink.com" EMAIL=$LUID@$EMAILDOMAIN # MORE VALIDATION # # check if user exists ldapsearch $LDAPOPTIONS $LDAPURL \ -D $BINDUSER -w $BINDPASS \ -b $BASEURL \ '(&(objectClass=inetOrgPerson)(uid='"${LUID}"'))' | grep "uid: $LUID" && die "ERROR: User already exists" # add user ldapadd $LDAPOPTIONS $LDAPURL \ -D $BINDUSER -w $BINDPASS <<EOF dn: $DN givenName: $FNAME sn: $SNAME cn: $DISPLAYNAME displayName: $DISPLAYNAME mail: $EMAIL objectClass: top objectClass: inetOrgPerson objectClass: person objectClass: organizationalPerson uid: $LUID userPassword: $USERPASSHASH EOF if [ $? = 0 ] then echo "SUCCESS: user $DISPLAYNAME added." else die "ERROR: Failed adding user." fi # add user to core group(s) ldapmodify $LDAPOPTIONS $LDAPURL \ -D $BINDUSER -w $BINDPASS <<EOF dn: cn=user,ou=groups,o=cl changetype: modify add: uniqueMember uniqueMember: $DN EOF if [ $? = 0 ] then echo "SUCCESS: user $DISPLAYNAME added to core groups" else die "ERROR: Failed adding user to core groups" fi # no errors exit 0
true
e5400414a0604d9702225743f4b1daa00a1ae070
Shell
missingjs/ptools
/serv-by-docker/_docks/mysql-serv
UTF-8
399
2.984375
3
[]
no_license
#!/bin/bash storage_dir=~/data/mysql/01 mysql_password=root export CMD_NAME=$(basename $0) export CONTAINER_NAME=mysql-01 export DOCKER_RUN=" docker run -d \ --name $CONTAINER_NAME \ --env MYSQL_ROOT_PASSWORD=$mysql_password \ -p 3306:3306 \ -v $storage_dir:/var/lib/mysql \ mysql:8.0 " self_dir=$(cd $(dirname $0) && pwd) $self_dir/serv-base "$@"
true
096dd3f7a16298d0a30b07da7a0d27374ac8ec72
Shell
marksplk/SysScripts
/sh/get_seismic_data.sh
UTF-8
176
2.53125
3
[]
no_license
#!/bin/bash for i in {01..29} do if [ $i -lt 10 ] then i="0${i}" fi curl -s http://apps1.gdr.nrcan.gc.ca/laurentian/stp-${i}.nav -o ldif/testldif/seis/st-${i}.txt done
true
8fc14bc0f5cab7650f8ccb386687c1f66c690a7f
Shell
umegaya/caer
/root/ca/new.sh
UTF-8
1,299
2.96875
3
[]
no_license
#!/bin/bash cd /root/ca # cleanup files find . -name *.pem -exec rm -f {} \; rm index.txt* serial* intermediate/index.txt* intermediate/serial intermediate/crlnumber touch index.txt touch intermediate/index.txt echo 1000 > serial echo 1000 > intermediate/serial echo 1000 > intermediate/crlnumber # create root key openssl genrsa -out private/ca.key.pem 4096 chmod 400 private/ca.key.pem # create root cert openssl req -config openssl.cnf \ -key private/ca.key.pem \ -new -x509 -days 7300 -sha256 -extensions v3_ca \ -out certs/ca.cert.pem # create intermediate key openssl genrsa -out intermediate/private/intermediate.key.pem 4096 chmod 400 intermediate/private/intermediate.key.pem # create intermediate cert openssl req -config intermediate/openssl.cnf -new -sha256 \ -key intermediate/private/intermediate.key.pem \ -out intermediate/csr/intermediate.csr.pem # sign to cert openssl ca -config openssl.cnf -extensions v3_intermediate_ca \ -days 3650 -notext -md sha256 \ -in intermediate/csr/intermediate.csr.pem \ -out intermediate/certs/intermediate.cert.pem # create cert chain cat intermediate/certs/intermediate.cert.pem \ certs/ca.cert.pem > intermediate/certs/ca-chain.cert.pem chmod 444 intermediate/certs/ca-chain.cert.pem
true
a1d534229f93e4e1196488213a28b2569cc06c1f
Shell
wardenlym/benchmark-test-on-kvm
/kubeadm/copy-cert.sh
UTF-8
2,709
3.328125
3
[]
no_license
ERROR: type should be string, got "\nhttps://kubernetes.io/zh/docs/setup/production-environment/tools/kubeadm/high-availability/\n手动证书分发\n如果您选择不将 kubeadm init 与 --upload-certs 命令一起使用, 则意味着您将必须手动将证书从主控制平面节点复制到 将要加入的控制平面节点上。\n\n有许多方法可以实现这种操作。在下面的例子中我们使用 ssh 和 scp:\n\n如果要在单独的一台计算机控制所有节点,则需要 SSH。\n\n在您的主设备上启动 ssh-agent,要求该设备能访问系统中的所有其他节点:\n\neval $(ssh-agent)\n将 SSH 身份添加到会话中:\n\nssh-add ~/.ssh/path_to_private_key\n检查节点间的 SSH 以确保连接是正常运行的\n\nSSH 到任何节点时,请确保添加 -A 标志:\n\nssh -A 10.0.0.7\n当在任何节点上使用 sudo 时,请确保环境完善,以便使用 SSH 转发任务:\n\nsudo -E -s\n在所有节点上配置 SSH 之后,您应该在运行过 kubeadm init 命令的第一个控制平面节点上运行以下脚本。 该脚本会将证书从第一个控制平面节点复制到另一个控制平面节点:\n\n在以下示例中,用其他控制平面节点的 IP 地址替换 CONTROL_PLANE_IPS。\n\nUSER=ubuntu # 可自己设置\nCONTROL_PLANE_IPS=\"10.0.0.7 10.0.0.8\"\nfor host in ${CONTROL_PLANE_IPS}; do\n scp /etc/kubernetes/pki/ca.crt \"${USER}\"@$host:\n scp /etc/kubernetes/pki/ca.key \"${USER}\"@$host:\n scp /etc/kubernetes/pki/sa.key \"${USER}\"@$host:\n scp /etc/kubernetes/pki/sa.pub \"${USER}\"@$host:\n scp /etc/kubernetes/pki/front-proxy-ca.crt \"${USER}\"@$host:\n scp /etc/kubernetes/pki/front-proxy-ca.key \"${USER}\"@$host:\n scp /etc/kubernetes/pki/etcd/ca.crt \"${USER}\"@$host:etcd-ca.crt\n scp /etc/kubernetes/pki/etcd/ca.key \"${USER}\"@$host:etcd-ca.key\ndone\n\n注意: 只需要复制上面列表中的证书。kubeadm 将负责生成其余证书以及加入控制平面实例所需的 SAN。 如果您错误地复制了所有证书,由于缺少所需的 SAN,创建其他节点可能会失败。\n然后,在每个连接控制平面节点上,您必须先运行以下脚本,然后再运行 kubeadm join。 该脚本会将先前复制的证书从主目录移动到 /etc/kubernetes/pki:\n\nUSER=ubuntu # 可自己设置\nmkdir -p /etc/kubernetes/pki/etcd\nmv /home/${USER}/ca.crt /etc/kubernetes/pki/\nmv /home/${USER}/ca.key /etc/kubernetes/pki/\nmv /home/${USER}/sa.pub /etc/kubernetes/pki/\nmv /home/${USER}/sa.key /etc/kubernetes/pki/\nmv /home/${USER}/front-proxy-ca.crt /etc/kubernetes/pki/\nmv /home/${USER}/front-proxy-ca.key /etc/kubernetes/pki/\nmv /home/${USER}/etcd-ca.crt /etc/kubernetes/pki/etcd/ca.crt\nmv /home/${USER}/etcd-ca.key /etc/kubernetes/pki/etcd/ca.key"
true
88759de24da9d38ea9ec9a1415929fbfaf63d237
Shell
qpdf/qpdf
/pkg-test/test-cli
UTF-8
473
3.390625
3
[ "Artistic-1.0", "Artistic-2.0", "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain", "MIT", "AGPL-3.0-or-later" ]
permissive
#!/bin/sh # # Test that the installed qpdf CLI works. Requires the CLI and runtime # libraries. # set -ex TMP=$1 if [ ! -d "$TMP" ]; then echo 1>&2 "Usage: $0 tmp-dir" exit 2 fi WANTED_VERSION=$(awk -F'"' '/#define QPDF_VERSION / {print $2}' include/qpdf/DLL.h) qpdf --version | grep -F $WANTED_VERSION qpdf --help qpdf --check qpdf/qtest/qpdf/minimal.pdf qpdf qpdf/qtest/qpdf/minimal.pdf --encrypt u o 256 -- $TMP/out.pdf qpdf --check --password=u $TMP/out.pdf
true
1cc85984ef0aca65ec280c3d1d19712068f4b150
Shell
adangadang/nginx-conf
/stat.sh
UTF-8
465
2.671875
3
[ "MIT" ]
permissive
一行 Shell 通过 Nginx access 日志实时统计单台机器QPS # 实时统计 ## 方式一 tail -f access.log | awk -F '[' '{print $2}' | awk 'BEGIN{key="";count=0}{if(key==$1){count++}else{printf("%s\t%d\r\n", key, count);count=1;key=$1}}' ## 方式二 tail -f access.log | awk -F '[' '{print $2}' | awk '{print $1}' | uniq -c # 非实时按秒统计QPS cat access.log | awk -F '[' '{print $2}' | awk '{print $1}' | sort | uniq -c |sort -k1,1nr
true
e6e3a6a4193b6d2483172e3084000f569bfbd30f
Shell
harrisonlab/fusarium_ex_strawberry
/genome_aligners/minimap.sh
UTF-8
694
2.84375
3
[]
no_license
#!/usr/bin/env bash #SBATCH -J minimap #SBATCH --partition=himem #SBATCH --mem-per-cpu=12G #SBATCH --cpus-per-task=30 ########################################################################## #INPUT: # 1st argument: Genome1 # 2nd argument: Genome2 #OUTPUT: # Commands to make dotplot in R Genome1=$1 Genome2=$2 Strain=$3 outdir=$4 CurDir=$PWD WorkDir=$PWD/${SLURM_JOB_USER}_${SLURM_JOBID} mkdir -p $WorkDir cp $Genome1 $WorkDir cp $Genome2 $WorkDir cd $WorkDir query=$Genome1 target=$Genome2 minimap2=/home/akinya/miniconda3/envs/olc_assemblers/bin/minimap2 $minimap2 -x asm5 -t 36 $target $query > "$Strain"_minimap.paf cp $WorkDir/"$Strain"_minimap.paf $outdir rm -r $WorkDir
true
ca03ab80d171b43ae94b5367c425f8d7bb2dd48b
Shell
jasonrclark/cycling.garmin
/slurp.sh
UTF-8
744
3.25
3
[]
no_license
set -e if [ -d "/Volumes/GARMIN/Garmin/Activities" ]; then if [ -d "$HOME/Rides" ]; then cd $(dirname $0) SCRIPTPATH=$(pwd -P) echo $SCRIPTPATH export PATH="/usr/local/bin:$PATH" echo $PATH source .secret cp /Volumes/GARMIN/Garmin/Activities/*.fit $HOME/Rides cd $HOME/Rides git add --all git commit -m "Ride upload" || true git push origin master mkdir -p /tmp/status rm /tmp/status/*.json || true cd /Volumes/GARMIN/Garmin/Activities find . -name "*.fit" -exec $SCRIPTPATH/strava.sh {} \; rm *.fit cd /tmp/status find . -name "*.json" -exec curl -X POST http://cycling.robotlikes.com/strava/upload -F file=@{} -H "Authorization: $ROBOT_LIKES_TOKEN" \; fi fi
true
3e0184397a7517fc177fa03a06f46e7c3528fb68
Shell
triquelme/MSc_Bioinformatics_projects
/Unix/getcomments.sh
UTF-8
177
2.9375
3
[]
no_license
#!/bin/bash grep -E -o '#.+$' $1 # look for pattern starting with # (commentary symbol) followed by any character repeated once or more and finishing at the end of the line '$'
true
1357266b5e6e39adb22ec4ff7778eca99f78ab45
Shell
rrbutani/tm4c-llvm-toolchain
/tlt.sh
UTF-8
4,844
4.28125
4
[ "MIT" ]
permissive
#!/usr/bin/env bash VERSION=0.4.2 # Arguments SUBCOMMAND=${1:-info} # As of now, the only env variables `tlt` itself uses are: # - TlT_FILE (defaults to .tlt) # - TLT_NO_GITIGNORES (if set tlt doesn't drop .gitignores; unset by default) # All or nothing: set -e # Some constants # readonly BOLD='\033[0;1m' #(OR USE 31) readonly CYAN='\033[0;36m' readonly PURPLE='\033[1;35m' readonly GREEN='\033[0;32m' readonly BROWN='\033[0;33m' readonly RED='\033[1;31m' readonly NC='\033[0m' # No Color # Global Vars # : "${TLT_FILE:=".tlt"}" TLT_INSTALL_DIR="$(dirname "$(realpath "${0}")")" # Functions # # shellcheck disable=SC2059 function print { n="-e" if [[ "$1" == "-n" ]]; then n="-ne" shift fi if [ "$#" -eq 1 ]; then echo $n "$1" elif [ "$#" -eq 2 ]; then printf "${2}" && >&2 echo $n "$1" && >&2 printf "${NC}" else >&2 printf "${RED}" && >&2 echo "Received: $* ($# args)" && >&2 printf "${NC}"; return 1 fi } function help { print "Usage: ${0} [subcommand]" print "Version: ${VERSION}\n" print "A tool to help create and manage tlt projects." print "More information here: https://git.io/fhNW6.\n" print "Subcommands:" "${GREEN}" cmd () { print -n " ${1}" "${CYAN}"; print -n " -- "; print "${2}" "${BROWN}"; } cmd " init" "🔨 Creates a new project." cmd " update" "🔄 Regenerates the build file for the current project." cmd "upgrade" "💿 Tries to update your tlt installation." cmd " help" "ℹ️ Displays this help message!" cmd "version" "🔢 Shows the version number for the tlt installation." exit "${1}" } function upgrade { local local_sha upstream_sha g () { git -C "${TLT_INSTALL_DIR}" "${@}"; } g fetch local_sha="$(g rev-parse HEAD)" # shellcheck disable=SC1083 upstream_sha="$(g rev-parse master@{upstream})" if [ "${local_sha}" != "${upstream_sha}" ]; then print "Update available!" "${BOLD}" print "Current version is ${VERSION}." print "Current SHA: ${local_sha}" print " New SHA: ${upstream_sha}\n" print "Attempting to update..." "${BROWN}" g pull print "New version is $("${0}" version)." "${BOLD}" print "Success!" "${CYAN}" else print -n "Already up to date!" "${CYAN}" print " (version: ${VERSION}; SHA: ${local_sha})" fi } function update { if [ ! -f "${TLT_FILE}" ]; then print "It doesn't look like this is a tlt project!" "${RED}" print "(we couldn't find a \`${TLT_FILE}\` file)\n" print "If you're trying to make a new project, try running \`${0} init\`." exit 2 fi "${TLT_INSTALL_DIR}/misc/gen.sh" } function new { local target_dir proj_name type mode modules mkdir -p "${2-.}" target_dir="$(realpath "${2-.}")" print "Making a new tlt project in \`${target_dir}\`.\n" "${CYAN}" read -r -p "First, let's give this project a name: " proj_name print "\nNow pick a project type: binary or library?" select type in "binary" "library"; do case $type in "binary") proj_name="${proj_name}.out" break;; "library") proj_name="${proj_name}.a" break;; esac done print "\nNext, a project mode (if you're not sure, choose native):" select mode in "native" "docker" "hybrid"; do case $mode in "native" | "docker" | "hybrid") break;; esac done print "\nLast step! If you'd like to use any modules in your project, " print "list them here. Otherwise just press enter." read -r -p "Modules: " modules print "\nGenerating...\n" "${GREEN}" (cd "${target_dir}"; \ "${TLT_INSTALL_DIR}/misc/gen.sh" \ "${mode}" "${proj_name}" "${modules}" "${TLT_INSTALL_DIR}") if [ ! -f "${target_dir}/.gitignore" ] && [ -z "${TLT_NO_GITIGNORES+x}" ]; then cat <<-EOF > "${target_dir}/.gitignore" # tlt project files # build.ninja target/ compile_commands.json graph.png .clangd EOF print "Added a .gitignore." "${CYAN}" fi # If the target directory isn't already part of a git repo, make one! if ! git -C "${target_dir}" rev-parse --git-dir &> /dev/null; then git init "${target_dir}" print "Made a new git repo." "${CYAN}" fi print "\nYou're all set up! 🎉" "${CYAN}" } case ${SUBCOMMAND} in "new" | "init") new "${@}" ;; "update" | "build" | "up" ) update ;; "upgrade" | "self-update") upgrade ;; "help" | "info" ) help 0 ;; "version") print "${VERSION}" ;; *) print "Sorry, we don't understand \`${*}\`! Here's the help message: " "${RED}" help 1 ;; esac
true
a61a3e58887b0ec63788cf0e0ceb689aaa2ab561
Shell
ra85wipe/openAAS_workshop
/update-openaas-vm.sh
UTF-8
997
3.125
3
[ "Apache-2.0" ]
permissive
#!/bin/bash #Start logging to file exec > >(tee -ia /home/openaas/Documents/update.log) exec 2> >(tee -ia /home/openaas/Documents/update.err) date >&2 echo "________________________________________________________________________" echo "Update openaas_workshop repository:" cd /home/openaas/openaas_workshop/ sshpass -p openaas git pull --no-edit pi@$1:/home/pi/openaas_workshop echo openaas | sudo -S git clean -fd git reset --hard cmake . make echo "" echo "________________________________________________________________________" echo "Installing opcua python interface" cd python echo openaas | sudo -S pip3 install -e . cd .. cp -f -v libreoffice/opcua_interface.py /home/openaas/.config/libreoffice/4/user/Scripts/python/opcua_interface.py echo "" echo "________________________________________________________________________" echo "Copying openAAS libre office client" cp -f -v libreoffice/aas_client.ods /home/openaas/Desktop/AAS\ Libre\ Office\ Client echo "" echo "Done." echo ""
true
d53c6a4bb90b3b37fb089edbfa73a7e67d617d4a
Shell
wrfly/check-port-open-in-x-ways
/nc.sh
UTF-8
95
2.609375
3
[]
no_license
#!/bin/sh TARGET=${1:-127.0.0.1:8080} TARGET=$(echo $TARGET | tr ":" " ") nc -zv -w 5 $TARGET
true
3da79bb171b8ece73b18ba12d07f8e149c9231a0
Shell
jorgemarpa/HiTS
/lib/lc_color_leftraru.slurm
UTF-8
1,558
3.25
3
[]
no_license
#!/bin/bash ## Job Name #SBATCH -J color_leftraru.slurm ## Job Output (stdout + stderr) file ## %A = parent job id ## %a = task id ## %j = real job id #SBATCH --output=/home/jmartinez/HiTS/logs/color.%A.%a.log #SBATCH --error=/home/jmartinez/HiTS/errors/color.%A.%a.err ## Job Array, 20 parallels jobs #SBATCH --partition=slims #SBATCH -n 10 #SBATCH --ntasks-per-node=10 #SBATCH -c 1 #SBATCH --array=1-60 ##SBATCH --mail-user=user@gmail.com ##SBATCH --mail-type=ALL # parametrize your variables PYTHON=python # get access to the SLURM task id variable export SLURM_JOBID ; # real job id export SLURM_ARRAY_JOB_ID ; # parent job id (originator job) export SLURM_ARRAY_TASK_ID ; # task id if [[ -z "$SLURM_ARRAY_TASK_ID" ]]; then # not under slurm environment. # assuming only one input file SLURM_ARRAY_TASK_ID=1 fi # make the toolchain available module load astro # list the modules loaded module list # include your home bin directory into the PATH export PATH=$HOME/bin:$PATH # write the hostname where we are running echo "Hostname: `hostname`" ## My Script ## export PYTHONPATH=`pwd`/test_omp:$PYTHONPATH ## read epoch.txt file with epochs echo "$SLURM_ARRAY_TASK_ID" FILELIST="/home/jmartinez/HiTS/info/ccds.txt" echo "$FILELIST" CCD=`head -n $SLURM_ARRAY_TASK_ID $FILELIST | tail -n 1 | cut -f 1 -d" "` echo "$CCD" ${PYTHON} lc_color_leftraru.py -F $1 -C $CCD -1 g -2 r -a $2 EXIT_CODE=$? ## finishing tasks echo "Exit code: $EXIT_CODE" ## - remove temporary files ## - handle errors
true
5c633780a6b1a754ad23eae9a9eb8c17060bfa46
Shell
caguerra/Burkardt-Fortran-90
/f_src/hdf5_test/hdf5_test.sh
UTF-8
256
2.640625
3
[]
no_license
#! /bin/bash # h5fc hdf5_test.f90 if [ $? -ne 0 ]; then echo "Compile error." exit fi # rm hdf5_test.o mv a.out hdf5_test # ./hdf5_test > hdf5_test.txt if [ $? -ne 0 ]; then echo "Load error." exit fi rm hdf5_test # echo "Normal end of execution."
true