Skip to content

Instantly share code, notes, and snippets.

View LightSystem's full-sized avatar

João Alves LightSystem

View GitHub Profile
@LightSystem
LightSystem / DiscriminatorCodecEnum.scala
Created September 13, 2024 13:48
Circe Codec derivation with discriminator
import io.circe.Codec
import io.circe.derivation.Configuration
enum DiscriminatorCodecEnum derives Codec:
case A(field: String)
case B(field: String)
object DiscriminatorCodecEnum:
given Configuration = Configuration(discriminator = Some("type"))
@LightSystem
LightSystem / odoo_api_integration.py
Last active August 13, 2024 08:54
Odoo JSON-RPC
import random
import requests
base_url = "http://localhost:8069"
api_url = f"{base_url}/jsonrpc"
db = "people_solutions_odoo"
uid = 6
password = "be4707627f4c1e07320e32442b08de6f2aef267c"
@LightSystem
LightSystem / selenium-manifest.yaml
Created May 13, 2021 14:32
selenium/standalone-chrome kubernetes deploy
apiVersion: v1
kind: Service
metadata:
name: selenium-chrome-service
annotations:
service.beta.kubernetes.io/azure-load-balancer-internal: "true"
spec:
type: LoadBalancer
loadBalancerIP: 180.44.235.83
selector:
/**
*
* Implements the standard calculation for the final age
*
* @param birthDate
* @param contractBeginDate
* @return the technical age
* @throws InvalidBirthDateException
*/
private int calculateFinalAge(Calendar birthDate, Calendar contractBeginDate) throws InvalidBirthDateException{
if (this == null) return null;
javax.xml.transform.TransformerFactory tf = javax.xml.transform.TransformerFactory.newInstance();
javax.xml.transform.Transformer transformer = tf.newTransformer();
transformer.setOutputProperty( javax.xml.transform.OutputKeys.METHOD, "xml");
transformer.setOutputProperty("encoding", "UTF-8");
transformer.setOutputProperty(javax.xml.transform.OutputKeys.INDENT,"yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "3" );
javax.xml.transform.dom.DOMSource source = new javax.xml.transform.dom.DOMSource(this);