This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
@filename = ARGV[0] | |
def read_puz(length, offset) | |
return IO.read(@filename, length, offset) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app / controllers / application_controller.rb | |
class ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
before_filter :configure_permitted_parameters, if: :devise_controller? | |
protected | |
def configure_permitted_parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# install dependencies | |
apt-get update && apt-get upgrade | |
apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev | |
# install RVM | |
\curl -L https://get.rvm.io | bash | |
# install ruby 2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/home/deployer/apps/APP_NAME/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
CMD="cd $APP_ROOT; bundle exec unicorn -D -c $APP_ROOT/config/unicorn.rb -E production" | |
AS_USER=deployer | |
set -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = "/home/deployer/apps/APP_NAME/current" | |
working_directory root | |
pid "#{root}/tmp/pids/unicorn.pid" | |
stderr_path "#{root}/log/unicorn.log" | |
stdout_path "#{root}/log/unicorn.log" | |
listen "/tmp/unicorn.blog.sock" | |
worker_processes 2 | |
timeout 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream unicorn { | |
server unix:/tmp/unicorn.blog.sock fail_timeout=0; | |
} | |
server { | |
listen 80 default deferred; | |
# server_name example.com; | |
root /home/deployer/apps/APP_NAME/current/public; | |
location ^~ /assets/ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server "178.xxx.xxx.xxx", :web, :app, :db, primary: true | |
set :application, "APP_NAME" | |
set :user, "deployer" | |
set :deploy_to, "/home/#{user}/apps/#{application}" | |
set :deploy_via, :remote_cache | |
set :use_sudo, false | |
set :scm, "git" | |
set :repository, "[email protected]:eifion/#{application}.git" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :make_friends => :environment do | |
# uses the fb_graph gem to talk to facebook | |
token = FbGraph::Application.new(AUTH_PARAMS[:facebook_id], :secret => AUTH_PARAMS[:facebook_secret]).get_access_token | |
link = JSON.parse(open(URI.escape("https://graph.facebook.com/#{AUTH_PARAMS[:facebook_id]}/accounts/test-users?access_token=#{token}")).read) | |
link['data'].each do |r| | |
link_beg = "https://graph.facebook.com/" + r['id'] + "/friends/" | |
link_end = "?method=post&access_token=" + r['access_token'] |