Skip to content

Instantly share code, notes, and snippets.

View paulosuzart's full-sized avatar

Paulo Suzart paulosuzart

View GitHub Profile
@anderson-custodio
anderson-custodio / profiling-jvm-kubernetes-visualvm.md
Last active January 23, 2024 13:41
Profiling JVM on Kubernetes using VisualVM

Profiling JVM on Kubernetes using VisualVM

Enable JMX server

Edit Dockerfile to enable JMX server and change the hostname with the IP where the container will run:

FROM openjdk:8-jre-alpine
ADD ./target/app.jar app.jar
EXPOSE 8080
ENTRYPOINT java -Dcom.sun.management.jmxremote.rmi.port=9090 -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=9090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=192.168.1.2 -jar app.jar
@gvolpe
gvolpe / CsvApp.scala
Last active July 6, 2023 00:19
CSV file reader using the Fs2 streaming library.
import cats.effect._
import cats.syntax.functor._
import fs2._
import java.nio.file.Paths
import java.util.concurrent.Executors
import scala.concurrent.ExecutionContext
import scala.util.Try
object CsvApp extends IOApp {
@psi-4ward
psi-4ward / LoginController.js
Created January 12, 2015 16:09
Sails.JS JWT Auth
// controllers/LoginController.js
module.exports = {
index: function(req, res) {
var email = req.param('email');
var password = req.param('password');
// delay everthing to prevent bruteforce, dos and timing attacks
setTimeout(function() {
@loicdescotte
loicdescotte / Forcomptran.md
Last active May 27, 2023 06:27
Scala for comprehension translation helper

Scala for comprehension translation helper

"For comprehension" is a another syntaxe to use map, flatMap and withFilter (or filter) methods.

yield keyword is used to aggregate values in the resulting structure.

This composition can be used on any type implementing this methods, like List, Option, Future...

@woods
woods / git_svn_bash_prompt.sh
Created December 4, 2008 15:37 — forked from halbtuerke/gist:31934
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE: