Category Archives: Uncategorized

Handy Aem CURL commands (6.*)

Steps

REPLICATION ACTIONS:

Activate

curl -u admin:admin -X POST -F path=”/content/path/to/page” -F cmd=”activate” http://localhost:4502/bin/replicate.json

Deactivate
curl -u admin:admin -X POST -F path=”/content/path/to/page” -F cmd=”deactivate” http://localhost:4502/bin/replicate.json

Tree Activation
curl -u admin:admin -F cmd=activate -F ignoredeactivated=true -F onlymodified=true
-F path=/content/geometrixx http://localhost:4502/etc/replication/treeactivation.html

PAGES:

Lock page
curl -u admin:admin -X POST -F cmd=”lockPage” -F path=”/content/path/to/page” -F “_charset_”=”utf-8” http://localhost:4502/bin/wcmcommand

Unlock page
curl -u admin:admin -X POST -F cmd=”unlockPage” -F path=”/content/path/to/page” -F “_charset_”=”utf-8” http://localhost:4502/bin/wcmcommand

Copy page
curl -u admin:admin -F cmd=copyPage -F destParentPath=/path/to/destination/parent -F srcPath=/path/to/source/locaiton http://localhost:4502/bin/wcmcommand

REPLICATION AGENT:

Create Replication Agents

curl -u admin:admin ‘http://localhost:4502/bin/wcmcommand’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=UTF-8’ –data ‘cmd=createPage&_charset_=utf-8&parentPath=/etc/replication/agents.author&title=ReplicationAgentTest&label=&template=/libs/cq/replication/templates/agent’

BUNDLES:

Uninstall a bundle

curl -u admin:admin -daction=uninstall http://localhost:4505/system/console/bundles/”name of bundle”

Install a bundle
curl -u admin:admin -F action=install -F bundlestartlevel=20 -F
bundlefile=@”name of jar.jar” http://localhost:4505/system/console/bundles

Build a bundle
curl -u admin:admin -F bundleHome=/apps/centrica/bundles/name of bundle -F
descriptor=/apps/centrica/bundles/com.centrica.cq.wcm.core-bundle/name_of_bundle.bnd
http://localhost:4505/libs/crxde/build

Stop a bundle
curl -u admin:admin http://localhost:4505/system/console/bundles/org.apache.sling.scripting.jsp
-F action=stop

Start a bundle
curl -u admin:admin http://localhost:4505/system/console/bundles/org.apache.sling.scripting.jsp
-F action=start

PACKAGES:

Upload a new package

curl -u admin:admin -F package=@”name_of_package.zip” http://localhost:4505/crx/packmgr/service/.json/?cmd=upload

Install an existing package
curl -u admin:admin -X POST http://localhost:4505/crx/packmgr/service/.json/etc/packages/export/name of package?cmd=install

Upload a package AND install
curl -u admin:admin -F file=@”name of zip file” -F name=”name of package”
-F force=true -F install=true http://localhost:4505/crx/packmgr/service.jsp

Upload a package DO NOT install
curl -u admin:admin -F file=@”name of zip file” -F name=”name of package”
-F force=true -F install=false http://localhost:4505/crx/packmgr/service.jsp

Rebuild an existing package in CQ
curl -u admin:admin -X POST http://localhost:4505:/crx/packmgr/service/.json/etc/packages/name_of_package.zip?cmd=build

Download (the package)
curl -u admin:admin http://localhost:4505/etc/packages/export/name_of_package.zip > name of local package file

USER ADMINISTRATION:

Add user to a group

curl -u admin:admin -FaddMembers=testing http://localhost:4502/home/groups/c/contributor.rw.html

Remove User from a Group
curl -u admin:admin -FremoveMembers=testing http://localhost:4502/home/groups/c/contributor.rw.html

BACKUP

Upload Assets in DAM

curl -u admin:admin -X POST -F file=@”test.png” http://localhost:4508/content/dam/geometrixx/portraits.createasset.html

Source: https://helpx.adobe.com/experience-manager/kb/common-AEM-Curl-commands.html

Exim to mandrilapp

