Skip to content

Instantly share code, notes, and snippets.

@korutx
korutx / pyzen.py
Created July 22, 2020 13:31
fun pyzen code!
#!/usr/bin/python3
import string
import codecs
import random
s = """Ornhgvshy vf orggre guna htyl.
Rkcyvpvg vf orggre guna vzcyvpvg.
Fvzcyr vf orggre guna pbzcyrk.
Pbzcyrk vf orggre guna pbzcyvpngrq.
@korutx
korutx / patch-configure-devserver.sh
Last active May 29, 2020 03:38
Patch Create Elm App. Allows to configure devserver from elmapp.config.
#!/bin/bash
# die () {
# echo >&2 "$@"
# exit 1
# }
# v=4.2.24
# [ "$v" = "4.2.24" ] ||
# die "Patch solo puede aplicarse a create-elm-app@4.2.24, se encontro $v"
# usage: curl 'https://gist.githubusercontent.com/korutx/27f9b7d8fd2f141002c6922456d73ab9/raw/a1c05d17069acb64893066c725202c79e9c6a4db/patch-configure-devserver.sh' | bash /dev/stdin ~/.nvm/versions/node/v13.9.0/lib/node_modules
nmpath="$1"
@korutx
korutx / flatten.js
Last active October 25, 2018 14:11
/**
* Hight-Order Funcion
* Returns a single item by iterating through the list, successively calling the iterator function and passing it an accumulator value and
* the current value from the array, and then passing the result to the next call.
* @param {Array} list Array of element
* @param {Function} fn Functor. The iterator function. Receives two values, the accumulator and the current element from the array.
* @param {*} acc The accumulator value.
* @return {*} The final, accumulated value.
*/
const reduce = (list, fn, acc) => {
@korutx
korutx / custom-bash-prompt-git-kubectl.sh
Last active June 1, 2018 20:21
Custom Prompt for git and kubectl useful info. fast and pragmatic version.
#!/bin/sh
# @Author: @korutx
# @Date: 2018-05-31 12:18:34
# @Last Modified time: 2018-05-31 12:18:34
#
# Using: Add the following lines to .bashrc
#
# if [ -f ~/bin/my_prompt.sh ]; then
# . ~/bin/my_prompt.sh
# fi
@korutx
korutx / alfresco-test-mail.js
Created February 26, 2018 17:27
Test Alfresco Mail
var mail = actions.create('mail');
mail.parameters.from = "alfresco@mail.com";
mail.parameters.to = 'somemail@mail.com';
mail.parameters.template = root.childByNamePath("Company Home/Data Dictionary/Email Templates/notify_user_email.ftl");
mail.parameters.text = "some text, in case template is not found";
mail.execute(companyhome);
@korutx
korutx / alfresco-global.properties
Created February 26, 2018 14:56
Alfresco disable outbound email notification
# add this prop to alfresco-global-properties
dev.email.not.sent=true
delete from alf_node_properties where node_id='178588';
delete from alf_node_aspects where id='178588';
delete from alf_child_assoc where child_node_id='178588';
delete from alf_node where id='178588';
<?xml version='1.0' encoding='UTF-8'?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/config"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.hazelcast.com/schema/config
http://www.hazelcast.com/schema/config/hazelcast-spring.xsd">
<bean id="mycustom.resources" class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
var client = mqtt.connect('ws://host:port', {
username: 'username',
clientId: 'client-id',
password: 'password'
});
client.subscribe('endpoint');
client.on('message', function (topic, payload) {
var evt = topic.toString(), args = payload.toString();
var node = search.findNode('<nodeRef>');
var assocname = '<thumbnailname>';
var nodeThumbnail = node.childAssocs['rn:rendition'].filter(function(assoc){
return assoc.name == assocname;
})[0];
if(nodeThumbnail){
logger.log(nodeThumbnail.nodeRef);
}