Skip to content

Instantly share code, notes, and snippets.

@maxfi
Last active February 21, 2019 10:46
Show Gist options
  • Save maxfi/dce31b0a15e830901d8c to your computer and use it in GitHub Desktop.
Save maxfi/dce31b0a15e830901d8c to your computer and use it in GitHub Desktop.
Setup new c9 workspace
#!/bin/bash
# SNIPPET REFERENCE
# -----------------
# https://cloud9-sdk.readme.io/docs/snippets
# https://community.c9.io/t/snippets-not-working-in-c9/19215
# https://github.com/ajaxorg/ace/blob/master/lib/ace/snippets/javascript.snippets
# Update NVM
wget https://gist.githubusercontent.com/maxfi/f04d8101d73d9f1e2d19f3ca66f05b73/raw/3b093865c0aa36d7198e77ae6748ac648e9965ca/install-latest-nvm.sh
chmod +x install-latest-nvm.sh
./install-latest-nvm.sh
rm install-latest-nvm.sh
source ~/.bashrc
# MAKE SURE THAT SOURCE WORKS then also do `npm install npm -g`
# Get some info
echo "Current node version: $(node -v)"
echo "Current npm version: $(npm --version)"
# Ask if meteor should be installed
read -p "Install meteor? [y/N]" -n 1 -r; echo
if [[ $REPLY =~ ^[Yy]$ ]]
then INSTALL_METEOR=true; fi;
# Install tools
npm install -g npm-check npm-check-updates repl-it ungit sloc yo generator-nm tldr
sudo apt update && sudo apt install ncdu ranger
# Install bat - A cat(1) clone with wings
LATEST_BAT_VERSION=$(curl -s https://api.github.com/repos/sharkdp/bat/releases/latest | grep '"tag_name":' | cut -d '"' -f 4 | sed 's/v//')
BAT_FILE_NAME=bat_$LATEST_BAT_VERSION'_amd64.deb'
wget https://github.com/sharkdp/bat/releases/download/v$LATEST_BAT_VERSION/$BAT_FILE_NAME
sudo dpkg -i $BAT_FILE_NAME
rm $BAT_FILE_NAME
# Setup ungit
# https://github.com/FredrikNoren/ungit/blob/master/source/config.js
# Cannot use ungit in cloud9 · Issue #1112 · FredrikNoren/ungit -- https://github.com/FredrikNoren/ungit/issues/1112
cat << EOF > ~/.ungitrc
{
"port": 8081,
"bugtracking": true,
"launchBrowser": false,
"ungitBindIp": "0.0.0.0"
}
EOF
# Setup MongoDB
cd
mkdir data
echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"' > mongod
chmod a+x mongod
# Install meteor
if [ "$INSTALL_METEOR" = true ]; then
curl https://install.meteor.com/ | sh
fi
# Finished
cat << EOF
################################################################
# #
# SETUP COMPLETE #
# #
################################################################
To start MongoDB use:
./mongod
################################################################
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment