Skip to content

Instantly share code, notes, and snippets.

View vitorpacheco's full-sized avatar

Vitor Pacheco vitorpacheco

  • Solutis Tecnologias
  • Brasil, Salvador - BA
View GitHub Profile
#!/bin/bash
fuser 9443/tcp
fuser 9080/tcp
fuser 8878/tcp
fuser 8879/tcp
fuser 9060/tcp
kill -9 `ps -ef | grep java | awk -F" " '{print $2}'`
@vitorpacheco
vitorpacheco / show-indexes.js
Created February 4, 2019 13:57 — forked from ixti/show-indexes.js
Small script that extracts all non-default indexes from MongoDB
rs.slaveOk();
db.getCollectionNames().forEach(function(coll) {
db[coll].getIndexes().forEach(function(index) {
if ("_id_" !== index.name) {
print("db." + coll + ".createIndex(" + tojson(index.key) + ")");
}
});
});
@vitorpacheco
vitorpacheco / ListAdapter.kt
Last active April 1, 2020 13:06
ListAdapter for RecyclerView
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.AsyncListDiffer
import androidx.recyclerview.widget.DiffUtil
#parse("File Header.java")
class Main {
static void calc_err(float xb, float x) {
float erroAbsoluto = Math.abs(x - xb);
float erroRelativo = Math.abs(erroAbsoluto/xb);
System.out.printf("%.5f %.5f\n", erroAbsoluto, erroRelativo);
}
public static void main(String[] args) {