Bash: Add completion for git-spindle

Bash: Add completion for git-spindle

#!/bin/bash

# Set this to yes in your environment to enable completions that require API
# calls and will be slower.
GIT_SPINDLE_COMPLETE_REMOTE=${GIT_SPINDLE_COMPLETE_REMOTE-no}

_git_hub() {
    local subcommands="
        add-account
        add-collaborator
        add-deploy-key
        add-hook
        add-public-keys
        add-remote
        apply-pr
        browse
        calendar
        cat
        check-pages
        clone
        collaborators
        config
        create
        create-token
        deploy-keys
        edit-hook
        fetch
        fork
        gist
        gists
        hooks
        ignore
        ip-addresses
        issue
        issues
        log
        ls
        mirror
        network
        public-keys
        pull-request
        remove-collaborator
        remove-deploy-key
        remove-hook
        render
        repos
        say
        set-origin
        status
        whoami
        whois
"

    local subcommand="$(__git_find_on_cmdline "$subcommands")"
    if [ -z "$subcommand" ]; then
        case "${cur}" in
            --account=*)
                __gitcomp "$(sed -ne 's/\[github "\(.*\)"]/\1/p' ~/.gitspindle)" "" "${cur##--account=}"
                ;;
            --*)
                __gitcomp "--account="
                ;;
            *)
                __gitcomp "$subcommands"
                ;;
        esac
        return
    fi

    local completion_func="_git_spindle_${subcommand//-/_}"
    declare -f $completion_func >/dev/null && $completion_func hub
    # Default to no completion, subcommands that expect filenames call _filedir
    # explicitely.
    compopt +o default
}

_git_lab() {
    local subcommands="
        add-account
        add-public_keys
        add-member
        add-remote
        apply-merge
        browse
        calendar
        config
        cat
        clone
        create
        fetch
        fork
        issue
        issues
        log
        ls
        members
        merge-request
        mirror
        protect
        protected
        public-keys
        remove-member
        repos
        set-origin
        unprotect
        whoami
        whois
"

    local subcommand="$(__git_find_on_cmdline "$subcommands")"
    if [ -z "$subcommand" ]; then
        case "${cur}" in
            --account=*)
                __gitcomp "$(sed -ne 's/\[gitlab "\(.*\)"]/\1/p' ~/.gitspindle)" "" "${cur##--account=}"
                ;;
            --*)
                __gitcomp "--account="
                ;;
            *)
                __gitcomp "$subcommands"
                ;;
        esac
        return
    fi

    local completion_func="_git_spindle_${subcommand//-/_}"
    declare -f $completion_func >/dev/null && $completion_func lab
    # Default to no completion, subcommands that expect filenames call _filedir
    # explicitely.
    compopt +o default
}

_git_bb() {
    local subcommands="
        add-account
        add-deploy_key
        add-privilege
        add-public_keys
        add-remote
        browse
        cat
        clone
        config
        create
        deploy-keys
        fetch
        fork
        invite
        issue
        issues
        ls
        mirror
        privileges
        public-keys
        pull-request
        remove-deploy-key
        remove-privilege
        repos
        set-origin
        snippet
        snippets
        whoami
        whois
"

    local subcommand="$(__git_find_on_cmdline "$subcommands")"
    if [ -z "$subcommand" ]; then
        case "${cur}" in
            --account=*)
                __gitcomp "$(sed -ne 's/\[bitbucket "\(.*\)"]/\1/p' ~/.gitspindle)" "" "${cur##--account=}"
                ;;
            --*)
                __gitcomp "--account="
                ;;
            *)
                __gitcomp "$subcommands"
                ;;
        esac
        return
    fi

    local completion_func="_git_spindle_${subcommand//-/_}"
    declare -f $completion_func >/dev/null && $completion_func bb
    # Default to no completion, subcommands that expect filenames call _filedir
    # explicitely.
    compopt +o default
}

_git_bucket() {
    _git_bb "$@"
}

##########################################################################

_git_spindle_add_account() {
    case "$1,${cur}" in
        hub,--*|lab,--*)
            __gitcomp "--host="
            ;;
    esac
}

_git_spindle_add_deploy_key() {
    case "$1,${cur}" in
        hub,--*)
            __gitcomp "--read-only"
            return
            ;;
    esac
    _filedir "@(pub)"
}

_git_spindle_add_member() {
    case "$cur" in
        --access-level=*)
            __gitcomp "guest reporter developer master owner" "" "${cur##--access-level=}"
            ;;
        --*)
            __gitcomp "--access-level="
            ;;
    esac
}

_git_spindle_add_privilege() {
    __git_spindle_options "--admin --read --write"
}

_git_spindle_add_public_keys() {
    _filedir "@(pub)"
}

_git_spindle_add_remote() {
    __git_spindle_protocols $1
    __git_spindle_forks $1
}

declare -A __git_spindle_browse_sections
__git_spindle_browse_sections[hub]="
    issues
    pulls
    wiki
    branches
    releases
    contributors
    graphs
    settings
"
__git_spindle_browse_sections[lab]="
    issues
    merge_requests
    wiki
    files
    commits
    branches
    graphs
    settings
"
__git_spindle_browse_sections[bb]="
    src
    commits
    branches
    pull-requests
    downloads
    admin
    issues
    wiki
"
_git_spindle_browse() {
    __git_spindle_options "--parent" && return
    __gitcomp "${__git_spindle_browse_sections[$1]}"
    __git_spindle_repos $1
}

_git_spindle_cat() {
    _filedir
}

_git_spindle_clone() {
    __git_spindle_protocols $1
    case "$cur" in
        --*)
            __gitcompappend "
                --parent
                --local
                --no-hardlinks
                --shared
                --reference
                --quiet
                --no-checkout
                --bare
                --mirror
                --origin
                --upload-pack
                --template=
                --depth
                --single-branch
                --branch
            " "" "$cur" " "
            ;;
    esac
}

_git_spindle_config() {
    __git_spindle_options "--unset" && return
    case $1 in
        bb)
            __gitcomp "user password"
            ;;
        hub)
            __gitcomp "user token auth-id host"
            ;;
        lab)
            __gitcomp "user token host"
            ;;
    esac
}

_git_spindle_create() {
    if [ $1 = lab ]; then
        __git_spindle_options "--private --internal --description="
    else
        __git_spindle_options "--private --description="
    fi
}

_git_spindle_create_token() {
    __git_spindle_options "--store"
}

_git_spindle_fetch() {
    __git_spindle_protocols $1
    __git_spindle_forks $1
}

_git_spindle_gist() {
    __git_spindle_options "--description=" && return
    _filedir
}

_git_spindle_ignore() {
    test "$GIT_SPINDLE_COMPLETE_REMOTE" = no && return
    __gitcomp_nl "$(git hub ignore | sed -ne 's/^ *\* *//p')"
}

_git_spindle_invite() {
    __git_spindle_options "--admin --read --write"
}

_git_spindle_ip_addresses() {
    __git_spindle_options "--git --hooks --importer --pages"
}

_git_spindle_issue() {
    __git_spindle_options "--parent"
}

_git_spindle_issues() {
    __git_spindle_options "--parent"
}

_git_spindle_log() {
    __git_spindle_options "--type= --count= --verbose"
    # TODO actually complete the types
}

_git_spindle_ls() {
    _filedir
}

_git_spindle_mirror() {
    __git_spindle_protocols $1
    case "$cur" in
        --*)
            __gitcompappend "--goblet" "" "$cur" " "
            ;;
    esac
}

_git_spindle_protect() {
    __gitcomp_nl "$(__git_heads)"
}

_git_spindle_pull_request() {
    if [ $1 = hub ]; then
        __git_spindle_options "--issue="
    fi
}

_git_spindle_remove_collaborator() {
    test "$GIT_SPINDLE_COMPLETE_REMOTE" = no && return
    __gitcomp "$(git hub collaborators)"
}

_git_spindle_remove_member() {
    test "$GIT_SPINDLE_COMPLETE_REMOTE" = no && return
    __gitcomp "$(git lab members | awk '{print $2}')"
}

_git_spindle_remove_privilege() {
    test "$GIT_SPINDLE_COMPLETE_REMOTE" = no && return
    __gitcomp "$(git bb privileges | awk '{print $2}')"
}

_git_spindle_render() {
    _filedir '@(md|rst)'
}

_git_spindle_repos() {
    __git_spindle_options "--no-forks"
}

_git_spindle_snippet() {
    __git_spindle_options "--description=" && return
    _filedir
}

_git_spindle_set_origin() {
    __git_spindle_protocols
}

_git_spindle_unprotect() {
    __gitcomp_nl "$(__git_heads)"
}

##########################################################################

__git_spindle_protocols() {
    case $1,$cur in
        hub,--*)
            __gitcomp "--http --ssh --git"
            ;;
        *,--*)
            __gitcomp "--http --ssh"
            ;;
    esac
}
__git_spindle_forks() {
    case "$1,$GIT_SPINDLE_COMPLETE_REMOTE,$cur" in
        *,no,*|lab,*|*,--*)
            ;;
        *)
            __gitcomp_nl_append "$(git $1 forks 2>/dev/null | sed -e 's/\[\(.*\)\].*/\1/')"
            ;;
    esac
}

__git_spindle_repos() {
    case "$GIT_SPINDLE_COMPLETE_REMOTE,$cur" in
        no,*|*,--*)
            ;;
        *)
            __gitcomp_nl_append "$(git $1 repos | sed -e 's/ .*//')"
            ;;
    esac
}

__git_spindle_options() {
    case "$cur" in
        --*)
            __gitcomp "$1"
            return
            ;;
    esac
    return 1
}

error: pathspec 'bash_completion.d/git-spindle.completion.bash' did not match any file(s) known to git


Add pypy installation script for docker

Add pypy installation script for docker

#!/bin/bash
# Copyright (c) 2015 The Pycroft Authors. See the AUTHORS file.
# This file is part of the Pycroft project and licensed under the terms of
# the Apache License, Version 2.0. See the LICENSE file for details.
set -e

if [[ $EUID -ne 0 ]]; then
    echo "must be run as root"
    exit 1
fi

apt-get install pypy

curl -O https://bootstrap.pypa.io/get-pip.py
pypy get-pip.py

pypy -m pip install cffi psycopg2cffi
sed '/psycopg2/d;/MySQL/d;/pysqlite/d' /pycroft/requirements.txt | xargs -a - -n 1 pypy -m pip install
echo -e "from psycopg2cffi import compat\ncompat.register()" > /usr/local/lib/pypy2.7/dist-packages/psycopg2.py

chmod 777 -R /usr/local/lib/pypy2.7/dist-packages/psycopg2cffi # for some reason it needs write access

error: pathspec 'legacy/install_pypy.sh' did not match any file(s) known to git


add rbenv executive path to path variable fix a bug in standard path

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mspl13/dotfiles.git/'


Run docker-bench-test image on the docker host

#!/bin/bash
###
### run-docker-bench-test.sh -- Run security evaluation on docker installation
###
### Note, default volume mappings presume Linux with systemd
###
### From https://github.com/gaia-adm/docker-bench-test.git
### Based on CIS Docker Benchmark (cisecurity.org) and Docker's docker-bench
###
### Supported environmental variables:
###     DOCKER to point to the docker binary
###     DOCKER_BENCH_TEST_IMAGE to the proper image (e.g., gaiaadm/docker-bench-test:latest)
###     DOCKER_BENCH_TEST_WORKDIR to the test result output directory
###     DOCKER_BENCH_TEST_LABEL to the desired container label
###     DOCKER_BENCH_TEST_NOAUTORM to retain the container (if unset, uses docker --rm)
###     DOCKER_BENCH_TEST_NOAUTOUPDATE to skip automatic docker pull
###

# Bash configuration
# Stop on errors, safe handling, extend globbing
set -e
set -u
set -o pipefail
shopt -s extglob

