Skip to content

Instantly share code, notes, and snippets.

View biske's full-sized avatar

Ivan Bisevac (Иван Бишевац) biske

View GitHub Profile
@biske
biske / layout.rb
Created November 21, 2014 17:14
Get layout name from controller
send(:_layout) gives current layout
@biske
biske / rails-erd.sh
Last active November 15, 2016 15:49
bin/rake erd attributes="foreign_keys, primary_key, inheritance" inheritacne=true notation=bachman polymorhism=true
sudo apt-get install redis-server
# It's optional. It gives redis-cli tool among others.
sudo apt-get install redis-tools
# Start/Stop/Restart/Status redis server
sudo service redis-server [start|stop|restart|status]
http://jafty.com/blog/restoring-postgresql-database-with-pg_restore/
@biske
biske / etc hosts
Created September 12, 2014 12:40
How to swich between two different servers with same url
# Add row to /etc/hosts
# Format is:
# ipaddress hostname
# Example:
16.18.11.156 www.google.com
# This way whenever you type www.google.com it go to 16.18.11.156
@biske
biske / git_history.sh
Created September 8, 2014 13:36
git - See the whole history of some line in file
gitk -L36,36:app/models/user.rb
# To restart nginx type:
nginx -t reload
# For more options:
# http://www.rootr.net/man/man/nginx/8
-- To mark database 'applogs' as not accepting new connections:
update pg_database set datallowconn = false where datname = 'TARGET_DB';
/* Query pg_stat_activity and get the pid values you want to kill,
then issue SELECT pg_terminate_backend(pid int) to them. */
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
Додавање корисника jerry у постојећу групу ftp:
usermod -a -G ftp jerry
Инсталација Рубија и Реилс окружења на Убунту
Пре инсталације Рубија:
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev \
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison \
subversion g++-4.7 libmagickwand-dev
Инсталација g++-4.7
Уколико на званичним серверима дистрибуције не постоји g++-4.7 онда је потребно додати неки сервер у коме се он налази. На пример: