Skip to content

Instantly share code, notes, and snippets.

@rwunsch
rwunsch / 0_reuse_code.js
Created June 7, 2016 18:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rwunsch
rwunsch / httpstatus
Created September 5, 2016 13:07 — forked from rsvp/httpstatus
httpstatus : bash script to get HTTP response code with optional status message (includes verbose definitions in comment)
#!/usr/bin/env bash
# bash 4.1.5(1) Linux Ubuntu 10.04 Date : 2011-08-25
#
# _______________| httpstatus : get HTTP status code
#
# Usage: httpstatus URL [timeout] [--code or --status] [see 4.]
# ^message with code (default)
# ^code (numeric only)
# ^in secs (default: 3)
# ^URL without "http://" prefix works fine.
/etc/map
+-- http
+-- example.com.80
| +-- sling:redirect = "http://www.example.com/"
+-- www.example.com.80
| +-- sling:internalRedirect = "/example"
+-- any_example.com.80
| +-- sling:match = ".+\.example\.com\.80"
| +-- sling:redirect = "http://www.example.com/"
+-- localhost_any
This scripts provide details related to various caches used in Oak MongoMK module while running within Sling OSGi Container
The script is based on (JAMM) [1]. Steps are provided below
1. Download JAMM from Maven
$wget http://repo1.maven.org/maven2/com/github/stephenc/jamm/0.2.5/jamm-0.2.5.jar
2. Modify the Quickstart launching by specifying agent and bootdelegation list
$java -javaagent:<path to>/jamm.jar -Dorg.apache.sling.launcher.bootdelegation=,org.github.jamm -jar
3. Deploy the Script Console jar
$wget http://repo1.maven.org/maven2/org/apache/sling/org.apache.sling.scripting.console/1.0.0/org.apache.sling.scripting.console-1.0.0.jar
$wget http://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/2.1.3/groovy-all-2.1.3.jar
@rwunsch
rwunsch / remove-docker-containers.md
Created January 6, 2017 01:05 — forked from ngpestelos/remove-docker-containers.md
How to remove unused Docker containers and images
  1. Delete all containers

     $ docker ps -q -a | xargs docker rm
    

-q prints only the container IDs -a prints all containers

Notice that it uses xargs to issue a remove container command for each container ID

  1. Delete all untagged images
@rwunsch
rwunsch / CQ_AEM_CURL_COMMANDS.txt
Last active January 19, 2017 16:28 — forked from sergeimuller/gist:2916697
CQ5 curl commands
Note 1: The following CQ curl commands assumes a admin:admin username and password.
Note 2: For Windows/Powershell users: use two "" when doing a -F cURL command.
Example: -F"":operation=delete""
Note 3: Quotes around name of package (or name of zip file, or jar) should be included.
Uninstall a bundle (use http://localhost:4505/system/console/bundles to access the Apache Felix web console)
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
@rwunsch
rwunsch / Oak-mongo.js.md
Last active January 19, 2017 16:29 — forked from chetanmeh/README.md
Utility JS function for Mongo when used with Jackrabbit Oak

Following js file can be load at start of mongo shell and then the functions can be accessed

$ wget https://gist.githubusercontent.com/chetanmeh/836ca8fffc4c410daed2/raw/oak-mongo.js
$ mongo localhost/oak --shell oak-mongo.js
MongoDB shell version: 2.6.3
connecting to: localhost/oak
type "help" for help
> oak.countChildren('/oak:index/')
356787

> oak.getChildStats('/oak:index')

@rwunsch
rwunsch / curlPackageFilterRules.sh
Created January 17, 2017 11:19 — forked from nateyolles/curlPackageFilterRules.sh
AEM/CQ cURL: Adding include/exclude rules to package filters
# Adding include/exclude rules to CQ/AEM package filters through cURL.
# Through a simple search, you will find numerous lists of CQ/AEM cURL commands.
# However, I haven't seen an example of adding rules to package filters. The
# JSON "rules" key takes an array value. You can leave the array empty if you
# don't need to include any rules. The array is of JSON objects with a
# "modifier" key and value of "include" or "exclude", and a "pattern" key with
# your path or regular expression as the value.
# create package
@rwunsch
rwunsch / bundle.info
Created January 23, 2017 09:52 — forked from chetanmeh/bundle.info
Felix 4.x bundle.info description
11 #Bundle Id
slinginstall:/path/to/foo.jar #Bundle original location
32 #Persistence State (INSTALLED, RESOLVED etc)
1 #Start level
1358768421064 #Last modified
0 #Refresh Count
@rwunsch
rwunsch / sessionSummary.groovy
Created November 14, 2017 15:11 — forked from badvision/sessionSummary.groovy
Summarize all open JCR sessions by the stack trace of the code that opened them. This helps identify session leaks in code.
import groovy.json.JsonSlurper
//Get data from here: /system/sling/monitoring/mbeans/org/apache/jackrabbit/oak/%2522SessionStatistics%2522.2.json
def file = '/Users/brobert/Desktop/all_sessions.json' as File
def sanitizeStacktrace = {trace->
if (trace.contains("loginAdministrative")) {
def lines = trace.split("\n")
def startIdx;
for (def idx=0; idx < lines.length; idx++) {