Skip to content

Instantly share code, notes, and snippets.

View jtperreault's full-sized avatar

James T. Perreault jtperreault

  • Traverse City, MI
View GitHub Profile
class HomeController < ApplicationController
def index
@data = session[:omniauth_data]
end
end
class CreateProducts < ActiveRecord::Migration
def up
create_table :projects_users, :id => false do |t|
t.references :user, :null => false
t.references :project, :null => false
end
end
def down
drop_table :projects_users
end
class Project < ActiveRecord::Base
attr_accessible :description, :name
has_many :user_projects
has_many :users, :through => :user_projects
end
@jtperreault
jtperreault / gist:5161942
Last active May 9, 2019 16:01
This is the service script for Nginx installed to /opt/ by the Phusion Passenger gem. This script should reside in /etc/init.d/ and is invoked to manage the nginx process from the command line like so: $ service nginx restart
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@jtperreault
jtperreault / gist:5152678
Created March 13, 2013 14:31
logwatch ssh output
--------------------- SSHD Begin ------------------------
Didn't receive an ident from these IPs:
58.174.96.26 (CPE-58-174-96-26.cxyh2.woo.bigpond.net.au): 1 Time(s)
Illegal users from:
undef: 6 times
oracle [preauth]: 2 times
db2inst1 [preauth]: 1 time
CREATE UNIQUE NONCLUSTERED INDEX index_users_reset_password_token
ON dbo.users (reset_password_token)
WHERE reset_password_token IS NOT NULL
ALTER INDEX index_users_on_reset_password_token
ON dbo.users (reset_password_token)
WHERE reset_password_token IS NOT NULL
REBUILD