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 / cleaner.js
Created February 6, 2019 13:24 — forked from wingyplus/cleaner.js
Delete all file in archive store
importClass(Packages.org.springframework.web.context.ContextLoader);
importClass(Packages.org.alfresco.service.cmr.repository.StoreRef);
var ctx = ContextLoader.getCurrentWebApplicationContext();
var archiveService = ctx.getBean("nodeArchiveService");
archiveService.purgeAllArchivedNodes(new StoreRef(StoreRef.PROTOCOL_WORKSPACE, "SpacesStore"));
@douglascrp
douglascrp / runas.js
Created February 6, 2019 13:23 — forked from yv84/runas.js
var RunAsUtil = {
execute: function(workFunction, runAsUser) {
Packages.org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(new Packages.org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork()
{
doWork: workFunction
}, runAsUser);
},
doInTransaction: function(workFunction) {
var txs = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext().getBean("TransactionService");
var th = txs.getRetryingTransactionHelper();
@douglascrp
douglascrp / VBScript class for json encode decode
Created December 20, 2018 17:47
JSON encode decode with VBScript
Reference: http://demon.tw/my-work/vbs-json.html
VbsJson class for parsing JSON format data with VBS
Tags: JavaScript , JSON , VB , VBS , VBScript
Title: The VBS resolve VbsJson class of JSON data format of: Demon
Link: http://demon.tw/my-work/vbs-json.html
Copyright: All articles in this blog are subject to the terms of " Signature - Non-Commercial Use - Share 2.5 China in the Same Way ".
@douglascrp
douglascrp / qpdf
Created December 9, 2018 01:20
How to protect PDF file with QPDF
qpdf --encrypt "empty_or_password_open" "owner_password" 40 --print=y --modify=n --extract=n --annotate=n -- input.pdf output.pdf
@douglascrp
douglascrp / Tmux cheatsheet
Last active November 27, 2018 15:20
Tmux cheatsheet
Some basic operations:
Split screen vertically: Ctrlb and Shift5
Split screen horizontally: Ctrlb and Shift"
Toggle between panes: Ctrlb and o (or arrows < > V ^ toward the desired screen)
Close current pane: Ctrlb and x
You can achieve more complex layouts by splitting panes. You can also have multiple windows with panes and switch between them.
sudo apt-get update
sudo apt-get install apache2
sudo apache2ctl configtest
Se aparecer:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Editar /etc/apache2/apache2.conf
@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();