Skip to content

Instantly share code, notes, and snippets.

Jono Feist defaye

  • England
View GitHub Profile
@defaye
defaye / install_elasticsearch.sh
Created May 29, 2020
Install ElasticSearch on Ubuntu 18.04
View install_elasticsearch.sh
# https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-18-04
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt update && sudo apt install -y elasticsearch
sudo sed -i -E "s/^\#?network\.host:\s+.*$/network.host: localhost/" /etc/elasticsearch/elasticsearch.yml
sudo service elasticsearch start # start as a service
systemctl list-units --type service | grep elasticsearch # check it is active and enabled on boot # https://askubuntu.com/questions/912216/16-04-command-to-list-all-services-started-on-boot
View install_postgis.sh
sudo apt update && sudo apt install -y postgis postgresql-10-postgis-2.4
sudo -u postgres createuser postgis_test
sudo -u postgres createdb postgis_db -O postgis_test
sudo -u postgres psql -d postgis_db -c 'CREATE EXTENSION postgis'
sudo -u postgres psql -d postgis_db -c 'SELECT PostGIS_version()'
@defaye
defaye / install_nvm_node.sh
Created May 26, 2020
Install Node.js via NVM automatically using the latest LTS
View install_nvm_node.sh
# https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh -o install_nvm.sh
bash install_nvm.sh
{ cat << 'EOT'; cat << EOF; } >> ~/.$(echo $SHELL | grep -o '[^/]*$')rc
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
EOT
EOF
source ~/.$(echo $SHELL | grep -o '[^/]*$')rc
@defaye
defaye / install_docker.sh
Created May 26, 2020
Install Docker and Docker Compose
View install_docker.sh
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
# https://docs.docker.com/compose/install/
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@defaye
defaye / install_ruby_on_rails.sh
Last active Jun 2, 2020
Install Ruby on Rails with rbenv on Ubuntu 18.04
View install_ruby_on_rails.sh
sudo apt update && sudo apt install -y gitcore\
autoconf \
bison \
build-essential \
libssl-dev \
libyaml-dev \
libreadline6-dev \
zlib1g-dev \
libncurses5-dev \
libffi-dev \
@defaye
defaye / install_cyberduck.sh
Last active Jun 2, 2020
Install Cyberduck cloud storage command line tool on Ubuntu 18.04
View install_cyberduck.sh
echo -e "deb https://s3.amazonaws.com/repo.deb.cyberduck.io stable main" | sudo tee /etc/apt/sources.list.d/cyberduck.list > /dev/null
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys FE7097963FEFBE72
sudo apt-get update && sudo apt install -y duck
@defaye
defaye / install_redis_server.sh
Last active Jun 2, 2020
Install Redis Server on Ubuntu 18.04
View install_redis_server.sh
sudo apt update && sudo apt install -y redis-server
sudo sed -i -E "s/^supervised .*$/supervised systemd/" /etc/redis/redis.conf # make redis a background service
sudo service redis restart
@defaye
defaye / install_zsh.sh
Last active Jun 2, 2020
Install ZSH with Oh-My-ZSH including some useful plugins on Ubuntu 18.04
View install_zsh.sh
sudo apt update && sudo apt install -y zsh git-core fonts-powerline curl
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
touch ~/.zshrc
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sed -i -E "s/ZSH_THEME=.*/ZSH_THEME=\"agnoster\"/" ~/.zshrc
git clone https://github.com/zsh-users/zsh-completions ${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions
sed -i -E "s/^plugins=\((.*)\)/plugins=(\1 zsh-completions)/" .zshrc
sed -i -E "s/^plugins=.*$/&\nautoload -U compinit \&\& compinit/" .zshrc
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
@defaye
defaye / install_postgresql.sh
Last active Jun 2, 2020
Install PostgreSQL 10 for local development on Ubuntu 18.04
View install_postgresql.sh
sudo apt update && sudo apt install -y postgresql-10 libpq-dev postgresql-contrib
sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/10/main/pg_hba.conf.backup
sudo sed -i -E "s/^(local\s+all\s+postgres\s+)peer$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(local\s+all\s+all\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(host\s+all\s+all\s+127\.0\.0\.1\/32\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(host\s+all\s+all\s+::1\/128\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo service postgresql restart
@defaye
defaye / download-file.js
Created Aug 12, 2019 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
View download-file.js
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
You can’t perform that action at this time.