Added some colors and echo more information.

#!/bin/bash
# By Kees C. Bakker / KeesTalksTech

# Downloads NodeJS from the Node repository. Should work for any Pi. Will detect ARM version.
# Tested with RPi1/armv6l and RPi3/armv7l.
# Will remove a previous version installed by the script (up and downgrade compatible).

# Syntax:
# install-node.sh latest - will install latest node version
# install-node.sh stable - will install the latest Long Term Stable (LTS) node version
# install-node.sh {version} - will install that version.

# Source: https://github.com/KeesCBakker/pi-config/blob/master/install-node.sh
# Based on script by Kees C. Bakker @ https://github.com/KeesCBakker/node-pi-zero/blob/master/install-node-v.last.sh
# Based on script by Steven de Salas @ https://github.com/sdesalas/node-pi-zero/blob/master/install-node-v7.7.1.sh
# Based on script by Richard Stanley @ https://github.com/audstanley/Node-MongoDb-Pi/

# colors
W='\033[1;37m'
G='\033[1;92m'
R='\033[0m' # No Color

echo ""

#get pi ARM version
PI_ARM_VERSION=$(
	uname -a |
	egrep 'armv[0-9]+l' -o
);

NODE_VERSION=$1

if [ -z "$NODE_VERSION" ] || [ "$NODE_VERSION" = "stable" ]; then

	echo -e "This script will${W} install the latest stable NodeJS (LTS)${R} for you."

	#get latest nodejs stable version from node website
	#read the first version that matches the arm platform and has a "lts":" part
	NODE_VERSION=$(
		curl -s https://nodejs.org/dist/index.json |
		egrep "{\"version\":\"v([0-9]+\.?){3}\"[^{}]*\"linux-"$PI_ARM_VERSION"[^}]*lts\":\"[^}]*}" -o |
  		head -n 1
	);

elif [ "$NODE_VERSION" = "latest" ]; then

	echo -e "This script will ${W}install the latest NodeJS ${R}for you (non LTS included)."

	#get latest nodejs stable version from node website
	#read the first version that matches the arm platform
	NODE_VERSION=$(
  		curl -s https://nodejs.org/dist/index.json |
  		egrep "{\"version\":\"v([0-9]+\.?){3}\"[^{}]*\"linux-"$PI_ARM_VERSION"[^}]*}" -o |
  		head -n 1
);
else

	echo -e "This script will try to ${W}install NodeJS v$NODE_VERSION ${R}for you."

	#get specific nodejs version from node website
	#make sure the version matches the arm platform
	NODE_VERSION=$(
  		curl -s https://nodejs.org/dist/index.json |
  		egrep "{\"version\":\"v$NODE_VERSION\"[^{}]*\"linux-"$PI_ARM_VERSION"[^}]*}" -o |
  		head -n 1
	);
fi

#get the version
VERSION=$(
  echo $NODE_VERSION |
  egrep 'v([0-9]+\.?){3}' -o
);

#get lts version
LTS_VERSION=$(echo $NODE_VERSION |
  egrep '"[^"]+"}$' -o |
  egrep '[a-zA-Z]+' -o |
  tr '[:upper:]' '[:lower:]'
);

#echo not found
if [ -z "$VERSION" ]; then
	echo -e "Version ${W}v$1${R} could not be found for architecture ${W}linux-$PI_ARM_VERSION${R}."
	echo ""
	exit 1
fi

#echo details before installing
if [ -z "$LTS_VERSION" ] ; then
	echo -e "NodeJS ${W}$VERSION${R} will be installed for architecture ${W}linux-$PI_ARM_VERSION${R}."
	echo "This version is not LTS."
else
	echo -e "NodeJS ${W}$VERSION${R} ($LTS_VERSION) will be installed for architecture ${W}linux-$PI_ARM_VERSION${R}."
fi

# download to tmp directory
cd /tmp/

echo ""
echo -e "${W}Downloading${R}:"

if [ -z "$LTS_VERSION" ]; then
	wget https://nodejs.org/dist/$VERSION/node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;
else
	wget https://nodejs.org/dist/latest-$LTS_VERSION/node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;
fi

echo -e "${W}Installing${R}..."

#tar the file
tar -xzf node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;

# Remove the tar after extracing it.
sudo rm node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;

# This line will clear existing nodejs
sudo rm -rf /opt/nodejs;

# This next line will copy Node over to the appropriate folder.
sudo mv node-$VERSION-linux-$PI_ARM_VERSION /opt/nodejs/;

# Remove existing symlinks
sudo unlink /usr/bin/node;
sudo unlink /usr/sbin/node;
sudo unlink /sbin/node;
sudo unlink /usr/local/bin/node;
sudo unlink /usr/bin/npm;
sudo unlink /usr/sbin/npm;
sudo unlink /sbin/npm;
sudo unlink /usr/local/bin/npm;

# Create symlinks to node && npm
sudo ln -s /opt/nodejs/bin/node /usr/bin/node;
sudo ln -s /opt/nodejs/bin/node /usr/sbin/node;
sudo ln -s /opt/nodejs/bin/node /sbin/node;
sudo ln -s /opt/nodejs/bin/node /usr/local/bin/node;
sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm;
sudo ln -s /opt/nodejs/bin/npm /usr/sbin/npm;
sudo ln -s /opt/nodejs/bin/npm /sbin/npm;
sudo ln -s /opt/nodejs/bin/npm /usr/local/bin/npm;

echo ""
echo -e "${G}Done${R}. Details:"

NV=$(node -v)
echo -e "- Node version: ${W}$NV${R}"

NPMV=$(npm -v)
echo -e "- NPM version: ${W}$NPMV${R}"

echo ""

#!/bin/bash
# By Steven de Sales

# 2017-04-20 Getting latest NodeJs version by Kees C. Bakker (KeesTalksTech)
# Based on script by Richard Stanley @ https://github.com/audstanley/Node-MongoDb-Pi/

#get pi ARM version
PI_ARM_VERSION=$(
  uname -a |
  egrep 'armv[0-9]+l' -o
);

NODE_VERSION=$1

if [ -z "$NODE_VERSION" ] || [ "$NODE_VERSION" = "stable" ]; then
#get latest nodejs version from node website
#read the first version that matches the arm platform
NODE_VERSION=$(
  curl https://nodejs.org/dist/index.json |
  egrep "{\"version\":\"v([0-9]+\.?){3}\"[^{]*\"linux-"$PI_ARM_VERSION"[^}]*lts\":\"[^}]*}" -o |
  head -n 1
);
elif [ "$NODE_VERSION" = "latest" ]; then
NODE_VERSION=$(
  curl https://nodejs.org/dist/index.json |
  egrep "{\"version\":\"v([0-9]+\.?){3}\"[^{]*\"linux-"$PI_ARM_VERSION"[^}]*}" -o |
  head -n 1
);
else
NODE_VERSION=$(
  curl https://nodejs.org/dist/index.json |
  egrep "{\"version\":\"v$NODE_VERSION\"[^{]*\"linux-"$PI_ARM_VERSION"[^}]*}" -o |
  head -n 1
);
fi

echo "Node version: $NODE_VERSION"

#get the version
VERSION=$(
  echo $NODE_VERSION |
  egrep 'v([0-9]+\.?){3}' -o
);

echo "Version: $VERSION"

#get lts version
LTS_VERSION=$(echo $NODE_VERSION |
  egrep '"[^"]+"$' -o |
  egrep '[a-zA-Z]+' -o |
  tr '[:upper:]' '[:lower:]'
);

echo "Lts version: $LTS_VERSION"

# Creates directory for downloads, and downloads node
cd /tmp/

echo ""
echo "Downloading:"

if [ -z "$LTS_VERSION" ]; then
wget https://nodejs.org/dist/$VERSION/node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;
else
wget https://nodejs.org/dist/latest-$LTS_VERSION/node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;
fi

echo ""
echo "Installing:"
tar -xzf node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;

# Remove the tar after extracing it.
sudo rm node-$VERSION-linux-$PI_ARM_VERSION.tar.gz;

# This line will clear existing nodejs
sudo rm -rf /opt/nodejs;

# This next line will copy Node over to the appropriate folder.
sudo mv node-$VERSION-linux-$PI_ARM_VERSION /opt/nodejs/;

# Remove existing symlinks
sudo unlink /usr/bin/node;
sudo unlink /usr/sbin/node;
sudo unlink /sbin/node;
sudo unlink /usr/local/bin/node;
sudo unlink /usr/bin/npm;
sudo unlink /usr/sbin/npm;
sudo unlink /sbin/npm;
sudo unlink /usr/local/bin/npm;

# Create symlinks to node && npm
sudo ln -s /opt/nodejs/bin/node /usr/bin/node;
sudo ln -s /opt/nodejs/bin/node /usr/sbin/node;
sudo ln -s /opt/nodejs/bin/node /sbin/node;
sudo ln -s /opt/nodejs/bin/node /usr/local/bin/node;
sudo ln -s /opt/nodejs/bin/npm /usr/bin/npm;
sudo ln -s /opt/nodejs/bin/npm /usr/sbin/npm;
sudo ln -s /opt/nodejs/bin/npm /sbin/npm;
sudo ln -s /opt/nodejs/bin/npm /usr/local/bin/npm;

echo ""
echo "Installation ready!"
echo ""

NV=$(node -v)
echo "Node version: $NV"

NPMV=$(npm -v)
echo "NPM version: $NPMV"


install/base: Add pidof

install/base: Add pidof

#!/usr/bin/env bash

PATH=/usr/local/bin:$PATH

source "${BASH_SOURCE%/*}/lib.sh"

TAPS=(
    homebrew/dupes
    caskroom/cask
    caskroom/fonts
)

HEAD=(
#    neovim/neovim/neovim
)

EGGS=(
    neovim
)

FORMULAS=(
    awk
    bash
    bazaar
    coreutils
    curl
    diffutils
    findutils
    fish
    fzf
    ghq
    git
    gnu-sed
    gnu-tar
    grep
    iftop
    jump
    less
    make
    mercurial
    moreutils
    neovim
    openssh
    pam_yubico
    pidof
    pstree
    python
    python3
    ripgrep
    rsync
    subversion
    tree
    watch
    wget
    xz
)

CASKS=(
    font-fira-code
)

h1 "base"
h2 "brew taps"
for t in "${TAPS[@]}"; do brew_tap "$t"; done
h2 "brew formulas (HEAD)"
for h in "${HEAD[@]}"; do brew_install "$h" "--HEAD"; done
h2 "brew formulas"
for f in "${FORMULAS[@]}"; do brew_install "$f"; done
h2 "brew casks"
for f in "${CASKS[@]}"; do cask_install "$f"; done
h2 "pip modules"
for e in "${EGGS[@]}"; do pip_install "$e"; done

#!/usr/bin/env bash

PATH=/usr/local/bin:$PATH

source "${BASH_SOURCE%/*}/lib.sh"

TAPS=(
    homebrew/dupes
    caskroom/cask
    caskroom/fonts
)

HEAD=(
#    neovim/neovim/neovim
)

EGGS=(
    neovim
)

FORMULAS=(
    awk
    bash
    bazaar
    coreutils
    curl
    diffutils
    findutils
    fish
    fzf
    ghq
    git
    gnu-sed
    gnu-tar
    grep
    iftop
    jump
    less
    make
    mercurial
    moreutils
    neovim
    openssh
    pam_yubico
    pstree
    python
    python3
    ripgrep
    rsync
    subversion
    tree
    watch
    wget
    xz
)

CASKS=(
    font-fira-code
)

