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 / Alfresco with Apache proxy and Let's Encrypt on Ubuntu
Last active June 24, 2021 14:12
Alfresco with Apache proxy and Let's Encrypt on Ubuntu
sudo apt-get install apache2
sudo a2enmod proxy
sudo a2enmod proxy_ajp
sudo mkdir -p /var/www/<alfresco-domain>
sudo chown -R $USER:$USER /var/www/<alfresco-domain>
sudo chmod -R 755 /var/www
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/<alfresco-domain>.conf
sudo vim /etc/apache2/sites-available/<alfresco-domain>.conf
@douglascrp
douglascrp / gist:eef2ab7197fea613a77f593b7784aac8
Created February 6, 2019 13:25 — forked from flox1an/gist:2a726224e23381fa41f9
Change username for cm:owner cm:creator cm:modifier in Alfresco Javascript Console
var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var behaviourFilter = ctx.getBean("policyBehaviourFilter");
// -----------------------------------------------------------------
function findAndReplaceAttribute(query, attribute, value) {
nodes = search.luceneSearch(query);
for each(var node in nodes) {
@douglascrp
douglascrp / start-wf-assigned-to-site-group.js
Created February 6, 2019 13:24 — forked from alfrescian/start-wf-assigned-to-site-group.js
Start Alfresco Workflow assigned to SiteManager group of a site
var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
var javaSiteService = ctx.getBean("siteService");
var site = javaSiteService.getSite(document.nodeRef);
var siteManagerGroup = javaSiteService.getSiteRoleGroup(site.getShortName(), "SiteManager", true);
var groupAssignee = people.getGroup(siteManagerGroup)
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "activiti$activitiParallelGroupReview";
workflow.parameters.requiredApprovePercent = 20;
workflow.parameters["bpm:workflowDescription"] = "Please review and approve: " + document.name;
importClass(Packages.org.springframework.web.context.ContextLoader);
importClass(Packages.org.alfresco.service.cmr.repository.TransformationOptions);
var context = ContextLoader.getCurrentWebApplicationContext();
var alfThumbnailService = context.getBean("thumbnailService");
alfThumbnailService.updateThumbnail(document.getThumbnail("webpreview").nodeRef, new TransformationOptions());
@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