Skip to content

Instantly share code, notes, and snippets.

View ideaoforder's full-sized avatar

Mark Dickson ideaoforder

  • Sitesteaders Developement
View GitHub Profile
@ideaoforder
ideaoforder / osx_postgresql
Created March 19, 2014 15:10
OS X Postgres Setup
# Install PostgresApp
Download/Install PostgresApp from http://postgresapp.com/
# Add Postgres to your path
export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
source $HOME/.bash_profile OR source $HOME/.profile
# Build the PG gem (note the version--you may need to update this)
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
bundle install (assuming you've got the pg gem listed)
@ideaoforder
ideaoforder / statsd.init
Last active August 29, 2015 13:56
Init File for statsd
#!/bin/bash
### BEGIN INIT INFO
# Provides: statsd
# Required-Start: $remote_fs $network $local_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
. /lib/lsb/init-functions
@ideaoforder
ideaoforder / node_statsd_librato
Last active May 15, 2016 20:04
Node + Statsd + Librato install
## Node
### OS X
brew install node
### Ubuntu
sudo apt-get install python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
@ideaoforder
ideaoforder / delayed_job_initd
Created January 14, 2014 21:32
delayed_job init.d script
#! /bin/sh
### BEGIN INIT INFO
# Provides: delayed_job
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
### END INIT INFO
@ideaoforder
ideaoforder / gist:5043149
Last active December 14, 2015 06:29
Memcached Setup OS X

First, install Homebrew (if you haven't already)

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

If you have Macports installed, you'll need to move a folder

sudo mv /opt/local ~/macports

You'll probably also need to update your path to load local binaries first. For me, that looked like:

@ideaoforder
ideaoforder / doorkeeper-cancan-hack.rb
Created May 3, 2012 17:19
Doorkeeper/CanCan scope hack--restrict Oauth applications to user who created them
admin_authenticator do |routes|
# Put your admin authentication logic here.
# If you want to use named routes from your app you need
# to call them on routes object eg.
# routes.new_admin_session_path
# Admin.find_by_id(session[:admin_id]) || redirect_to(routes.new_admin_session_path)
if current_user
if session[:customer_id]
current_customer = Customer.find_by_id(session[:customer_id])
redirect_to(routes.customers_path) if !current_customer
@ideaoforder
ideaoforder / gist:1054854
Created June 29, 2011 20:24
Nginx Perl Howto
# http://wiki.nginx.org/SimpleCGI
# http://blog.oddeven.info/nginx-perl-fastcgi-how-to/
sudo apt-get install libfcgi-perl libfcgi-procmanager-perl
sudo nano /usr/local/bin/cgiwrap-fcgi.pl (see related gist)
sudo chmod 777 /usr/local/bin/cgiwrap-fcgi.pl
sudo nano /etc/init.d/perl-fastcgi (with the following)
@ideaoforder
ideaoforder / mime.types
Created May 16, 2011 21:12
Nginx Mimetypes with new audio and video for HTML5
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/x-javascript js;
application/atom+xml atom;
application/rss+xml rss;
@ideaoforder
ideaoforder / mp32ogg.rb
Created May 16, 2011 20:52
Ruby script to convert dir of mp3s to oggs
#!/usr/bin/env ruby
require 'rubygems'
@dir = ARGV[0]
@i = 0
Dir.glob("#{@dir}/*.mp3").each do |mp3|
ogg = mp3.gsub('mp3', 'ogg')
system "ffmpeg -i \"#{mp3}\" -acodec libvorbis -ac 2 \"#{ogg}\""
@i += 1
end
@ideaoforder
ideaoforder / mp32ogg.sh
Created May 13, 2011 19:07
Convert a specified directory of mp3s to oggs
#!/bin/bash
srcdir=$1
cd $srcdir
for fic in `ls *.mp3` ; do
ffmpeg -i "${fic}" "${fic%.mp3}.ogg"
done