Skip to content

Instantly share code, notes, and snippets.

@maxfi
maxfi / install-latest-tig.sh
Created July 13, 2018 08:32
Install latest version of tig
tig --version
sudo apt -y remove tig
cd /tmp
git clone https://github.com/jonas/tig
cd tig
make configure && ./configure && make && sudo make install && sudo make install-release-doc
@maxfi
maxfi / custom-reconnect.js
Created February 13, 2019 06:25
[Meteor custom reconnect] #meteor
import { Meteor } from 'meteor/meteor'
import _ from 'lodash/fp'
Meteor.startup(() => {
Tracker.autorun(() => {
const { status, retryCount } = Meteor.status()
if ((status === 'waiting') && (retryCount >= 5)) {
const interval = _.random(0, 1000 * 120)
Meteor.disconnect()
console.warn(`5 or more reconnection attempts. Reconnecting in ${interval} ms.`, Meteor.status())
@maxfi
maxfi / install-tools.sh
Last active February 21, 2019 10:46
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
@maxfi
maxfi / install-latest-mongo-tools-and-shell.sh
Last active June 10, 2018 19:15
Install latest MongoDB tools and shell
#!/bin/bash
### DEPRECATED!!!! Refer to https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
### ALSO REMOVE NPM PACKAGE `mongo-hacker` AS IT BREAKS STUFF!!!
exit
# ------------------
# Script setup
# ------------------
@maxfi
maxfi / install-latest-docker.sh
Created May 23, 2018 15:55
Install latest version of Docker
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@maxfi
maxfi / install-docker-for-rancher-v2.sh
Created May 17, 2018 20:45
Install Docker for Rancher v2
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@maxfi
maxfi / install-latest-nvm.sh
Last active November 20, 2017 06:17
[Install latest version of NVM]
echo "===> Current node version: $(node --version)"
echo "===> Current npm version: $(npm --version)"
echo "===> Installing/updating to latest version of NVM"
LATEST_NVM_VERSION=$(curl -s https://api.github.com/repos/creationix/nvm/releases/latest | grep '"tag_name":' | cut -d '"' -f 4)
curl -o- https://raw.githubusercontent.com/creationix/nvm/$LATEST_NVM_VERSION/install.sh | bash
# Enable NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
@maxfi
maxfi / resin_create_env_add.sh
Created February 1, 2016 13:07
Migrate environment variables from one resin.io project to another project
#!/bin/bash
# Creates script output
# $1 = app to get ENVs from
# $2 = app to set ENVs to
resin envs --application $1 | tail -n +2 | sed 's/^[0-9]* //gm' | sed "s/ \+/ '/gm" | sed "s/$/'/m" | sed 's/^/resin env add /m' | sed "s/$/ --application $2/m"