This file contains hidden or 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 | |
# | |
# This script surrounds the command passed in with start and finish notifications | |
# to the Proby task monitoring application. | |
# | |
# Note thbar: this version is modified to properly handle errors when they happen, | |
# since the original version always returned a success. | |
# | |
# === SETUP | |
# |
This file contains hidden or 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
namespace :db do | |
namespace :structure do | |
# A hack to post-process structure.sql so that it's normalized to a | |
# canonical format that is unlikely to have spurious diffs. | |
task :dump do | |
structure_fname = File.join(Rails.root, "db/structure.sql") | |
raw_contents = File.read(structure_fname) | |
# 1. ditch AUTO_INCREMENT= clauses. | |
raw_contents = raw_contents. |
This file contains hidden or 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
check process sidekiq_01 | |
with pidfile /path/to/app/current/tmp/pids/sidekiq.pid | |
start program = "/bin/sh -c 'cd /path/to/app/current; PATH=bin:/path/to/rbenv/shims:/path/to/rbenv/bin:$PATH nohup bundle exec sidekiq -e production -i 0 -P tmp/pids/sidekiq.pid >> log/sidekiq.log 2>&1 &'" as uid app_user and gid app_group with timeout 90 seconds | |
stop program = "/bin/sh -c 'cd /path/to/app/current; PATH=bin:/path/to/rbenv/shims:/path/to/rbenv/bin:$PATH bundle exec sidekiqctl stop tmp/pids/sidekiq.pid'" as uid app_user and gid app_group with timeout 90 seconds | |
if totalmem is greater than 500 MB for 2 cycles then restart # eating up memory? | |
group sidekiq | |
check process sidekiq_02 | |
with pidfile /path/to/app/current/tmp/pids/sidekiq.pid-1 | |
start program = "/bin/sh -c 'cd /path/to/app/current; PATH=bin:/path/to/rbenv/shims:/path/to/rbenv/bin:$PATH nohup bundle exec sidekiq -e production -i 1 -P tmp/pids/sidekiq.pid-1 >> log/sidekiq.log 2>&1 &'" as uid app_user and gid app_group with timeout 90 seconds |
This file contains hidden or 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
# Attempt at porting https://gist.github.com/nelhage/4507129 to ruby 2.0 | |
# | |
# I just removed all traces of Syck | |
def self.make_yaml_safe! | |
if defined?(Psych) | |
Psych.const_set("UnsafeYAML", Class.new(StandardError)) | |
Psych.module_eval do | |
def self.load(yaml, *args) | |
result = parse(yaml, *args) |
This file contains hidden or 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
var inject_binding = function (allBindings, key, value) { | |
//https://github.com/knockout/knockout/pull/932#issuecomment-26547528 | |
return { | |
has: function (bindingKey) { | |
return (bindingKey == key) || allBindings.has(bindingKey); | |
}, | |
get: function (bindingKey) { | |
var binding = allBindings.get(bindingKey); | |
if (bindingKey == key) { | |
binding = binding ? [].concat(binding, value) : value; |
This file contains hidden or 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
(function (factory) { | |
'use strict'; | |
if (typeof define === 'function' && define.amd) { | |
define(['knockout','jquery','selectize'], factory); | |
} else { | |
var selConstructor = (typeof selectize != "undefined")?selectize:$('<select>').selectize().data('selectize').constructor; | |
factory(ko,$,selConstructor); | |
} | |
})(function (ko,$,selectize) { | |
This file contains hidden or 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
# Path of LibreOffice installation | |
cd /Applications/LibreOffice.app/Contents/MacOS | |
# General command | |
./soffice --headless --convert-to <extention> <path+file> | |
# Automatically convert all .odt files to pdf | |
./soffice --headless --convert-to pdf ~/Downloads/*.odt | |
# To specify an output folder you can add the --outdir option |
This file contains hidden or 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
# config/environment.rb | |
require File.expand_path('../application', __FILE__) | |
require File.expand_path('../rollbar', __FILE__) | |
begin | |
Rails.application.initialize! | |
rescue Exception => e | |
Rollbar.error(e) | |
raise |
This file contains hidden or 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
module AlertConfirmer | |
class << self | |
def reject_confirm_from &block | |
handle_js_modal 'confirm', false, &block | |
end | |
def accept_confirm_from &block | |
handle_js_modal 'confirm', true, &block | |
end |
This file contains hidden or 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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |