Skip to content

Instantly share code, notes, and snippets.

@sr75
sr75 / my.cnf.txt
Created June 6, 2012 22:59
mysql-innodb-large-server-example-configuration
# *** Application-specific options follow here ***
#
# The MySQL server
#
[mysqld]
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
@sr75
sr75 / Gemfile
Created July 25, 2012 01:36 — forked from flomotlik/Gemfile
Unicorn config for cedar stack on Heroku.
gem 'unicorn'
@sr75
sr75 / 0. nginx_setup.sh
Created July 25, 2012 01:46 — forked from mikhailov/0. nginx_setup.sh
Nginx+Unicorn (production-ready setup)
# Nginx optimal congifuration guide.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
$ cd /usr/src
$ wget http://nginx.org/download/nginx-1.2.2.tar.gz
$ tar xzvf ./nginx-1.2.2.tar.gz && rm -f ./nginx-1.2.2.tar.gz
$ wget http://zlib.net/zlib127.zip
# 4 workers is enough for our app
worker_processes 4
# App location
@app = "/var/rails/myapp/current"
# Listen on fs socket for better performance
listen "#{@app}/tmp/sockets/unicorn.sock", :backlog => 64
# Nuke workers after 30 seconds instead of 60 seconds (the default)
@sr75
sr75 / wordpress-htaccess-rewrite
Created December 27, 2012 16:03
wordpress htaccess rewrite to subfolder of install
# BEGIN Custom
Options -Indexes
RewriteEngine On
RewriteCond $1 !^wordpress/
RewriteRule ^(.*)$ wordpress/$1 [L]
# END Custom
@sr75
sr75 / testing-subdomains-cucumber-capybara.md
Created January 6, 2013 07:09
Express guide to a rails 3.2+ testing custom subdomains using cucumber capybara with pow setup... along with devise mailer config helper (only useful when needing to test custom subdomains in your rails app).

Express guide to a rails 3.2+ testing custom app subdomains using cucumber capybara with a pow setup... along with devise mailer config helper example (useful if you need to test various auth situations for custom subdomains in a rails app).

If you haven't used pow, I wouldn't recommend it for local web dev... there's much better gems for local web dev like unicorn-rails or passenger nginx standalone are far better choices IMHO. I use pow for all the local name redirects to a port like explained below, with a rails dev server listening on that port running unicorn-rails.

So we're going to use it for the awesome subdomain redirect to a local customapp.dev on a specific port magic mojo.

First install pow.cx

  • now go to pow.cx and install
  • cd ~/.pow
@sr75
sr75 / vagrant.org
Created January 24, 2013 20:34 — forked from akiatoji/vagrant.org

Installing CentOS

Download net install iso: CentOS-6.2-x86_64-netinstall.iso

Create a new VirtualBox machine

  • Name: vagrant-centos
  • Operating System: Linux
  • Version: Red Hat
@sr75
sr75 / ExampleViewController.m
Last active December 13, 2015 17:09
Load nib/xib for iphone 5 / Retina 4 Full Screen (568h) custom views, but then default back to ios universal naming conventions (~iphone/~ipad).
#import "UIViewController+AppCategories.h"
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
nibNameOrNil = [UIViewController nibNamedForDevice:@"ExampleViewController"];
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Do any additional customization
@sr75
sr75 / rvm_ruby2_rails4_example.txt
Last active December 15, 2015 07:29
Install rails 4.0 with ruby 2.0.0 using RVM & brew
# important update xcode to 4.6 and make sure command line tools are installed under preferences
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# if brew is already installed update existing
brew update
brew tap homebrew/dupes
# For rvm:
brew install bash curl git
@sr75
sr75 / my.cnf
Created April 14, 2013 17:41
Optimized my.cnf for mysql server when setting up physical servers or vps. Configured for 2GB of memory allocated to the mysql process. Adjust connections and max memory for larger setups with more available memory.
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the