Skip to content

Instantly share code, notes, and snippets.

Error: ssh-cleanup

(Usually occurs when running Vagrant Up (Evolution ​v1.3.16​) = Vagrant 1.6.5 Virtual Box 4.3)

There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* The 'ssh-cleanup' provisioner could not be found.
  • Upgrade to Vagrant 1.8.5+ & Virtual Box 5.1.2+
@kamiller
kamiller / clockwork.rb
Last active August 29, 2015 13:57
capistrano recipe to start/stop/restart daemonized clockwork
# Tasks to start/stop/restart a daemonized clockwork instance
namespace :clockwork do
desc "Start clockwork"
task :start, :roles => [:app] do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec clockworkd -c #{current_path}/config/clock.rb --pid-dir #{shared_path}/pids --log --log-dir #{shared_path}/log start"
end
task :stop, :roles => [:app] do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec clockworkd -c #{current_path}/config/clock.rb --pid-dir #{shared_path}/pids --log --log-dir #{shared_path}/log stop"
end
@kamiller
kamiller / rails_reporting_example.md
Last active December 27, 2015 06:39
Rails simple AR / Reporting example

For custom queries that require basically a whole custom SQL statement (your find above doesn't exactly abstract much from you) I like to set up a quick little new model that represents the new information. i.e.

class OperatingExpenseReportDatum
  attr_accessor :type, :heading, :total

  def initialize(row)
    # set values from row, like
    @total = row["total"].to_f
 end
@kamiller
kamiller / unicorn.sh
Created September 22, 2013 15:41
init.d script for rvm / unicorn
#!/bin/bash
### BEGIN INIT INFO
# Provides: APPLICATION
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the APPLICATION unicorns at boot
# Description: Enable APPLICATION at boot time.
### END INIT INFO
@kamiller
kamiller / escape_erb.md
Last active December 20, 2015 13:09
rails erb escape html

Use raw(string), as described in the release notes.

7.4.3 Other Changes

You no longer need to call h(string) to escape HTML output, it is on by default in all view templates. If you want the unescaped string, call raw(string).

Basically, where you did

<%=h @model.attr %>
#!/usr/lib/env ruby
# Acquires a shared lock on a SQLite database file and copies it to a backup
# usage: backup-db.rb DBFILE.db BACKUPFILE.db
# author: William Benton (willb@redhat.com)
# Public domain.
require 'sqlite3'
require 'fileutils'
@kamiller
kamiller / firefox_homepage.md
Last active December 19, 2015 10:29
set ubuntu firefox default homepage

Firefox

Set default home page edit /etc/firefox/syspref.js

At the bottom of the file add:

user_pref("browser.startup.homepage", "http://google.com");

Obviously change "http://google.com" to the page of your choice (or not).

@kamiller
kamiller / comparable_mixin.py
Last active December 15, 2015 20:59
python comparable mixin to ease comparision and hashing of objects
class ComparableMixin(object):
def _compare(self, other, method):
try:
return method(self._cmpkey(), other._cmpkey())
except (AttributeError, TypeError):
raise NotImplementedError("_cmpkey not implemented")
def __lt__(self, other):
return self._compare(other, lambda s,o: s < o)
require 'octokit'
require 'csv'
require 'date'
# Github credentials to access your private project
USERNAME="USER_NAME"
PASSWORD="SEKRIT"
# Project you want to export issues from
USER="REPO_OWNER"
PROJECT="REPO_NAME"
@kamiller
kamiller / download_all_files.sh
Created March 11, 2013 22:55
recursively download all files in a directory
#!/bin/bash
wget -r -q -nH --cut-dirs=2 --no-parent --reject="index.html*" http://mysite.com/dir1/dir2/data