# Defaults configuration
DOCKER="${DOCKER:-/usr/bin/docker}"
DOCKER_BENCH_TEST_IMAGE="${DOCKER_BENCH_TEST_IMAGE:-gaiaadm/docker-bench-test}"
DOCKER_BENCH_TEST_WORKDIR="${DOCKER_BENCH_TEST_WORKDIR:-/var/docker-bench-test}"
DOCKER_BENCH_TEST_LABEL="${DOCKER_BENCH_TEST_LABEL:-docker_bench_test}"
if [ -z "${DOCKER_BENCH_TEST_NOAUTORM+x}" ]; then
    _autorm="--rm"
else
    _autorm=""
fi
LATEST_TEST="results/tests_latest.tap"

# Update the container to the latest by default
if [ -z "${DOCKER_BENCH_TEST_NOAUTOUPDATE+x}" ]; then
    echo "==> Pulling latest version of: ${DOCKER_BENCH_TEST_IMAGE}"
    ${DOCKER} pull "${DOCKER_BENCH_TEST_IMAGE}"
else
    echo "==> Skipping image update of: ${DOCKER_BENCH_TEST_IMAGE}"
fi
${DOCKER} images --digests "${DOCKER_BENCH_TEST_IMAGE}"

echo "==> Commencing test runs..."
${DOCKER} run -it "${_autorm}" \
    --net host \
    --pid host \
    --cap-add audit_control \
    -v /var/lib:/var/lib \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v /usr/lib/systemd:/usr/lib/systemd \
    -v "${DOCKER_BENCH_TEST_WORKDIR}:/var/docker-bench-test" \
    -v /etc:/host/etc \
    --label "${DOCKER_BENCH_TEST_LABEL}" \
    "${DOCKER_BENCH_TEST_IMAGE}"

echo "==> Testing complete, results directory: ${DOCKER_BENCH_TEST_WORKDIR}"
ls -lh "${DOCKER_BENCH_TEST_WORKDIR}/${LATEST_TEST}"

error: pathspec 'run-docker-bench-test.sh' did not match any file(s) known to git


Added jmeter_test scripts with grafana

Added jmeter_test scripts with grafana

#!/bin/bash
echo "### Running JMeter performance test ###"

# Clear out old results
rm $WORKSPACE/jmeter.jtl

# Run the tests
echo "## Running the tests"
cd "$WORKSPACE/jmeter"

START=`date +%s`
jmeter -n -t jmeter_formdevops3.jmx -l $WORKSPACE/jmeter.jtl
END=`date +%s`
curl -o grafana.png 'http://formdevops1.upcnet.es:8022/graphite/render?target=stats.gauges.biz.calavera.brazos.cpu.*&from='"$START"'&until='"$END"'&format=png&maxDataPoints=1636&width=1588&height=121&bgcolor=1f1f1f&fgcolor=BBBFC2&lineWidth=1&hideLegend=false&yUnitSystem=si&lineMode=connected'

error: pathspec 'calavera_scripts/jmeter_test_2.sh' did not match any file(s) known to git


nagios script to update resource state

nagios script to update resource state

From https://irods.org/2016/09/monitoring-irods-resources-with-nagios/

#/bin/bash

LOGFILE=/tmp/update_resc.log

echo update_irods_resc_state.sh "$@" >> $LOGFILE

HOST=$1
SERVICE_STATE=$2
SERVICE_STATE_TYPE=$3
SERVICE_ATTEMPT=$4

RESOURCES=$(iquest "%s" "select RESC_NAME where RESC_LOC = '$HOST'")

echo RESOURCES = $RESOURCES >> $LOGFILE
echo SERVICES_STATE = $SERVICE_STATE >> $LOGFILE

case "$SERVICE_STATE" in
OK)
    for RESOURCE in $RESOURCES; do
        iadmin modresc $RESOURCE status up
    done
    ;;
WARNING)
    ;;
UNKNOWN)
    ;;
CRITICAL)
    for RESOURCE in $RESOURCES; do
        iadmin modresc $RESOURCE status down
    done
    ;;

esac
exit 0

error: pathspec 'roles/irods-nagios/files/nagios-update_irods_resc_state.sh' did not match any file(s) known to git


Redhat installer for sbt

Redhat installer for sbt

#!/bin/bash

# http://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html

if which sbt > /dev/null; then
    echo "Found sbt installation"
else
    echo "sbt installation"
    if [ ! -f /etc/yum.repos.d/bintray-sbt-rpm.repo ]; then
        curl https://bintray.com/sbt/rpm/rpm | sudo tee /etc/yum.repos.d/bintray-sbt-rpm.repo
    fi
    sudo yum install sbt
fi

error: pathspec 'lib/bash/redhat/sbt.sh' did not match any file(s) known to git


adding build script

adding build script

