Skip to content

Instantly share code, notes, and snippets.

View arielvalentin's full-sized avatar

Ariel Valentin arielvalentin

View GitHub Profile
@arielvalentin
arielvalentin / console.log
Created July 29, 2014 23:48
JRuby 1.7.4 AWS Euca SDK Open SSL Error
java.lang.RuntimeException: org.jruby.exceptions.RaiseException: (SSLError) jar:file:/var/lib/storm/supervisor/stormdist/test_rsync-4-1406677418/stormjar.jar!/gems/gems/aws-sdk-euca-1.8.5/ca-bundle.crt
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:107) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating]
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:78) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating]
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:77) ~[storm-core-0.9.1-incubating.jar:0.9.1-incubating]
at backtype.storm.daemon.executor$eval3918$fn__3919$fn__3931$fn__3978.invoke(executor.clj:745) ~[na:na]
at backtype.storm.util$async_loop$fn__384.invoke(util.clj:433) ~[na:na]
at clojure.lang.AFn.run(AFn.java:24) [clojure-1.4.0.jar:na]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_60]
org.jruby.exceptions.RaiseException: (SSLError) jar:file:/var/li
@arielvalentin
arielvalentin / exceptions.rb
Created August 5, 2014 03:20
Sample code Throwable vs RubyException
# The following block logs java.lang.Throwable correctly: http://www.slf4j.org/api/org/slf4j/Logger.html#error(java.lang.String,%20java.lang.Throwable)
begin
Java::ComGoogleCommonBase::Preconditions.check_argument(false, "I don't like you")
rescue => e
logger = Java::OrgSlf4j::LoggerFactory.get_logger('logger')
logger.error("This works", e)
end
# However RubyException is not a throwable and treats it as a java.lang.Object: http://www.slf4j.org/api/org/slf4j/Logger.html#error(java.lang.String,%20java.lang.Object...)
begin
raise "error"
@arielvalentin
arielvalentin / accumulo-client-unknown-host
Last active August 29, 2015 14:09
Accumulo Client Retries to connect to TServers that have invalid hostnames
22:14:53,549 DEBUG [org.apache.zookeeper.ClientCnxn] (http-/192.168.220.198:8080-1-SendThread(ZKHOST:2181)) Reading reply sessionid:0x1498bc00431010f, packet:: clientPath:null serverPath:null finished:false header:: 414,3 replyHeader:: 414,107374188046,0 request:: '/accumulo/4663a372-d7f0-4956-a110-ff063c781ead/tservers/TSERVER_HOST:10011/zlock-0000000036,T response:: s{107374187891,107374187891,1415398174207,1415398174207,0,0,0,92758924158107923,33,0,107374187891}
22:14:53,922 DEBUG [org.apache.zookeeper.ClientCnxn] (http-/192.168.220.198:8080-1-SendThread(ZKHOST:2181)) Reading reply sessionid:0x1498bc00431010f, packet:: clientPath:null serverPath:null finished:false header:: 415,4 replyHeader:: 415,107374188046,0 request:: '/accumulo/4663a372-d7f0-4956-a110-ff063c781ead/tservers/TSERVER_HOST:10011/zlock-0000000036,T response:: #54534552565f434c49454e543d7330322d6265732d646e6f6436323a3130303131,s{107374187891,107374187891,1415398174207,1415398174207,0,0,0,92758924158107923,33,0,107374187891}
22:14:53
#!/bin/bash
sudo rm -f /etc/racoon/remote/*
sudo cp /var/run/racoon/*.conf /etc/racoon/remote
sudo sed -i.bak 's/lifetime time 3600 sec/lifetime time 168 hours/' /etc/racoon/remote/*.conf
sudo patch /etc/racoon/racoon.conf <<EOF
--- /etc/racoon.orig/racoon.conf 2009-06-23 09:09:08.000000000 +0200
+++ /etc/racoon/racoon.conf 2009-12-11 13:52:11.000000000 +0100
@@ -135,4 +135,5 @@
# by including all files matching /var/run/racoon/*.conf
# This line should be added at the end of the racoon.conf file
@arielvalentin
arielvalentin / routing
Created July 15, 2015 17:03
Route VPN traffic through static route
mataleon:~ ariel$ ifconfig
....
ppp0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1280
inet 192.168.80.8 --> 192.168.20.1 netmask 0xffffff00
mataleon:~ ariel$ sudo /sbin/route add -net 192.168.20.0/16 -interface ppp0
add net 192.168.20.0: gateway ppp0
mataleon:~ ariel$ ssh gust@192.168.20.35
Password:
@arielvalentin
arielvalentin / httpd.conf
Last active September 12, 2015 08:31
Sample Apache mod_proxy_balancer config for torquebox
<VirtualHost *:443>
#mod_ssl options and Certs ...
<Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
@arielvalentin
arielvalentin / ssh-forward-agent
Created September 18, 2015 21:57
ssh forward-agent
#on the server in /etc/ssh/sshd_config
AllowAgentForwarding on
#on the server /home/ubuntu/.ssh/authorized_keys
# CONTENTS of my public key id_rsa
#on the client in ~/.ssh/config
Host remote_server
User ubuntu
ForwardAgent yes
@arielvalentin
arielvalentin / A. Tiered compilation
Last active December 9, 2015 23:18
JRuby 1.7 startup with JDK 7
[torquebox@n3 myapp]$ uname -a
Linux n3 2.6.32-279.14.1.el6.x86_64 #1 SMP Mon Oct 15 13:44:51 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
[torquebox@n3 myapp]$ java -version
java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)
[torquebox@n3 myapp]$ file `which /etc/alternatives/java`
/etc/alternatives/java: symbolic link to `/usr/lib/jvm/jre-1.7.0-oracle.x86_64/bin/java'
@arielvalentin
arielvalentin / hornetq-jms.xml
Created August 20, 2013 03:10
Torquebox Messaging JMS Exception "There is no queue with name"
<configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
<!-- Connection factory stuff -->
<queue name="DissemQueue">
<entry name="/queues/DissemQueue"/>
</queue>
</configuration>
@arielvalentin
arielvalentin / extract_config.sh
Created December 21, 2015 17:14
Whenever I need to bootstrap a new dev ENV vars based on production
heroku config | grep -iv "Config Vars" | tr ':' '=' | tr -d '[:blank:]' | sed -e 's/production/development/g'`