h1 "base"
h2 "brew taps"
for t in "${TAPS[@]}"; do brew_tap "$t"; done
h2 "brew formulas (HEAD)"
for h in "${HEAD[@]}"; do brew_install "$h" "--HEAD"; done
h2 "brew formulas"
for f in "${FORMULAS[@]}"; do brew_install "$f"; done
h2 "brew casks"
for f in "${CASKS[@]}"; do cask_install "$f"; done
h2 "pip modules"
for e in "${EGGS[@]}"; do pip_install "$e"; done


Установка свободной реализации Win32 API "Wine" и "Winetricks" на Ubuntu.

#!/bin/bash
set -x  # echo on

# Wine is a free and open-source compatibility layer that aims to allow computer programs developed for Microsoft Windows to run on Unix-like operating systems.
# Winetricks is a script to install some basic components (typically Microsoft DLLs and fonts) and tweak settings required for some applications to run correctly under Wine.

sudo apt-get install wine

sudo apt-get install winetricks

winetricks comctl32
winetricks mfc42
winetricks vcrun6

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


Added Script to install qiime

Added Script to install qiime

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/chistogo/bio-cloud.git/'


shell script to run all the get_* download scripts

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


Stupid script check to detect extranous "@"-identifiers

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


Update install.sh

Update install.sh

#!/bin/bash -e

echo "================ Installing openjdk11-installer ================="
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install -y openjdk-11-jdk --allow-unauthenticated

echo "================ Installing oracle-java11-installer ================="
export ORACLEJDK_VERSION=11
mkdir -p /usr/lib/jvm && cd /usr/lib/jvm
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.deb
tar -xzf jdk-"$ORACLEJDK_VERSION"_linux-x64_bin.tar.gz
mv jdk-"$ORACLEJDK_VERSION"/ java-11-oraclejdk-amd64
echo 'export JAVA_HOME=/usr/lib/jvm/java-11-oraclejdk-amd64' >> /etc/drydock/.env
echo 'export PATH=$PATH:/usr/lib/jvm/java-11-oraclejdk-amd64/bin' >> /etc/drydock/.env
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-11-oraclejdk-amd64/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-11-oraclejdk-amd64/bin/javac 1
sudo update-alternatives --set java /usr/lib/jvm/java-11-oraclejdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-11-oraclejdk-amd64/bin/javac

#!/bin/bash -e

echo "================ Installing openjdk11-installer ================="
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt install -y openjdk-11-jdk --allow-unauthenticated
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-11-openjdk-amd64/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac 1
sudo update-alternatives --set java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-11-openjdk-amd64/bin/javac

echo "================ Installing oracle-java11-installer ================="
export ORACLEJDK_VERSION=11
mkdir -p /usr/lib/jvm && cd /usr/lib/jvm
wget --no-check-certificate -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/11+28/55eed80b163941c8885ad9298e6d786a/jdk-11_linux-x64_bin.deb
tar -xzf jdk-"$ORACLEJDK_VERSION"_linux-x64_bin.tar.gz
mv jdk-"$ORACLEJDK_VERSION"/ java-11-oraclejdk-amd64
echo 'export JAVA_HOME=/usr/lib/jvm/java-11-oracle' >> /etc/drydock/.env
echo 'export PATH=$PATH:/usr/lib/jvm/java-11-oracle/jre/bin' >> /etc/drydock/.env


Improve join function

Improve join function

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/Motiejus/riak_damage.git/'


Deploy to S3

Deploy to S3

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/Craftware/Kornell.git/'


Optionally start Impala with 'perf' tracing

Similar to how we can start Impala under gdb, this patch adds a '-perf'
flag to start-impalad.sh that starts Impala with perf tracing
enabled. By default, tracing is recorded at 99Hz, and after Impala
terminates the summary is written to `pwd`/perf.data.

Arguments to perf can be overridden by setting PERF_ARGS in the
environment of start-impalad.sh.

Change-Id: Iad5717fa8e2d9b1da0d95f8e8fa27341a2e86fa5
Reviewed-on: http://gerrit.cloudera.org:8080/1635
Reviewed-by: Henry Robinson <3eca10f30041813f045165784e24b5a950a6cc7e@cloudera.com>
Tested-by: Internal Jenkins

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/kapilrastogi/Impala.git/'


workaround for tim

workaround for tim

#!/bin/bash

alias python3="LD_LIBRARY_PATH='${HOME}/utils/libc6_2.17/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH}' '${HOME}/utils/libc6_2.17/lib/x86_64-linux-gnu/ld-2.17.so' $(command -v python3)"

mkdir -p logs/predicate/wn18/

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 1 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_1.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 1 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_1.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.9 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_0.9.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.9 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_0.9.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.8 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_0.8.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.8 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_0.8.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.7 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_0.7.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.7 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_0.7.tx 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.6 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_0.6.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.6 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_0.6.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.5 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_10_0.5.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.5 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 10 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_10_0.5.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 1 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_1.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 1 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_1.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.9 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_0.9.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.9 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_0.9.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.8 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_0.8.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.8 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_0.8.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.7 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_0.7.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.7 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_0.7.tx 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.6 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_0.6.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.6 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_0.6.txt 2>&1

python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.5 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 100 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_ASR_0_0.5.txt 2>&1
python3 ./bin/adv-cli.py --train data/wn18/wordnet-mlj12-train.txt --valid data/wn18/wordnet-mlj12-valid.txt --test data/wn18/wordnet-mlj12-test.txt --clauses data/wn18/clauses/clauses_0.9.pl --nb-epochs 100 --lr 0.1 --nb-batches 10 --model ComplEx --similarity dot --margin 1 --embedding-size 200 --subsample-size 0.5 --loss hinge --adv-lr 0.1 --adv-init-ground --adversary-epochs 0 --discriminator-epochs 10 --adv-weight 0 --adv-batch-size 10 --debug-results > logs/predicate/wn18/ComplEx_0_0.5.txt 2>&1

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


Update awscli-deleteBuckets.sh

Update awscli-deleteBuckets.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/'


Create centos6.sh

Create centos6.sh

#!/bin/bash

# initialisasi var
OS=`uname -m`;
MYIP=`ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0'`;
MYIP2="s/xxxxxxxxx/$MYIP/g";

# go to root
cd

# set locale
sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
service sshd restart

# disable ipv6
echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local
sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.d/rc.local

# install wget and curl
yum -y install wget curl

# setting repo
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh epel-release-6-8.noarch.rpm
rpm -Uvh remi-release-6.rpm

if [ "$OS" == "x86_64" ]; then
  wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
  rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
else
  wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
  rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.i686.rpm
fi

sed -i 's/enabled = 1/enabled = 0/g' /etc/yum.repos.d/rpmforge.repo
sed -i -e "/^\[remi\]/,/^\[.*\]/ s|^\(enabled[ \t]*=[ \t]*0\\)|enabled=1|" /etc/yum.repos.d/remi.repo
rm -f *.rpm

# remove unused
yum -y remove sendmail;
yum -y remove httpd;
yum -y remove cyrus-sasl

# update
yum -y update

# install webserver
yum -y install nginx php-fpm php-cli
service nginx restart
service php-fpm restart
chkconfig nginx on
chkconfig php-fpm on

# install essential package
yum -y install rrdtool screen iftop htop nmap bc nethogs openvpn vnstat ngrep mtr git zsh mrtg unrar rsyslog rkhunter mrtg net-snmp net-snmp-utils expect nano bind-utils
yum -y groupinstall 'Development Tools'
yum -y install cmake

yum -y --enablerepo=rpmforge install axel sslh ptunnel unrar

# matiin exim
service exim stop
chkconfig exim off

# setting vnstat
vnstat -u -i venet0
echo "MAILTO=root" > /etc/cron.d/vnstat
echo "*/5 * * * * root /usr/sbin/vnstat.cron" >> /etc/cron.d/vnstat
sed -i 's/eth0/venet0/g' /etc/sysconfig/vnstat
service vnstat restart
chkconfig vnstat on

# install screenfetch
cd
curl -L https://raw.github.com/KittyKatt/screenFetch/master/screenfetch-dev > screenfetch-dev
mv screenfetch-dev /usr/bin/screenfetch
chmod +x /usr/bin/screenfetch
echo "clear" >> .bash_profile
echo "screenfetch" >> .bash_profile