#!/bin/bash
CGO_ENABLED=0 godep go build -a -ldflags "-s" -installsuffix cgo -o bin/app src/main/*.go

error: pathspec 'build/build.sh' did not match any file(s) known to git


Fix pycalendar for GEO property parsing.

git-svn-id: 0c33e958600270102f91bf5868e396345dde476c@9359 e27351fd-9f3e-4f54-a53b-843176b1656c

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/red-hood/calendarserver.git/'


Create init.sh

Create init.sh

#!/bin/bash

# Install Arc Theme

# Install Numix Icons

# Install Sublime Text

# Install Atom

# Install Docker

# Install VirtualBox

# Install Vagrant

# Install VisualStudio Code

# Install Google Chrome

# Install Firefox

# Install FileZilla

# Install MySQL Workbench

# Install Minetest

# Install Google Music Manager

# Install Skype

# Install TeamViewer

# Install BleachBit

# Install WireShark

# Install VLC

error: pathspec 'init.sh' did not match any file(s) known to git


Run commands

Run commands

#!/bin/bash

# Example: ./run-command.sh 'docker rm -f btsync-data'

ansible all --verbose --inventory-file=hosts --module-name=command --args="$*"

error: pathspec 'run-command.sh' did not match any file(s) known to git


Use ylan as the tmux session name, so it provides some meaning to others

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ylansegal/dotfiles.git/'


add vmware-reinstall.sh

add vmware-reinstall.sh

#!/bin/bash

# reinstall vmware workstation

set -xe
cd $(dirname $0)

antsable=".."
playbooks="../playbooks"

# Put running playbooks here
/bin/bash $antsable/ansible.sh $playbooks/vmware-uninstall.yaml -c local -l localhost $@
/bin/bash $antsable/ansible.sh $playbooks/vmware-workstation.yaml -c local -l localhost $@

error: pathspec 'shells/vmware-reinstall.sh' did not match any file(s) known to git


Fixed the static analyzer to check exit code instead of stdout results. Less strict on warnings because html_dartium.dart has a bunch of deprecated methods that we don't have the ability to ignore.

#!/bin/bash

set -e

#####
# Unit Tests

# Disabled unit tests for now just doing type analysis
#echo "DumpRenderTree test/test_runner_headless.html"
#results=`DumpRenderTree test/test_runner_headless.html 2>&1`

#echo "$results" | grep CONSOLE

#echo $results | grep 'unittest-suite-success' >/dev/null

#echo $results | grep -v 'Exception: Some tests failed.' >/dev/null

#####
# Type Analysis

echo
echo "dart_analyzer lib/*.dart"

results=`dart_analyzer lib/*.dart 2>&1`
analyzer_exitcode=$?
echo "$results"
echo "analyzer exitcode $analyzer_exitcode"
if [ $analyzer_exitcode -ne 0 ]; then
    exit 1
else
    echo "Passed analysis."
fi

#!/bin/bash

set -e

#####
# Unit Tests

# Disabled unit tests for now just doing type analysis
#echo "DumpRenderTree test/test_runner_headless.html"
#results=`DumpRenderTree test/test_runner_headless.html 2>&1`

#echo "$results" | grep CONSOLE

#echo $results | grep 'unittest-suite-success' >/dev/null

#echo $results | grep -v 'Exception: Some tests failed.' >/dev/null

#####
# Type Analysis

echo
echo "dart_analyzer lib/*.dart"

results=`dart_analyzer lib/*.dart 2>&1`

echo "$results"

if [ -n "$results" ]; then
    exit 1
else
    echo "Passed analysis."
fi


Added files via upload

Added files via upload

curl -X GET "http://58.215.141.103:9002/oneStep/69349097?limit=100&picNum=3&rule=****1*&showEmpty=true&all=true&devId=665DAD8C9F884773A1CD7F2AACBA7636" > ios7.txt
curl -X GET "http://58.215.141.103:9002/oneStep/69349097?limit=100&picNum=3&rule=****1*&showEmpty=true&all=true" > null.txt
curl -o /dev/null -s -w '%{time_connect}:%{time_starttransfer}:%{time_total}\n' 'http://58.215.141.103:9002/oneStep/69349097?limit=100&picNum=3&rule=1*****&showEmpty=true&all=true&devId= 665DAD8C9F884773A1CD7F2AACBA7636'
curl -X GET 'http://58.215.141.103:9002/fr2/12367006?comboId=&limit=5&in=1&phone=2&weibo=1&weixin=2&picNum=0&onestep=&a1=1.5&a2=0.2&a3=0.02&a4=0.5&a5=0.5&a6=0.5&a7=0&devId= 665DAD8C9F884773A1CD7F2AACBA7636'
#graphsql查询
#本地表查询，graph查询人，映射到本地服务器，返回给前段
#

error: pathspec 'a.sh' did not match any file(s) known to git


Add setup build environment script

Add setup build environment script

#!/bin/sh

sudo apt-get update
sudo apt-get install --no-install-recommends --no-install-suggests -y \
  libncurses5-dev \
  gcc \
  make \
  git \
  exuberant-ctags \
  bc \
  libssl-dev \
  build-essential \
  curl \
  sudo \
  ca-certificates \
  ruby

touch ~/.gemrc
echo "gem: --no-document" >> ~/.gemrc
sudo gem install bundler

error: pathspec 'chroot-scripts/setup-build-env.sh' did not match any file(s) known to git


Add preliminary watchdog script

Add preliminary watchdog script

#!/usr/bin/env bash

# This is meant to be executed periodically. It will check if the application is
# running. If it's not, it will start it.

# on crontab:
#    * * * * * /bin/bash -l -c '/path/to/watchdog/watchdog.sh'

app="myapp"
user="myuser"
dir="/home/$user/$app/current"
log="$dir/log/$app.log"

# test proof of life
alive="$dir/tmp/alive"
mtime=$(ls -l --time-style=+%s $alive | awk '{print $6}')
let "last = $(date +%s) - 60"
[ -f $alive ] && [ $mtime -gt $last ] && exit

erlopts="-boot $dir/boot/start -config $dir/boot/sys -env ERL_LIBS $dir/lib"
cmd="iex --erl \"$erlopts\" --name $app@localhost --detached"

echo "Running: $cmd" >> $log

$cmd 2>&1 >> $log

# To connect (interactive elixir):
#         iex --remsh "$app@localhost" --sname connector

error: pathspec 'lib/scripts/watchdog.sh' did not match any file(s) known to git


Small script to update GitHub Pages.

Small script to update GitHub Pages.

#!/bin/sh

git checkout gh-pages
git checkout master index.html languages.css languages.min.css languages.png
git commit -a -m 'Pages built.'
git push
git checkout master

error: pathspec 'build-pages.sh' did not match any file(s) known to git


Update git-hubflow.plugin.zsh

Update git-hubflow.plugin.zsh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/takady/oh-my-zsh.git/'


Fix path

Fix path

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/rwood-moz/automation.git/'


ADD: Alpha version of linux/mac easy-build script

#! /bin/bash

compiler=""
version=""

function build()
{
	if ["$compiler" = "g"]; then ./premake --dotnet mono2 --target gnu; fi
	if ["$compiler" = "m"]; then ./premake --dotnet mono2 --target monodev; fi
	if ["$compiler" = "s"]; then ./premake --target sharpdev; fi
	if ["$compiler" = "C"]; then ./premake --target cl-gcc; fi

	if ["$compiler" = "c"]; then
		if ["$version" = "o"]; then ./premake --target cb-gcc; fi
		if ["$version" = "g"]; then ./premake --target cb-gcc; fi
	fi

	if ["$compiler" = "v"]; then
		case "$version" in
		"1")
			./premake --target vs6
		;;
		"2")
			./premake --target vs2002
		;;
		"3")
			./premake --target vs2003
		;;
		"4")
			./premake --target vs2005
		;;
		"5")
			./premake --target vs2008
		;;
		esac
	fi
}

function visualstudio()
{
	#clear
	echo
	echo "Choose VisualStudio version:"
	echo "0: Go Back               2: Visual Studio 2002**        4: Visual Studio 2005"
	echo "1: Visual Studio 6*      3: Visual Studio 2003          5: Visual Studio 2008"
	echo
	echo "  *(don't support managed code)     **(don't support .Net 2.0)"
	echo
	echo "   Enter a number:"

	read version
	echo $version

	if [ $version -eq 0 ]; then return 1; fi
	if [ $version -ge 1] && [$version -le 5 ]; then build; return $?; fi

	return 1
}

function codeblocks()
{
	#clear
	echo
	echo "Choose the Code::Blocks compiler:"
	echo " 0: Go Back           2: Open Watcom*"
	echo " 1: GCC (MinGW)"
	echo
	echo "  *(Not Supported yet)"
	echo
	echo "   Enter a number:"

	read version

	if [ $version -eq 0 ]; then return 1; fi
	if [ $version -ge 1 && $version -le 2 ]; then build; return $?; fi

	return 1
}

function menu()
{
	#clear
	echo
	echo
	echo
	echo "                            MusiC"
	echo
	echo
	echo
	echo " Choose one of the alternatives(NOTE they are case sensitive):"
	echo
	echo "v: Visual Studio         g: GNU Makefile       C: CodeLite"
	echo "c: Code::Blocks          m: Monodevelop        s: Sharpdevelop"
	echo
	echo "x: Exit"
	echo
	echo " Enter a letter:"

	read compiler

	if [ "$compiler" = "v" ]; then visualstudio; return $?; fi
	if [ "$compiler" = "c" ]; then codeblocks; return $?; fi
	if [ "$compiler" = "g" ]; then build; exit $?; fi
	if [ "$compiler" = "m" ]; then build; exit $?; fi
	if [ "$compiler" = "s" ]; then build; exit $?; fi
	if [ "$compiler" = "C" ]; then build; exit $?; fi
	if [ "$compiler" = "x" ]; then return 0; fi

	return 1;
}

function start()
{
	menu
	if [ "$?" != "0" ]; then menu; fi
}

start


added script to setup the submodules

added script to setup the submodules

#!/bin/bash
# Copyright 2013 by Weisi Dai <multiple1902@gmail.com>
# Released under MIT License
#

rm vendors -rfv
mkdir vendors
cd vendors

grep 'url = ' ../.gitmodules | while read x; do
    REPO=$(echo $x | cut -d '=' -f 2)
    git clone $REPO &
done

error: pathspec 'submodules.sh' did not match any file(s) known to git


Scripts: Tidy up

Scripts: Tidy up

#!/bin/bash
echo 'Formatting rust...'
(cd core/ && cargo fmt -- --write-mode=overwrite);

error: pathspec 'scripts/fmt.sh' did not match any file(s) known to git


Codify Git and GitHub

Codify Git and GitHub

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/JuanitoFatas/bin.git/'


add a script for initializing git aliases.

#!/bin/bash

git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.hist 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global alias.type 'cat-file -t'
git config --global alias.dump 'cat-file -p'
git config --global alias.d 'diff -M -C --patience -U8'
git config --global alias.ds 'diff -M -C --patience -U8 --staged'

git config --list

error: pathspec 'setup-git-alias.sh' did not match any file(s) known to git


Added test_coverage.sh.

Added test_coverage.sh.

#! /usr/bin/env sh

./run_tests.sh --cov=storage --cov-report html $@

error: pathspec 'test_coverage.sh' did not match any file(s) known to git


Added tests for all servers

Added tests for all servers

#! /usr/bin/env bats
#
# Acceptance test script for srv010
admin_user=bert

@test "EPEL repository should be available" {
  [ -n "$(yum -C repolist | grep 'epel')" ]
}

@test "Bash-completion should have been installed" {
  # This file should exist if bash-completion was installed
  [ -f /etc/profile.d/bash_completion.sh ]
}

@test "bind-utils should have been installed" {
  # Ask version of dig, this should execute with exit status 0
  dig -v
}

@test "Git should have been installed" {
  git --version
}

@test "Nano should have been installed" {
  nano --version
}

@test "Tree should have been installed" {
  tree --version
}

@test "Vim-enhanced should have been installed" {
  vim --version
}

@test "Wget should have been installed" {
  wget --version
}

@test "Admin user ${admin_user} should exist" {
  # The user should exist
  getent passwd ${admin_user}
  # and should be member of the `wheel` group
  [ -n "$(groups ${admin_user} | grep wheel)" ]
}

@test "Custom /etc/motd should have been installed" {
  [ -f /etc/motd ]
  [ -n "$(grep enp0s3 /etc/motd)" ]
}

error: pathspec 'test/common.bats' did not match any file(s) known to git


the db script

the db script

#!/bin/bash
bundle exec rake db:drop && bundle exec rake db:migrate && bundle exec rake db:seed

error: pathspec 'db.sh' did not match any file(s) known to git


missed in a previous commit

missed in a previous commit

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/cdsi/elrond.git/'


fetch script

fetch script

#!/usr/bin/env bash
git submodule update --recursive

error: pathspec 'fetch.sh' did not match any file(s) known to git


removed set -x

removed set -x

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/stangenberg/docker-baseimage.git/'


Fixed jacorb name server ip grep

Fixed jacorb name server ip grep

#!/bin/sh

set -e

export HOST_IP=$(grep "${HOSTNAME}" /etc/hosts | head -n 1 | awk '{print $1}')
[ -z "$JACORB_NAME_SERVER_IP" ] && export JACORB_NAME_SERVER_IP=$(grep 'jacorb-name-server' /etc/hosts | head -n 1 | awk '{print $1}')
[ -z "$JACORB_NAME_SERVER_URL" ] && export JACORB_NAME_SERVER_URL="corbaloc::${JACORB_NAME_SERVER_IP}:${JACORB_NAME_SERVER_ENV_NAME_SERVER_PORT}/StandardNS/NameServer-POA/_root"
[ -z "$NARAYANA_OPTS" ] && export NARAYANA_OPTS=""

echo "Starting Narayana Transaction Service container on ${HOST_IP}:${NARAYANA_PORT}"
echo "NARAYANA_OPTS=$NARAYANA_OPTS"
echo "JACORB_NAME_SERVER_URL=$JACORB_NAME_SERVER_URL"

for i in /opt/jboss/lib/*.jar
do
    export EXT_CLASSPATH="$EXT_CLASSPATH:$i"
done

exec "$@"

#!/bin/sh

set -e

export HOST_IP=$(grep "${HOSTNAME}" /etc/hosts | awk '{print $1}')
[ -z "$JACORB_NAME_SERVER_IP" ] && export JACORB_NAME_SERVER_IP=$(grep 'name-server' /etc/hosts | awk '{print $1}')
[ -z "$JACORB_NAME_SERVER_URL" ] && export JACORB_NAME_SERVER_URL="corbaloc::${JACORB_NAME_SERVER_IP}:${JACORB_NAME_SERVER_ENV_NAME_SERVER_PORT}/StandardNS/NameServer-POA/_root"
[ -z "$NARAYANA_OPTS" ] && export NARAYANA_OPTS=""

echo "Starting Narayana Transaction Service container on ${HOST_IP}:${NARAYANA_PORT}"
echo "NARAYANA_OPTS=$NARAYANA_OPTS"
echo "JACORB_NAME_SERVER_URL=$JACORB_NAME_SERVER_URL"

for i in /opt/jboss/lib/*.jar
do
    export EXT_CLASSPATH="$EXT_CLASSPATH:$i"
done

exec "$@"


Create mysql-backup.sh

Create mysql-backup.sh

#!/bin/bash
### MySQL Server Login Info ###
MUSER="root"
MPASS="root_password"
MHOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
BAK="/path/to/export"

# USE THIS CODE TO BACKUP ONLY ONE SPECIFIC DB
DB="my_database"
FILE=$BAK/$db_back.sql
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $DB > $FILE

# USE BELOW CODE TO BACKUP ALL DBS And GZIP them
# GZIP="$(which gzip)"

### FTP SERVER Login info ###
# FTPU="FTP-SERVER-USER-NAME"
# FTPP="FTP-SERVER-PASSWORD"
# FTPS="FTP-SERVER-IP-ADDRESS"
# NOW=$(date +"%d-%m-%Y")

### See comments below ###
### [ ! -d $BAK ] && mkdir -p $BAK || /bin/rm -f $BAK/* ###
# [ ! -d "$BAK" ] && mkdir -p "$BAK"
# DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
# for db in $DBS
# do
#  FILE=$BAK/$db.$NOW-$(date +"%T").gz
#  $MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
# done
#
# lftp -u $FTPU,$FTPP -e "mkdir /mysql/$NOW;cd /mysql/$NOW; mput /backup/mysql/*; quit" $FTPS

- https://gist.github.com/daspecster/9ed8f235186c731bcc2f

error: pathspec 'k2/application-dev/DB/backup/mysql-backup.sh' did not match any file(s) known to git


Remove nonexistent $ANDROID_QTOOLS from $PATH.

Bug: 15983070
Change-Id: Id3807a6dabd616ae06aafc2b894c1858e4400e26

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/xorware/android_build.git/'


am c3aeddd3: Merge "Fix mma/mmma by making gettop canonicalize TOP when set"

* commit 'c3aeddd331a62ebe7a4d6d6e5892cbe35222d6e7':
  Fix mma/mmma by making gettop canonicalize TOP when set


xbps-src: more shell quoting fixes to binpkg deps code.

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/Bubble-be/void-packages.git/'


add docker

add docker

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/hachihub/ubuntu-init.git/'


Added some handy shell functions to connect to virtual routers

#!/bin/sh

vr_mgmt_ip() {
	VROUTER=$1
	VR_ADDRESS=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' $VROUTER)
	echo $VR_ADDRESS
}

vrssh() {
	VROUTER=$1
	USER=$2
	VR_ADDRESS=$(vr_mgmt_ip $VROUTER)

	if [ -z "$USER" ] ; then
		ssh $VR_ADDRESS -l vrnetlab
	else
		ssh $VR_ADDRESS -l $USER
	fi
}

vrcons() {
	VROUTER=$1
	telnet $(vr_mgmt_ip $VROUTER) 5000
}

error: pathspec 'vrnetlab.sh' did not match any file(s) known to git


Added script to upload to db.

Added script to upload to db.

#!/bin/sh

psql -c "TRUNCATE TABLE nodes,ways,ways_refs,multipols,multipols_refs" osmwalk-prepare jethro
echo Copying nodes...
COMMAND="COPY nodes (id,lat,lon,height,objtype,inside,intunnel,onbridge,loc) FROM STDIN;"
./todb n |  psql -c "$COMMAND" osmwalk-prepare jethro

echo Copying ways...
COMMAND="COPY ways (id,area,barrier,type,bridge,tunnel,wayidx) FROM STDIN;"
./todb w | psql -c "$COMMAND" osmwalk-prepare jethro

echo Copying way refs...
COMMAND="COPY ways_refs (id,ref,ord) FROM STDIN;"
./todb v | psql -c "$COMMAND" osmwalk-prepare jethro

echo Copying multipolygons...
COMMAND="COPY multipols (id,objtype) FROM STDIN;"
./todb m | psql -c "$COMMAND" osmwalk-prepare jethro

echo Copying multipolygon references...
COMMAND="COPY multipols_refs (id,ref,role) FROM STDIN;"
./todb l | psql -c "$COMMAND" osmwalk-prepare jethro

error: pathspec 'compiled/todb.sh' did not match any file(s) known to git


enabled scripted setting of testing envrionment variables

#!/bin/bash

## private ip address
ip_addr=$(
python - <<EOF
import socket
print socket.gethostbyname(socket.gethostname())
EOF
)

## set up with port to attach remote debugger
ip_addr+=":5678"

## path to creds file which is a text file with entries like
## 1 <aws key> <aws secret> us_west_oregon
creds_file=$(
python - <<EOF
import os
path_to_creds = os.path.split(os.path.abspath('testenv.sh'))[0] + '/creds'
print path_to_creds
EOF
)

if [ $1 = '-h' ] || [ $1 = '--help' ]
 then
     echo "
     ************************************************************************************
     usage:  source testenv.sh [option]

     The options below let you determine which environment variables to
     set for testing the agent.  Note that to set DCM_AGENT_STORAGE_CREDS
     properly you must have your credentials in a file called creds in the
     same directory as this file. <whereeveryoursourceis>/es-ex-pyagent/tests/<here>
     Don't worry, there is a 'creds' entry in the .gitignore.  But please double check
     for yourself.

     Here are the possible options:
     -h/--help    show this help menu
     -a/--all     set DCM_AGENT_STORAGE_CREDS, PYDEVD_CONTACT, and SYSTEM_CHANGING_TEST
     -dp          set DCM_AGENT_STORAGE_CREDS, PYDEVD_CONTACT,
     -ds          set DCM_AGENT_STORAGE_CREDS, SYSTEM_CHANGING_TEST
     -ps          set PYDEVD_CONTACT, SYSTEM_CHANGING_TEST
     -dcm         set only DCM_AGENT_STORAGE_CREDS
     -pydev       set only PYDEVD_CONTACT
     -sct         set only SYSTEM_CHANGING_TEST
     ************************************************************************************"

elif [ $1 = '-a' ] || [ $1 = '--all' ]
 then
     export DCM_AGENT_STORAGE_CREDS=$creds_file
     export PYDEVD_CONTACT=$ip_addr
     export SYSTEM_CHANGING_TEST=1

elif [ $1 = '-dp' ]
 then
     export DCM_AGENT_STORAGE_CREDS=$creds_file
     export PYDEVD_CONTACT=$ip_addr
     unset SYSTEM_CHANGING_TEST

elif [ $1 = '-ds' ]
 then
     export DCM_AGENT_STORAGE_CREDS=$creds_file
     export SYSTEM_CHANGING_TEST=1
     unset PYDEVD_CONTACT

elif [ $1 = '-ps' ]
 then
     export PYDEVD_CONTACT=$ip_addr
     export SYSTEM_CHANGING_TEST=1
     unset DCM_AGENT_STORAGE_CREDS

elif [ $1 = '-dcm' ]
 then
     export DCM_AGENT_STORAGE_CREDS=$creds_file
     unset PYDEVD_CONTACT
     unset SYSTEM_CHANGING_TEST

elif [ $1 = '-pydev' ]
 then
     export PYDEVD_CONTACT=$ip_addr
     unset DCM_AGENT_STORAGE_CREDS
     unset SYSTEM_CHANGING_TEST

elif [ $1 = '-sct' ]
 then
     export SYSTEM_CHANGING_TEST=1
     unset DCM_AGENT_STORAGE_CREDS
     unset PYDEVD_CONTACT

else
 echo "
 *******************************************************************
 Unrecognized or absent argument please do: source testenv.sh --help
 *******************************************************************"

fi

error: pathspec 'tests/testenv.sh' did not match any file(s) known to git


Create monitoring_cli.sh

Create monitoring_cli.sh

error: pathspec 'linux/monitoring_cli.sh' did not match any file(s) known to git


add run.sh

add run.sh

bundle exec thin start -R config.ru -p 8888 -t 6000

error: pathspec 'RUN.sh' did not match any file(s) known to git


update memory forensics tool: volatility

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/mhtsai1010/ubuntu-dotfiles.git/'


initial commit

initial commit

#!/bin/sh
# Usage: ./sustc-cas-login.sh [username] [password]

URL=`curl --head baidu.com 2> /dev/null | grep "Location: http://enet.10000.gd.cn" | sed 's/Location: //'`
if echo $URL | grep -q "http"
then
DATE=`date "+%Y-%m-%d %H:%M:%S"`
URL=`echo "$URL" | sed 's/\r$//g'`
echo "[$DATE] Logging..."
FORM=`curl -L "${URL}" 2> /dev/null`
ACTION=`echo "$FORM" | grep "<form " | sed 's/.*action="\(.*\)" .*/\1/'`
LT=`echo "$FORM" | grep '<input type="hidden" name="lt" ' | sed 's/.*value="\(.*\)" .*/\1/'`
EXEC=`echo "$FORM" | grep '<input type="hidden" name="execution" ' | sed 's/.*value="\(.*\)" .*/\1/'`
DATA="username=$1&password=$2&lt=$LT&execution=$EXEC&_eventId=submit&submit=LOGIN"
RESULT=`curl -L --data "$DATA" "http://weblogin.sustc.edu.cn$ACTION" 2> /dev/null`
if echo $RESULT | grep -q "<h2>success"
then
echo "Success"
else
echo "Failed"
fi
fi
exit 0

