Skip to content

Instantly share code, notes, and snippets.

View rtacconi's full-sized avatar

Riccardo Tacconi rtacconi

View GitHub Profile
@rtacconi
rtacconi / README.md
Created July 26, 2016 10:26 — forked from fnichol/README.md
Auto-enable Local HTTP Caching in Test Kitchen

Auto-enable Local HTTP Caching in Test Kitchen

Note: total experiment and hack, looks nasty, could be awesome:

Setup

  • Drop the kitchen.local.yml into $HOME/.kitchen/config.yml
  • Install polipo (with Mac: brew install polipo, with Ubuntu: apt-get install polipo)
  • Drop polipo-start and polipo-console somewhere useful (perhaps $HOME/bin?)
Archive: build/distributions/aws-lambda-jruby/Archive.zip
Length Date Time Name
-------- ---- ---- ----
980 04-06-16 12:28 A.class
1613 04-06-16 12:28 AWSLambdaJRuby.class
962 04-06-16 12:28 AWSLambdaJRuby0.class
1159 04-06-16 12:28 AWSLambdaJRuby1.class
1618 04-06-16 12:28 AWSLambdaJRuby2.class
1618 04-06-16 12:28 AWSLambdaJRuby3.class
0 04-06-16 12:29 lib/
@rtacconi
rtacconi / aws_l-missing_gem.txt
Created April 5, 2016 11:46
AWS lambda Jruby error missing gem
{
"errorMessage": "(LoadError) no such file to load -- aws-sdk",
"errorType": "org.jruby.embed.EvalFailedException",
"stackTrace": [
"org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:131)",
"org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1311)",
"org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1356)",
"AWSLambdaJRuby.handler(AWSLambdaJRuby.java:35)",
"sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
"sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)",
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz
tar -xvzf ruby-2.3.0.tar.gz
cd ruby-2.3.0/
./configure --prefix=/usr/local
make
make install
wget https://opscode-omnibus-packages.s3.amazonaws.com/el/7/x86_64/chefdk-0.10.0-1.el7.x86_64.rpm
rpm -i chefdk-0.10.0-1.el7.x86_64.rpm
if [ ! -d /var/chef/cache/ ]; then mkdir -p /var/chef/cache/; fi
if [ ! -d /var/chef/cookbooks/ ]; then mkdir -p /var/chef/cookbooks/; fi
if [ ! -d /var/chef/checksums/ ]; then mkdir -p /var/chef/checksums/; fi
if [ ! -d /etc/chef ]; then mkdir -p /etc/chef; fi
if [ ! -d /var/chef/backup ]; then mkdir -p /var/chef/backup; fi
if [ ! -d /var/chef/environments ]; then mkdir -p /var/chef/environments; fi
if [ ! -f /var/chef/environments/production.rb ]; then mkdir -p /var/chef/environments/production.rb; fi
cat << EOF > /etc/chef/solo.rb
@rtacconi
rtacconi / wsrep_cluster_size.rb
Created January 19, 2013 17:41
Nagios plugin to be executed with NPRE to check the number of clusters online, the number should be equal to the number of nodes you have. this script has the number of nodes hardcoded to 3. The script needs the Myql2 gem: gem install mysql2
#!/usr/bin/env ruby
#
# WSREP_CLUSTER_SIZE Plugin
#
# $ ./wsrep_cluster_size.rb -w 50 -c 75
#
require 'rubygems'
require 'mysql2'
@rtacconi
rtacconi / meteor_update_dollar_error
Created December 9, 2012 08:38
meteor update error
Exception while simulating the effect of invoking '/documents/update'
Error
Error: can't append to array using string field name [$]
at Error (<anonymous>)
at Function.LocalCollection._findModTarget (http://localhost:3000/packages/minimongo/modify.js?e7f02f0df0bff9f0b97236f9548637b7ede1ac74:90:15)
at Function.LocalCollection._modify (http://localhost:3000/packages/minimongo/modify.js?e7f02f0df0bff9f0b97236f9548637b7ede1ac74:50:38)
at LocalCollection._modifyAndNotify (http://localhost:3000/packages/minimongo/minimongo.js?d21efb753206850b6ada27b1fc327307eb2f2b9c:428:19)
at LocalCollection.update (http://localhost:3000/packages/minimongo/minimongo.js?d21efb753206850b6ada27b1fc327307eb2f2b9c:394:12)
at m.(anonymous function) (http://localhost:3000/packages/mongo-livedata/collection.js?2240f86c7b1195971d25f481e4a6c31da43bc0c1:378:36)
at http://localhost:3000/packages/livedata/livedata_connection.js?ff27a501d94ef196d150a04e346edbcbdcccdb1a:537:25
@rtacconi
rtacconi / php.rb
Created September 9, 2012 16:44
PHP 5.2 Formula for Homebrew
require 'formula'
def mysql_installed?
`which mysql_config`.length > 0
end
class Php5.2.17 < Formula
url 'http://ca2.php.net/distributions/php-5.2.17.tar.gz'
homepage ''
md5 '04d321d5aeb9d3a051233dbd24220ef1'
@rtacconi
rtacconi / activerecord_ndb_default.rb
Created August 31, 2012 09:37
Set default Mysql engine to NDB for ActiveRecord
module ActiveRecord
module ConnectionAdapters
class MysqlAdapter &lt; AbstractAdapter
def create_table(table_name, options = {}) #:nodoc:
super(table_name, options.reverse_merge(:options =&gt; "ENGINE=NDB"))
end
end
end
end
@rtacconi
rtacconi / compile_php5217_fcgi.txt
Created August 29, 2012 08:13
Compile PHP 5.2.17 for FCGI use
./configure --prefix=/usr/local/php5.2.17 \
--with-config-file-path=/etc/php5.2.17 \
--with-config-file-scan-dir=/etc/php5.2.17/php.d \
--enable-fastcgi \
--enable-discard-path \
--enable-force-cgi-redirect \
--with-layout=PHP \
--with-pear \
--enable-calendar \
--enable-bcmath \