# install webserver
cd
wget -O /etc/nginx/nginx.conf "https://raw.githubusercontent.com/metaland/centos6/master/nginx.conf"
sed -i 's/www-data/nginx/g' /etc/nginx/nginx.conf
mkdir -p /home/vps/public_html
wget -O /home/vps/public_html/index.html "http://vpsscript.hol.es/index.html"
echo "<?php phpinfo(); ?>" > /home/vps/public_html/info.php
rm /etc/nginx/conf.d/*
wget -O /etc/nginx/conf.d/vps.conf "https://raw.githubusercontent.com/metaland/centos6/master/vps.conf"
sed -i 's/apache/nginx/g' /etc/php-fpm.d/www.conf
chmod -R +rx /home/vps
service php-fpm restart
service nginx restart

# install openvpn
wget -O /etc/openvpn/openvpn.tar "https://raw.githubusercontent.com/metaland/centos6/master/openvpn-debian.tar"
cd /etc/openvpn/
tar xf openvpn.tar
wget -O /etc/openvpn/1194.conf "https://raw.githubusercontent.com/metaland/centos6/master/1194-centos.conf"
if [ "$OS" == "x86_64" ]; then
wget -O /etc/openvpn/1194.conf "https://raw.githubusercontent.com/metaland/centos6/master/1194-centos64.conf"
fi
wget -O /etc/iptables.up.rules "https://raw.githubusercontent.com/metaland/centos6/master/iptables.up.rules"
sed -i '$ i\iptables-restore < /etc/iptables.up.rules' /etc/rc.local
sed -i '$ i\iptables-restore < /etc/iptables.up.rules' /etc/rc.d/rc.local
sed -i $MYIP2 /etc/iptables.up.rules;
iptables-restore < /etc/iptables.up.rules
sysctl -w net.ipv4.ip_forward=1
sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
service openvpn restart
chkconfig openvpn on
cd

# configure openvpn client config
cd /etc/openvpn/
wget -O /etc/openvpn/1194-client.ovpn "https://raw.githubusercontent.com/metaland/centos6/master/1194-client.conf"
sed -i $MYIP2 /etc/openvpn/1194-client.ovpn;
PASS=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n 1`;
useradd -M -s /bin/false KangArie
echo "KangArie:$PASS" | chpasswd
echo "username" > pass.txt
echo "password" >> pass.txt
tar cf client.tar 1194-client.ovpn pass.txt
cp client.tar /home/vps/public_html/
cd

# install badvpn
wget -O /usr/bin/badvpn-udpgw "https://raw.githubusercontent.com/metaland/centos6/master/badvpn-udpgw"
if [ "$OS" == "x86_64" ]; then
wget -O /usr/bin/badvpn-udpgw "https://raw.githubusercontent.com/metaland/centos6/master/badvpn-udpgw64"
fi
sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300' /etc/rc.local
sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300' /etc/rc.d/rc.local
chmod +x /usr/bin/badvpn-udpgw
screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300

# install mrtg
cd /etc/snmp/
wget -O /etc/snmp/snmpd.conf "https://raw.githubusercontent.com/metaland/centos6/master/snmpd.conf"
wget -O /root/mrtg-mem.sh "https://raw.githubusercontent.com/metaland/centos6/master/mrtg-mem.sh"
chmod +x /root/mrtg-mem.sh
service snmpd restart
chkconfig snmpd on
snmpwalk -v 1 -c public localhost | tail
mkdir -p /home/vps/public_html/mrtg
cfgmaker --zero-speed 100000000 --global 'WorkDir: /home/vps/public_html/mrtg' --output /etc/mrtg/mrtg.cfg public@localhost
curl "https://raw.githubusercontent.com/metaland/centos6/master/mrtg.conf" >> /etc/mrtg/mrtg.cfg
sed -i 's/WorkDir: \/var\/www\/mrtg/# WorkDir: \/var\/www\/mrtg/g' /etc/mrtg/mrtg.cfg
sed -i 's/# Options\[_\]: growright, bits/Options\[_\]: growright/g' /etc/mrtg/mrtg.cfg
indexmaker --output=/home/vps/public_html/mrtg/index.html /etc/mrtg/mrtg.cfg
echo "0-59/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg" > /etc/cron.d/mrtg
LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
cd

# setting port ssh
sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config
sed -i '/Port 22/a Port  80' /etc/ssh/sshd_config
sed -i 's/#Port 22/Port  22/g' /etc/ssh/sshd_config
service sshd restart
chkconfig sshd on

# install dropbear
yum -y install dropbear
echo "OPTIONS=\"-p 109 -p 110 -p 443\"" > /etc/sysconfig/dropbear
echo "/bin/false" >> /etc/shells
service dropbear restart
chkconfig dropbear on

# install vnstat gui
cd /home/vps/public_html/
wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz
tar xf vnstat_php_frontend-1.5.1.tar.gz
rm vnstat_php_frontend-1.5.1.tar.gz
mv vnstat_php_frontend-1.5.1 vnstat
cd vnstat
sed -i 's/eth0/venet0/g' config.php
sed -i "s/\$iface_list = array('venet0', 'sixxs');/\$iface_list = array('venet0');/g" config.php
sed -i "s/\$language = 'nl';/\$language = 'en';/g" config.php
sed -i 's/Internal/Internet/g' config.php
sed -i '/SixXS IPv6/d' config.php
cd

# install fail2ban
yum -y install fail2ban
service fail2ban restart
chkconfig fail2ban on

# install squid
yum -y install squid
wget -O /etc/squid/squid.conf "https://raw.githubusercontent.com/metaland/centos6/master/squid-centos.conf"
sed -i $MYIP2 /etc/squid/squid.conf;
service squid restart
chkconfig squid on

# install webmin
cd
wget http://download.webmin.com/download/yum/webmin-1.680-1.noarch.rpm
rpm -Uvh webmin-1.680-1.noarch.rpm
service webmin restart
chkconfig webmin on

# pasang bmon
if [ "$OS" == "x86_64" ]; then
  wget -O /usr/bin/bmon "https://raw.githubusercontent.com/metaland/centos6/master/bmon64"
else
  wget -O /usr/bin/bmon "https://raw.githubusercontent.com/metaland/centos6/master/bmon"
fi
chmod +x /usr/bin/bmon

# downlaod script
cd
curl -L "https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py" > speedtest_cli.py
curl -L "https://raw.github.com/pixelb/ps_mem/master/ps_mem.py" > ps_mem.py
wget -O bench-network.sh "https://raw.githubusercontent.com/metaland/centos6/master/bench-network.sh"
curl https://raw.githubusercontent.com/metaland/centos6/master/user-login.sh > user-login.sh
curl https://raw.githubusercontent.com/metaland/centos6/master/user-expired.sh > user-expired.sh
echo "0 0 * * * root /root/user-expired.sh" > /etc/cron.d/user-expired
chmod +x bench-network.sh
chmod +x speedtest_cli.py
chmod +x ps_mem.py
chmod +x user-login.sh
chmod +x user-expired.sh

# cron
service crond start
chkconfig crond on

# set time GMT +7
ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime

# finalisasi
chown -R nginx:nginx /home/vps/public_html
service nginx start
service php-fpm start
service vnstat restart
service openvpn restart
service snmpd restart
service sshd restart
service dropbear restart
service fail2ban restart
service squid restart
service webmin restart
service crond start
chkconfig crond on

# info
clear
echo "Original Script By Mikodemos Dan Kang Arie | Edited By Metaland | " | tee log-install.txt
echo "===============================================" | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Service"  | tee -a log-install.txt
echo "-------"  | tee -a log-install.txt
echo "OpenVPN  : TCP 1194 (client config : http://$MYIP:81/client.tar)"  | tee -a log-install.txt
echo "OpenSSH  : 22, 80, 143"  | tee -a log-install.txt
echo "Dropbear : 109, 110, 443"  | tee -a log-install.txt
echo "Squid3   : 8080 (limit to IP SSH)"  | tee -a log-install.txt
echo "badvpn   : badvpn-udpgw port 7300"  | tee -a log-install.txt
echo "nginx    : 81"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Tools"  | tee -a log-install.txt
echo "-----"  | tee -a log-install.txt
echo "axel"  | tee -a log-install.txt
echo "bmon"  | tee -a log-install.txt
echo "htop"  | tee -a log-install.txt
echo "iftop"  | tee -a log-install.txt
echo "mtr"  | tee -a log-install.txt
echo "nethogs"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Script"  | tee -a log-install.txt
echo "------"  | tee -a log-install.txt
echo "screenfetch"  | tee -a log-install.txt
echo "./ps_mem.py"  | tee -a log-install.txt
echo "./speedtest_cli.py --share"  | tee -a log-install.txt
echo "./bench-network.sh"  | tee -a log-install.txt
echo "./user-login.sh"  | tee -a log-install.txt
echo "./user-expired.sh"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Account Default (utk SSH dan VPN)"  | tee -a log-install.txt
echo "---------------"  | tee -a log-install.txt
echo "User     : KangArie"  | tee -a log-install.txt
echo "Password : $PASS"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Fitur lain"  | tee -a log-install.txt
echo "----------"  | tee -a log-install.txt
echo "Webmin   : http://$MYIP:10000/"  | tee -a log-install.txt
echo "vnstat   : http://$MYIP:81/vnstat/"  | tee -a log-install.txt
echo "MRTG     : http://$MYIP:81/mrtg/"  | tee -a log-install.txt
echo "Timezone : Asia/Jakarta"  | tee -a log-install.txt
echo "Fail2Ban : [on]"  | tee -a log-install.txt
echo "IPv6     : [off]"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "Log Installasi --> /root/log-install.txt"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "SILAHKAN REBOOT VPS ANDA !"  | tee -a log-install.txt
echo ""  | tee -a log-install.txt
echo "==============================================="  | tee -a log-install.txt

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


Wercker: Add create-wercker.sh

Wercker: Add create-wercker.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/szkl/koding.git/'


added check-build for scipy

added check-build for scipy

module load ci
module load python
module add gcc/4.8.2
module add lapack
module add fftw3/3.3.4
module add numpy

echo $LD_LIBRARY_PATH
echo ""
cd $WORKSPACE/$NAME-$VERSION
python setup.py check

echo $?
if [ $? != 0 ] ; then
  exit 1
fi

python setup.py install --prefix=$SOFT_DIR

mkdir -p modules
(
cat <<MODULE_FILE
#%Module1.0
## $NAME modulefile
##
proc ModulesHelp { } {
    puts stderr "       This module does nothing but alert the user"
    puts stderr "       that the [module-info name] module is not available"
}

module-whatis   "$NAME $VERSION."
setenv       SCIPY_VERSION       $VERSION
setenv       SCIPY_DIR           /apprepo/$::env(SITE)/$::env(OS)/$::env(ARCH)/$NAME/$VERSION
prepend-path LD_LIBRARY_PATH   $::env(SCIPY_DIR)/lib64
prepend-path PYTHONPATH   $::env(SCIPY_DIR)/lib64/python2.6/site-packages
MODULE_FILE
) > modules/$VERSION

mkdir -p $LIBRARIES_MODULES/$NAME
cp modules/$VERSION $LIBRARIES_MODULES/$NAME

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


Add EMR bootstrap script

Add EMR bootstrap script

#!/bin/bash

echo s3 location of RPM and EBF
export S3_LOCATION_RPM=s3://bdm-awsmarketplace

echo Temp location to extract the RPM
export TEMP_DIR=/tmp/temp_infa

echo Default location to install Informatica RPM
export INFA_RPM_INSTALL_HOME=/opt/Informatica

echo Extracting the prefix part from the rpm file name
echo The rpm installer name would be InformaticaHadoop-10.1.0-1.364.x86_64.tar.gz
export INFA_RPM_FILE_PREFIX=InformaticaHadoop-10.1.0-1.364

echo Extracting the prefix part from the ebf file name
echo The ebf rpm installer name would be EBF17557_HadoopEBF.x86_64.tar.gz
export INFA_RPM_EBF_PREFIX=EBF17557_HadoopEBF

echo S3_LOCATION_RPM = $S3_LOCATION_RPM
echo TEMP_DIR = $TEMP_DIR
echo INFA_RPM_INSTALL_HOME = $INFA_RPM_INSTALL_HOME
echo INFA_RPM_FILE_PREFIX = $INFA_RPM_FILE_PREFIX
echo INFA_RPM_EBF_PREFIX = $INFA_RPM_EBF_PREFIX

echo  Installing the RPM:
echo "Creating temporary folder for rpm extraction"
sudo mkdir -p $TEMP_DIR
cd $TEMP_DIR/
echo "current directory =" $(pwd)

echo Getting RPM installer
echo Copying the rpm installer $S3_LOCATION_RPM/$INFA_RPM_FILE_PREFIX.x86_64.tar.gz to $(pwd)
sudo aws s3 cp $S3_LOCATION_RPM/$INFA_RPM_FILE_PREFIX.x86_64.tar.gz .
sudo tar -zxvf $INFA_RPM_FILE_PREFIX.x86_64.tar.gz
cd $INFA_RPM_FILE_PREFIX
echo Installing RPM to $INFA_RPM_INSTALL_HOME
echo Running rpm2cpio command
sudo rpm2cpio InformaticaHadoop-10.1.0-1.x86_64.rpm | sudo cpio -idmv
sudo mkdir $INFA_RPM_INSTALL_HOME
cd opt/
sudo mv Informatica/* $INFA_RPM_INSTALL_HOME/
echo Contents of $INFA_RPM_INSTALL_HOME
echo $(ls $INFA_RPM_INSTALL_HOME)

echo chmod
cd $INFA_RPM_INSTALL_HOME
sudo chmod 777 -R $INFA_RPM_INSTALL_HOME
echo removing temporary folder
sudo rm -rf $TEMP_DIR/

echo Applying the EBF:
echo Creating temporary folder
sudo mkdir -p $TEMP_DIR
cd $TEMP_DIR/
echo Getting EBF installer
sudo aws s3 cp $S3_LOCATION_RPM/"$INFA_RPM_EBF_PREFIX"_EBFInstaller.tar .
echo Applying EBF installer to $INFA_RPM_INSTALL_HOME
sudo tar -xvf "$INFA_RPM_EBF_PREFIX"_EBFInstaller.tar
cd $INFA_RPM_EBF_PREFIX
sudo -S ./InformaticaHadoopEBFInstall.sh <<< $1$'\nYes\n1\n'

echo chmod
cd $INFA_RPM_INSTALL_HOME
sudo chmod 777 -R $INFA_RPM_INSTALL_HOME
echo Removing temporary folder
sudo rm -rf $TEMP_DIR/

echo done

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


Bash script for carrying our empirical distance decay analysis.R

commName=$2

metricsToCalc="sorensen varWithin"

dataType="abu binary"

if [ $1 == unc ]
then
  for i in $commName
  do
    for j in $metricsToCalc
    do
      for k in $dataType
      do
        bsub -q week -J $commName\
        Rscript spat_empir_analysis.R $i $j $k\
        -o "error_${j}_${k}_${i}.log"
      done
    done
  done
fi

if [ $1 == usu ]
then
  for i in $commName
  do
    for j in $metricsToCalc
    do
      for k in $dataType
      do
        Rscript spat_empir_analysis.R $i $j $k\
        >"error_${j}_${k}_${i}.log" 2>&1 &
      done
    done
  done
fi

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


Script to install bosh cli

Script to install bosh cli

#!/bin/bash -ex

apt-get update

apt-get install -y libxslt-dev libxml2-dev

gem install bosh_cli --no-ri --no-rdoc

# Plugin required for 'bosh aws create' and bootstrap commands
gem install bosh_cli_plugin_aws --no-ri --no-rdoc

# Plugin required for deploying MicroBOSH
gem install bosh_cli_plugin_micro --no-ri --no-rdoc

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


updated rsync flags in deploy script

updated rsync flags in deploy script

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/ministryofjustice/mojintranet-theme.git/'


unused line

unused line

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

#!/bin/bash

WHEN=$(date -d "yesterday" +%Y-%m-%d)

php @APP_DIR@/scripts/findEntriesSizes.php $WHEN >> @LOG_DIR@/`hostname`-findEntriesSizes.log
php @APP_DIR@/alpha/batch/batchPartnerUsage.php >> @LOG_DIR@/`hostname`-BatchPartnerUsage_upgradeProcess.log 2>&1

#!/bin/bash

cd @LOG_DIR@

WHEN=$(date -d "yesterday" +%Y-%m-%d)

php @APP_DIR@/scripts/findEntriesSizes.php $WHEN >> @LOG_DIR@/`hostname`-findEntriesSizes.log
php @APP_DIR@/alpha/batch/batchPartnerUsage.php >> @LOG_DIR@/`hostname`-BatchPartnerUsage_upgradeProcess.log 2>&1


Fix issues with postgres install

Fix issues with postgres install

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/regan-sarwas/places-api.git/'


bump build-release to use golang 1.9.2

bump build-release to use golang 1.9.2

#!/usr/bin/env bash
set -euo pipefail

BOOTKUBE_ROOT=$(git rev-parse --show-toplevel)
sudo rkt run \
    --volume bk,kind=host,source=${BOOTKUBE_ROOT} \
    --mount volume=bk,target=/go/src/github.com/kubernetes-incubator/bootkube \
    --insecure-options=image docker://golang:1.9.2 --exec /bin/bash -- -c \
    "cd /go/src/github.com/kubernetes-incubator/bootkube && make release"

#!/usr/bin/env bash
set -euo pipefail

BOOTKUBE_ROOT=$(git rev-parse --show-toplevel)
sudo rkt run \
    --volume bk,kind=host,source=${BOOTKUBE_ROOT} \
    --mount volume=bk,target=/go/src/github.com/kubernetes-incubator/bootkube \
    --insecure-options=image docker://golang:1.8.4 --exec /bin/bash -- -c \
    "cd /go/src/github.com/kubernetes-incubator/bootkube && make release"


add aur_install.sh

add aur_install.sh

#!/usr/bin/bash

echo "install Android..."
yaourt -S --needed
android-tools android-udev-git \
android-sdk android-sdk-platform-tools android-sdk-build-tools \
android-platform android-ndk \
android-studio android-apktool
echo "install Android Done"

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


Add solution to question 193

Add solution to question 193

# Read from the file file.txt and output all valid phone numbers to stdout.

egrep "^([0-9]{3}-|\([0-9]{3}\) )[0-9]{3}-[0-9]{4}$" file.txt

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


WIP macosx build script

WIP macosx build script

#!/usr/bin/env bash
# Script to build Openfire Mac DMG artifact
set -x

export OPENFIRE_FULLVERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
export OPENFIRE_VERSION=$(echo "${OPENFIRE_FULLVERSION}" | cut -d'-' -f1)
export VERSION_MAJOR=$(echo "${OPENFIRE_VERSION}" | cut -d'.' -f1)
export VERSION_MINOR=$(echo "${OPENFIRE_VERSION}" | cut -d'.' -f2)
export TARGET_OSX=distribution/build/osx
export MAC_PKG_DIR=${TARGET_OSX}/macpkg
export MAC_DMG_DIR=${TARGET_OSX}/Openfire
export MAC_DMG_FILE=openfire.dmg
export MAC_TEMPLATE=${TARGET_OSX}/template
export MAC_PREFPANE_BUILD=${TARGET_OSX}/prefPane
export COPYRIGHTYEAR=$(date +'%Y')

# replicating ant target mac.delete
rm -rf ${TARGET_OSX}
rm -f $MAC_DMG_FILE

# replicating ant target mac.prefpane
mkdir -p $MAC_PREFPANE_BUILD
cp -R build/osx/openfirePrefPane/* $MAC_PREFPANE_BUILD/
cd $MAC_PREFPANE_BUILD
/usr/bin/xcodebuild -configuration Deployment -target Openfire clean install
cd ../../../..

# replicating ant target mac.prepare
mkdir -p $MAC_PKG_DIR/usr/local/openfire
cp -R distribution/target/distribution-base/. $MAC_PKG_DIR/usr/local/openfire/
mkdir -p $MAC_PKG_DIR/Library/LaunchDaemons
cp build/osx/org.jivesoftware.openfire.plist $MAC_PKG_DIR/Library/LaunchDaemons
mkdir -p $MAC_DMG_DIR
mkdir -p $MAC_PKG_DIR/Library/PreferencePanes
# <copy todir="${mac.pkg.dir}/Library/PreferencePanes">
#            <fileset dir="${mac.prefpane.build}/build/UninstalledProducts/"/>
#        </copy>
#        <chmod perm="o+x">
#            <fileset dir="${mac.pkg.dir}/Library/PreferencePanes/Openfire.prefPane/Contents/MacOS/">
#                <include name="HelperTool"/>
#            </fileset>
#        </chmod>
mkdir -p $MAC_TEMPLATE/.background
cp build/osx/dmgBackground.png $MAC_TEMPLATE/.background/

# replicating ant target mac.pkg
cp build/osx/Info.plist $TARGET_OSX/
sed -i.bak s/@VERSION@/${OPENFIRE_VERSION}/g $TARGET_OSX/Info.plist
sed -i.bak s/@VERSIONMAJOR@/"${VERSION_MAJOR}"/g $TARGET_OSX/Info.plist
sed -i.bak s/@VERSIONMINOR@/"${VERSION_MINOR}"/g $TARGET_OSX/Info.plist
sed -i.bak s/@COPYRIGHT@/"${COPYRIGHTYEAR}"/g $TARGET_OSX/Info.plist

cp build/osx/Description.plist $TARGET_OSX/

# -proj build/osx/openfire.pmproj
/Developer/usr/bin/packagemaker -build \
  -f ${MAC_PKG_DIR} \
  -i ${TARGET_OSX}/Info.plist \
  -d ${TARGET_OSX}/Description.plist \
  -r build/osx/resources \
  -p ${MAC_TEMPLATE}/Openfire.pkg \
  -ds \
  -v

# replicating mac target installer.mac
mkdir -p distribution/target/macosx
hdiutil create -srcfolder "${MAC_TEMPLATE}" -volname 'Openfire' \
  -fs HFS+ -fsargs '-c c=64,a=16,e=16' \
  -format UDRW "${TARGET_OSX}/tmp.dmg"

hdiutil attach "${TARGET_OSX}/tmp.dmg" -readwrite -noverify \
  -noautoopen -noidme -mountpoint "${MAC_DMG_DIR}"

hdiutil detach ${MAC_DMG_DIR} -quiet -force

hdiutil convert ${TARGET_OSX}/tmp.dmg -format UDZO \
  -imagekey zlib-level=9 -o ${MAC_DMG_DIR}

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


Adds simple script

Adds simple script

echo "Remoting inside relay"
ssh router.LB-LLD.SAFER.isi.deterlab.net "./dissent/pings.sh"

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


working version of alignment accuracy

working version of alignment accuracy

#!/usr/bin/env bash
set -ex

FASTA=../data/human_g1k_v37.fa.gz
FASTQ_PREFIX=../generating-reads/HG00119-reads
BAM=HG00119-bwa.bam

bwa mem \
  ${FASTA} \
  ${FASTQ_PREFIX}-corrupt1.fq.gz \
  ${FASTQ_PREFIX}-corrupt2.fq.gz | samtools view -bSho temp.bam
samtools sort temp.bam > ${BAM}
samtools index ${BAM}

mitty -v4 debug alignment-analysis process\
  ${BAM} \
  ${FASTQ_PREFIX}-corrupt-lq.txt \
  ${BAM}.alignment.npy \
  --fig-prefix ${BAM}.alignment \
  --max-d 200 \
  --max-size 50 \
  --plot-bin-size 10

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


miniconda3

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/Amber-MD/ambertools-conda-build.git/'


Add scripts to generate doxyfile

Add scripts to generate doxyfile

#!/bin/bash

script_dir=$(cd $(dirname ${0});pwd)
path_to_repository=${script_dir}/../generalized_niederreiter_sequence
repository_name=$(basename ${path_to_repository})
path_to_repository_in_docker=/tmp/${REPOSITORY_NAME}

docker run -it --rm \
  --volume ${path_to_repository}:${path_to_repository_in_docker} \
  sphinx-breathe:alpine-1.6.3 \
  doxygen -g ${path_to_repository_in_docker}/Doxyfile

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


Print the user names of pushers that violate a given pre-receive-hook

#!/usr/bin/env bash
#
# Print the GitHub user names of pushers that violate a given
# pre-receive-hook.
#
# Usage:
#   pre-receive-hook-violator.sh [OPTIONS] [<pre-receive-hook>]
#
# Options:
#   -a, --all     Process all available logs (rolled logs
#   -n            Dry-run; only show what would be done.
#   -h, --help    Display this message.
#
# Example:
#   pre-receive-hook-violator.sh reject-external-email.sh
#

BASE_DIR=$(cd "${0%/*}/.." && pwd)
. "$BASE_DIR/lib-ghe.sh"

while [ $# -gt 0 ]; do
    case $1 in
        (-a|--all)      all_logs; shift;;
        (-h|--help)     usage 2>&1;;
        (-n)            DRY_RUN=1; shift;;
        (--)            shift; break;;
        (-*)            usage "$1: unknown option";;
        (*) break;;
    esac
done

HOOK_SCRIPT_NAME=$1
if [ -z "$HOOK_SCRIPT_NAME" ]; then
    usage "Hook script name must not be empty."
fi

execute << EOF
    zgrep -hF '${HOOK_SCRIPT_NAME}: failed with exit status' /var/log/github/audit.$LOG |
        perl -nE 'say /actor":"([^"]+)/' |
        sort -u
    printf "\nExecution timeouts: "
    zgrep -hF '${HOOK_SCRIPT_NAME}: execution exceeded' /var/log/github/audit.$LOG | wc -l
EOF

error: pathspec 'reports/pre-receive-hook-violator.sh' did not match any file(s) known to git


A little error with string substitution

A little error with string substitution

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/jjuarez/mydotfiles.git/'


Forgot to add this one.

Forgot to add this one.

#! /bin/sh

if [ -z $1 ]; then
  echo "I need a .pem file to work with."
  exit
fi

if [ `grep -c "BEGIN X509 CRL" $1` -gt 0 ]; then
  echo "File contains a CRL"
  HASH=`openssl crl -hash -noout -inform PEM -in "$1"`
  echo "Hash is: $HASH"

  for i in `seq 0 10`; do
    if [ ! -f $HASH.r$i ]; then
      ln -s "$1" $HASH.r$i
      break
    else
      echo "Link $HASH.r$i is already used"
    fi
  done
else
  if [ ` grep -c "BEGIN CERTIFICATE" $1` -gt 0 ]; then
    echo "File contains a certificate"
    HASH=`openssl x509 -hash -noout -inform PEM -in "$1"`
    echo "Hash is: $HASH"

    for i in `seq 0 10`; do
      if [ ! -f $HASH.$i ]; then
        ln -s "$1" $HASH.$i
        break
      else
        echo "Link $HASH.$i is already used"
      fi
    done
  else
    echo "That file doesn't contain a CRL or a certificate."
  fi
fi

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


dont delete in rsync

dont delete in rsync

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/sleepbusorg/sleepbus.org.git/'


Create Symbols plugin

Create Symbols plugin

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/lpireyn/super-bash.git/'


Install script. Danger.

Install script. Danger.

#!/bin/bash

sudo apt-get update

sudo apt-get install -y python3.2 python-pip python-virtualenv

virtualenv .venv

source .venv/bin/activate

pip install -r requirements.txt

python tally.py

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


Set everything in install inside a function

This is to prevent problems in case the connection gets dropped when
getting it, as per the command in the README

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/'


Improve install script by checking file exists

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/TheoKouzelis/my-dev-env.git/'


Fix bash return when exit was needed

Fix bash return when exit was needed

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/jakedex/dotfiles.git/'


Initial commit

Initial 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/B-LUC/logstash-rule-webui.git/'


Add LBRY to mine.sh

Add LBRY to mine.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/GrantSheehan/nvidia-cryptomining-install.git/'


bash on ubuntu

bash on ubuntu

#!/bin/bash

apt-get update
add-apt-repository ppa:aseering/wsl
apt-get update
apt-get install python-pip ipython ipython-notebook
ipython notebook --no-browser


Create install.sh

Create install.sh

#!/bin/bash

set -e

if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit
fi

if [ -z "$1" ] ; then
  echo "Usage: $0 /dev/sdX"
  exit 1
fi

SDX="$1" # /dev/sdX

if [ ! -e "$1" ] ; then
  echo "$1 does not exist"
fi

mntpart=$(mount | grep "$SDX" | head -n 1 | cut -d " " -f 3)
if [ "" != "$mntpart" ] ; then
  if [ ! -e "$mntpart" ] ; then
    echo "$mntpart does not exist"
  fi
  echo "$SDX is mounted to $mntpart and currently contains:"
  ls "$mntpart"
fi

echo "Format this disk and install SystemImageKit?"

echo "Everything on all partitions of this disk will be deleted!"

read -p "Are you sure? " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    exit 0
fi

read -p "Are you really sure? " -n 1 -r
echo    # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
    exit 0
fi

echo "Continuing..."

# On the desktop, stop automatic mounting of disks
systemctl stop udisks2.service

umount $SDX* || true

# Make one partition
echo 'start=2048, type=0b' | sfdisk $SDX

# Make first partition bootable
sfdisk -A $SDX 1

# Format
mkfs.vfat "$SDX"1

# Mount
mount "$SDX"1 /mnt/

# Install SystemImageKit
apt-get -y install git
git clone https://github.com/probonopd/SystemImageKit.git /mnt

# Clear the gap between the boot sector and the first partition
# to prevent from GRUB having issues being installed
dd if=/dev/zero of=$SDX seek=1 count=2047

# Install bootloader for PC
# Tested with grub-install (GRUB) 2.02~beta2-9 from Ubuntu 14.04 LTS Trusty Tahr
# and with grub2-install (GRUB) 2.02~beta2 from Fedora 22 (Rawhide)
grub-install --boot-directory=/mnt/boot/ $SDX || true # Ubuntu
grub2-install --boot-directory=/mnt/boot/ $SDX || true # Fedora

# Install bootloader for Mac
apt-get -y install grub-efi-amd64
mkdir -p /mnt/boot/efi
sudo grub-install --target=x86_64-efi --efi-directory=/mnt/boot/EFI --boot-directory=/mnt/boot/ "$SDX"1 || true
mkdir -p /mnt/EFI/BOOT
find /mnt/boot/ -name grubx64.efi -exec cp {} /mnt/EFI/BOOT/bootx64.efi \;

# Generate additional initrd (gets loaded in addition to the one on the ISO)
/mnt/boot/iso/additional-initramfs/generate

# Download Ubuntu ISO

if [ -e "/isodevice/boot/iso/xubuntu-18.04-desktop-amd64.iso" ] ; then
  cp "/isodevice/boot/iso/xubuntu-18.04-desktop-amd64.iso" /mnt/boot/iso/
else
  wget -c "http://cdimage.ubuntu.com/xubuntu/releases/18.04/release/xubuntu-18.04-desktop-amd64.iso" -O /mnt/boot/iso/xubuntu-18.04-desktop-amd64.iso
fi

# Configure bootloader
/mnt/boot/bin/detect

# Create and install ExtensionImages, e.g., for Adobe Flash Player and proprietary firmware
bash /mnt/boot/bin/generate-appimaged-extension
bash /mnt/boot/bin/generate-b43firmware-extension
bash /mnt/boot/bin/generate-dymo-extension
umount /mnt

# The disk should now be bootable

# On the desktop, stop automatic mounting of disks
systemctl start udisks2.service


add install script

add install script

mkdir -p $HOME/hovercraft &&
# download tar file and untar in ~/hovercraft
# put .desktop file into autostart folder
curl http://now.she.codes/hovercraft/hovercraft.tar.gz | tar -xz -C $HOME/hovercraft &&

cat << EOF > $HOME/.config/autostart/hovercraft.desktop
[Desktop Entry]
Name[en]=Hovercraft
Name[de]=Hovercraft
Comment[en]=for Cordula
Comment[de]=für Cordula
Exec=$HOME/hovercraft/hovercraft-linux-x64/hovercraft\n
Icon=application-default-icon
X-GNOME-Autostart-enabled=true
Type=Application
EOF


install script for docker and compose

install script for docker and compose

wget -qO- https://get.docker.com/ | sh
curl -L https://github.com/docker/compose/releases/download/1.4.2/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose


Always install casperjs (ref #50)

Always install casperjs (ref #50)

#!/usr/bin/env bash

# Make sure only root can run our script
if [ "$(id -u)" == "0" ]; then
   echo "This script must NOT be run as root" 1>&2
   exit 2
fi

# Make sure script runs from source root
if [ ! -f Makefile ]; then
   echo "This script must be run from source folder (c.f. README)" 1>&2
   exit 3
fi

#
# Redirect whole output to log file
#----------------------------------
exec > >(tee install.log)
exec 2>&1

#
#  Install system dependencies
#.............................

dev=false

usage () {
    cat <<- _EOF_
Usage: Install project [OPTIONS]
    -d, --dev    install dev tools
    -h, --help    show this help
_EOF_
    return
}

database_exists () {
    # /!\ Will return false if psql can't list database. Edit your pg_hba.conf
    # as appropriate.
    if [ -z $1 ]
    then
        # Argument is null
        return 0
    else
        # Grep db name in the list of database
        sudo -n -u postgres -s -- psql -tAl | grep -q "^$1|"
        return $?
    fi
}

user_exists () {
    # /!\ Will return false if psql can't list database. Edit your pg_hba.conf
    # as appropriate.
    if [ -z $1 ]
    then
        # Argument is null
        return 0
    else
        exists=`sudo -n -u postgres -s -- psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='$1'" | wc -l`
        return $exists
    fi
}

ini_value () {
    return $(sed -n 's/.*$2 *= *\([^ ]*.*\)/\1/p' < $1)
}

while [[ -n $1 ]]; do
    case $1 in
        -d | --dev )        dev=true
                            ;;
        -h | --help )       usage
                            exit
                            ;;
        *)                  usage
                            exit
                            ;;
    esac
    shift
done

function ubuntu_precise {
    set -x

    sudo apt-get update > /dev/null
    sudo apt-get install -y python-software-properties
    sudo apt-add-repository -y ppa:ubuntugis/ubuntugis-unstable
    sudo apt-add-repository -y ppa:sharpie/postgis-stable
    sudo apt-get update > /dev/null
    sudo apt-get install -y git gettext python-virtualenv build-essential python-dev unzip
    sudo apt-get install -y libjson0 libgdal1 libgdal-dev libproj0 libgeos-c1
    sudo apt-get install -y postgresql-client postgis-bin gdal-bin

    # Default settings if not any
    mkdir -p etc/
    settingsfile=etc/settings.ini
    if [ ! -f $settingsfile ]; then
        if [ -f caminae/conf/settings.ini.sample ]; then
            cp caminae/conf/settings.ini.sample $settingsfile
        else
            echo "# WARNING : empty configuration ! Use model file 'settings.ini.sample'" > $settingsfile
        fi
    fi
    # Prompt user to edit/review settings
    vim -c 'startinsert' $settingsfile

    #
    # If database is local, check it !
    #----------------------------------
    dbname=`ini_value $settingsfile dbhost`
    dbhost=`ini_value $settingsfile dbname`
    dbpassword=`ini_value $settingsfile dbpassword`

    if [ ${dbhost} == "localhost" ] ; then
        echo "Installing postgresql server locally..."
        sudo apt-get install -y postgresql postgresql-9.1-postgis2 postgresql-server-dev-9.1

        # Activate PostGIS in database
        if ! database_exists ${dbname}
        then
            sudo -n -u postgres -s -- psql -c "CREATE DATABASE ${dbname};"
            sudo -n -u postgres -s -- psql -d ${dbname} -c "CREATE EXTENSION postgis;"
        fi

        # Create user if missing
        if ! user_exists ${dbuser}
        then
            sudo -n -u postgres -s -- psql -c "CREATE USER ${dbuser} WITH PASSWORD '${dbpassword}';"
            sudo -n -u postgres -s -- psql -c "GRANT ALL PRIVILEGES ON DATABASE ${dbname} TO ${dbuser};"

            # Open local and host connection for this user as md5
            sudo cat >> /etc/postgresql/9.1/main/pg_hba.conf << _EOF_
# Automatically added by Caminae installation :
local    ${dbname}    ${dbuser}        md5
host     ${dbname}    ${dbuser}        md5
_EOF_
            sudo /etc/init.d/postgresql restart
        fi
    else
        # Check that database connection is correct
        dbport=$(sed -n 's/.*dbport *= *\([^ ]*.*\)/\1/p' < $settingsfile)
        export PGPASSWORD=$dbpassword
        psql $dbname -h $dbhost -p $dbport -U $dbuser -c "SELECT NOW();"
        result=$?
        export PGPASSWORD=
        if [ ! $result -eq 0 ]
        then
            echo "Failed to connect to database with settings provided in '$settingsfile'."
            echo "Check your postgres configuration (``pg_hba.conf``) : it should allow md5 identification for user '${dbuser}' on database '${dbname}'"
            exit 4
        fi
    fi

    mkdir -p lib/
    cd lib/

    wget http://phantomjs.googlecode.com/files/phantomjs-1.6.0-linux-x86_64-dynamic.tar.bz2 -O phantomjs.tar.bz2
    tar -jxvf phantomjs.tar.bz2
    rm phantomjs.tar.bz2
    cd *phantomjs*
    sudo ln -sf `pwd`/bin/phantomjs /usr/local/bin/phantomjs
    cd ..

    wget https://github.com/n1k0/casperjs/zipball/0.6.10 -O casperjs.zip
    unzip -o casperjs.zip > /dev/null
    rm casperjs.zip
    cd *casperjs*
    sudo ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
    cd ..

    cd ..

    if $dev ; then
        # A postgis template is required for django tests
        if [ ${dbhost} == "localhost" ] ; then
            if ! database_exists template_postgis
            then
                sudo -n -u postgres -s -- createdb template_postgis
                sudo -n -u postgres -s -- psql -d template_postgis -c "CREATE EXTENSION postgis"
                sudo -n -u postgres -s -- psql -d template_postgis -c "VACUUM FREEZE"
                sudo -n -u postgres -s -- psql -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'"
                sudo -n -u postgres -s -- psql -c "UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template_postgis'"

                # Listen to all network interfaces (useful for VM etc.)
                listen="'*'"
                sudo sed -i "s/^#listen_addresses.*$/listen_addresses = $listen/" /etc/postgresql/9.1/main/postgresql.conf
                sudo /etc/init.d/postgresql restart
            fi
        fi
    else
        sudo apt-get install -y nginx
        sudo apt-get install -y yui-compressor

        make deploy

        sudo rm /etc/nginx/sites-enabled/default
        sudo cp etc/nginx.conf /etc/nginx/sites-enabled/default
        sudo /etc/init.d/nginx restart

        sudo cp etc/init/supervisor.conf /etc/init/supervisor.conf
        sudo start supervisor
    fi

    set +x

    sudo chmod 600 install.log
    echo "Output is available in 'install.log'"
    echo "Done."
}

printf "Target operating system [precise]: "
while read options; do
  case "$options" in
    "")         ubuntu_precise
                exit
                ;;
    precise)    ubuntu_precise
                exit
                ;;
    *) printf "Incorrect value option!\nPlease enter the correct value: " ;;
  esac
done

#!/usr/bin/env bash

# Make sure only root can run our script
if [ "$(id -u)" == "0" ]; then
   echo "This script must NOT be run as root" 1>&2
   exit 2
fi

# Make sure script runs from source root
if [ ! -f Makefile ]; then
   echo "This script must be run from source folder (c.f. README)" 1>&2
   exit 3
fi

#
# Redirect whole output to log file
#----------------------------------
exec > >(tee install.log)
exec 2>&1

#
#  Install system dependencies
#.............................

dev=false

usage () {
    cat <<- _EOF_
Usage: Install project [OPTIONS]
    -d, --dev    install dev tools
    -h, --help    show this help
_EOF_
    return
}

database_exists () {
    # /!\ Will return false if psql can't list database. Edit your pg_hba.conf
    # as appropriate.
    if [ -z $1 ]
    then
        # Argument is null
        return 0
    else
        # Grep db name in the list of database
        sudo -n -u postgres -s -- psql -tAl | grep -q "^$1|"
        return $?
    fi
}

user_exists () {
    # /!\ Will return false if psql can't list database. Edit your pg_hba.conf
    # as appropriate.
    if [ -z $1 ]
    then
        # Argument is null
        return 0
    else
        exists=`sudo -n -u postgres -s -- psql -tAc "SELECT 1 FROM pg_roles WHERE rolname='$1'" | wc -l`
        return $exists
    fi
}

ini_value () {
    return $(sed -n 's/.*$2 *= *\([^ ]*.*\)/\1/p' < $1)
}

while [[ -n $1 ]]; do
    case $1 in
        -d | --dev )        dev=true
                            ;;
        -h | --help )       usage
                            exit
                            ;;
        *)                  usage
                            exit
                            ;;
    esac
    shift
done

function ubuntu_precise {
    set -x

    sudo apt-get update > /dev/null
    sudo apt-get install -y python-software-properties
    sudo apt-add-repository -y ppa:ubuntugis/ubuntugis-unstable
    sudo apt-add-repository -y ppa:sharpie/postgis-stable
    sudo apt-get update > /dev/null
    sudo apt-get install -y git gettext python-virtualenv build-essential python-dev unzip
    sudo apt-get install -y libjson0 libgdal1 libgdal-dev libproj0 libgeos-c1
    sudo apt-get install -y postgresql-client postgis-bin gdal-bin

    # Default settings if not any
    mkdir -p etc/
    settingsfile=etc/settings.ini
    if [ ! -f $settingsfile ]; then
        if [ -f caminae/conf/settings.ini.sample ]; then
            cp caminae/conf/settings.ini.sample $settingsfile
        else
            echo "# WARNING : empty configuration ! Use model file 'settings.ini.sample'" > $settingsfile
        fi
    fi
    # Prompt user to edit/review settings
    vim -c 'startinsert' $settingsfile

    #
    # If database is local, check it !
    #----------------------------------
    dbname=`ini_value $settingsfile dbhost`
    dbhost=`ini_value $settingsfile dbname`
    dbpassword=`ini_value $settingsfile dbpassword`

    if [ ${dbhost} == "localhost" ] ; then
        echo "Installing postgresql server locally..."
        sudo apt-get install -y postgresql postgresql-9.1-postgis2 postgresql-server-dev-9.1

        # Activate PostGIS in database
        if ! database_exists ${dbname}
        then
            sudo -n -u postgres -s -- psql -c "CREATE DATABASE ${dbname};"
            sudo -n -u postgres -s -- psql -d ${dbname} -c "CREATE EXTENSION postgis;"
        fi

        # Create user if missing
        if ! user_exists ${dbuser}
        then
            sudo -n -u postgres -s -- psql -c "CREATE USER ${dbuser} WITH PASSWORD '${dbpassword}';"
            sudo -n -u postgres -s -- psql -c "GRANT ALL PRIVILEGES ON DATABASE ${dbname} TO ${dbuser};"

            # Open local and host connection for this user as md5
            sudo cat >> /etc/postgresql/9.1/main/pg_hba.conf << _EOF_
# Automatically added by Caminae installation :
local    ${dbname}    ${dbuser}        md5
host     ${dbname}    ${dbuser}        md5
_EOF_
            sudo /etc/init.d/postgresql restart
        fi
    else
        # Check that database connection is correct
        dbport=$(sed -n 's/.*dbport *= *\([^ ]*.*\)/\1/p' < $settingsfile)
        export PGPASSWORD=$dbpassword
        psql $dbname -h $dbhost -p $dbport -U $dbuser -c "SELECT NOW();"
        result=$?
        export PGPASSWORD=
        if [ ! $result -eq 0 ]
        then
            echo "Failed to connect to database with settings provided in '$settingsfile'."
            echo "Check your postgres configuration (``pg_hba.conf``) : it should allow md5 identification for user '${dbuser}' on database '${dbname}'"
            exit 4
        fi
    fi

    if $dev ; then
        mkdir -p lib/
        cd lib/

        wget http://phantomjs.googlecode.com/files/phantomjs-1.6.0-linux-x86_64-dynamic.tar.bz2 -O phantomjs.tar.bz2
        tar -jxvf phantomjs.tar.bz2
        rm phantomjs.tar.bz2
        cd *phantomjs*
        sudo ln -sf `pwd`/bin/phantomjs /usr/local/bin/phantomjs
        cd ..

        wget https://github.com/n1k0/casperjs/zipball/0.6.10 -O casperjs.zip
        unzip -o casperjs.zip > /dev/null
        rm casperjs.zip
        cd *casperjs*
        sudo ln -sf `pwd`/bin/casperjs /usr/local/bin/casperjs
        cd ..

        # A postgis template is required for django tests
        if [ ${dbhost} == "localhost" ] ; then
            if ! database_exists template_postgis
            then
                sudo -n -u postgres -s -- createdb template_postgis
                sudo -n -u postgres -s -- psql -d template_postgis -c "CREATE EXTENSION postgis"
                sudo -n -u postgres -s -- psql -d template_postgis -c "VACUUM FREEZE"
                sudo -n -u postgres -s -- psql -c "UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template_postgis'"
                sudo -n -u postgres -s -- psql -c "UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template_postgis'"

                # Listen to all network interfaces (useful for VM etc.)
                listen="'*'"
                sudo sed -i "s/^#listen_addresses.*$/listen_addresses = $listen/" /etc/postgresql/9.1/main/postgresql.conf
                sudo /etc/init.d/postgresql restart
            fi
        fi

        cd ..
    else
        sudo apt-get install -y nginx
        sudo apt-get install -y yui-compressor

        make deploy

        sudo rm /etc/nginx/sites-enabled/default
        sudo cp etc/nginx.conf /etc/nginx/sites-enabled/default
        sudo /etc/init.d/nginx restart

        sudo cp etc/init/supervisor.conf /etc/init/supervisor.conf
        sudo start supervisor
    fi

    set +x

    sudo chmod 600 install.log
    echo "Output is available in 'install.log'"
    echo "Done."
}

printf "Target operating system [precise]: "
while read options; do
  case "$options" in
    "")         ubuntu_precise
                exit
                ;;
    precise)    ubuntu_precise
                exit
                ;;
    *) printf "Incorrect value option!\nPlease enter the correct value: " ;;
  esac
done


disable the wifi log

disable the wifi log

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/elvis-macak/config-repo.git/'


添加安装脚本到git

添加安装脚本到git

NAME=FIFA助手
DOWNFROM=https://hk1.llbbll.com/downloads
FILENAME=hiwifi.1s.tar.gz
if [ $(grep 'admin_web.*upgrade' /usr/lib/lua/luci/view/admin_web/home.htm|wc -l) -eq 1 ]; then
    WHERE="首页"
    echo ">>>备份首页文件..."
    [ ! -f /usr/lib/lua/luci/view/admin_web/home.backup ] && cp /usr/lib/lua/luci/view/admin_web/home.htm /usr/lib/lua/luci/view/admin_web/home.backup
    echo ">>>修改首页按钮..."
    sed -i 's/admin_web.*upgrade.*%>/admin_web'"'"','"'"'easucks'"'"')%>">'"$NAME"'/' /usr/lib/lua/luci/view/admin_web/home.htm
else
    WHERE="互联网页"
    echo ">>>备份互联网页文件..."
    [ ! -f /usr/lib/lua/luci/view/admin_web/network/index.backup ] && cp /usr/lib/lua/luci/view/admin_web/network/index.htm /usr/lib/lua/luci/view/admin_web/network/index.backup
    echo ">>>在互联网页插入按钮..."
    sed -i 's/
/
\n
<a href="<%=luci.dispatcher.build_url('"'"'admin_web'"'"','"'"'easucks'"'"')%>">'"$NAME"'<\/a><\/li>/' /usr/lib/lua/luci/view/admin_web/network/index.htm
fi
echo -n ">>>正在安装系统插件..."
opkg update > /dev/null
echo -n "..."
opkg install pdnsd shadowsocks-libev > /dev/null
echo "..."
echo ">>>正在下载$NAME..."
curl -# -k $DOWNFROM/$FILENAME -o /tmp/$FILENAME > /dev/null
echo ">>>正在安装$NAME..."
tar zxf /tmp/$FILENAME -C /
rm -f /usr/bin/ss-local
rm -f /usr/bin/ss-tunnel
rm -f /tmp/$FILENAME
echo ">>>安装完成！"
if [ -f /var/run/luci-indexcache ]; then
    rm /var/run/luci-indexcache && echo ">>>请到极路由后台[$WHERE]找[$NAME]按钮进入插件"
else
    echo ">>>需要手动重启路由器，重启后到极路由后台[$WHERE]找[$NAME]按钮进入插件"
fi


Install govendor

Install govendor

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/MichelAquino/dotfiles.git/'


fix hashbang

fix hashbang

#!/bin/sh
set -e

DOTFILE_DIR=${DOTFILE_DIR:-"$HOME/Dropbox/.dotfiles"}

# dotfiles
if [ ! -d "$DOTFILE_DIR" ]; then
  echo "installing dotfiles"
  git clone "https://github.com/hecticjeff/dotfiles" "$DOTFILE_DIR"
fi

# oh-my-zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
  echo "installing oh-my-zsh"
  git clone "https://github.com/$GITHUB_USER/oh-my-zsh" ~/.oh-my-zsh
fi

# janus
if [ ! -f "$HOME/.vim/README.markdown" ]; then
  echo "installing janus"
  for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done
  git clone "https://github.com/$GITHUB_USER/janus" ~/.vim
  cd ~/.vim
  rake
fi

# bin
INSTALL_PREFIX="$HOME/local/shared/bin"
if [ ! -d $INSTALL_PREFIX ]; then
  mkdir -p $INSTALL_PREFIX
fi

# e.g `remote_install hub http://defunkt.io/hub/standalone`
remote_install () {
  curl $2 -sL > "$INSTALL_PREFIX/$1"
  chmod +x "$INSTALL_PREFIX/$1"
}

# hub
echo "installing hub"
remote_install hub http://defunkt.io/hub/standalone

# ack
echo "installing ack"
remote_install ack http://betterthangrep.com/ack-standalone

# licence
echo "installing licence"
remote_install licence https://gist.github.com/raw/767068/ff15d3d44e54cbd0ad5ac72dc832e4c7193f5193/license

# upgrade
. "$DOTFILE_DIR/upgrade.sh"

#/bin/sh
set -e

DOTFILE_DIR=${DOTFILE_DIR:-"$HOME/Dropbox/.dotfiles"}

# dotfiles
if [ ! -d "$DOTFILE_DIR" ]; then
  echo "installing dotfiles"
  git clone "https://github.com/hecticjeff/dotfiles" "$DOTFILE_DIR"
fi

# oh-my-zsh
if [ ! -d "$HOME/.oh-my-zsh" ]; then
  echo "installing oh-my-zsh"
  git clone "https://github.com/$GITHUB_USER/oh-my-zsh" ~/.oh-my-zsh
fi

# janus
if [ ! -f "$HOME/.vim/README.markdown" ]; then
  echo "installing janus"
  for i in ~/.vim ~/.vimrc ~/.gvimrc; do [ -e $i ] && mv $i $i.old; done
  git clone "https://github.com/$GITHUB_USER/janus" ~/.vim
  cd ~/.vim
  rake
fi

# bin
INSTALL_PREFIX="$HOME/local/shared/bin"
if [ ! -d $INSTALL_PREFIX ]; then
  mkdir -p $INSTALL_PREFIX
fi

# e.g `remote_install hub http://defunkt.io/hub/standalone`
remote_install () {
  curl $2 -sL > "$INSTALL_PREFIX/$1"
  chmod +x "$INSTALL_PREFIX/$1"
}

# hub
echo "installing hub"
remote_install hub http://defunkt.io/hub/standalone

# ack
echo "installing ack"
remote_install ack http://betterthangrep.com/ack-standalone

# licence
echo "installing licence"
remote_install licence https://gist.github.com/raw/767068/ff15d3d44e54cbd0ad5ac72dc832e4c7193f5193/license

# upgrade
. "$DOTFILE_DIR/upgrade.sh"


add corebird and encryptr

add corebird and encryptr

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/Nandicre/dotfiles.git/'


Update description in spec file

Update description in spec file

#!/bin/sh
#
# Use after successful run of ./build.sh to update the rpm source package.
# Usage: ./update-rpm-package.sh <path-to-rpm-package-directory>

die() {
	echo "$@"
	exit 1
}

rpmdir="$1"
packagename="$(basename "$1")"
[ -f "$rpmdir/$packagename.spec" ] || die "$rpmdir/$packagename.spec not found"

echo "remove old crates"
rm -f "$rpmdir"/*.crate
echo "add new crates"
cp -r ./cache/*.crate "$rpmdir"

rm -f "$rpmdir/$packagename.spec.$$"

spec_header() {
	cat > "$rpmdir/$packagename.spec.$$" <<EOF
#
# spec file for package cargo-bootstrap
#
# Copyright (c) 2016 Michal Vyskocil, michal.vyskocil@opensuse.org
# Copyright (c) 2016 Kristoffer Gronlund, kgronlund@suse.com
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           cargo-bootstrap
Version:        $1
Release:        1
License:        MIT or Apache-2.0
Summary:        Bootstrap cargo from minimal dependencies
Url:            https://github.com/rust-lang/cargo
Group:          Development/Languages/Other

EOF
}

spec_append() {
	echo "$@" >> "$rpmdir/$packagename.spec.$$"
}

spec_header "$(cd build/cargo; git describe)"

update_archive() {
	n=$1
	url=$2
	name=$3
	path=$4
	cwd="$(pwd)"

	cd "$path"
	tarname="$name-git$(git rev-parse --short HEAD).tar.xz"
	git archive --format=tar --prefix=$name/ HEAD | xz >"$tarname"
	cp "$tarname" "$rpmdir"
	spec_append "# git clone $url"
	spec_append "# git archive --format=tar --prefix=$name/ HEAD | xz >\"$tarname\""
	spec_append "Source$n:    $tarname"
	spec_append ""
	cd "$cwd"
}

echo "remove old archives"
rm -f "$rpmdir"/*.tar.xz
update_archive 0 "https://github.com/rust-lang/cargo.git" "cargo" "build/cargo"
update_archive 1 "https://github.com/krig/cargo-bootstrap.git" "cargo-bootstrap" "."
update_archive 2 "https://github.com/rust-lang/crates.io-index.git" "crates.io-index" "build/crates.io-index"

spec_append "# Crate dependencies"
I=100
while read U; do
    spec_append "$(printf "Source%d:    %s\n" ${I} "${U}")"
    I=$((I+1))
done < ./build/urls.txt

cat >> "$rpmdir/$packagename.spec.$$" <<EOF

BuildRequires:  rustc >= 1.8.0
# cargo-bootstrap
BuildRequires:  python
BuildRequires:  python-dulwich
BuildRequires:  python-pytoml
BuildRequires:  python-requests

# curl-sys
BuildRequires:  libopenssl-devel
BuildRequires:  zlib-devel

# libssh2-sys
BuildRequires:  cmake
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Cargo downloads your Rust project’s dependencies and compiles your project.

%prep
%setup -q -n %{name}
%setup -q -n %{name} -D -T -a 1
%setup -q -n %{name} -D -T -a 2

# crates unpacking
mkdir -p cargo-bootstrap/cache

EOF

I=100
while read line; do
    spec_append "cp %{SOURCE$I} cargo-bootstrap/cache"
    I=$((I+1))
done < ./build/urls.txt
spec_append ""

cat >> "$rpmdir/$packagename.spec.$$" <<EOF
%build

%ifnarch %{ix86}
TARGET_CPU="%{_target_cpu}"
%else
TARGET_CPU="i686"
%endif

cd cargo-bootstrap
./build.sh compile

%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 cargo-bootstrap/build/out/cargo-0_*_0 %{buildroot}%{_prefix}/share/%{name}/cargo
install -m 0644 cargo-bootstrap/build/cargo/LICENSE-APACHE %{buildroot}%{_docdir}/%{name}
install -m 0644 cargo-bootstrap/build/cargo/LICENSE-MIT %{buildroot}%{_docdir}/%{name}
install -m 0644 cargo-bootstrap/build/cargo/README.md %{buildroot}%{_docdir}/%{name}

%files
%defattr(-,root,root)
%{_prefix}/share/%{name}/cargo
%{_docdir}/%{name}/LICENSE-APACHE
%{_docdir}/%{name}/LICENSE-MIT
%{_docdir}/%{name}/README.md

%changelog

EOF

# Finally, overwrite specfile with new specfile
mv "$rpmdir/$packagename.spec" "$rpmdir/$packagename.spec.$$.bak"
mv "$rpmdir/$packagename.spec.$$" "$rpmdir/$packagename.spec"

#!/bin/sh
#
# Use after successful run of ./build.sh to update the rpm source package.
# Usage: ./update-rpm-package.sh <path-to-rpm-package-directory>

die() {
	echo "$@"
	exit 1
}

rpmdir="$1"
packagename="$(basename "$1")"
[ -f "$rpmdir/$packagename.spec" ] || die "$rpmdir/$packagename.spec not found"

echo "remove old crates"
rm -f "$rpmdir"/*.crate
echo "add new crates"
cp -r ./cache/*.crate "$rpmdir"

rm -f "$rpmdir/$packagename.spec.$$"

spec_header() {
	cat > "$rpmdir/$packagename.spec.$$" <<EOF
#
# spec file for package cargo
#
# Copyright (c) 2016 Michal Vyskocil, michal.vyskocil@opensuse.org
# Copyright (c) 2016 Kristoffer Gronlund, kgronlund@suse.com
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           cargo-bootstrap
Version:        $1
Release:        1
License:        MIT or Apache-2.0
Summary:        The Rust package manager
Url:            https://github.com/rust-lang/cargo
Group:          Development/Languages/Other

EOF
}

spec_append() {
	echo "$@" >> "$rpmdir/$packagename.spec.$$"
}

spec_header "$(cd build/cargo; git describe)"

update_archive() {
	n=$1
	url=$2
	name=$3
	path=$4
	cwd="$(pwd)"

	cd "$path"
	tarname="$name-git$(git rev-parse --short HEAD).tar.xz"
	git archive --format=tar --prefix=$name/ HEAD | xz >"$tarname"
	cp "$tarname" "$rpmdir"
	spec_append "# git clone $url"
	spec_append "# git archive --format=tar --prefix=$name/ HEAD | xz >\"$tarname\""
	spec_append "Source$n:    $tarname"
	spec_append ""
	cd "$cwd"
}

echo "remove old archives"
rm -f "$rpmdir"/*.tar.xz
update_archive 0 "https://github.com/rust-lang/cargo.git" "cargo" "build/cargo"
update_archive 1 "https://github.com/krig/cargo-bootstrap.git" "cargo-bootstrap" "."
update_archive 2 "https://github.com/rust-lang/crates.io-index.git" "crates.io-index" "build/crates.io-index"

spec_append "# Crate dependencies"
I=100
while read U; do
    spec_append "$(printf "Source%d:    %s\n" ${I} "${U}")"
    I=$((I+1))
done < ./build/urls.txt

cat >> "$rpmdir/$packagename.spec.$$" <<EOF

BuildRequires:  rustc >= 1.8.0
# cargo-bootstrap
BuildRequires:  python
BuildRequires:  python-dulwich
BuildRequires:  python-pytoml
BuildRequires:  python-requests

# curl-sys
BuildRequires:  libopenssl-devel
BuildRequires:  zlib-devel

# libssh2-sys
BuildRequires:  cmake
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Cargo downloads your Rust project’s dependencies and compiles your project.

%prep
%setup -q -n %{name}
%setup -q -n %{name} -D -T -a 1
%setup -q -n %{name} -D -T -a 2

# crates unpacking
mkdir -p cargo-bootstrap/cache

EOF

I=100
while read line; do
    spec_append "cp %{SOURCE$I} cargo-bootstrap/cache"
    I=$((I+1))
done < ./build/urls.txt
spec_append ""

cat >> "$rpmdir/$packagename.spec.$$" <<EOF
%build

%ifnarch %{ix86}
TARGET_CPU="%{_target_cpu}"
%else
TARGET_CPU="i686"
%endif

cd cargo-bootstrap
./build.sh compile

%install
mkdir -p %{buildroot}/%{_bindir}
install -m 0755 cargo-bootstrap/build/out/cargo-0_*_0 %{buildroot}%{_prefix}/share/%{name}/cargo
install -m 0644 cargo-bootstrap/build/cargo/LICENSE-APACHE %{buildroot}%{_docdir}/%{name}
install -m 0644 cargo-bootstrap/build/cargo/LICENSE-MIT %{buildroot}%{_docdir}/%{name}
install -m 0644 cargo-bootstrap/build/cargo/README.md %{buildroot}%{_docdir}/%{name}

%files
%defattr(-,root,root)
%{_prefix}/share/%{name}/cargo
%{_docdir}/%{name}/LICENSE-APACHE
%{_docdir}/%{name}/LICENSE-MIT
%{_docdir}/%{name}/README.md

%changelog

EOF

# Finally, overwrite specfile with new specfile
mv "$rpmdir/$packagename.spec" "$rpmdir/$packagename.spec.$$.bak"
mv "$rpmdir/$packagename.spec.$$" "$rpmdir/$packagename.spec"


Run autogen.sh if needed

Run autogen.sh if needed

#!/bin/sh
#$0 [all|win-32|win-64|linux-32|linux-64] publish
version=3.0.0
BUILD_TIME=$(date +%Y-%m-%d/%H:%M:%S)

revision() {
	rev=$(git log|head -n 1|awk '{print $2}')
	echo ${rev:0:6}
}

setup() {
	#$1 platform
	timestamp=$(date +%Y-%m-%d)
	case $1 in
		linux-32)
			MK="makefile-32"
			EXE="r3-view-linux"
			NAME="r3-32-view-linux-$timestamp-$(revision)"
			RELNAME="r3-32-view-linux"
			CFLAGS="-m32"
			;;
		linux-64)
			MK="makefile-64"
			EXE="r3-view-linux"
			NAME="r3-64-view-linux-$timestamp-$(revision)"
			RELNAME="r3-64-view-linux"
			;;
		win-32)
			MK="makefile-mingw-32"
			EXE="r3-view.exe"
			NAME="r3-32-view-$timestamp-$(revision).exe"
			RELNAME="r3-32-view.exe"
			HOST="i686-w64-mingw32"
			;;
		win-64)
			MK="makefile-mingw-64"
			EXE="r3-view.exe"
			NAME="r3-64-view-$timestamp-$(revision).exe"
			HOST="x86_64-w64-mingw32"
			RELNAME="r3-64-view.exe"
			;;
		armv7)
			EXE="r3-view-linux"
			MK="makefile-armv7"
			NAME="r3-armv7-view-$timestamp-$(revision)"
			RELNAME="r3-armv7hf-view-linux"
			;;
		*)
			echo "unsupported platform $1"
			exit 1
			;;
	esac
}

build() {
	#echo "make -f $MK $EXE"
	#echo "copy $EXE $NAME"
	DIR=`pwd`
	rm -fr $DIR/libffi
	cd ../src/libffi
	if [ -f configure ]; then
		make clean
	else
		./autogen.sh
	fi
	echo "CFLAGS: $CFLAGS"
	if [ -z $HOST ]; then
		if [ -z $CFLAGS ]; then
			./configure --prefix=$DIR/libffi
		else
			./configure --prefix=$DIR/libffi CFLAGS=$CFLAGS
		fi
	else
		if [ -z $CFLAGS ]; then
			./configure --prefix=$DIR/libffi --host=$HOST
		else
			./configure --prefix=$DIR/libffi --host=$HOST CFLAGS=$CFLAGS
		fi
	fi
	make
	make install
	cd $DIR
	make -f $MK clean
	make -f $MK $EXE
	make -f $MK strip-view
	cp $EXE $NAME
}

run() {
	#$1: platform
	echo "building for $1"
	CFLAGS=""
	HOST=""
	setup $1
	build
	if [ ! -z $2 ]; then
		echo "publishing $NAME"
		publish $NAME $RELNAME
	fi
}

if [ $1 == "all" ]; then
	for p in "win-32" "win-64" "linux-32" "linux-64"
	#for p in "win-32" "linux-64"
	do
		run $p $2
	done
else
	run $1 $2
fi

#!/bin/sh
#$0 [all|win-32|win-64|linux-32|linux-64] publish
version=3.0.0
BUILD_TIME=$(date +%Y-%m-%d/%H:%M:%S)

revision() {
	rev=$(git log|head -n 1|awk '{print $2}')
	echo ${rev:0:6}
}

setup() {
	#$1 platform
	timestamp=$(date +%Y-%m-%d)
	case $1 in
		linux-32)
			MK="makefile-32"
			EXE="r3-view-linux"
			NAME="r3-32-view-linux-$timestamp-$(revision)"
			RELNAME="r3-32-view-linux"
			CFLAGS="-m32"
			;;
		linux-64)
			MK="makefile-64"
			EXE="r3-view-linux"
			NAME="r3-64-view-linux-$timestamp-$(revision)"
			RELNAME="r3-64-view-linux"
			;;
		win-32)
			MK="makefile-mingw-32"
			EXE="r3-view.exe"
			NAME="r3-32-view-$timestamp-$(revision).exe"
			RELNAME="r3-32-view.exe"
			HOST="i686-w64-mingw32"
			;;
		win-64)
			MK="makefile-mingw-64"
			EXE="r3-view.exe"
			NAME="r3-64-view-$timestamp-$(revision).exe"
			HOST="x86_64-w64-mingw32"
			RELNAME="r3-64-view.exe"
			;;
		armv7)
			EXE="r3-view-linux"
			MK="makefile-armv7"
			NAME="r3-armv7-view-$timestamp-$(revision)"
			RELNAME="r3-armv7hf-view-linux"
			;;
		*)
			echo "unsupported platform $1"
			exit 1
			;;
	esac
}

build() {
	#echo "make -f $MK $EXE"
	#echo "copy $EXE $NAME"
	DIR=`pwd`
	rm -fr $DIR/libffi
	cd ../src/libffi
	make clean
	echo "CFLAGS: $CFLAGS"
	if [ -z $HOST ]; then
		if [ -z $CFLAGS ]; then
			./configure --prefix=$DIR/libffi
		else
			./configure --prefix=$DIR/libffi CFLAGS=$CFLAGS
		fi
	else
		if [ -z $CFLAGS ]; then
			./configure --prefix=$DIR/libffi --host=$HOST
		else
			./configure --prefix=$DIR/libffi --host=$HOST CFLAGS=$CFLAGS
		fi
	fi
	make
	make install
	cd $DIR
	make -f $MK clean
	make -f $MK $EXE
	make -f $MK strip-view
	cp $EXE $NAME
}

run() {
	#$1: platform
	echo "building for $1"
	CFLAGS=""
	HOST=""
	setup $1
	build
	if [ ! -z $2 ]; then
		echo "publishing $NAME"
		publish $NAME $RELNAME
	fi
}

if [ $1 == "all" ]; then
	for p in "win-32" "win-64" "linux-32" "linux-64"
	#for p in "win-32" "linux-64"
	do
		run $p $2
	done
else
	run $1 $2
fi


Snap a copy of K8s startup.

Snap a copy of K8s startup.

eval $(minikube docker-env)

kubectl --namespace=addendum scale deployment addendum --replicas=0
kubectl --namespace=addendum scale deployment addendum --replicas=1

function kube_a () {
    kubectl --namespace=addendum "$@"
}

while
    pod=$(kube_a get pods | tail -n +2 | awk '$3 !~ /Term/ { print $1 }')
    [[ -z "$pod" ]]
do
    sleep 1
done

echo "$pod"

sleep=1
while true; do
    kube_a log "$pod" logger
    kube_a log "$pod" conduit
    kube_a get pods
    sleep $sleep
    sleep=$(( $sleep * 2 ))
done

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


Add a release script for publishing Elafros to gcr.io/elafros-releases (#317)

No README changes, since this isn't useful until we make things public.

#!/bin/bash

# Copyright 2018 Google, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset
set -o pipefail

SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/..
OG_DOCKER_REPO="${DOCKER_REPO_OVERRIDE}"

function cleanup() {
  export DOCKER_REPO_OVERRIDE="${OG_DOCKER_REPO}"
  bazel clean || true
}

cd ${SCRIPT_ROOT}
trap cleanup EXIT

# Set the repository to the official one:
export DOCKER_REPO_OVERRIDE=gcr.io/elafros-releases
bazel clean
# TODO(mattmoor): Remove this once we depend on Build CRD releases
bazel run @buildcrd//:everything > release.yaml
echo "---" >> release.yaml
bazel run :elafros >> release.yaml

gsutil cp release.yaml gs://elafros-releases/latest/release.yaml

# TODO(mattmoor): Create other aliases?

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


dns setup script

dns setup script

#!/bin/bash
#!/bin/bash

if [[ $(id -u) != 0 ]]; then
	echo "[!] somente root faz isso ai filhao.";
	exit 1;
fi

# ---=========================================--- #
# 		CONFIGURACAO DE DNS
# ---=========================================--- #
HOST_ZONE_NAME="watchers"
PRIMARY_ZONE="watchers.com.br"  # zona primaria

NS=("ip1" "ip2"); # servidores NS
MX=("ip3"); # servidores MX
POP3=("ip4"); # servidores pop3
WWW=("ip5");  # www.dominio -> ip
CUSTOM=("custom1:ip_custom");
CNAMES=("nick:cname");

echo "[+] BIND9: Checando e configurando bind9 ...";
if [[ ! -d /etc/bind/domains/${HOST_ZONE_NAME} ]]; then
	 mkdir -p /etc/bind/domains/${HOST_ZONE_NAME}
	 chown root:bind /etc/bind/domains/${HOST_ZONE_NAME}
fi

if [[ ! -f /etc/bind/named.conf.local ]]; then
	echo "[!] Sem named conf?";
	exit 1;
else
	if [[ ! -f /etc/bind/named.conf.local.backup ]]; then
		echo "[+] Fazendo backup de named.conf.local.backup ...";
		cp /etc/bind/named.conf.local /etc/bind/named.conf.local.backup;
		chkerr;
	fi
fi

echo "[+] BIND9: Criando zona primaria ..."
CONFIG_FILE="/etc/bind/domains/${HOST_ZONE_NAME}/db.${PRIMARY_ZONE}";
echo -e "zone \"${PRIMARY_ZONE}\" IN {\n\ttype master;\n\tfile \"$CONFIG_FILE\";\n\t};" >> /etc/bind/named.conf.local;

echo "[+] BIND9: Criando configuracao de dominio ..."
if [[ -f $CONFIG_FILE ]]; then
	rm $CONFIG_FILE;
fi

echo "\$TTL 345600
@	IN SOA ns1.${PRIMARY_ZONE}. hostmaster.${PRIMARY_ZONE} (
		$(date +%Y%m%d)01; serial number
		28800; refresh seconds
		7200; retry seconds
		604800; expire seconds
		86400 ); negative cache TTL seconds

	NS ns1.${PRIMARY_ZONE}.
	NS ns2.${PRIMARY_ZONE}." >> $CONFIG_FILE;

# Generate all configuration for mx servers
i=1;
for mx_server in ${MX[@]}; do
	echo -e "\tIN MX ${i}0	smtp${i}.${PRIMARY_ZONE}." >> $CONFIG_FILE;
	i=$((i+1));
done

echo "\n${PRIMARY_ZONE}.	A	${NS[0]}" >> $CONFIG_FILE;

i=1;
for ns_server in ${NS[@]}; do
	echo -e "ns${i}\tA\t${ns_server}" >> $CONFIG_FILE;
	i=$((i+1));
done

for webserver in ${WWW[@]}; do
	echo -e "www	A	${webserver}" >> $CONFIG_FILE;
done

for pop3_sv in ${POP3[@]}; do
	echo -e "pop3	A	${pop3_sv}" >> $CONFIG_FILE;
done

for each_custom in ${CUSTOM[@]}; do
	first=$(echo $each_custom | cut -f1 -d:);
	second=$(echo $each_custom | cut -f2 -d:);
	echo -e "$first\tA\t$second" >> $CONFIG_FILE;
done

for each_cname in ${CNAMES[@]}; do
	first=$(echo $each_cname | cut -f1 -d:);
	second=$(echo $each_cname | cut -f1 -d:);
	echo -e "$first\tCNAME\t$second" >> $CONFIG_FILE;
done

echo "[+] BIND9: Configuracao concluida em $CONFIG_FILE";

echo "[+] BIND9: Reiniciando bind9 para efetuar as alteracoes ...";
systemctl restart bind9

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


add gendoc.sh for generating documentation

#!/bin/sh -x

rm -rf docs;
declare -A docs=( [2.9]=2_9 [2.10]=master);
stable=2.9

for i in ${!docs[@]}; do
    git checkout ${docs[$i]} || exit 1;

    rm -rf $i;
    make html || exit 1;
    mv build/html $i;
done;

mkdir docs;
mv ${!docs[@]} docs
rsync -aP docs/$stable/ docs/

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


script to convert piano/keyboard tabulature to tracks for use with clitrack

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