Skip to content

Instantly share code, notes, and snippets.

View abner's full-sized avatar

Ábner Silva de Oliveira abner

View GitHub Profile
@abner
abner / gist:753ea6ef9cf597321a6dfda286ad9787
Created June 7, 2019 21:35 — forked from pditommaso/gist:2265496
Read/write input/output stream of interactive process
import java.io.*;
public class TestProcessIO {
public static boolean isAlive(Process p) {
try {
p.exitValue();
return false;
}
catch (IllegalThreadStateException e) {
@abner
abner / prevent_multiple_instance_run
Created June 7, 2019 13:54 — forked from bmchae/prevent_multiple_instance_run
How to lock a process in java to prevent multiple instance at the same time
http://www.dscripts.net/2010/06/09/how-to-lock-a-process-in-java-to-prevent-multiple-instance-at-the-same-time/
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// check if another process is running
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
package utils;
import java.io.File;
import java.io.IOException;
@abner
abner / Anotações.md
Last active June 13, 2019 15:27
ExemplosVertx

VERTX

vertx-base:

  • git@github.com:abner/vertx-base.git
  • /home/abner/Projetos/vertx/vertx-base

projeto-exemplo:

  • /home/abner/Projetos/vertx/projeto-exemplo
@abner
abner / aggregation_lookup.md
Created May 15, 2019 21:06 — forked from bertrandmartel/aggregation_lookup.md
MongoDB $lookup aggregation example

MongoDB $lookup aggregation

SO link

db.votes.aggregate([{
    $lookup: {
        from: "users",
        localField: "createdBy",
        foreignField: "_id",
@abner
abner / scp-with-compression.sh
Created February 19, 2019 19:43
Copy with SCP from remote server using compression
#!/bin/bash
ssh root@10.139.7.126 "cd /home/abner/target-folder; tar zc data-bkp --verbose" | tar zx
@abner
abner / native-mem-tracking.md
Created November 16, 2018 13:13 — forked from prasanthj/native-mem-tracking.md
Native memory tracking in JVM

Enable native memory tracking in JVM by specifying the following flag

-XX:NativeMemoryTracking=detail

Know the <PID> of the java process

jps

To print ps based RSS

ps -p <PID> -o pcpu,rss,size,vsize

To print native memory tracking summary

@abner
abner / script.sh
Created November 6, 2018 03:20
jq search id
#!/bin/bash
JQ_CMD="$PWD/jq"
if [ ! -f $JQ_CMD ]; then
echo "Downloading jq binary..." \
&& wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O $JQ_CMD \
&& chmod +x $JQ_CMD \
&& echo "JQ was downloaded"
@abner
abner / environment.interface.ts
Created August 22, 2018 21:35 — forked from tabirkeland/environment.interface.ts
Ionic 3.9.2 Environment Variables
export interface Environment {
DEBUG : boolean;
API_URL : string;
WS_URL : string;
BASE_URL : string;
}
@abner
abner / async_middleware_redux.js
Created June 14, 2018 12:12 — forked from GuillaumeNachury/async_middleware_redux.js
Redux Async middleware - Add a convient way to dispatch new action from an action
const asyncDispatcMiddleware = store => next => action => {
let syncActivityFinished = false;
let actionQueue = [];
function flushQueue() {
actionQueue.forEach(a => store.dispatch(a));
actionQueue = [];
}
function asyncDispatch(asyncAction) {