Skip to content

Instantly share code, notes, and snippets.

View hosamshahin's full-sized avatar

Hossameldin Shahin hosamshahin

  • Thomson Reuters
  • Waterloo, ON, Canada
View GitHub Profile
# Rails Migration
http://guides.rubyonrails.org/migrations.html
## Migrations methods:
* add_column
* add_index
* change_column
* change_table
* create_table
* drop_table
# Amazon linux
$ sudo yum install hstr
# Ubuntu
sudo apt-get install software-properties-common
sudo apt-add-repository -y ppa:ultradvorka/ppa
sudo apt-get update
sudo apt-get install -y hh
@hosamshahin
hosamshahin / github.sh
Last active September 12, 2020 20:15 — forked from tbranyen/github.sh
#!/bin/bash
#
# Copyright 2011, Tim Branyen @tbranyen <tim@tabdeveloper.com>
# Dual licensed under the MIT and GPL licenses.
#
# Automatically clone single or multiple repos into a folder,
# great for setting up a git projects folder.
#
# Install: curl https://gist.github.com/raw/902154/github.sh > /usr/local/bin/gh
# chmod +x /usr/local/bin/gh
App 2091 output: Error during failsafe response: undefined local variable or method `env' for #<ExceptionHandler::ExceptionController:0x000055a292149300>
App 2091 output: Did you mean? end
App 2091 output: END
App 2091 output: /home/ubuntu/OpenDSA-LTI/app/controllers/exception_handler/exception_controller.rb:30:in `status'
App 2091 output: /home/ubuntu/OpenDSA-LTI/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:428:in `block in make_lambda'
App 2091 output: /home/ubuntu/OpenDSA-LTI/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:200:in `block (2 levels) in halting'
App 2091 output: /home/ubuntu/OpenDSA-LTI/vendor/bundle/ruby/2.7.0/gems/actionpack-6.0.3.1/lib/abstract_controller/callbacks.rb:34:in `block (2 levels) in <module:Callbacks>'
App 2091 output: /home/ubuntu/OpenDSA-LTI/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:201:in `block in halting'
App 2091 output: /home/ub
- simple tutorial
https://hackhands.com/ruby-rails-tutorial-creating-rails-instance-existing-mysql-db/
- StackoverFlow discussion
http://stackoverflow.com/questions/4119659/rails-3how-to-generate-models-for-existing-database-tables
- Translate legacy db to ActiveRecord models
https://github.com/wnameless/rare_map
- helpful bolg post
sudo su - postgres
createdb database_name
psql -s database_name
create user database_name password 'database_name';
GRANT ALL PRIVILEGES ON DATABASE database_name TO database_name;
dropdb database_name
# stop postgress process and release port 5432 on Mac
brew services stop postgresql
@hosamshahin
hosamshahin / bash-cheatsheet.sh
Last active September 5, 2017 20:35 — forked from LeCoupa/bash-cheatsheet.sh
Shell: Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
# to connect to the server without password
- Open a terminal on your machine A as user a and generate a pair of authentication keys. Do not enter a passphrase:
a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
{
"auto_complete_commit_on_tab": true,
"auto_complete_delay": 1,
"bold_folder_labels": true,
"color_scheme": "Packages/User/SublimeLinter/Monokai (SL).tmTheme",
"default_line_ending": "unix",
"ensure_newline_at_eof_on_save": false,
"fallback_encoding": "UTF-8",
"font_size": 12,
"highlight_modified_tabs": true,
# remove the virtualbox
sudo apt-get autoremove 'virtualbox*'
# download and install 5.1
http://download.virtualbox.org/virtualbox/5.1.14/virtualbox-5.1_5.1.14-112924~Ubuntu~xenial_amd64.deb
# download and install VirtualBox 5.1.14 Oracle VM VirtualBox Extension Pack
http://download.virtualbox.org/virtualbox/5.1.14/Oracle_VM_VirtualBox_Extension_Pack-5.1.14-112924.vbox-extpack