error: pathspec 'sustc-cas-login.sh' did not match any file(s) known to git


bat.sh

bat.sh

charge=$(</sys/class/power_supply/battery/charge_now)
capacity=$(</sys/class/power_supply/battery/capacity)
case $1 in
	"status")
		[[ $charge -gt 0 ]] && echo charging
		[[ $charge -gt 0 ]] || echo discharging
		;;
	"percent")
		echo $capacity
		;;
	*)
		res="$capacity%"
		[[ $charge -gt 0 && $capacity -ne 100 ]] && res="+$res"
		echo $res
esac

error: pathspec 'bat.sh' did not match any file(s) known to git


Make sense

Make sense

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/i-Ching/ccass.git/'


Initial commit

Initial commit

#!/bin/bash

DIR_DEPTH=`grep -o "/" <<< $(pwd) |wc -l`

goToDir() {
NEW_DIR=`pwd | grep -P -o "^\/(\S+?\/){$1}"`
cd $NEW_DIR
}

if [ $1 -ge 0 ];
 then
    if [[ $1 -lt $DIR_DEPTH  ]] && [[ $1 -ge 1  ]]
     then
        goToDir $1
     else
        echo "Value passed is too high"
    fi
elif [[ $1 -le 0 ]]
 then
    X=$(expr $DIR_DEPTH + $1)
    if [[ $X -ge 0 ]]
     then
        goToDir $X
     else
        echo "Value passed is too low"
    fi
fi

error: pathspec 'cdg.sh' did not match any file(s) known to git


backup default spacemacs config just in case

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/vali19th/linux-scripts.git/'


Add commit command

Add commit command

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/jfriesse/hsu.git/'


script to help with env variables

script to help with env variables

export PYTHONPATH=$PYTHONPATH:`pwd`/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/lib

error: pathspec 'env.sh' did not match any file(s) known to git


Add TeX Live

Add TeX Live

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/samestep/env.git/'


Initial commit

Initial commit

env.sh, shell script to --/inform/-- environments of "CBBL®" in one go.
Usage: $ sh env.sh


GPU runscript

GPU runscript

error: pathspec 'gpu.sh' did not match any file(s) known to git


fix upstart script for path changes

fix upstart script for path changes

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/ahoym/asterank.git/'


gatsby

gatsby

#!/usr/bin/env bash

npm install -g gatsby
npm install -g git-open
npm install -g grunt
npm install -g gulp
npm install -g npm-check-updates
npm install -g svgo
npm install -g trash-cli
npm install -g ungit

#!/usr/bin/env bash

npm install -g git-open
npm install -g grunt
npm install -g gulp
npm install -g npm-check-updates
npm install -g svgo
npm install -g trash-cli
npm install -g ungit


Don't exclude anything in /etc/passwd

Don't exclude anything in /etc/passwd

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/konstruktoid/ubuntu-conf.git/'


[New] `use`: set `NVM_INC` to expose the node include path

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/PeterDaveHelloKitchen/nvm.git/'


script to checkout pr branch

script to checkout pr branch

#!/bin/bash

# This script checks out a PR branch and then starts a management server with that code.
# Next, you can run Marvin to setup whatever you need to verify the PR.

# Stop executing when we encounter errors
set -e

# Check if a pull request id was specified
prId=$1
if [ -z ${prId} ]; then
  echo "No PR number specified. Quiting."
  exit 1
fi

# Go the the source
cd /data/git/${HOSTNAME}/cloudstack
git checkout master

# Get the PR
git fetch origin pull/${prId}/head:pr/${prId}
git checkout pr/${prId}

error: pathspec 'helper_scripts/cloudstack/checkout-pr.sh' did not match any file(s) known to git


[Performance] Use awk's comparison to save a pipe to grep


The original autorevision script.

The original autorevision script.

#!/bin/bash

# autorevision.sh - a shell script to get git / hg revisions etc. into binary builds.
# To use pass a path to the desired output file: some/path/to/autorevision.h.
# Note: the script will run at the root level of the repository that it is in.

# Config
TARGETFILE="${1}"

# For git repos
function gitRepo {
	cd "$(git rev-parse --show-toplevel)"

	# Is the working copy clean?
	git diff --quiet HEAD &> /dev/null
	WC_MODIFIED="${?}"

	# Enumeration of changesets
	VCS_NUM="$(git rev-list --count HEAD)"
	if [ -z "${VCS_NUM}" ]; then
		echo "warning: Counting the number of revisions may be slower due to an outdated git version less than 1.7.2.3. If something breaks, please update it."
		VCS_NUM="$(git rev-list HEAD | wc -l)"
	fi

	# The full revision hash
	VCS_FULL_HASH="$(git rev-parse HEAD)"

	# The short hash
	VCS_SHORT_HASH="$(echo ${VCS_FULL_HASH} | cut -b 1-7)"

	# Current branch
	VCS_URI=`git rev-parse --symbolic-full-name --verify $(git name-rev --name-only --no-undefined HEAD)`

	# Current tag (or uri if there is no tag)
	VCS_TAG="$(git describe --exact-match --tags 2>/dev/null)"
	if [ -z "${VCS_TAG}" ]; then
		VCS_TAG="${VCS_URI}"
	fi

	# Date of the curent commit
	VCS_DATE="$(git log -1 --pretty=format:%ci)"
}

# For hg repos
function hgRepo {
	cd "$(hg root)"

	# Is the working copy clean?
	hg sum | grep -q 'commit: (clean)'
	WC_MODIFIED="${?}"

	# Enumeration of changesets
	VCS_NUM="$(hg id -n)"

	# The full revision hash
	VCS_FULL_HASH="$(hg log -r ${VCS_NUM} -l 1 --template '{node}\n')"

	# The short hash
	VCS_SHORT_HASH="$(hg id -i)"

	# Current bookmark (bookmarks are roughly equivalent to git's branches) or branch if no bookmark
	VCS_URI="$(hg id -B | cut -d ' ' -f 1)"
	# Fall back to the branch if there are no bookmarks
	if [ -z "${VCS_URI}" ]; then
		VCS_URI="$(hg id -b)"
	fi

	# Current tag (or uri if there is no tag)
	if [ "$(hg log -r ${VCS_NUM} -l 1 --template '{latesttagdistance}\n')" = "0" ]; then
		VCS_TAG="`hg id -t | sed -e 's:qtip::' -e 's:tip::' -e 's:qbase::' -e 's:qparent::' -e "s:$(hg --color never qtop 2>/dev/null)::" | cut -d ' ' -f 1`"
	else
		VCS_TAG="${VCS_URI}"
	fi

	# Date of the curent commit
	VCS_DATE="$(hg log -r ${VCS_NUM} -l 1 --template '{date|isodatesec}\n')"
}

if [[ -d .git ]] && [[ ! -z "$(git rev-parse HEAD 2>/dev/null)" ]]; then
	gitRepo
elif [[ -d .hg ]] && [[ ! -z "$(hg root 2>/dev/null)" ]]; then
	hgRepo
else
	echo "error: No repo detected."
	exit 1
fi

