Skip to content

Instantly share code, notes, and snippets.

View ppazos's full-sized avatar
🌎
All around

Pablo Pazos Gutiérrez ppazos

🌎
All around
View GitHub Profile
@ppazos
ppazos / webServer.groovy
Created June 30, 2023 01:35 — forked from renatoathaydes/webServer.groovy
A simple web server written in Groovy that provides static and code-generated content
#!/usr/bin/env groovy
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.*
import groovy.servlet.*
@Grab(group='org.eclipse.jetty.aggregate', module='jetty-all', version='7.6.15.v20140411')
def startJetty() {
def server = new Server(8080)
@ppazos
ppazos / paths_to_trees.groovy
Last active August 16, 2023 21:52
openEHR data paths to trees
import groovy.json.*
// NOTE: the prefix / was removed to help the recursion, this step could be done before starting of it can be part of the first recursion
def data = [
"name",
"category",
"context/setting",
"context/start_time",
"content(3)/data/origin",
"content(3)/data/events(1)/time",
@chunrapeepat
chunrapeepat / uptime-chart.js
Last active March 9, 2023 03:37
Uptime Chart -> Chronological timeline format (ECharts)
var data = [];
var dataCount = 20;
var startTime = +new Date();
var categories = ['14/2/2020'];
var types = [
{name: 'Offline', color: 'red'},
{name: 'Online', color: 'green'},
];
// Generate mock data
@ppazos
ppazos / git_branch_in_terminal_prompt.sh
Last active September 15, 2022 01:31
add this to the end of the .bashrc and for git repos it will show the current branch in the command prompt of the terminal
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
#PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \[\033[00m\]\[\033[32;1m\]\[\033[42m\]$(parse_git_branch)\[\033[00m\] $ '
@docwhat
docwhat / profiling.groovy
Last active September 23, 2022 15:46
In Groovy profiling
#!/usr/bin/env groovy
// This works in Jenkinsfiles without approving any scripts.
class MyProfiler {
def timings
def dsl
MyProfiler(dsl) {
this.timings = [:]
@jonbartels
jonbartels / Managing SSL Connections in MC.md
Last active May 30, 2024 18:08
Mirth Connect has many ways to manage SSL connections. This gist provides a primer on how to manage them. Edits, contributions, and corrections are appreciated!

Mirth Connect is awesome! One common question on the forums and Slack is how to manage SSL connctions. These questions mainly focus on HTTPS but also include TCP connections.

The quick rundown is:

  1. The built-in MC HTTP Sender connector will do HTTPS if:
  • The endpoint has a certificate which is signed by a CA already present in the JVM truststore and has the right DN or SAN for the hostname. This is logically equivalent to the "green check" if you open the URL in a browser.
  • The certificate has been added to the truststore for the JVM that MC is running under
  • Changes to DNS or host files allow a hostname to match the DN or SAN already present in the cert (not reccomended)
  • The connector may flag these connections with a warning or red x. Test the channel first as the validator makes assumptions about SSL that may not apply in this case.
  1. The built-in MC HTTP Listener connector will not do SSL directly. A plugin or a proxy is necessary.
  • Tony Germano has a plugin implemented for SSL l
^((?:19|20)[0-9]{2})(?:(1[0-2]|0[1-9])(?:(3[0-1]|[1-2][0-9]|0[1-9])(?:([0-1][0-9]|2[0-3])(?:([0-5][0-9])(?:([0-5][0-9](?:\.[0-9]{1,4})?)?)?)?)?)?)?([+-](?:[0-1][0-9]|2[0-3])[0-5][0-9])?$
curl -X POST \
http://178.62.71.220:8080/rest/v1/template/ \
-H 'Authorization: Basic Z3Vlc3Q6Z3Vlc3Q=' \
-H 'Content-Type: application/xml' \
-H 'Ehr-Session: sessionId:127.0.0.1-guest-1548250494478-1031674849-11061' \
-d '<?xml version="1.0" encoding="utf-8"?>
<!--Operational template XML automatically generated by Ocean Template Designer Version 2.8.94Beta-->
<template xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.openehr.org/v1">
<language>
<terminology_id>
package mygrailsapp
import grails.converters.JSON
import org.springframework.security.authentication.AccountExpiredException
import org.springframework.security.authentication.CredentialsExpiredException
import org.springframework.security.authentication.DisabledException
import org.springframework.security.authentication.LockedException
import org.springframework.security.web.WebAttributes
import org.springframework.security.web.authentication.session.SessionAuthenticationException
import org.springframework.web.servlet.support.RequestContextUtils
@serg0x
serg0x / material-design-shadows.css
Last active July 7, 2023 13:33
Google material design elevation system shadows as css. Based on https://material.io/design/environment/elevation.html#default-elevations Exported with Sketchapp from the Google material design theme editor plugin "Baseline" theme.
/* Shadow 0dp */
box-shadow: none;
/* Shadow 1dp */
box-shadow: 0 1px 1px 0 rgba(0,0,0,0.14), 0 2px 1px -1px rgba(0,0,0,0.12), 0 1px 3px 0 rgba(0,0,0,0.20);
/* Shadow 2dp */
box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14), 0 3px 1px -2px rgba(0,0,0,0.12), 0 1px 5px 0 rgba(0,0,0,0.20);
/* Shadow 3dp */