Skip to content

Instantly share code, notes, and snippets.

@ramonpin
ramonpin / Gemfile
Last active December 21, 2015 00:18 — forked from andrenam/Gemfile
############################################################
### Gem file to install GITLAB on Raspberry-Pi
############################################################
source "http://rubygems.org"
gem "rails", "3.2.5"
# Supported DBs
gem "sqlite3"
gem "mysql2"
@ramonpin
ramonpin / tunnel-ssh.sh
Last active June 24, 2020 22:48
Expect script to automatically create a ssh tunnel from a local port to a remote destination.
#!/usr/bin/expect -f
set ssh_host "172.19.10.80"
set ssh_user "user"
set ssh_password "password"
set dest_host "172.19.10.91"
set dest_port 8080
set local_port 80
set timeout -1
spawn ssh -N $ssh_user@$ssh_host -L 127.0.0.1:$local_port:$dest_host:$dest_port
@ramonpin
ramonpin / alias_ops_elastic.txt
Created January 18, 2017 16:56
Operaciones sobre alias en Elasticsearch
Este comando añade al alias 'alias1' el índice 'test1':
curl -XPOST http://elastic:9200/_aliases --data '{ "actions" : [ { "add" : { "index" : "test1", "alias" : "alias1" } } ] }''
Este comando elimina del alias 'alias1' el índice 'test1':
curl -XPOST http://elastic:9200/_aliases --data '{ "actions" : [ { "remove" : { "index" : "test1", "alias" : "alias1" } } ] }'
Este comando quita 'test1' y añade 'test2' simultáneamente al 'alias1' (en esencia un rename):
curl -XPOST http://elastic:9200/_aliases --data '{ "actions" : [ { "remove" : { "index" : "test1", "alias" : "alias1" } }, { "add" : { "index" : "test2", "alias" : "alias1" } } ] }'
Si lees la entrada https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html de la documentación
@ramonpin
ramonpin / spark-rest-submit.sh
Created April 11, 2018 06:52 — forked from yaravind/spark-rest-submit.sh
Submit apps (SparkPi as e.g.) to spark cluster using rest api
curl -X POST -d http://master-host:6066/v1/submissions/create --header "Content-Type:application/json" --data '{
"action": "CreateSubmissionRequest",
"appResource": "hdfs://localhost:9000/user/spark-examples_2.11-2.0.0.jar",
"clientSparkVersion": "2.0.0",
"appArgs": [ "10" ],
"environmentVariables" : {
"SPARK_ENV_LOADED" : "1"
},
"mainClass": "org.apache.spark.examples.SparkPi",
"sparkProperties": {
@file:DependsOn("io.arrow-kt:arrow-core:0.7.1")
@file:DependsOn("io.arrow-kt:arrow-syntax:0.7.1")
@file:DependsOn("io.arrow-kt:arrow-typeclasses:0.7.1")
@file:DependsOn("io.arrow-kt:arrow-instances:0.6.1")
@file:DependsOn("io.arrow-kt:arrow-data:0.7.1")
import arrow.core.None
import arrow.core.Option
import arrow.core.Predicate
import arrow.data.ListK
@ramonpin
ramonpin / sample.rb
Last active January 22, 2021 15:23
Sinatra App Simple Sample
require 'sinatra'
get '/hi' do
"Hello World!"
end
-XX:+CMSClassUnloadingEnabled -XX:MaxMetaspaceSize=512M -XX:MetaspaceSize=256M -Xms2G -Xmx2G
@ramonpin
ramonpin / boostrap-almond.sh
Created October 13, 2018 14:52
Boostrapping an app with coursier
coursier bootstrap \
-i user -I user:sh.almond:scala-kernel-api_$SCALA_VERSION:$ALMOND_VERSION \
sh.almond:scala-kernel_$SCALA_VERSION:$ALMOND_VERSION \
-o almond
@ramonpin
ramonpin / mo
Created October 17, 2018 14:46
mo script for moustache on bash
#!/usr/bin/env bash
#
#/ Mo is a mustache template rendering software written in bash. It inserts
#/ environment variables into templates.
#/
#/ Simply put, mo will change {{VARIABLE}} into the value of that
#/ environment variable. You can use {{#VARIABLE}}content{{/VARIABLE}} to
#/ conditionally display content or iterate over the values of an array.
#/
#/ Learn more about mustache templates at https://mustache.github.io/

Instruction

This instruction fully tested under Ubuntu 14.04 LTS 64-bit, Java 1.8.0_25 64-bit.

Create a stub.sh file with this content:

#!/bin/sh
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"