Skip to content

Instantly share code, notes, and snippets.

View igorzg's full-sized avatar
🎯
Focusing

igorzg igorzg

🎯
Focusing
View GitHub Profile
@igorzg
igorzg / gist:112dd5f20f7fac276f435b65eb57fbec
Last active September 4, 2016 12:03
Bash on windows update to 16.04
# Upgrade all the packages to the latest versions
aptitude update
aptitude full-upgrade -y
# Update our sources, save the original as /etc/apt/sources.list.ORIG
# This step is REQUIRED, otherwise the instructions below will not upgrade a
# single package.
sed -i.ORIG 's/trusty/xenial/g' /etc/apt/sources.list
# Backup the /etc/apt/sources.list.d/ folder and create an empty one.
# downgrade to php5.4 first
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:ondrej/php5-oldstable -y
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
# install ajenti
wget -O- https://raw.github.com/Eugeny/ajenti/master/scripts/install-ubuntu.sh | sudo sh
@igorzg
igorzg / ubuntu-14.04.LTS-docker-install.sh
Last active December 12, 2016 13:58
Install docker on ubuntu 14.04 LTS
apt-get update
apt-get dist-upgrade -y
apt-get install linux-image-extra-$(uname -r)
apt-get install apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
apt-get update -y
apt-get install docker-engine
@igorzg
igorzg / sbt-install-ubuntu.sh
Created December 12, 2016 13:59
Sbt install on ubuntu
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt
@igorzg
igorzg / hibernate43_JTA_CMT.md
Last active January 16, 2017 13:30
Multitenancy, Hibernate 4.3, Wildfly 9, Hikaricp autocommit mode false with ejb3 JTA container managed transactions and dao

We are using hibernate 4.3 multiTenancy, hikaricp connection provider:

  <property name="hibernate.multiTenancy" value="DATABASE"/>
  <property name="hibernate.multi_tenant_connection_provider" value="multitenancy.HikariTenantConnectionProvider"/>
  <property name="hibernate.tenant_identifier_resolver" value="multitenancy.ThreadLocalIdentifierResolver"/> 

In all cases we want that container is managing our transactions using java ee ejb standard.

PROBLEMS:

@igorzg
igorzg / dynamodb_dynamic_structure.java
Created March 24, 2017 14:21
Dynamodb dynamic low level api map converter
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter;
import com.amazonaws.services.dynamodbv2.document.internal.InternalUtils;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import java.util.Map;
public class DynamicStructure implements DynamoDBTypeConverter<Map<String, AttributeValue>, Map<String, Object>> {
@Override
public Map<String, AttributeValue> convert(Map<String, Object> object) {
@igorzg
igorzg / async_resolution.java
Created June 18, 2017 17:04
Jaxrs async marshaling feature reqeust
@Path("/{partner}/sync")
@Produces(MediaType.APPLICATION_JSON)
public class SyncResource {
@PathParam("partner") String partner;
@Inject SyncService syncService;
@igorzg
igorzg / CMakeLists.txt
Last active April 16, 2018 14:40
NodeJS native Cmake config - MacOS
cmake_minimum_required(VERSION 3.10)
project(NodeProject)
set(CMAKE_CXX_STANDARD 17)
file(READ $ENV{HOME}/.nvm/alias/default NODE_VER)
string(STRIP ${NODE_VER} NODE_VER)
set(LIBUV_VER "1.20.0")
set(LIBUV_PATH "/usr/local/Cellar/libuv/${LIBUV_VER}")
@igorzg
igorzg / AWS-Lambda-To-ElasticBeanStalk-Deployment-CodePipeLine.js
Created November 20, 2017 15:41
CodePipeline AWS Lambda to ElasticBeanstalk deployment
"use strict";
const util = require('util');
const AWS = require("aws-sdk");
/**
* Deploy env
* @param event
* @param context
* @param callback
* Example of params
npm init
npm i --save-dev @types/node \
                 @types/jest \
                 @typescript-eslint/eslint-plugin \
                 @typescript-eslint/eslint-plugin-tslint \
                 @typescript-eslint/parser \
                 coveralls \
                 eslint \
 jest \