cat > "${TARGETFILE}" << EOF
/* ${VCS_FULL_HASH} */
#ifndef AUTOREVISION_H
#define AUTOREVISION_H

#define VCS_NUM			${VCS_NUM}
#define VCS_DATE		${VCS_DATE}
#define VCS_URI			${VCS_URI}
#define VCS_TAG			${VCS_TAG}

#define VCS_FULL_HASH					${VCS_FULL_HASH}
#define VCS_SHORT_HASH					${VCS_SHORT_HASH}

#define VCS_WC_MODIFIED					${WC_MODIFIED}

#endif

EOF

error: pathspec 'autorevision.sh' did not match any file(s) known to git


Added test-script from @dengert to view how card responds to various APDU to find applications *ISO 7816-4 Sec 8 Application-independent card services)

#!/bin/bash
# test how card responds to  various APDUs  to find applications
#ISO 7816-4  Section  8 Application-independent card services
#
# want to test for duplicate AIDs, PIV and OpenPGP etc.
#

CMD="/usr/local/bin/opensc-tool -c default"

# PIV SELECT AID for PIV + Le=256
PIV=(-s "00 A4 04 00 09 A0 00 00 03 08 00 00 10 00 00")

# OpenPGP AID + Le=256
PGP=(-s "00 A4 04 00 06 D2 76 00 01 24 01 00")

# muscle AID + Le=256 Used ti try aa AID that is not on the card
MUSCLE=(-s "00 A4 04 00 06 A0 00 00 00 01 01 00")

# read EF.DIR  3F002F00 using select file Select from the MF
REFDIR=(-s "00 A4 08 00 02 2F 00 00" -s "00 B0 00 00 1F")

# Try GET DATA EF.DIR Use first if known to work
#GEFDIR=(-s "00 A4 08 00 02 2F 00 00" -s "00 CA 00 00 00 00")
GEFDIR=(-s "00 CA 00 00 02 5C 00 00")

#Verify PIV pin 123456
V80P=(-s "00 20 00 80 08 31 32 33 34 35 36 FF FF")
#VERIFY PIV login state i.e. VERIFY with Lc absent
V800=(-s "00 20 00 80")

#Verify PGP pin 222222 for the login pin 82
V82P=(-s "00 20 00 82 06 32 32 32 32 32 32")
#VERIFY PGP login state
V820=(-s "00 20 00 82")
#
set -x

while test $# -gt 0 ; do
arg="$1"
  case $arg in
    piv.ef)
	echo  Select AID, try and read EF.DIR, not expected to work
	$CMD "${PIV[@]}" "${REFDIR[@]}" "${GEFDIR[@]}"
	;;

    pgp.ef)
	echo Select AID, try and read EF.DIR, not expected to work
	$CMD "${PGP[@]}" "${REFDIR[@]}" "${GERDIR[@]}"
	;;

    piv.login.state)
	echo test if PIV login state is maintained
	$CMD "${PIV[@]}" "${V800[@]}" "${V80P[@]}" "${V800[@]}" \
	    "${PIV[@]}" "${V800[@]}" \
	    "${PGP[@]}" "${V800[@]}"\
	        "${PIV[@]}" "${V800[@]}"
      #"${MUSCLE[@]}" "${V800[@]}"
	;;

    pgp.login.state)
	echo test if PGP login state query works
	$CMD "${PGP[@]}" "${V820[@]}" "${V82P[@]}" "${V820[@]}" \
	    "${PGP[@]}" "${V820[@]}" \
	    "${PIV[@]}" "${V820[@]}"\
	        "${PGP[@]}" "${V820[@]}"
      #"${MUSCLE[@]}" "${V820[@]}" \
	;;
    *)
	echo unknown arg $arg
	;;
  esac
  shift
done

error: pathspec 'test-aid-ef.sh' did not match any file(s) known to git


#417 Test escaping

#417 Test escaping

#!/bin/bash
#
# The MIT License
# Copyright (c) 2010 JmxTrans team
#
# 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

set -ev

MVN_SETTINGS=${HOME}/travis/settings.xml

if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
  if [ "$TRAVIS_BRANCH" == "master" ]; then
    # decrypt SSH key so we can push maven to gh-pages
    gpg --homedir ${HOME}/travis \
        --output ${HOME}/.ssh/id_rsa \
        --passphrase ${GPG_PASSPHRASE} \
        --decrypt ${HOME}/travis/id_rsa.gpg
    chmod 600 ${HOME}/.ssh/id_rsa

    # configure our git identity
    git config --global user.email "travis@jmxtrans.org"
    git config --global user.name "JmxTrans travis build"

    echo "Building master"
    mvn deploy --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,gpg,rpm,deb
  elif [ "$TRAVIS_BRANCH" == "release" ]; then
    if [[ `git log --format=%B -n 1` == *"[maven-release-plugin]"* ]]; then
      echo "Do not release commits created by maven release plugin"
    else
      echo "Building release"

      # decrypt SSH key so we can push release to GitHub
      gpg --homedir ${HOME}/travis \
          --output ${HOME}/.ssh/id_rsa \
          --passphrase ${GPG_PASSPHRASE} \
          --decrypt ${HOME}/travis/id_rsa.gpg
      chmod 600 ${HOME}/.ssh/id_rsa

      # configure our git identity
      git config --global user.email "travis@jmxtrans.org"
      git config --global user.name "JmxTrans travis build"

      # travis checkout the commit as detached head (which is normally what we
      # want) but maven release plugin does not like working in detached head
      # mode. This might be a problem if other commits have already been pushed
      # to the release branch, but in that case we will have problem anyway.
      git checkout release

      mvn release:prepare --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"
      mvn release:perform --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"

      git fetch origin +master:master
      git checkout master
      git merge release
      git push origin master
    fi
  else
    echo "Building feature branch"
    mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,rpm,deb,\!gpg
  fi
else
  echo "Building pull request"
  mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests
fi

#!/bin/bash
#
# The MIT License
# Copyright (c) 2010 JmxTrans team
#
# 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
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#

set -ev

MVN_SETTINGS=${HOME}/travis/settings.xml

if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
  if [ "$TRAVIS_BRANCH" == "master" ]; then
    # decrypt SSH key so we can push maven to gh-pages
    gpg --homedir ${HOME}/travis \
        --output ${HOME}/.ssh/id_rsa \
        --passphrase ${GPG_PASSPHRASE} \
        --decrypt ${HOME}/travis/id_rsa.gpg
    chmod 600 ${HOME}/.ssh/id_rsa

    # configure our git identity
    git config --global user.email "travis@jmxtrans.org"
    git config --global user.name "JmxTrans travis build"

    echo "Building master"
    mvn deploy --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,gpg,rpm,deb
  elif [ "$TRAVIS_BRANCH" == "release" ]; then
    if [[ `git log --format=%B -n 1` == *"[maven-release-plugin]"* ]]; then
      echo "Do not release commits created by maven release plugin"
    else
      echo "Building release"

      # decrypt SSH key so we can push release to GitHub
      gpg --homedir ${HOME}/travis \
          --output ${HOME}/.ssh/id_rsa \
          --passphrase ${GPG_PASSPHRASE} \
          --decrypt ${HOME}/travis/id_rsa.gpg
      chmod 600 ${HOME}/.ssh/id_rsa

      # configure our git identity
      git config --global user.email "travis@jmxtrans.org"
      git config --global user.name "JmxTrans travis build"

      # travis checkout the commit as detached head (which is normally what we
      # want) but maven release plugin does not like working in detached head
      # mode. This might be a problem if other commits have already been pushed
      # to the release branch, but in that case we will have problem anyway.
      git checkout release

      mvn release:prepare --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"
      mvn release:perform --settings ${MVN_SETTINGS} -B -V -Pgpg,rpm,deb -Darguments="--settings ${MVN_SETTINGS}"

      git fetch origin +master:master
      git checkout master
      git merge release
      git push origin master
    fi
  else
    echo "Building feature branch"
    mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests,rpm,deb,!gpg
  fi
else
  echo "Building pull request"
  mvn verify --settings ${MVN_SETTINGS} -B -V -PwithMutationTests
fi


Create twitch_ffmpeg.sh

Create twitch_ffmpeg.sh

#! /bin/bash

# Copyright (c) 2013-2014, Giovanni Dante Grazioli (deroad)

# ================================================ OPTIONS =====================================================
# Add the FFMPEG ABSOLUTE PATH "/path/to/ffmpeg"
FFMPEG_PATH="ffmpeg"

# Streaming Options
OUTRES="1920x1080"
FPS="24"              # Frame per Seconds (Suggested 24, 25, 30 or 60)
THREADS="4"           # Change this if you have a good CPU (Suggested 4 threads, Max 6 threads)
QUALITY="ultrafast"   # ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
CBR="1000k"           # Constant bitrate (CBR) Increase this to get a better pixel quality (1000k - 3000k for twitch)

# Webcam Options
WEBCAM="/dev/video1" # WebCam device
WEBCAM_WH="320:240"  # WebCam Width end Height
WEBCAM_XY=""         # WebCam Position (in pixel) example: "10:10", if "" (empty) then it will set the standard position

# File to save if you do not want to stream
FILE_VIDEO="my.flv"  # File name

# STREAM KEY
# You can find YOUR key here: http://www.twitch.tv/broadcast/ (Show Key button)
# Save your key inside the twitch_key file
# Or make a global file named ".twitch_key" in your home directory (~/.twitch_key)

# Twitch Server list http://bashtech.net/twitch/ingest.php
SERVER="live-fra"    # EU server

# These will be used only if the -coords option is called.
SET_XY="0,0"		# Position of the Window on the screen (X,Y)
SET_INRES="0x0"		# Window size (WxH)

# Change this to 'true' if you want to go always on FULLSCREEN, this will disable the output.
ALWAYS_FULLSCREEN=false

# Change this to 'true' if you want to hide your STREAM_KEY, for security purpose (this will disable most of the output).
# This will not affect the ALWAYS_FULLSCREEN option. ALWAYS_FULLSCREEN will always disable the output.
SUPPRESS_OUTPUT=false

# Twitch says it MUST have a 44100 rate, please do not change it unless you know what you are doing.
AUDIO_RATE="44100"
# Twitch says it MUST be 2, please do not change it unless you know what you are doing.
KEY_FRAME="2"

# ============================================== END OPTIONS ===================================================
# The following values are changed automatically, so do not change them
TOPXY="0,0"          # Position of the Window (You don't need to change this)
INRES="0x0"          # Game Resolution (You don't need to change this)
LOGLEVEL_ARG=""      # LogLevel, for security purpose (You don't need to change this)
SCREEN_SETUP=0       # Do not change this. it's used for the args.
STREAM_SAVE=0        # Do not change this. it's used for the args.
# ================================================= CHECKS =====================================================
# To see the output.
ECHO_LOG=""

# checks to avoid a false "true" where it checks for the webcam
if [ -z "$WEBCAM" ]; then
	ECHO_LOG=$ECHO_LOG"\nYour Webcam has been disabled because there isn't a WEBCAM in the options"
	WEBCAM="/dev/no-webcam"
elif [ -z "$WEBCAM_WH" ]; then
# checks to avoid a fail on loading the Webcam
	ECHO_LOG=$ECHO_LOG"\nYour Webcam has been disabled because there isn't a WEBCAM_WH in the options"
	WEBCAM="/dev/no-webcam"
fi
# Find stream key
if [ -f ~/.twitch_key ]; then
    ECHO_LOG=$ECHO_LOG"\nUsing global twitch key located in home directory"
    STREAM_KEY=$(cat ~/.twitch_key)
else
    if [ -f ./twitch_key ]; then
        ECHO_LOG=$ECHO_LOG"\nUsing twitch key located in current running directory"
        STREAM_KEY=$(cat ./twitch_key)
    else
        echo "Could not locate ~/.twitch_key or twitch_key"
        exit 1
    fi
fi

