Skip to content

Instantly share code, notes, and snippets.

View cspinetta's full-sized avatar
👨‍💻
I may be slow to respond.

Cristian Spinetta cspinetta

👨‍💻
I may be slow to respond.
View GitHub Profile
@cspinetta
cspinetta / decompile-java-classes-cfr
Last active June 4, 2021 17:50
An script to decompile multiple java classes with CFR Java Decompiler: http://www.benf.org/other/cfr/
#!/usr/bin/env bash
# USAGE: ./decompile-java-classes.sh -d {cfr jar} -i {input directory} -n {fiel name pattern} -o {output directory}
# Output directory and file name is optional
# File name accepts wildcard such as '*'
OUTPUTDIR="/tmp/decompiled-classes/"
FILE_NAME="*"
@cspinetta
cspinetta / select-all-inputs-in-siga-survey.js
Last active July 15, 2016 19:01
For quickly completion the SIGA Survey: Open the Developer Tool of your browser (press F12), go to the Console Tab and Run this script (in 2 separated steps) to get your convenient options selected in all fields.
// First enable JQuery on the page
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// Then, (After Jquery is in page) select your default option
var selectValue = '100%';
$('body > div > div > form > div > div:nth-child(6) > table')
.find('select > option')
.filter(function () { return $(this).html() == selectValue; })
@cspinetta
cspinetta / Cargo.toml
Created June 25, 2017 21:58
currently with compile failed
[package]
name = "toy-load-balancer"
version = "0.1.0"
authors = ["Cristian Spinetta <[email protected]>"]
[dependencies]
log = "0.3"
#env_logger="0.4.3"
pretty_env_logger = "0.1"
@cspinetta
cspinetta / ab-netty-client
Created August 11, 2017 20:59
AB tool built with Netty Client
package kamon.netty
import java.lang
import io.netty.bootstrap.Bootstrap
import io.netty.channel._
import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.SocketChannel
import io.netty.channel.socket.nio.NioSocketChannel
import io.netty.handler.codec.http.{HttpContent, LastHttpContent, _}
@cspinetta
cspinetta / ConfigReaders.scala
Created May 11, 2018 20:09
pureconfig ConfigReader for parsing TimeUnit values
import pureconfig.{ConfigReader, ConvertHelpers}
import scala.concurrent.duration.TimeUnit
trait ConfigReaders {
import ConvertHelpers._
implicit val dayOfWeekReader: ConfigReader[TimeUnit] =
ConfigReader.fromString[TimeUnit](catchReadError(s => TimeUnitConverter.timeUnit(s)))
}
@cspinetta
cspinetta / installation-of-stuffs.md
Created November 15, 2018 01:19
Instalaciones para Workshop de Scala

Instalar IntellijIDEA:

  • Extraer ideaIU-2018.2.6.tar.gz en alguna carpeta.
  • Por consola ejecutar ./idea-IU-182.5107.16/bin/idea.sh.
  • Al momento de poner la licencia, seleccionar registración offline y pegar el código que está en Licencia IDEA hasta 2019-03-29.txt.
  • Una vez abierto, seleccionar Configure -> Create Desktop Entry.
  • Cerrar y abrirlo como un programa más de Ubuntu.

Instalar JDK 8 Oracle:

@cspinetta
cspinetta / Exercises for learning Scala
Last active January 25, 2019 15:48
Exercises for learning Scala
* Implementar `MyOptional`
* Implementar `StudentsAnalyzer`
@cspinetta
cspinetta / SnakeCaseSerializer.scala
Created November 20, 2018 15:15
Jackson ObjectMapper
package base.serializer
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility
import com.fasterxml.jackson.annotation.{JsonInclude, PropertyAccessor}
import com.fasterxml.jackson.databind._
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper
import play.api.libs.json.{JsValue, Json}
@cspinetta
cspinetta / jthreads_stats.py
Last active May 18, 2020 19:24
Java Thread Stats based on pidstat + jstack + /proc/.../schedstat
#!/usr/bin/env python3
import os
import re
import sys
import subprocess
import curses
import traceback
import argparse
from curses import wrapper
@cspinetta
cspinetta / docker-compose-workshop-troubleshooting.yml
Last active January 17, 2020 13:27
Docker compose for workshop "system tools for dev"
version: '3.4'
services:
external-api:
image: cspinetta/workshop-external-api:0.1
network_mode: "host"
# ports:
# - "9290:9290"
internal-api:
image: cspinetta/workshop-internal-api:0.1
network_mode: "host"