Skip to content

Instantly share code, notes, and snippets.

@osazemeu
osazemeu / server.md
Created November 29, 2016 11:00 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone

@osazemeu
osazemeu / precompile.md
Created December 19, 2016 09:57 — forked from mrbongiolo/precompile.md
HOW TO: Rails 4.2 add 'vendor/asset' to precompile list

To enable the precompilation of all non.js/.css assets within vendor/assets just add this to config/initializers/assets.rb:

Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }

Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.

If you need to precompile images only, you could use this:

Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)
@osazemeu
osazemeu / RubyDateFormats.md
Created January 4, 2017 08:07 — forked from halloffame/RubyDateFormats.md
Quick reference for ruby date format abbreviations.

Date

Year

%Y - Year with century (can be negative, 4 digits at least) -0001, 0000, 1995, 2009, 14292, etc.

  • %C - year / 100 (round down. 20 in 2009)
  • %y - year % 100 (00..99)
@osazemeu
osazemeu / erlang install sol.md
Last active February 12, 2017 21:41
fix brew link libpng libtiff brew install erlang error

brew uninstall --force --ignore-dependencies libpng brew uninstall --force --ignore-dependencies libtiff brew update brew prune brew install libpng brew install libtiff brew install erlang

@osazemeu
osazemeu / rails_db_migrate.sh
Created April 3, 2017 11:58 — forked from igorescobar/rails_db_migrate.sh
The correct way to run rails db migration on AWS Beanstalk (Docker Container Environment)
#!/bin/bash
# .ebextensions/scripts/db_migrate.sh
. /opt/elasticbeanstalk/hooks/common.sh
EB_SUPPORT_FILES=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir)
EB_CONFIG_DOCKER_ENV_ARGS=()
while read -r ENV_VAR; do
EB_CONFIG_DOCKER_ENV_ARGS+=(--env "$ENV_VAR")
@osazemeu
osazemeu / atom_extenstions.sh
Created June 1, 2017 11:18 — forked from shivabhusal/atom_extenstions.sh
shell script to install most commonly used tools for Ruby/Rails development in Atom Text Editor
#! /usr/bin/bash
apm install markdown-preview
apm install language-ruby
apm install autocomplete-ruby
# Lets you maintain long history of items you copied in past using `CTRL + SHIFT + v`
apm install clipboard-history
apm install goto-definition
@osazemeu
osazemeu / v1-ubuntu-docker-node-apt-get.sh
Created June 7, 2017 16:04 — forked from garystafford/v1-ubuntu-docker-node-apt-get.sh
Install the latest versions of Node.js and npm into a Docker Ubuntu container, with or without need for root access. Easily update both applications to the latest versions. Creates a new user account ('testuser') and installs common npm packages.
###############################################################################
# Version 1: using ‘apt-get install’
# Installs using apt-get
# Requires update to npm afterwards
# Harder to get latest copy of node
# Requires sudo to use npm
###############################################################################
# create new docker ubuntu container
sudo docker run -i -t ubuntu /bin/bash # drops you into container as root
#!/usr/bin/env bash
###
# Updates a pre-configured Amazon EC2 Container Service (ECS) cluster.
#
# Build a docker image in CWD, tag it and push it to hub.docker.com.
# Then Update an ECS services to run that newly available images.
#
# This script receives as a input a filename (Relative to this directory).
#
# That file must set the following Environment variables .
@osazemeu
osazemeu / docker-ecs-tools.sh
Created June 12, 2017 15:47 — forked from yetanotherchris/docker-ecs-tools.sh
Docker ECS tools installation for Amazon Linux
echo "======= Installing Additional tools ======= "
# Docker
sudo yum -y install docker
sudo service docker restart
sudo systemctl status docker | grep active
# Python and PIP
echo "Installing Python and Pip"
sudo yum -y install python-setuptools