# Find script name
SCRIPT_NAME=${0##*/}

# Suppress output for security purpose
if [ $SUPPRESS_OUTPUT = true ]; then
	ECHO_LOG=$ECHO_LOG"\nOutput blocked!"
	LOGLEVEL_ARG="-loglevel 0"
fi

# checks to avoid fails
if [ -z "$SERVER" ]; then
     SERVER="live"
fi
if [ -z "$OUTRES" ]; then
     OUTRES="1280x720"
fi
if [ -z "$FPS" ]; then
     FPS="30"
     GOP="60"
     GOPMIN="30"
else
     GOP=$(($FPS*2))
     GOPMIN=$FPS
fi
if [ -z "$THREADS" ]; then
     THREADS="4"
fi
if [ -z "$QUALITY" ]; then
     QUALITY="fast"
fi
if [ -z "$CBR" ]; then
     CBR="1000k"
fi
if [ -z "$ALWAYS_FULLSCREEN" ]; then
     ALWAYS_FULLSCREEN=false
fi
if [ -z "$AUDIO_RATE" ]; then
     AUDIO_RATE="44100"
fi
if [ -z "$LOGLEVEL_ARG" ]; then
     LOGLEVEL_ARG=""
fi
if [ -z "$SUPPRESS_OUTPUT" ]; then
     SUPPRESS_OUTPUT=false
fi
if [ -z "$FILE_VIDEO" ]; then
     FILE_VIDEO="video.flv"
fi
if [ ! $SCREEN_SETUP -eq 0 ]; then
     SCREEN_SETUP=0
fi
if [ ! $STREAM_SAVE -eq 0 ]; then
     STREAM_SAVE=0
fi
if [ -z "$STREAM_KEY" ]; then
     ECHO_LOG=$ECHO_LOG"\nSTREAM_KEY not set or there is a problem with it... Aborting."
     ECHO_LOG=$ECHO_LOG"\nCheck if the path to the file or the streaming key is correctly set."
     exit 1
fi

# ================================================= CODE =======================================================
# DO NOT CHANGE THE CODE!
MODULE_LOAD1=""
MODULE_LOAD2=""
APP_RETURN=""

checkFileExists(){
	if [ -f $FILE_VIDEO ]; then
	     i=0
	     TMP="OLD_"$i"_"$FILE_VIDEO
	     echo "$FILE_VIDEO already exists! finding a new name for the old file"
	     while [ -f $TMP ]
	     do
	     	i=$((i+1))
	     	TMP="OLD_"$i"_"$FILE_VIDEO
		echo "$TMP already exists"
	     done
	     echo "The old stream $FILE_VIDEO has been renamed as $TMP"
	     echo "The new stream will be saved into $FILE_VIDEO"
	     mv $FILE_VIDEO $TMP
	fi
}

streamWebcam(){
        echo "Webcam found!!"
        echo "You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)"
        echo " "
        if [ -z "$WEBCAM_XY" ]; then
                # checks to avoid a fail on loading the Webcam
                #standard position is: main_w - overlay_w - 10:10
                WEBCAM_XY="$(($(echo $INRES | awk -F"x" '{ print $1 }') - $(echo $WEBCAM_WH | awk -F":" '{ print $1 }') - 10)):10"
                echo "There isn't a WEBCAM_XY in the options, i'll generate the standard one ($WEBCAM_XY)"
        fi
        $FFMPEG_PATH -f x11grab -s $INRES -framerate "$FPS" -i :0.0+$TOPXY -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE -vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p -s $OUTRES -preset $QUALITY -tune film  -acodec libmp3lame -threads $THREADS -vf "movie=$WEBCAM:f=video4linux2, scale=$WEBCAM_WH , setpts=PTS-STARTPTS [WebCam]; [in] setpts=PTS-STARTPTS [Screen]; [Screen][WebCam] overlay=$WEBCAM_XY [out]" -strict normal -bufsize $CBR $LOGLEVEL_ARG "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"
        APP_RETURN=$?
}

streamNoWebcam(){
        echo "Webcam NOT found!! ("$WEBCAM")"
        echo "You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)"
        echo " "
        $FFMPEG_PATH -f x11grab -s $INRES -framerate "$FPS" -i :0.0+$TOPXY -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE -vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $GOPMIN  -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p -s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal -bufsize $CBR $LOGLEVEL_ARG "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"
        APP_RETURN=$?
}

saveStreamWebcam(){
        echo "Webcam found!!"
        echo "You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)"
        echo " "
        if [ -z "$WEBCAM_XY" ]; then
                # checks to avoid a fail on loading the Webcam
                #standard position is: main_w - overlay_w - 10:10
                WEBCAM_XY="$(($(echo $INRES | awk -F"x" '{ print $1 }') - $(echo $WEBCAM_WH | awk -F":" '{ print $1 }') - 10)):10"
                echo "There isn't a WEBCAM_XY in the options, i'll generate the standard one ($WEBCAM_XY)"
        fi
        $FFMPEG_PATH -f x11grab -s $INRES -framerate "$FPS" -i :0.0+$TOPXY -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE -vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p -s $OUTRES -preset $QUALITY -tune film  -acodec libmp3lame -threads $THREADS -vf "movie=$WEBCAM:f=video4linux2, scale=$WEBCAM_WH , setpts=PTS-STARTPTS [WebCam]; [in] setpts=PTS-STARTPTS [Screen]; [Screen][WebCam] overlay=$WEBCAM_XY [out]" -strict normal -bufsize $CBR $LOGLEVEL_ARG $FILE_VIDEO
        APP_RETURN=$?
}

saveStreamNoWebcam(){
        echo "Webcam NOT found!! ("$WEBCAM")"
        echo "You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)"
        echo " "
        $FFMPEG_PATH -f x11grab -s $INRES -framerate "$FPS" -i :0.0+$TOPXY -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE -vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $GOPMIN  -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p -s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal -bufsize $CBR $LOGLEVEL_ARG $FILE_VIDEO
        APP_RETURN=$?
}

doDefaults(){
	if [ $ALWAYS_FULLSCREEN = true ]; then
		echo "[+] ALWAYS_FULLSCREEN is ON. Going to fullscreen!"
		echo "[+] Output blocked!"
		TOPXY="0,0"
		INRES=$(xwininfo -root | awk '/geometry/ {print $2}'i | sed -e 's/\+[0-9]//g')
		LOGLEVEL_ARG="-loglevel 0"
		SUPPRESS_OUTPUT=true
	else
		echo "[+] Click, with the mouse, on the Window that you want to Stream"
		rm -f twitch_tmp 2> /dev/null
		xwininfo -stats >> twitch_tmp
		TOPXY=$(cat twitch_tmp | awk 'FNR == 8 {print $4}')","$(cat twitch_tmp | awk 'FNR == 9 {print $4}')
		INRES=$(cat twitch_tmp | awk 'FNR == 12 {print $2}')"x"$(cat twitch_tmp | awk 'FNR == 13 {print $2}')
		rm -f twitch_tmp 2> /dev/null
		echo " "
	fi
}

loadModule(){
	MODULE_LOAD1=$(pactl load-module module-null-sink sink_name=GameAudio sink_properties=device.description="GameAudio") # For Game Audio
	MODULE_LOAD2=$(pactl load-module module-null-sink sink_name=MicAudio sink_properties=device.description="MicAudio") # For Mic Audio
	pactl load-module module-device-manager >> /dev/null
	pactl load-module module-loopback sink=GameAudio >> /dev/null
	pactl load-module module-loopback sink=MicAudio >> /dev/null
}

unloadModule(){
	echo "Stopping Audio (Don't worry if you see errors here)"
	pactl unload-module $MODULE_LOAD1
	pactl unload-module $MODULE_LOAD2
	pactl unload-module module-device-manager
	pactl unload-module module-null-sink
	pactl unload-module module-loopback
	echo "Exit!"
}

showUsage(){
		echo "usage:"
		echo "      "$SCRIPT_NAME" [options]"
		echo "      -h          | show usage screen"
		echo "      -fullscreen | enable the fullscreen"
		echo "                    and disable the output"
		echo "      -window     | enable the window mode"
		echo "      -coords     | set the screen resolution"
		echo "                    by using SET_XY SET_INRES"
		echo "                    defined inside the script"
		echo "      -save       | save the video to a file"
		echo "                    instead of streaming it"
		echo "      -quiet      | disables most of the outputs"
}

echo " "
echo "Twitch Streamer for Linux ("$SCRIPT_NAME")"
echo "Copyright (c) 2013 - 2014, Giovanni Dante Grazioli (deroad)"
# To be sure to unload everything
trap "unloadModule; exit" SIGHUP SIGINT SIGTERM
echo -e $ECHO_LOG
if [ $# -ge 1 ]; then
    for ARG in "$@"
    do
	if [ $ARG == "-h" ]; then
		showUsage
		exit 1
	elif [ $ARG == "-fullscreen" ]; then
		if [ ! $SCREEN_SETUP -eq 0 ]; then
		    continue
		fi
		echo "[+] Going to fullscreen! Output blocked!"
		TOPXY="0,0"
		INRES=$(xwininfo -root | awk '/geometry/ {print $2}'i | sed -e 's/\+[0-9]//g')
		LOGLEVEL_ARG="-loglevel 0"
		SUPPRESS_OUTPUT=true
		SCREEN_SETUP=1
	elif [ $ARG == "-window" ]; then
		if [ $SCREEN_SETUP -eq 1 ]; then
		     continue
		fi
		echo "[+] Click, with the mouse, on the Window that you want to Stream"
		rm -f twitch_tmp 2> /dev/null
		xwininfo -stats >> twitch_tmp
		TOPXY=$(cat twitch_tmp | awk 'FNR == 8 {print $4}')","$(cat twitch_tmp | awk 'FNR == 9 {print $4}')
		INRES=$(cat twitch_tmp | awk 'FNR == 12 {print $2}')"x"$(cat twitch_tmp | awk 'FNR == 13 {print $2}')
		rm -f twitch_tmp 2> /dev/null
		SCREEN_SETUP=2
	elif [ $ARG == "-coords" ]; then
		if [ $SCREEN_SETUP -eq 1 ]; then
		     continue
		elif [ "$SET_INRES" != "0x0" ]; then
			TOPXY=$SET_XY
			INRES=$SET_INRES
			echo "[+] Using pre-defined screen coords (X,Y = $TOPXY) (WxH = $INRES)."
			SCREEN_SETUP=2
		else
			echo "[+] Could not use pre-defined screen coords, because 'SET_INRES' equals '0x0'."
		fi
	elif [ $ARG == "-save" ]; then
		if [ ! $STREAM_SAVE -eq 0 ]; then
		     continue
		fi
		echo "[+] Saving the video into $FILE_VIDEO instead of stream to Twitch.tv"
		STREAM_SAVE=1
	elif [ $ARG == "-quiet" ]; then
		if [ $SUPPRESS_OUTPUT = true ]; then
		     continue
		fi
		echo "[+] Quiet Mode"
		LOGLEVEL_ARG="-loglevel 0"
		SUPPRESS_OUTPUT=true
	else
		echo "[+] Unknown param:" $ARG
		showUsage
		exit 1
	fi
    done
elif [ $# -eq 0 ]; then
	doDefaults
	SCREEN_SETUP=1;
else
	# You should never get here.. but who knows..
	echo "[+] There are some unknown params, please check what you wrote!"
	echo "[+] Params: " $@
	showUsage
	exit 1
fi
echo " "
# Setup
echo "Please setup the Audio Output to sink null (something like 'pavucontrol')"
# if you see errors here, please report on github
loadModule

# Disable trap
trap - SIGHUP SIGINT SIGTERM
# Checks if the screen got a setup
if [ $SCREEN_SETUP -eq 0 ]; then
    # if not then, get the defaults
    doDefaults
fi
# Checks if the webcam is loaded
if [ $STREAM_SAVE -eq 1 ]; then
     checkFileExists
     if [ -c $WEBCAM ]; then
	saveStreamWebcam
     else
	saveStreamNoWebcam
     fi
else
     if [ -c $WEBCAM ]; then
	streamWebcam
     else
	streamNoWebcam
     fi
fi
# Checks if any error returned
if [ $APP_RETURN -eq 1 ]; then
	if [ $SUPPRESS_OUTPUT = true ]; then
		echo "[+] Something went wrong. check the log without FULLSCREEN or SUPPRESS_OUTPUT options"
	fi
fi
echo " "

# Closing..
unloadModule

error: pathspec 'twitch_ffmpeg.sh' did not match any file(s) known to git


Added go-spew_v1.1.0_ubi_8.5.sh build script (#1853)

#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package	: go-spew
# Version	: v1.1.0
# Source repo	: https://github.com/davecgh/go-spew
# Tested on     : UBI: 8.5
# Language      : GO
# Travis-Check  : True
# Script License: Apache License, Version 2 or later
# Maintainer	: Valen Mascarenhas / Vedang Wartikar <Vedang.Wartikar@ibm.com>
#
# Disclaimer: This script has been tested in root mode on given
# ==========  platform using the mentioned version of the package.
#             It may not work as expected with newer versions of the
#             package and/or distribution. In such case, please
#             contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------

PACKAGE_NAME=go-spew
PACKAGE_VERSION=${1:-v1.1.0}
PACKAGE_URL=github.com/davecgh/go-spew

yum install -y git golang

go get -d -t $PACKAGE_URL@$PACKAGE_VERSION

cd ~/go/pkg/mod/$PACKAGE_URL*

go mod init $PACKAGE_URL

go build ./...

if ! go test ./...; then
	echo "------------------Test_fails---------------------"
	exit 1
else
	echo "------------------Build_and_Test_success-------------------------"
	echo "$PACKAGE_NAME  | $PACKAGE_VERSION |"
	exit 0
fi

error: pathspec 'g/go-spew/go-spew_v1.1.0_ubi_8.5.sh' did not match any file(s) known to git


added site_validator

added site_validator

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/vitorgalvao/dotfiles.git/'


Add generateKconfig.sh script

Add generateKconfig.sh script

This script should be called with one argument - path to folder in which
the files will be generated. Default value for this argument is "output"
(default value of $(OUTPUT) variable in the build scripts).

The script searches for all files matching "Kconfig*" pattern. Each file
is scanned for pattern in the following form

"### don't remove this line! <filename>"

For each pattern a file named <filename> is generated in the selected
folder. This generated file includes ("sources") all files named
<filename> (except itself) that were found in the project.

This generated file can be included by "normal" Kconfig scripts and it
will act as a "proxy" file for other files that can be freely
added/removed. This is useful for adding custom boards, user application
configuration or for removing unused parts of distortos (like unused
chips, architectures, boards, test application, ...).

The script calls "find" with full path as "/usr/bin/find" in an attempt
to simplify requirements for Windows. In Windows there's a "find.exe"
file in "c:/Windows/System32", which conflicts with "find.exe" from
MSYS2. One option is to require MSYS2 folder to be at the very beginning
of system's PATH environment variable, the other option is to use full
"/usr/bin/..." path. Both options are bad, but the latter seemed like a
smaller inconvenience for users.

#!/bin/sh

#
# file: generateKconfig.sh
#
# author: Copyright (C) 2016 Kamil Szczygiel http://www.distortec.com http://www.freddiechopin.info
#
# This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
# distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#

set -e
set -u

output=output

# If any argument was given, then use it as the output path, otherwise assume the output path to be "./output"
if [ $# -ge 1 ]; then
	output=`realpath --relative-base=. $1`
fi

mkdir -p $output
pattern="### don't remove this line! "
for file in \
		`/usr/bin/find -path "./$output" -prune -o -name 'Kconfig*' -exec grep "$pattern" {} + | cut -d ' ' -f 6 | uniq`
do

cat << EOF > $output/$file
#
# file: $file
#
# Automatically generated file - do not edit!
#
# date: `date +'%Y-%m-%d %H:%M:%S'`
#

`/usr/bin/find -path "./$output" -prune -o -name $file -printf 'source "%p"\n' | sort`
EOF

done

error: pathspec 'scripts/generateKconfig.sh' did not match any file(s) known to git


Update s3deletebuckets.sh

Update s3deletebuckets.sh

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/kalantal/s3-tests.git/'


fwr: reorganize configuration files

fwr: reorganize configuration files

git-svn-id: 8a2ccb88241e16c78017770bc38d91d6d5396a5a@71053 6b8eccd3-e8c5-4e7d-8186-e12b5326b719

#!/bin/bash
source ../configurations/system.ini

#
# serviceBatchMgr      This shell script takes care of starting and stopping a Kaltura Batch Service
#
# chkconfig: 2345 13 87
# description: Kaltura Batch

# Source function library.
#. /etc/rc.d/init.d/functions

# Directory containing the batchers' php files
BATCHDIR=$APP_DIR/batch
LOGDIR="$LOG_DIR"

BATCHEXE=KGenericBatchMgr.class.php
# The batch service filename without extensions
FILE_NAME=${BATCHEXE%.*}

if [ $# != 1 ]; then
   echo "Usage: $0 [start|stop|restart|status]"
   #exit 1 chages the return code because this fails the build
   exit 0
fi

CONFIG_FILE=$BATCHDIR/config/`hostname`_config.ini

default_config=0
if [ ! -f $CONFIG_FILE ]; then
     CONFIG_FILE=$APP_DIR/configurations/batch.ini
     default_config=1
fi

LOCKFILE="$BATCHDIR/$FILE_NAME"

echo_success() {
  [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
  echo -n "["
  [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
  echo -n $"  OK  "
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "]"
  echo -ne "\r"
  return 0
}

echo_failure() {
  [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
  echo -n "["
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo -n $"FAILED"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "]"
  echo -ne "\r"
  #return 1
  return 0
}

start() {
	echo -n $"Starting:"
	KP=$(pgrep -P 1 -f $FILE_NAME.php)
	if [ -f $LOCKFILE ]; then
		echo_failure
		echo
		if [ "X$KP" != "X"  ]; then
		   echo "Service $FILE_NAME already running"
		   #return 1
		   return 0
                else
		   echo "Service $FILE_NAME isn't running but stale lock file exists"
	           echo "Removing stale lock file at $LOCKFILE"
                   rm -f $LOCKFILE
		   start_scheduler
	           return 0
                fi
	else
		if [ "X$KP" != "X"  ]; then
          	    echo "$FILE_NAME.php is running as $KP without a $LOCKFILE"
          	    exit 0
		fi
		start_scheduler
		return 0
	fi
}

start_scheduler() {
		echo "$PHP_BIN $BATCHEXE $PHP_BIN $CONFIG_FILE >> ${LOGDIR}/KGenericBatchMgr.log 2>&1 &"
                if [ $default_config -eq 1 ]; then
                   echo "Warning : using default batch_config.ini !"
                fi
                cd $BATCHDIR
		$PHP_BIN $BATCHEXE $PHP_BIN $CONFIG_FILE >> ${LOGDIR}/KGenericBatchMgr.log 2>&1 &
                if [ "$?" -eq 0 ]; then
                        echo_success
                        echo
                        touch $LOCKFILE
                else
                        echo_failure
                        echo
                fi
}

show_status() {
      KP=$(pgrep -P 1 -f $FILE_NAME.php)
      if [ "X$KP" != "X"  ]; then
	  echo "$FILE_NAME.php is running as $KP ..."
	  return 0
      else
          echo "Service $FILE_NAME isn't running"
          #return 1
          return 0
      fi
}

stop() {
	echo -n $"Shutting down:"
	KP=$(pgrep -P 1 -f $FILE_NAME.php)
	if [ $KP > 1 ]; then
		PIDS=$(pstree -p $KP | grep -o '[0-9]\{2,5\}')
		# hack, returnds the PIDS as string and tells kill to kill all at once
		for pid in "$PIDS"
		do
			kill -9 $pid
		done
		echo_success
		echo
		RC=0
	else
		echo_failure
		echo
		echo "Service $FILE_NAME not running"
		#RC=2
		RC=0
	fi
	rm -f $LOCKFILE
	return $RC
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        show_status
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage:  [start|stop|restart|status]"
        #exit 1
        exit 0
        ;;
esac
exit $?

#!/bin/bash
source ../configurations/system.ini

#
# serviceBatchMgr      This shell script takes care of starting and stopping a Kaltura Batch Service
#
# chkconfig: 2345 13 87
# description: Kaltura Batch

# Source function library.
#. /etc/rc.d/init.d/functions

# Directory containing the batchers' php files
BATCHDIR=$APP_DIR/batch
LOGDIR="$LOG_DIR"

BATCHEXE=KGenericBatchMgr.class.php
# The batch service filename without extensions
FILE_NAME=${BATCHEXE%.*}

if [ $# != 1 ]; then
   echo "Usage: $0 [start|stop|restart|status]"
   #exit 1 chages the return code because this fails the build
   exit 0
fi

CONFIG_FILE=$BATCHDIR/config/`hostname`_config.ini

default_config=0
if [ ! -f $CONFIG_FILE ]; then
     CONFIG_FILE=$BATCHDIR/batch_config.ini
     default_config=1
fi

LOCKFILE="$BATCHDIR/$FILE_NAME"

echo_success() {
  [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
  echo -n "["
  [ "$BOOTUP" = "color" ] && $SETCOLOR_SUCCESS
  echo -n $"  OK  "
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "]"
  echo -ne "\r"
  return 0
}

echo_failure() {
  [ "$BOOTUP" = "color" ] && $MOVE_TO_COL
  echo -n "["
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo -n $"FAILED"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
  echo -n "]"
  echo -ne "\r"
  #return 1
  return 0
}

start() {
	echo -n $"Starting:"
	KP=$(pgrep -P 1 -f $FILE_NAME.php)
	if [ -f $LOCKFILE ]; then
		echo_failure
		echo
		if [ "X$KP" != "X"  ]; then
		   echo "Service $FILE_NAME already running"
		   #return 1
		   return 0
                else
		   echo "Service $FILE_NAME isn't running but stale lock file exists"
	           echo "Removing stale lock file at $LOCKFILE"
                   rm -f $LOCKFILE
		   start_scheduler
	           return 0
                fi
	else
		if [ "X$KP" != "X"  ]; then
          	    echo "$FILE_NAME.php is running as $KP without a $LOCKFILE"
          	    exit 0
		fi
		start_scheduler
		return 0
	fi
}

start_scheduler() {
		echo "$PHP_BIN $BATCHEXE $PHP_BIN $CONFIG_FILE >> ${LOGDIR}/KGenericBatchMgr.log 2>&1 &"
                if [ $default_config -eq 1 ]; then
                   echo "Warning : using default batch_config.ini !"
                fi
                cd $BATCHDIR
		$PHP_BIN $BATCHEXE $PHP_BIN $CONFIG_FILE >> ${LOGDIR}/KGenericBatchMgr.log 2>&1 &
                if [ "$?" -eq 0 ]; then
                        echo_success
                        echo
                        touch $LOCKFILE
                else
                        echo_failure
                        echo
                fi
}

show_status() {
      KP=$(pgrep -P 1 -f $FILE_NAME.php)
      if [ "X$KP" != "X"  ]; then
	  echo "$FILE_NAME.php is running as $KP ..."
	  return 0
      else
          echo "Service $FILE_NAME isn't running"
          #return 1
          return 0
      fi
}

stop() {
	echo -n $"Shutting down:"
	KP=$(pgrep -P 1 -f $FILE_NAME.php)
	if [ $KP > 1 ]; then
		PIDS=$(pstree -p $KP | grep -o '[0-9]\{2,5\}')
		# hack, returnds the PIDS as string and tells kill to kill all at once
		for pid in "$PIDS"
		do
			kill -9 $pid
		done
		echo_success
		echo
		RC=0
	else
		echo_failure
		echo
		echo "Service $FILE_NAME not running"
		#RC=2
		RC=0
	fi
	rm -f $LOCKFILE
	return $RC
}

case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    status)
        show_status
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo "Usage:  [start|stop|restart|status]"
        #exit 1
        exit 0
        ;;
esac
exit $?


Add scripts/static-analysis.sh

Add scripts/static-analysis.sh

#!/bin/bash

echo "Running go vet..."
go vet ./...

error: pathspec 'scripts/static-analysis.sh' did not match any file(s) known to git


Extract the travis-ci shell script, so that it is easier to test

#!/bin/bash
# Script run in the travis CI

if [ $BUILDTOOL = "autotools" ]; then ../configure && echo "CONFIGURATION DONE. Compiling now." && make check_all; if [ $CXX = "gcc" ]; then echo "Release now"; fi; fi
if [ $BUILDTOOL = "cmake" ]; then cmake .. -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE && make && ctest -V; fi
if [ $BUILDTOOL = "cmake" ]; then cmake .. -DGMOCK=ON && make && ctest -V; fi
if [ $BUILDTOOL = "cmake" ]; then cmake .. -DGMOCK=OFF -DREAL_GTEST=ON && make && ctest -V; fi

error: pathspec 'scripts/travis_ci_build.sh' did not match any file(s) known to git


Updates GOPATH in README.macOS.bash

Updates GOPATH in README.macOS.bash

gpbackup and gpmigrate need the GOPATH to be set to the standard GOPATH
gpupgrade uses direnv to successfully set a custom GOPATH

#!/bin/bash

echo "Caching password..."
sudo -K
sudo true;

if hash brew 2>/dev/null; then
	  echo "Homebrew is already installed!"
else
	  echo "Installing Homebrew..."
	  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

brew install bash-completion
brew install conan
brew install cmake # gporca
brew install xerces-c #gporca
brew install libyaml   # enables `--enable-mapreduce`
brew install libevent # gpfdist
brew install apr # gpperfmon
brew install apr-util # gpperfmon
brew link --force apr
brew link --force apr-util

# Installing Golang
mkdir -p ~/go/src
brew install go # Or get the latest from https://golang.org/dl/
brew install dep

# Installing python libraries
brew install python
cat >> ~/.bash_profile << EOF
export PATH=/usr/local/opt/python/libexec/bin:\$PATH
EOF
source ~/.bash_profile
pip install lockfile psi paramiko pysql psutil setuptools
pip install unittest2 parse pexpect mock pyyaml
pip install git+https://github.com/behave/behave@v1.2.4
pip install pylint

#echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts
echo 127.0.0.1$'\t'$HOSTNAME | sudo tee -a /etc/hosts

# OS settings
sudo sysctl -w kern.sysv.shmmax=2147483648
sudo sysctl -w kern.sysv.shmmin=1
sudo sysctl -w kern.sysv.shmmni=64
sudo sysctl -w kern.sysv.shmseg=16
sudo sysctl -w kern.sysv.shmall=524288
sudo sysctl -w net.inet.tcp.msl=60

sudo sysctl -w net.local.dgram.recvspace=262144
sudo sysctl -w net.local.dgram.maxdgram=16384
sudo sysctl -w kern.maxfiles=131072
sudo sysctl -w kern.maxfilesperproc=131072
sudo sysctl -w net.inet.tcp.sendspace=262144
sudo sysctl -w net.inet.tcp.recvspace=262144
sudo sysctl -w kern.ipc.maxsockbuf=8388608

sudo tee -a /etc/sysctl.conf << EOF
kern.sysv.shmmax=2147483648
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=524288
net.inet.tcp.msl=60

net.local.dgram.recvspace=262144
net.local.dgram.maxdgram=16384
kern.maxfiles=131072
kern.maxfilesperproc=131072
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
kern.ipc.maxsockbuf=8388608
EOF

# Step: Create GPDB destination directory
sudo mkdir /usr/local/gpdb
sudo chown $USER:admin /usr/local/gpdb

# Step: Configure
cat >> ~/.bashrc << EOF
ulimit -n 65536 65536  # Increases the number of open files
export PGHOST="$(hostname)"
EOF

# Step: GOPATH for Golang
cat >> ~/.bash_profile << EOF
export GOPATH=\$HOME/go
export PATH=\$HOME/go/bin:\$PATH
EOF

# Step: speed up compile time (optional)
cat >> ~/.bashrc << EOF

# This assumes that the macOS machine has 8 threads
export MAKEFLAGS='-j8'
EOF

# Step: install any optional tools
brew install gdb

#!/bin/bash

echo "Caching password..."
sudo -K
sudo true;

if hash brew 2>/dev/null; then
	  echo "Homebrew is already installed!"
else
	  echo "Installing Homebrew..."
	  ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi

brew install bash-completion
brew install conan
brew install cmake # gporca
brew install xerces-c #gporca
brew install libyaml   # enables `--enable-mapreduce`
brew install libevent # gpfdist
brew install apr # gpperfmon
brew install apr-util # gpperfmon
brew link --force apr
brew link --force apr-util

# Installing Golang
mkdir -p ~/go/src
brew install go # Or get the latest from https://golang.org/dl/
brew install dep

# Installing python libraries
brew install python
cat >> ~/.bash_profile << EOF
export PATH=/usr/local/opt/python/libexec/bin:\$PATH
EOF
source ~/.bash_profile
pip install lockfile psi paramiko pysql psutil setuptools
pip install unittest2 parse pexpect mock pyyaml
pip install git+https://github.com/behave/behave@v1.2.4
pip install pylint

#echo -e "127.0.0.1\t$HOSTNAME" | sudo tee -a /etc/hosts
echo 127.0.0.1$'\t'$HOSTNAME | sudo tee -a /etc/hosts

# OS settings
sudo sysctl -w kern.sysv.shmmax=2147483648
sudo sysctl -w kern.sysv.shmmin=1
sudo sysctl -w kern.sysv.shmmni=64
sudo sysctl -w kern.sysv.shmseg=16
sudo sysctl -w kern.sysv.shmall=524288
sudo sysctl -w net.inet.tcp.msl=60

sudo sysctl -w net.local.dgram.recvspace=262144
sudo sysctl -w net.local.dgram.maxdgram=16384
sudo sysctl -w kern.maxfiles=131072
sudo sysctl -w kern.maxfilesperproc=131072
sudo sysctl -w net.inet.tcp.sendspace=262144
sudo sysctl -w net.inet.tcp.recvspace=262144
sudo sysctl -w kern.ipc.maxsockbuf=8388608

sudo tee -a /etc/sysctl.conf << EOF
kern.sysv.shmmax=2147483648
kern.sysv.shmmin=1
kern.sysv.shmmni=64
kern.sysv.shmseg=16
kern.sysv.shmall=524288
net.inet.tcp.msl=60

net.local.dgram.recvspace=262144
net.local.dgram.maxdgram=16384
kern.maxfiles=131072
kern.maxfilesperproc=131072
net.inet.tcp.sendspace=262144
net.inet.tcp.recvspace=262144
kern.ipc.maxsockbuf=8388608
EOF

# Step: Create GPDB destination directory
sudo mkdir /usr/local/gpdb
sudo chown $USER:admin /usr/local/gpdb

# Step: Configure
cat >> ~/.bashrc << EOF
ulimit -n 65536 65536  # Increases the number of open files
export PGHOST="$(hostname)"
EOF

# Step: GOPATH for Golang
cat >> ~/.bash_profile << EOF
export GOPATH=\$HOME/workspace/gpdb/gpMgmt/go-utils
export PATH=\$HOME/workspace/gpdb/gpMgmt/go-utils/bin:\$PATH
EOF

# Step: speed up compile time (optional)
cat >> ~/.bashrc << EOF

# This assumes that the macOS machine has 8 threads
export MAKEFLAGS='-j8'
EOF

# Step: install any optional tools
brew install gdb


forgot to add

forgot to add

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/MarginC/kame.git/'


use letsencrypt naming convention

use letsencrypt naming convention

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/coolaj86/nodejs-self-signed-certificate-example.git/'


Add cron script to run add_events.py

Add cron script to run add_events.py

#!/bin/bash
# runs add_events.py and updates events from facebook data.

BASE_DIR=~/apps/myapp/

# activate venv
. $BASE_DIR/venv/bin/activate

python $BASE_DIR/cron/add_events.py

error: pathspec 'update_events.sh' did not match any file(s) known to git


run.sh shell script

run.sh shell script

#!/bin/bash

python evaluation.py -g ../team-lab-ss2015/data/pos/dev.col -p ../team-lab-ss2015/data/pos/dev-predicted.col

error: pathspec 'run.sh' did not match any file(s) known to git


Added a run script for pulling in settings and starting the meteor webserver

cd app
meteor --settings=../settings.json --port=3008


Added run.sh

Added run.sh

#!/bin/bash
if [ ! -e "token" ]
then
    echo "File 'token' does not exist"
    exit
fi
xargs go run bot.go -token < token


Create run.sh

Create run.sh

Copied from local env

#!/bin/bash
source settings.conf

function usage() {
    cat << EOF
    usage: $0 options
    OPTIONS:
     -h Show [H]elp (this message)
     -s [S]ettings file	(if not default)
     -x l[x]c mode
     -m Virtual [m]achine mode
     -i vm[i]d
     -H [H]ostname
     -P Password

	AutoProx is intended to speed up the creation of common nodes on Proxmox using the pvesh tool.
	Use the settings file for "standards" and use options for things that differ.
	You can call run.sh from your own script as many times and as many options as needed.

	Example
	ssh root@proxmox runme.sh -x -H newhost -P supersecure
EOF
exit 1
}
function buildlxc(){
ssh $vmbox "pvesh create /nodes/$vmbox/lxc/ \
        -vmid=$vmid \
        -hostname=$hostname \
        -storage=$storage1 \
        -password=$password \
        -ostemplate=$ostemplate \
        -memory=$memory \
        -swap=$swap \
        -storage=$storage2 \
        -rootfs=$lxc_disk \
        -cpulimit=$lxc_cpulimit \
        -cpuunits=$lxc_cpuunits \
        -net0=$net0 \
        "
}

function parseopts () {
    while getopts "hs:xmi:H:P:" OPTION ; do
        case $OPTION in
         h) usage		;;
         s) source $OPTARG	;;
         x) lxc=1		;;
         m) vm=1		;;
         i) vmid=$OPTARG	;;
         H) hostname=$OPTARG	;;
         P) password=$OPTARG	;;
        esac
    done
    ### Verify Mode is set ###
    if [[ -z $lxc ]] ; then
        if [[ -z $vm ]] ; then
            print "Please select LXC or VM mode. Note, these options are mutually exclusive"
	    usage
        fi
    fi
}
function main() {
	if [[ $lxc -eq 1 ]] ; then
		buildlxc
	fi
	if [[ $vm -eq 1 ]] ; then
		buildvm
	fi
exit 0
}
parseopts $*
main


add thumb.sh tool

add thumb.sh tool

#!/usr/bin/env bash
#
# shell script for regenerating thumbnails
#

if [ "$1" == "" ] ; then
    echo "usage: $0 webroot_dir"
else
    cd $1
    echo "regenerate missing thumbs in $(pwd)"
    find img/ \
         -type f \
         -regextype posix-extended \
         -iregex '.*\.(png|jpg|gif)$' \
         -not -execdir test -f '../thm/{}' \; \
         -exec echo 'generating missing thumb for {}' \; \
         -exec mogrify \
         -define jpeg:size=500x500 \
         -thumbnail '250>x250>' \
         -path thm/ \
         -strip \
         '{}' \;
fi

error: pathspec 'contrib/tools/thumbs.sh' did not match any file(s) known to git


Add missing service hook

Add missing service hook

error: pathspec 'hooks/linux/generic/stop_service.sh' did not match any file(s) known to git


Create auto-stop.sh

Create auto-stop.sh

#!/bin/bash

x=5     # initialize x to 5 : dwell multiplier
y=$1    # initialize y to $1 args1

mul=$(($x * $y))   # multiply the values of x and y and assign it to variable mul

# configure docker containers
for ((i = 1; i <= $y; i++)); do
    docker exec splunk-fwd-$i /bin/bash /opt/perfmon/bin/stopdg.sh
    sleep 5
done

error: pathspec 'scripts/auto-stop.sh' did not match any file(s) known to git