Skip to content

Instantly share code, notes, and snippets.

View douglascrp's full-sized avatar

Douglas C. R. Paes douglascrp

View GitHub Profile
@douglascrp
douglascrp / cleanlogs.sh
Last active September 29, 2023 17:04
Script to automate the log cleaning task for Alfresco servers installed using alfresco-ubuntu-install
#!/bin/bash
# crontab
# 0 5 * * * /opt/alfresco/scripts/cleanlogs.sh
DAYS_TO_KEEP=7
find /opt/alfresco/logs/* -maxdepth 0 -name '*.log*' -mtime +${DAYS_TO_KEEP} -type f -exec rm {} \;
find /opt/alfresco/logs/bart/* -maxdepth 0 -name '*.log*' -mtime +${DAYS_TO_KEEP} -type f -exec rm {} \;
find /opt/alfresco/tomcat/logs/* -maxdepth 0 -name '*.log*' -mtime +${DAYS_TO_KEEP} -type f -exec rm {} \;
@douglascrp
douglascrp / renew-letsencrypt-cert.txt
Created June 28, 2018 12:37
Let's Encrypt certbot renew command
This is the command to be used in the cron schedule to have the certificates automatically renewed
certbot renew --pre-hook "service apache2 stop" --post-hook "service apache2 start" --authenticator standalone --agree-tos --email <email>
// To be used with Alfresco JS Console. Select folder in js console to create export package for
var exportaction = actions.create("export");
exportaction.parameters["store"] = "workspace://SpacesStore";
exportaction.parameters["package-name"] = space.properties.name + "_export.acp";
exportaction.parameters["destination"] = space.parent;
exportaction.parameters["include-children"] = true;
exportaction.parameters["include-self"]=true;
exportaction.parameters["encoding"]="UTF-8";
exportaction.execute(space);
// Delete thumbnails if exists. To be used in Alfresco javascript console. Starts from selected space
recurse(space, function(node) {
var doclib = node.getThumbnail('doclib');
var webpreview = node.getThumbnail('webpreview');
var webpreview2 = node.getThumbnail('web-preview');
var imgpreview = node.getThumbnail('imgpreview');
var pdf = node.getThumbnail('pdf');
if(doclib){
doclib.remove();
@douglascrp
douglascrp / Como sincronizar Relógio TomTom Runner 3 Cardio com MySport no Ubuntu
Last active January 30, 2018 20:56
Como sincronizar Relógio TomTom Runner 3 Cardio com MySport no Ubuntu
Instalação
==========
1 - Baixar o pacote
http://uk.support.tomtom.com/app/answers/detail/a_id/24741/~/linux-version-of-tomtom-sports-connect
2 - Instalar
sudo dpkg -i tomtomsportsconnect.x86_64.deb
3 - Corrigir dependências faltando
sudo apt-get -f install
@douglascrp
douglascrp / remove residual properties
Created December 28, 2017 12:45
How to remove residual properties in Alfresco
# JavaScript https://community.alfresco.com/thread/193889-is-there-any-way-to-remove-node-property-using-js-api#comment-739758 #
delete node.properties["yourprefix:yourproperty"];
node.save();
# Java https://community.alfresco.com/thread/193889-is-there-any-way-to-remove-node-property-using-js-api#comment-651225 #
nodeService.removeProperty();
@douglascrp
douglascrp / Alfresco SDK 3.0 with minificatio of javascript files.xml
Last active October 4, 2018 13:06
How to add the missing minification of javascript files in Alfresco SDK 3.0
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>compress-assembly</id>
<goals>
<goal>compress</goal>
</goals>
/**
* Script to locate error nodes from solr error report, and do something with them.
*
* @author Younes Regaieg <[email protected]>
* @version 1.0
**/
//----- Solr error report to be fetched from solr /solr4/alfresco/query?q=EXCEPTIONMESSAGE:*&wt=json&rows=<number-of-rows-to-fetch>
//----- Swap this dummy object with a real object from the output of the endpoint mentionned above.
var solrErrorsReport = {
@douglascrp
douglascrp / set_alfresco_node_site_role_based_permission_using_javascript.js
Created September 28, 2017 15:33
Set alfresco node site role based permission using javascript
// Print object's permissions
logger.warn(document.directPermissions);
logger.warn(document.fullPermissions);
// Stop permission inheritance
document.setInheritsPermissions(false);
// Give a specific group the SiteCollaborator permission
document.setPermission("SiteCollaborator", "GROUP_docs_cliente_empreendimento");
@douglascrp
douglascrp / manutencao postgresql.txt
Last active October 28, 2017 03:02
Manutenção PostgreSQL
sudo -u postgres psql alfresco
sudo -u postgres pg_activity -d alfresco
Sem clientes conectados:
VACUUM FULL VERBOSE ANALYZE;
REINDEX DATABASE <database>;
https://wiki.postgresql.org/wiki/Disk_Usage
http://pgtune.leopard.in.ua/