Skip to content

Instantly share code, notes, and snippets.

View hi-ko's full-sized avatar

Heiko Robert hi-ko

  • ecm4u GmbH
  • Stuttgart, Germany
View GitHub Profile
SOLR_CONTEXT="https://${SOLR_TOMCAT_HOST}:${SOLR_TOMCAT_PORT}/${SOLR_TOMCAT_CONTEXT}"
REPO_CERT=$SSL_BASE/certs/client.pem
CURL_PARAMS=( -k -s --cert "$REPO_CERT":"$REPO_CERT_PW" )
# get indexing status
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=SUMMARY&wt=json" |jq -r '.Summary | keys_unsorted[] as $k | "\($k), \(.[$k]."TX Duration"), \(.[$k]."Id for last TX in index")/\(.[$k]."Id for last TX on server") tx, \(.[$k]."On disk (GB)") GB, \(.[$k]."Approx transaction indexing time remaining")"'
# Show numDocs,maxDoc and deletedDocs for each Alfresco core
curl "${CURL_PARAMS[@]}" "$SOLR_CONTEXT/admin/cores?action=SUMMARY&wt=json"| \
jq '.Summary[].Searcher' | jq -r '"\(.searcherName),\(.numDocs),\(.maxDoc),\(.deletedDocs)"'
ALF_TICKET=$(curl -ks "http://localhost:$ALF_TOMCAT_PORT/alfresco/service/api/login.json?u=$ALF_ADMIN_USER&pw=$ALF_ADMIN_PW"|jq -r .data.ticket)
echo $ALF_TICKET
# validate ticket
curl -s -u "$ALF_ADMIN_USER:$ALF_ADMIN_PW" -X GET "http://localhost:$ALF_TOMCAT_PORT/alfresco/service/api/login/ticket/$ALF_TICKET"
# delete
curl -s -u "$ALF_ADMIN_USER:$ALF_ADMIN_PW" -X DELETE "http://localhost:$ALF_TOMCAT_PORT/alfresco/service/api/login/ticket/$ALF_TICKET?format=json"
TICKET_URL_PARAM="alf_ticket=$ALF_TICKET"
<alfresco-config>
<config evaluator="string-compare" condition="Remote">
<remote>
<authenticator>
<id>custom-ticket-login</id>
<name>Redpill Alfresco Ticket Authenticator</name>
<description>Alfresco Ticket Authenticator</description>
<class>org.redpill.alfresco.webscripts.connector.AlfrescoTicketAuthenticator</class>
</authenticator>
<connector>
@hi-ko
hi-ko / git_rebase.md
Created October 22, 2019 14:07 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream

@hi-ko
hi-ko / solrcore.properties
Last active December 6, 2019 09:48
solr snippets
alfresco.lag=1000
alfresco.hole.retention=3600000
# alfresco.hole.check.after is not used yet
# It will reduce the hole checking load
alfresco.hole.check.after=300000
alfresco.batch.count=5000
alfresco.recordUnindexedNodes=false
enable.alfresco.tracking=true
@hi-ko
hi-ko / md4hash.py
Last active May 3, 2021 09:23
generate initial password for alfresco admin (by mt and AFaust from discord)
#!/usr/bin/python3
import hashlib
import sys
# import os
#hash = hashlib.new('md4', os.environ['ALF_ADMIN_PASS'].encode('utf-16le')).digest()
hash = hashlib.new('md4', sys.argv[1].encode('utf-16le')).digest()
print(bytes.hex(hash))
@hi-ko
hi-ko / README.md
Last active September 30, 2023 01:28
joplin server install

this gist is no longer maintained

Please use https://github.com/hi-ko/joplin-server-ubuntu-install instead

Install joplin server on Ubuntu (20.04)

  1. as root run joplin-requirements.sh to install the joplin requirements but please take this script with causion since it is not well tested in existing environments. You could also create the requirements by yourself by
    1. create user joplin with home /home/joplin
    2. install nodejs 16
  2. install packages vim git build-essential python curl dirmngr apt-transport-https lsb-release ca-certificates
@hi-ko
hi-ko / createPreviewsInFolder.js
Last active March 11, 2022 17:22
Alfresco Javascript Console
// example for the ecm4u smartTransformer to (re)create high quality Previews for Office-Docs
var suffixList=['pptx', 'ppt', 'xlsx', 'xls', 'docx', 'doc'];
recurse(document, function(node) {
if ( node.isDocument){
var suffix=node.properties["cm:name"].split('.').pop();
if (suffixList.indexOf(suffix.toLowerCase()) >= 0) {
print(node.displayPath+'/'+node.name+': ' + smarttransformer.createThumbnails(node).message);
}
@hi-ko
hi-ko / checkDockerDisks.sh
Created March 22, 2022 15:06 — forked from robsonke/checkDockerDisks.sh
This Bash script will loop through all running docker containers on a host and list the disk usage per mount. In case it's breaching the 65%, it will email you.
#!/bin/bash
# get all running docker container names
containers=$(sudo docker ps | awk '{if(NR>1) print $NF}')
host=$(hostname)
# loop through all containers
for container in $containers
do
echo "Container: $container"
## Install Docker
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"