If you have ever tried to send emails from your dedicated server in the cloud to either a mailing list or to individual users of your site, you would know that it is not as simple as it sounds. Depending upon the reputation of the IP address asigned to your server, many large email providers might block your emails – even though you have a perfectly legitimate reason to send this email, and your company has never spammed anyone. The solution we implemented was subscribing to the excellent Mandrill transactional email server from https://mandrillapp.com/ and sending all our emails via them. The problem then is how to makes sure all your emails as routed (relayed) through them? For your Drupal emails, you can use the Mandrill module, but that covers only Drupal (and has other issues). So what we really did was route emails to Mandrill at SMTP MTA (Mail Transport Agent) configuration level itself. The rest of the article describes how.

We use Debian Linux, which uses exim4 as the default MTA. To reconfigure it, just run sudo dpkg-reconfigure exim4-config, and follow the screens. You can take the defaults, except in the following three cases:

  • Type of mail configuration – mail sent by smarthost; no local mail
  • System mail name – yourdomain.com (or whatever your primary domain name is)
  • IP address or host name of the outgoing smarthost – smtp.mandrillapp.com::587 (this is most important)

Exim4 - Type of mail configuration

Exim4 - System mail name

Exim4 - Outgoing smarthost

Exit the configuration program and then there is one more VERY IMPORTANT thing. You must edit /etc/exim4/passwd.client file (as root or using sudo) and add the following line to it:

*.mandrillapp.com:your-mandrill-username@yourdomain.com:your-mandrill-api-key

You can find your Mandrill API from https://mandrillapp.com/settings/index after logging in.

That’s it. Now all emails going out of your server will be relayed through Mandrill, and thus (hopefully) not rejected by your recepient’s email providers. Happy emailing!

All Credits are for – https://spinspire.com/article/smtp-relay-mandrill-service

change the execution time for php-fpm and nginx for long running scripts

in the php pool config set:

php_admin_value[max_execution_time] = 600;
location ~ \.php$ {
	include /etc/nginx/fastcgi_params;
        fastcgi_pass  unix:/var/run/php5-fpm.sock;
	fastcgi_read_timeout 600; 
}

Generate ssh key

ssh-keygen -b 4096 -t rsa <-C "your_email@example.com">

git empty folder

# Ignore everything in this directory
*
# Except this file
!.gitignore

Magento admin could not be found

SET FOREIGN_KEY_CHECKS=0;
UPDATE `core_store` SET store_id = 0 WHERE code='admin';
UPDATE `core_store_group` SET group_id = 0 WHERE name='Default';
UPDATE `core_website` SET website_id = 0 WHERE code='admin';
UPDATE `customer_group` SET customer_group_id = 0 WHERE customer_group_code='NOT LOGGED IN';
SET FOREIGN_KEY_CHECKS=1;

debian cleanup :)

apt-get --purge remove nfs-kernel-server nfs-common portmap rpcbind

ssh set public key

~/.ssh/authorized_keys

go2shell

One of my favourite tools in OSX can use iTerm 2. I had to google it to find out how.
So as a reminder to myself

 

open -a Go2Shell --args config

Cisco Transparent firewall

Setting up a transparent firewall is very easy. just follow the steps below and you’re all set!

 

  1. Login to the ASA appliance.
  2. enable
  3. config t
  4. firewall transparent
  5. show firewall (check if it has been set.)
  6. interface ethernet 0/0 (set first ethernet port)
  7. switchport access vlan 2 ( set it to vlan 2)
  8. no shut (prevent it from shutting down)
  9. interface ethernet 0/1 (set first ethernet port)
  10. switchport access vlan 1 ( set it to vlan 1)
  11. no shut (prevent it from shutting down)
  12. interface  vlan 2
  13. nameif outside (name interface vlan 2 to outside – INFO: Security level for “outside” set to 0 by default.)
  14. interface  vlan 1
  15. nameif inside (name interface vlan 1 to inside – INFO: Security level for “inside” set to 100 by default.)
  16. http server enable (enable http server for asdm – optional)
  17. http 192.168.70.0 255.255.255.0 inside (set access list for http server)
  18. asdm image flash:/asdm-621.bin (load asdm image – optional)