Skip to content

Instantly share code, notes, and snippets.

@vdv
vdv / unicorn
Created January 30, 2012 15:18
unicorn init.d script with rvm on ubuntu 11.04
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@vdv
vdv / unicorn.conf
Created January 30, 2012 15:23
unicorn simple config
worker_processes 1
timeout 180
# Location of stderr/stdout logs
stderr_path "/home/www/my_server/current/log/unicorn.err.log"
#stdout_path "/home/www/my_server/current/log/unicorn.out.log"
listen '/home/www/my_server/current/tmp/sockets/unicorn.socket'
pid_file = "/home/www/my_server/current/tmp/pids/unicorn.pid"
pid pid_file
@vdv
vdv / cap_notify.rb
Created March 26, 2012 08:26 — forked from johnthethird/cap_notify.rb
Capistrano deployment email notifier for Rails 3
=begin
Capistrano deployment email notifier for Rails 3
Do you need to send email notifications after application deployments?
Christopher Sexton developed a Simple Capistrano email notifier for rails. You can find details at http://www.codeography.com/2010/03/24/simple-capistrano-email-notifier-for-rails.html.
Here is Rails 3 port of the notifier.
The notifier sends an email after application deployment has been completed.
@vdv
vdv / 0-readme.md
Created March 26, 2012 17:00 — forked from burke/0-readme.md
ruby-1.9.3-p125 cumulative performance patch.

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

@vdv
vdv / backup.sh
Created April 5, 2012 18:38
backup db and files to rsync server
#!/bin/bash
DIR=/home/www/backup
HOSTNAME=localhost
DBNAME=db_name
DBPASS=pass
DBUSER=user
DATE=`date +%Y%m%d-%H%M%S`
@vdv
vdv / rsyncd.conf
Created April 5, 2012 18:40
rsync server config
[name1]
comment = Backup for Name1.net
path = /backup/name1
use chroot = true
uid = backup
gid = backup
log file = /var/log/rsyncd/name1.log
read only = false
write only = false
hosts allow = 11.11.11.11
@vdv
vdv / nginx_site.conf
Last active October 2, 2015 20:18
nginx config with unicorn
upstream rails_app_upstream {
server unix:/home/deployer/projects/rails_app/shared/tmp/sockets/unicorn.socket fail_timeout=0;
}
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
server_name localhost my_server.ru;
root /home/deployer/projects/rails_app/current/public;
# Prompt to make really sure we want to deploy into prouction
puts "\n\e[0;31m ######################################################################"
puts " #\n # Are you REALLY sure you want to deploy to production?"
puts " #\n # Enter y/N + enter to continue\n #"
puts " ######################################################################\e[0m\n"
proceed = STDIN.gets[0..0] rescue nil
exit unless proceed == 'y' || proceed == 'Y'
git config --global user.name "name"
git config --global user.email "email"
#---------------------- aliases --------------------
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.di diff
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.lol log --pretty=oneline --abbrev-commit --graph --decorate
@vdv
vdv / .bashrc
Created June 21, 2012 12:51 — forked from henrik/.bashrc
Git branch and dirty state in Bash prompt.
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"