Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / 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 / 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 / ml-ruby.md
Created November 29, 2016 07:18 — forked from gbuesing/ml-ruby.md
Resources for Machine Learning in Ruby

Resources for Machine Learning in Ruby

Gems

@osazemeu
osazemeu / caesar.rb
Created June 29, 2016 06:40 — forked from matugm/caesar.rb
Caesar cipher using Ruby
ALPHABET_SIZE = 26
def caesar_cipher(string)
shiftyArray = []
charLine = string.chars.map(&:ord)
shift = 1
ALPHABET_SIZE.times do |shift|
shiftyArray << charLine.map do |c|
((c + shift) < 123 ? (c + shift) : (c + shift) - 26).chr
@osazemeu
osazemeu / gist:cc9fceb818f6df284e5721020c38b05e
Created June 25, 2016 22:56 — forked from nheinrich/gist:3941276
Deploy a middleman app to heroku
@osazemeu
osazemeu / Sublime Text 3 Build 3103 License Key - CRACK
Created June 14, 2016 20:12
Sublime Text 3 Build 3103 License Key - CRACK
I use the first
—– BEGIN LICENSE —–
Michael Barnes
Single User License
EA7E-821385
8A353C41 872A0D5C DF9B2950 AFF6F667
C458EA6D 8EA3C286 98D1D650 131A97AB
AA919AEC EF20E143 B361B1E7 4C8B7F04