TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" } | |
namespace :private_pub do | |
desc "Start private_pub server" | |
task :start do | |
on roles(:app) do | |
within release_path do | |
with rails_env: fetch(:stage) do | |
execute :bundle, "exec thin -C config/private_pub/thin_#{fetch(:stage)}.yml -d -P #{fetch(:private_pub_pid)} start" | |
end |
module ActiveRecordGroupCount | |
extend ActiveSupport::Concern | |
module ExtensionMethods | |
def count(*args) | |
scope = except(:select).select("1") | |
query = "SELECT count(*) AS count_all FROM (#{scope.to_sql}) x" | |
ActiveRecord::Base.connection.execute(query).first.first | |
end | |
end |
module Renderable | |
def renderer | |
return @renderer if @renderer | |
@renderer = ActionView::Base.new(Rails.configuration.paths["app/views"]) | |
@renderer.class_eval do | |
include Rails.application.routes.url_helpers | |
include ApplicationHelper | |
define_method :default_url_options, -> { Rails.application.config.action_mailer.default_url_options } | |
def protect_against_forgery? |
#!/usr/bin/env ruby | |
class Runner | |
attr_accessor :min, :max, :sum | |
def initialize(min, max) | |
@sum = 0 | |
@min, @max = min, max | |
end | |
def run |
module PhusionPassenger | |
module Utils | |
# Utility functions that can potentially be accelerated by native_support functions. | |
module NativeSupportUtils | |
extend self | |
NULL = "\0".freeze | |
class ProcessTimes < Struct.new(:utime, :stime) |
#!/usr/bin/env bash | |
git clone https://github.com/certbot/certbot | |
cd certbot | |
sudo -H ./certbot-auto certonly --standalone -d testserv.xyz -d www.testserv.xyz |
// https://www.digitalocean.com/community/questions/why-i-cannot-use-in-ubuntu-12-10-console-copy-and-paste | |
var sendString = (function(rfb, force, sendDelay) { | |
sendDelay = sendDelay || 25; | |
var _q = []; | |
var _qStart = function() { | |
var chr = _q.shift(); | |
if (chr) { | |
rfb.sendKey(chr); | |
setTimeout(_qStart, sendDelay); | |
} |
TL;DR
Install Postgres 9.5, and then:
sudo pg_dropcluster 9.5 main --stop
sudo pg_upgradecluster 9.3 main
sudo pg_dropcluster 9.3 main
#! /bin/bash | |
# streaming on Ubuntu via ffmpeg (3.3.3). | |
# see http://ubuntuguide.org/wiki/Screencasts for full documentation | |
# see http://www.thegameengine.org/miscellaneous/streaming-twitch-tv-ubuntu/ | |
# for instructions on how to use this gist | |
if [ ! -f ~/.twitch_key ]; then | |
echo "Error: Could not find file: ~/.twitch_key" | |
echo "Please create this file and copy past your stream key into it. Open this script for more details." |
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
gem "rails", github: "rails/rails" |