This repository has been archived by the owner on Jun 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 8cc19a6
Showing
34 changed files
with
808 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Cloud 9 (C9) Extension for BreatheCode Users | ||
|
||
All of Breathe Code's functionality inside the C9 Coding Editor. | ||
|
||
## Installation | ||
|
||
Please copy the content of the init.js script and paste inside the Cloud9 -> "Open Your Init Script" file. | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.c9/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
if [ ! "$BC_C9_AUTOEXEC" = 3 ]; then | ||
export BC_C9_NAME="breathecode/scripts" | ||
export BC_C9_LIBRARY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
export BC_C9_WORKSPACE="$HOME/workspace" | ||
|
||
export PATH="$PATH:$BC_C9_LIBRARY/bash" | ||
|
||
# https://unix.stackexchange.com/questions/48381/fixing-scrolling-in-nano-running-in-tmux-in-mate-terminal | ||
export TERM=screen | ||
|
||
# Increment this number each time you change something inside of this 'if'-block | ||
export BC_C9_AUTOEXEC=3 | ||
|
||
echo "$BC_C9_NAME: BreatheCode Plugin #$BC_C9_AUTOEXEC" | ||
|
||
source ~/.nvm/nvm.sh | ||
read version _ <<< $(nvm current) | ||
if [[ "$version" == *"v6"* ]]; then | ||
nvm i 8 | ||
nvm alias default 8 | ||
echo "$BC_C9_NAME: Node was upgraded to version 8" | ||
fi | ||
|
||
# Path to .pyenv | ||
if [ -d ~/.pyenv ]; then | ||
export PATH="/home/ubuntu/.pyenv/bin:$PATH" | ||
eval "$(pyenv init -)" | ||
eval "$(pyenv virtualenv-init -)" | ||
fi | ||
fi | ||
|
||
# Functions | ||
pathContainsDirectory() { if [[ ":$PATH:" == *":$1:"* ]]; then return 0; else return 1; fi } | ||
randomStringAlphaNum() { cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c ${1:-32}; } | ||
|
||
# ~/workspace/bin | ||
if [ -d "$HOME/workspace/bin" ] && ! pathContainsDirectory "$HOME/workspace/bin"; then | ||
export PATH="$PATH:$HOME/workspace/bin" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# https://docs.c9.io/docs/multiple-ports | ||
declare -a PORTS=(8082 8081 8080) | ||
|
||
if [ "$1" = "-a" ]; then | ||
for PORT in "${PORTS[@]}"; do | ||
echo "$PORT" | ||
done | ||
exit 0 | ||
fi | ||
|
||
for PORT in "${PORTS[@]}"; do | ||
if ! nc "127.0.0.1" "$PORT" < /dev/null; then | ||
echo "$PORT" | ||
exit 0 | ||
fi | ||
done | ||
|
||
echo "$BC_C9_NAME: find-free-port: error: no free port available!" >&2 | ||
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
echo "$C9_USER: this are the helper-scripts you have available!" >&2 | ||
|
||
(cd ~/c9-scripts/utils/ && ls) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
git gc --prune=now && \ | ||
git submodule foreach git gc --prune=now && \ | ||
|
||
git repack -adf --depth=250 --window=250 && \ | ||
git submodule foreach git repack -adf --depth=250 --window=250 && \ | ||
|
||
git prune && \ | ||
git submodule foreach git prune |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# find free port | ||
PORT="$(find-free-port)" || exit 1 | ||
|
||
# print url | ||
echo "$BC_C9_NAME: godoc-http: info: godoc serves on https://$C9_HOSTNAME:$PORT" | ||
|
||
# run godoc | ||
godoc -http="$IP:$PORT" \ | ||
-play \ | ||
"$@" \ | ||
|| exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# stop apache2 | ||
service apache2 stop || exit 1 | ||
|
||
# find free port | ||
PORT="$(find-free-port)" || exit 1 | ||
|
||
# update apache2 config | ||
find-free-port -a | while read port; do sed "s/$port/$PORT/" -i /etc/apache2/ports.conf; done || exit 1 | ||
find-free-port -a | while read port; do sed "s/$port/$PORT/" -i /etc/apache2/sites-available/001-cloud9.conf; done || exit 1 | ||
|
||
# install phpmyadmin, restart apache2 | ||
phpmyadmin-ctl install | sed "s/.c9users.io/.c9users.io:$PORT/" || exit 1 | ||
|
||
# get adminer | ||
wget 'https://www.adminer.org/latest.php' -O /usr/share/phpmyadmin/adminer.php || exit 1 | ||
|
||
# start apache2 | ||
service apache2 start | ||
|
||
# return adminer url | ||
echo "Adminer has been installed to https://$C9_HOSTNAME:$PORT/phpmyadmin/adminer.php" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
if [ -e "$HOME/appengine_go" ]; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: already installed. remove ~/appengine_go to reinstall." | ||
exit 1 | ||
fi | ||
|
||
SDK_URL='https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.40.zip' | ||
|
||
if ! SDK_ZIP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! SDK_UNP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! wget -O "$SDK_ZIP" "$SDK_URL"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not download sdk. invalid url?" | ||
exit 1 | ||
fi | ||
|
||
if ! mkdir "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not create temporary directory." | ||
exit 1 | ||
fi | ||
|
||
if ! unzip "$SDK_ZIP" -d "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not extract sdk." | ||
exit 1 | ||
fi | ||
|
||
if ! mv "$SDK_UNP/go_appengine" "$HOME/appengine_go"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not rename $SDK_UNP/go_appengine to ~/appengine_go." | ||
exit 1 | ||
fi | ||
|
||
if ! rm "$SDK_ZIP"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not remove appengine sdk zip ($SDK_ZIP)." | ||
exit 1 | ||
fi | ||
|
||
if ! rm -rf "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not remove appengine sdk tmp dir ($SDK_UNP)." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
if [ -e "$HOME/appengine_python_php" ]; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: already installed. remove ~/appengine_python_php to reinstall." | ||
exit 1 | ||
fi | ||
|
||
SDK_URL='https://storage.googleapis.com/appengine-sdks/featured/google_appengine_1.9.40.zip' | ||
|
||
if ! SDK_ZIP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! SDK_UNP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! wget -O "$SDK_ZIP" "$SDK_URL"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not download sdk. invalid url?" | ||
exit 1 | ||
fi | ||
|
||
if ! mkdir "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not create temporary directory." | ||
exit 1 | ||
fi | ||
|
||
if ! unzip "$SDK_ZIP" -d "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not extract sdk." | ||
exit 1 | ||
fi | ||
|
||
if ! mv "$SDK_UNP/google_appengine" "$HOME/appengine_python_php"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not move $SDK_UNP/google_appengine to ~/appengine_python_php." | ||
exit 1 | ||
fi | ||
|
||
if ! rm "$SDK_ZIP"; then | ||
echo "$BC_C9_NAME: install_appengine_python_php: error: could not remove appengine sdk zip ($SDK_ZIP)." | ||
exit 1 | ||
fi | ||
|
||
if ! rm -rf "$SDK_UNP"; then | ||
echo "$BC_C9_NAME: install_appengine_go: error: could not remove appengine sdk tmp dir ($SDK_UNP)." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# add atom repository | ||
add-apt-repository -y ppa:webupd8team/atom || exit 1 | ||
|
||
# update package cache | ||
apt-get update || exit 1 | ||
|
||
# install atom | ||
apt-get -y install atom || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# update package cache | ||
apt-get update || exit 1 | ||
|
||
# install git-extras | ||
apt-get -y install git-extras || exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# add repository | ||
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash || exit 1 | ||
|
||
# install git-lfs | ||
apt-get -y install git-lfs || exit 1 | ||
|
||
# add git-lfs filters to git | ||
git lfs install || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
sudo apt-get -y install gcc python-dev python-setuptools libffi-dev && \ | ||
sudo apt-get -y install python-pip && \ | ||
sudo pip install -U gsutil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# update package cache | ||
apt-get update || exit 1 | ||
|
||
# install mongodb | ||
apt-get install -y mongodb-org || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# stop apache2 | ||
service apache2 stop || exit 1 | ||
|
||
# find free port | ||
PORT="$(find-free-port)" || exit 1 | ||
|
||
# update apache2 config | ||
find-free-port -a | while read port; do sed "s/$port/$PORT/" -i /etc/apache2/ports.conf; done || exit 1 | ||
find-free-port -a | while read port; do sed "s/$port/$PORT/" -i /etc/apache2/sites-available/001-cloud9.conf; done || exit 1 | ||
|
||
# install phpmyadmin, restart apache2 | ||
phpmyadmin-ctl install | sed "s/.c9users.io/.c9users.io:$PORT/" || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
. "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )/autoexec" || exit 1 | ||
|
||
# run as root | ||
if [ "$UID" != "0" ]; then | ||
sudo -E "$0" "$@" | ||
exit | ||
fi | ||
|
||
# update package cache | ||
apt-get update || exit 1 | ||
|
||
# install dependency package for s3cmd | ||
apt-get -y install python-dateutil || exit 1 | ||
|
||
if [ -e "$HOME/s3cmd" ]; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: already installed. remove ~/s3cmd to reinstall." | ||
exit 1 | ||
fi | ||
|
||
S3CMD_URL='http://downloads.sourceforge.net/project/s3tools/s3cmd/1.6.0/s3cmd-1.6.0.zip' | ||
|
||
if ! S3CMD_ZIP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! S3CMD_UNP="/tmp/$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c 8)"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not generate random string." | ||
exit 1 | ||
fi | ||
|
||
if ! wget -O "$S3CMD_ZIP" "$S3CMD_URL"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not download s3cmd. invalid url?" | ||
exit 1 | ||
fi | ||
|
||
if ! mkdir "$S3CMD_UNP"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not create temporary directory." | ||
exit 1 | ||
fi | ||
|
||
if ! unzip "$S3CMD_ZIP" -d "$S3CMD_UNP"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not extract s3cmd." | ||
exit 1 | ||
fi | ||
|
||
if ! mv "$S3CMD_UNP"/s3cmd-* "$HOME/s3cmd"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not rename $S3CMD_UNP/s3cmd-* to ~/s3cmd." | ||
exit 1 | ||
fi | ||
|
||
if ! rm "$S3CMD_ZIP"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not remove s3cmd zip ($S3CMD_ZIP)." | ||
exit 1 | ||
fi | ||
|
||
if ! rm -rf "$S3CMD_UNP"; then | ||
echo "$BC_C9_NAME: install_s3cmd: error: could not remove s3cmd tmp dir ($S3CMD_UNP)." | ||
exit 1 | ||
fi |
Oops, something went wrong.