Skip to content

Instantly share code, notes, and snippets.

View maikelsperandio's full-sized avatar

Maikel Sperandio maikelsperandio

  • Goiânia, GO, Brazil
View GitHub Profile
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
wget --no-cookies \
--no-check-certificate \
UserService service = new UserService(url); // Service class
port = service.getPort(IUser.class); // the HTTP port of the webservice
Client client = ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(30000); //the timeout in milli
httpClientPolicy.unsetReceiveTimeout();
http.setClient(httpClientPolicy);
@maikelsperandio
maikelsperandio / StatelessRepository.java
Created August 2, 2019 09:09
A way to get Hibernate's StatelessSession from spring JPA
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.hibernate.Session;
import org.hibernate.StatelessSession;
import org.springframework.stereotype.Repository;
@Repository
public class StatelessRepository {
@maikelsperandio
maikelsperandio / TimezoneList.java
Created October 23, 2019 18:16
List the timezone config in the jvm Daylight Saving Time database.
import java.util.Date;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.zone.ZoneOffsetTransition;
import java.time.zone.ZoneRules;
public class TimezoneList {
public static void main(String[] args) {
@maikelsperandio
maikelsperandio / docker-compose.yml
Created November 4, 2019 17:56
Docker compose with lot of integration tools
version: '3'
services:
redis:
image: redis
container_name: dev_redis
hostname: redis
environment:
- TZ=America/Sao_Paulo
ports:
- "6379:6379"
@maikelsperandio
maikelsperandio / links.txt
Created November 8, 2019 11:34
List of nice githubs
@maikelsperandio
maikelsperandio / docker-compose-kafka.yml
Last active March 26, 2020 11:26
Docker compose that configures Apache Kafka
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
container_name: zookeeper
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
networks:
- network
@maikelsperandio
maikelsperandio / mongodb-repl-concepts.txt
Last active November 21, 2019 16:41
Some concepts about replication in MongoDB
MongoDB Replication
Replication is the concept of maintaining multiple copies of your data.
This is a really important concept in MongoDB, but really in any database system.
The main reason why replication is necessary is because you can never assume that all of your servers will always be available.
Whether you have to perform maintenance on a data center or a disaster wipes out your data entirely, your servers will experience downtime at some point.
The point of replication is to make sure that in the event your server goes down, you can still access your data.
This concept is called availability.
@maikelsperandio
maikelsperandio / mongodb-repl-replica-set.txt
Created November 21, 2019 19:07
Some concepts and annotations about the Replica Set process in MongoDB.
MongoDB Replica Set
Replica sets or groups of mongods that share copies of the same information between them.
Replica set members can have one of two different roles.
The either can be primary node where all reads and all writes are served by this node.
Or secondary node where the responsibility of this node is to replicate all of the information, and then serve as a high availability to node in case of failure of the primary.
The secondaries will get the data from the primary through an asynchronous replication mechanism.
Every time an application writes some data to the replica set, that right is handled by the primary node.
And then data gets replicated to the secondary nodes.
Now this replication mechanism is based out of a protocol that manages the way that the secondaries should read data from the primary.
@maikelsperandio
maikelsperandio / mongodb-repl-replica-set-config-up.txt
Last active November 25, 2019 17:14
Some commands needed to starting up a replica set in MongoDB
MongoDB Setting up a replica set
The configuration file for the first node (/data/node1.conf):
storage:
dbPath: /var/mongodb/db/node1
net:
bindIp: 192.168.103.100,localhost
port: 27011
security:
authorization: enabled