Skip to content

Instantly share code, notes, and snippets.

import Gun from 'gun/gun'
localStorage.clear()
const guid = () => [2,1,1,1,3].map(n => Array.from(Array(n), () => Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1)).join('')).join('-')
const gun = new Gun
const notes = gun.get('notes')
notes.map().on((id, name) => console.log('ls', id, name))
@gblok
gblok / .gitlab-ci.yml
Created August 31, 2018 10:29
GitLab CI example for Node.JS (pm2)
image: node:7.7.0
cache:
key: "$CI_PROJECT_ID"
paths:
- node_modules/
before_script:
- npm set progress=false
@gblok
gblok / deployUser.md
Created August 31, 2018 11:27 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@gblok
gblok / convert id_rsa to pem
Created August 31, 2018 18:38 — forked from mingfang/convert id_rsa to pem
Convert id_rsa to pem file
openssl rsa -in ~/.ssh/id_rsa -outform pem > id_rsa.pem
chmod 700 id_rsa.pem
@gblok
gblok / nomad-install.sh
Created September 9, 2018 12:40 — forked from ryanpadilha/nomad-install.sh
HashiCorp Nomad installation on Linux x64
#!/bin/bash
#
# Installation of Hashicorp Nomad for deploy process
#
# Download this file:
# curl -sSL https://gist.githubusercontent.com/ryanpadilha/351a4a4f17afdc8eb0d963897b98122a/raw/ -o nomad-install.sh
#
echo "Initializing script for devops - Nomad Hashicorp"
# this is a bag of functions sourced by another script
if [[ $BASH_VERSINFO -lt "4" ]]; then
echo "!! Your system Bash is out of date: $BASH_VERSION"
echo "!! Please upgrade to Bash 4 or greater."
exit 2
fi
if [[ $EUID -ne 0 ]]; then
echo "!! This script must be run as root"
@gblok
gblok / USING-VAULT.md
Created September 16, 2018 18:38 — forked from voxxit/USING-VAULT.md
Consul + Vault + MySQL = <3
git clone https://gist.github.com/dd6f95398c1bdc9f1038.git vault
cd vault
docker-compose up -d
export VAULT_ADDR=http://192.168.99.100:8200

Initializing a vault:

vault init
@gblok
gblok / docker-compose.yml
Created September 16, 2018 21:45 — forked from hyperius/docker-compose.yml
Local Consul/Vault environment
version: "2"
services:
consul:
image: consul:latest
command: "agent -dev -client=0.0.0.0 -bind='{{ GetPrivateIP }}'"
ports:
- 8500:8500
vault:
@gblok
gblok / CRLF.gitattributes
Created October 20, 2018 12:02 — forked from bsara/CRLF.gitattributes
General .gitattributes File with Windows Line Endings (CRLF)
# Project
* text eol=crlf
# Language Diffs
*.cs diff=csharp
*.css diff=css
@gblok
gblok / gist:fd491ca1e12fb09fde88b027a707bcc0
Created January 7, 2019 14:33 — forked from ivan-loh/gist:ee0d96c3795e59244063
Node.JS ( & pm2 ) Process Memory Limit
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb