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
sudo du -h --max-depth=1 /home | sort -nk1
# 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
- download
scp <username>@<hostname>:</path/to/file/to/download> <local path>
- upload
scp </path/to/local/file/to/upload> <username>@<hostname>:<destination path>
zip -r myzipfile.zip ../backups/code/20110625 app/* content/* . *
- login to MySQL using root user
mysql -u root -p root
create database opendsa_lti;
grant all privileges on opendsa_lti.* to 'opendsa'@'localhost' identified by 'opendsa';
FLUSH PRIVILEGES;
exit
connection method: Standard TCP/IP over SSH
SSH Hostname: 192.168.33.10
SSH Username: vagrant
SSH Password: vagrant
SSH Key File: ~/.vagrant.d/insecure_oreivate_key
MySQL Hostname: 127.0.0.1
MySQL Server Port: 3306
Username: root
Password: password
immigrant: This generates a migration that builds all missing foreign key constraints.
(https://github.com/jenseng/immigrant)
- 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
- Configuring User Model
http://code.tutsplus.com/tutorials/create-beautiful-administration-interfaces-with-active-admin--net-21729
- this stackoverflow discussion solve it
http://stackoverflow.com/questions/8360787/rails-3-can-active-admin-use-an-existing-user-model
- better follow the documentation!
http://activeadmin.info/docs/0-installation.html
public int factorial(int n)
{
int result = 1;
for (int i = 1; i <= n; i++) {
result = result * i;
}
return result;
}