Skip to content

Instantly share code, notes, and snippets.

apiVersion: batch/v1
kind: Job
metadata:
name: aws-s3-import
spec:
backoffLimit: 4
template:
spec:
containers:
- name: aws-cli
import org.jruby.*;
import org.jruby.ast.executable.AbstractScript;
import org.jruby.ast.executable.RuntimeCache;
import org.jruby.internal.runtime.methods.CallConfiguration;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.IRubyObject;
public class person extends AbstractScript
{
@douglasrodrigo
douglasrodrigo / gist:3788109
Created September 26, 2012 13:41
ssh tunnel port
Accessing a server port through another server
ssh -N -L<local_port>:<server>:<port> <another_server>
@douglasrodrigo
douglasrodrigo / gist:3707089
Created September 12, 2012 14:42
lambda-calculus factorial
True = ->(a,b) {a}
False = ->(a,b) {b}
#Church encodings
zero = ->(f){->(x) {x}}
one = ->(f){->(x) { f.(x)}}
two = ->(f){->(x) { f.(f.(x))}}
three =->(f){->(x) { f.(f.(f.(x)))}}
#operations
@douglasrodrigo
douglasrodrigo / gist:2032371
Created March 13, 2012 22:48
java allocate
public class ReflectionUtils {
public static <T> T allocate(Class<?> clazz) {
Object instance = null;
Object unsafe = getUnsafe();
Method allocate;
try {
allocate = unsafe.getClass().getDeclaredMethod("allocateInstance", Class.class);
instance = allocate.invoke(unsafe, clazz);
} catch (Exception e) {
import java.lang.reflect.Field;
import sun.misc.Unsafe;
import sun.reflect.FieldAccessor;
import sun.reflect.ReflectionFactory;
public class Teste {
static {
try {
setValor(Boolean.class, "TRUE", new Boolean(false));
@douglasrodrigo
douglasrodrigo / gist:1932353
Created February 28, 2012 12:53
git update
[alias]
update = !sh -c \"git fetch && git rebase origin/$(git symbolic-ref HEAD | sed -e \"s,.*/\\(.*\\),\\1,\")\"
@douglasrodrigo
douglasrodrigo / gist:1371798
Created November 16, 2011 23:03
dm-hibernate build
douglas@douglas-laptop:~/projetos/dm-hibernate-adapter$ rmvn rake spec
maven commandline: de.saumya.mojo:rake-maven-plugin:rake -Dargs="spec" -f dm-hibernate-adapter.gemspec.pom
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building dm-hibernate-adapter 0.3pre
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- rake-maven-plugin:0.28.1:rake (default-cli) @ dm-hibernate-adapter ---
[WARNING] log4j:WARN No appenders could be found for logger (org.hibernate.cfg.annotations.Version).
@douglasrodrigo
douglasrodrigo / randexp_specs_ruby_1.8.7
Created October 28, 2011 01:52
randexp - specs - ruby - 1.8.7
douglas@douglas-laptop:~/projetos/randexp$ rake
rake/gempackagetask is deprecated. Use rubygems/package_task instead
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
Example disabled: should be a union between 3 sexp's
Example disabled: should return a word or a 3 digit number
Regexp#gen
- should always return a string
Randexp::Parser.parse
@douglasrodrigo
douglasrodrigo / randexp_specs_JRuby_1.6.4
Created October 28, 2011 01:49
randexp - specs - JRuby - 1.6.4
douglas@douglas-laptop:~/projetos/randexp$ jruby -S rake
rake/gempackagetask is deprecated. Use rubygems/package_task instead
WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
at /home/douglas/.rvm/gems/jruby-1.6.4/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
rm -r coverage
/home/douglas/.rvm/gems/jruby-1.6.4/gems/rcov-0.9.11-java/lib/rcov/differential_analyzer.rb:31 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
Regexp#gen
- should always return a string