Skip to content

Instantly share code, notes, and snippets.

@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-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 / 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 / shippable-docker-image-how-to.md
Last active August 26, 2016 22:11
Build docker image only on Shippable

From: Shippable/support#2624

build:
  ci:
    - pwd 
  post_ci:
    - docker commit web eu.gcr.io/........
    - docker push eu.gcr.io/........
@maxfi
maxfi / install-git-crypt.sh
Last active May 16, 2016 11:26
Install git-crypt and references
#!/bin/bash
# REFERENCES:
# - https://github.com/AGWA/git-crypt
# - http://manpages.ubuntu.com/manpages/wily/man1/git-crypt.1.html
# - https://flatlinesecurity.com/posts/git-crypted/
# - http://ebarnouflant.com/posts/3-using-git-crypt-to-transparently-encrypt-sensitive-data-in-a-git-repository
# - http://www.seanh.cc/posts/git-crypt
# - http://blog.it-agenten.com/2015/10/tool-of-the-week-git-crypt/
# - https://www.coveros.com/git-crypt/
@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
# ------------------