Skip to content

Instantly share code, notes, and snippets.

@tml
tml / AuthyToOtherAuthenticator.md
Created February 9, 2020 17:01 — forked from gboudreau/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

Generating Authy passwords on other authenticators


There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, through Google) for you to use on your favorite authenticator.

His method is to extract the secret keys using Authy's Google Chrome app via Developer Tools. If this was not possible, I guess people would be reverse engineering the Android app or something like that. But when I tried that code, nothing appeared on the screen. My gues

@tml
tml / oakTreeNodeCount.groovy
Created July 15, 2019 12:33 — forked from andrewmkhoury/oakTreeNodeCount.groovy
Counting nodes in a tree of Oak repository using the oak-run console tool
import org.apache.jackrabbit.oak.spi.state.NodeState
import java.util.concurrent.atomic.AtomicInteger
def countNodes(NodeState n, String path = "/", flush = 5000, AtomicInteger count = new AtomicInteger(0), root = true) {
if(root) {
println "Counting nodes in tree ${path}"
}
cnt = count.incrementAndGet()
if (cnt % flush == 0) println(" " + cnt)
  1. Download https://files.acrobat.com/a/preview/e885654b-8424-4698-b5e9-7751b647276b (or build oak-run 1.1.x version)
  2. Stop all AEM instances
  3. Upload the oak-run 1.1 version to the AEM server if using TarMK or MongoDB server (if using MongoMK)
  4. Run this command to start the oak console
  • on TarMK:
   java -jar target/oak-run.jar console --quiet /path/to/segmentstore
  • For MongoMK run this:
@tml
tml / INSTRUCTIONS.md
Created July 15, 2019 12:33 — forked from andrewmkhoury/INSTRUCTIONS.md
Apache Sling - enabling debug log level for all java packages when instance won't start up
  1. Open this file in an editor crx-quickstart/launchpad/config/org/apache/sling/commons/log/LogManager.config
  2. Change org.apache.sling.commons.log.level value from "info" to "debug"
  3. Try to start the instance again
@tml
tml / ClonedReindexingInstructions.md
Created July 15, 2019 12:32 — forked from andrewmkhoury/ClonedReindexingInstructions.md
Reindexing Oak Async Indexes on a Clone AEM Instance

How to Reindex AEM on a Clone Instance and Sync over the Changes

  1. Clone your AEM instance to another VM for reindexing
  2. Download these oak-run jars:
  1. Upload the oak-run jars to the clone server
  2. Stop AEM (stop all AEM instances if a cluster or cold standby)
  3. Run this command (using oak-run-1.6.6.jar)
  • java -Xmx4096m -jar oak-run-1.6.6.jar checkpoints /path/to/repository/segmentstore
  1. Run this command (using oak-run-1.6.6.jar)
@tml
tml / Oak Datastore Check.md
Created July 15, 2019 12:32 — forked from andrewmkhoury/Oak Datastore Check.md
Oak Datastore Consistency Check
  1. Download the oak-run version that matches what is installed from http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run/
  2. Stop all AEM instances in cluster
  3. Upload the oak-run jar to the AEM server
  4. Run this command to start the oak console
  • on TarMK:
   java -Xmx4g -jar target/oak-run.jar console --quiet /path/to/segmentstore
  • For MongoMK run this:
@tml
tml / User-Group-ACL-Migration.md
Created July 15, 2019 12:32 — forked from andrewmkhoury/User-Group-ACL-Migration.md
Migrating AEM Users, Groups and ACLs between instances
  1. Migrate users and groups (If users were not imported automatically via LDAP) Package users and groups (2 separate packages) on the old system (excluding admin and anonymous OOTB users)
    1. Go to CRXDE lite app /crx/de/index.jsp and log in as admin user (on the old system)
    2. Go to "Tools" => "Query"
    3. In the bottom "Query" box enter this query to find the admin user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="admin"]
    4. Click "Execute" and copy the path of the admin user node in the results to a text file
    5. Repeat step 3 with a query for anonymous user: /jcr:root/home/users//element(*,rep:User)[@rep:principalName="anonymous"]
  2. Click "Execute" and copy the path of the anonymous user node in the results to a text file (so now you should have two paths, one for "admin" and one for "anonymous")
@tml
tml / INSTRUCTIONS.md
Created July 15, 2019 12:32 — forked from andrewmkhoury/INSTRUCTIONS.md
oak-run Groovy script to reset the Adobe AEM "admin" user password

To run this script:

  1. Download the oak-run version matching the version of Oak installed in AEM: http://repo1.maven.org/maven2/org/apache/jackrabbit/oak-run
  2. Download the attached adminUtils.groovy script
  3. Upload the adminUtils.groovy script and the oak-run jar to your AEM server
  4. Run the command to start the oak-run console. For example:
    java -Xmx2048m -jar /tmp/oak-run-1.6.1.jar console /app/aem/aem63/crx-quickstart/repository/segmentstore --read-write
    
  5. Once the oak-run console is open then load the groovy script using this command:
@tml
tml / 1 Instructions - Find Oak Corruptions.md
Created July 15, 2019 12:30 — forked from andrewmkhoury/1 Instructions - Find Oak Corruptions.md
Oak count node check in script console - use while AEM / Oak is running
  1. Go to http://host:port/system/console/bundles and install these two bundles
  2. Go to http://host/system/console/configMgr/org.apache.sling.jcr.base.internal.LoginAdminWhitelist
  3. Add org.apache.felix.webconsole.plugins.scriptconsole to "Whitelist regexp" and save
  4. After the two bundles fully install then go to http://host:port/system/console/sc
  5. Select "Groovy" as the language
  6. Copy/Paste the contents of countNodes-*.groovy script below which matches your oak version to the script console
  7. Click "Execute"
  8. Don't close the browser, the output is displayed in the console UI

The objective here is to find all SegmentNotFoundException type corruption and remove it (as we don't have a valid backup)

Before running any of the below steps we created an index.json file (see the file below) which contains only the index definitions of the corrupted indexes.

  1. This generates the file indexing-results\index-definities.json
java -Xmx8g -jar oak-run-1.8.12.jar index --fds-path=crx-quickstart\repository\datastore crx-quickstart\repository\segmentstore --index-definitions
  1. From that file we copied only the definitions we needed and created index.json (file attached here )