Skip to content

Instantly share code, notes, and snippets.

@belano
belano / install-scala.sh
Created September 15, 2013 17:29
Install scalla tgz on ubuntu
sudo mkdir -pf /usr/local/scala && cd /usr/local/scala
sudo wget http://www.scala-lang.org/files/archive/scala-2.10.2.tgz && sudo tar xvfz scala-2.10.2.tgz
sudo update-alternatives --install /usr/bin/scala scala /usr/local/scala/scala-2.10.2/bin/scala 1 --slave /usr/bin/scalac scalac /usr/local/scala/scala-2.10.2/bin/scalac --slave /usr/bin/scalap scalap /usr/local/scala/scala-2.10.2/bin/scalap --slave /usr/bin/scaladoc scaladoc /usr/local/scala/scala-2.10.2/bin/scaladoc --slave /usr/bin/fsc fsc /usr/local/scala/scala-2.10.2/bin/fsc
sudo echo 'SCALA_HOME=$(readlink -f /usr/bin/scala | sed "s:/bin/scala::")' > /etc/profile.d/scala.sh
sudo echo 'export SCALA_HOME' >> /etc/profile.d/scala.sh
@belano
belano / postmkvirtualenv.sh
Created January 6, 2015 19:59
Install yolk automatically each time you create a virtual env via postmkvirtualenv file
#!/bin/bash
# This hook is run after a new virtualenv is activated.
PYTHON_VERSION=`python -c 'import sys
print (sys.version_info.major)'`
case $PYTHON_VERSION in
2)
echo "Version 2+"
pip install yolk
;;
3)
@belano
belano / zprofile.sh
Created January 18, 2015 17:12
set global variables in zsh while keeping things compatible with bash, add this to either /etc/zsh/zprofile or ~/.zprofile
# User config for login shells
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
@belano
belano / hibernate.cfg.xml
Created January 26, 2015 11:04
jBPM 3.2 Groovy scripting
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- hibernate dialect -->
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
@belano
belano / android.sh
Created February 11, 2015 16:27
/etc/profile.d/android.sh
export ANDROID_HOME=$HOME/apps/adt-bundle-linux-x86_64-20130219/sdk
export ANDROID_NDK_HOME=$HOME/apps/adt-bundle-linux-x86_64-20130219/ndk
export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
@belano
belano / elasticsearch-reindex.py
Created November 26, 2015 16:07
Elasticsearch reindex data with zero downtime
#!/usr/bin/env python
'''
Lots taken from http://codereview.stackexchange.com/q/56979
'''
from argparse import ArgumentParser, FileType
import requests
import json
import os, sys
@belano
belano / Network.java
Created February 15, 2016 14:26
Allocate free port from an ephemeral port range
import java.io.IOException;
import java.net.ServerSocket;
public final class Network {
private Network() {
// Do nothing.
}
public static int findFreePort() {
@belano
belano / start-container.sh
Last active May 3, 2016 14:55
Helper script for (re)starting a docker container
#!/bin/bash
function getStatus(){
CONTAINER_ID=$(docker ps -a | grep -v Exit | grep $1 | awk '{print $1}')
if [[ -z $CONTAINER_ID ]] ; then
echo 'Not running.'
return 1
else
echo "Running in container: $CONTAINER_ID"
return 0
@belano
belano / JodaParamConverterProvider.java
Created May 11, 2016 07:45
Jersey Joda parameter converter provider
package com.belano;
import static java.lang.String.format;
import static org.joda.time.format.ISODateTimeFormat.date;
import static org.joda.time.format.ISODateTimeFormat.dateTime;
import static org.joda.time.format.ISODateTimeFormat.dateTimeNoMillis;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
@belano
belano / README.md
Created February 17, 2017 16:54 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications you can follow me @leonardofed