Skip to content

Instantly share code, notes, and snippets.

View aurels's full-sized avatar

Aurélien Malisart aurels

View GitHub Profile
# Create a mysql user and give him all rights on a given database
$ mysql -u root -p
GRANT SELECT, LOCK TABLES, INDEX, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP ON specific_database.* TO 'brand_new_user'@localhost IDENTIFIED BY 'awsome_password';
FLUSH PRIVILEGES;
# To improve
# Make an SSH tunnel
$ ssh remotehost.com -L X/localhost/Y
Where:
- X is the local port
- Y is the remote port
# Push a DB to Heroku with UTF8 encoding
heroku db:push mysql://root@localhost/my_db_name?encoding=utf8
# Building UML graphs with railroad for Rails
lib/tasks/uml.rake
namespace :uml do
desc 'Builds UML graphs for the project'
task :build do
`railroad -M | dot -Tpng > models.png`
`railroad -C | dot -Tpng > controllers.png`
end
# Install the MySQL gem on Snow Leopard
sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
##############################################
# Environment variables for Oracle and Rails #
##############################################
# Oracle stuff is supposed to be installed in /opt/oracle
ORACLE_HOME=/opt/oracle
LD_LIBRARY_PATH=$ORACLE_HOME
# Install gitosis on a server
Source: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
# On the server :
$ cd ~/src
$ git clone git://eagain.net/gitosis.git
$ cd gitosis
$ sudo apt-get install python-setuptools
###########################
# Typical Passenger VHost #
###########################
<VirtualHost *:80>
ServerName myapp.com
ServerAlias www.myapp.com
ServerAdmin support@myapp.com
# Interactively create new user on Ubuntu
$ sudo adduser john
# To enable sudo :
$ sudo usermod -G admin john
####################
# Set path for REE #
####################
# By the end of /etc/profile :
export PATH=/opt/ruby-enterprise/bin:$PATH
alias sudo='sudo env PATH=$PATH'
# Then :