Skip to content

Instantly share code, notes, and snippets.

View fmaul's full-sized avatar

Florian fmaul

  • Braunschweig, GERMANY
View GitHub Profile
@fmaul
fmaul / IgnoreSSLcert.java
Created January 25, 2019 12:07
Java ignore SSL for OpenCMIS connections
private void acceptSelfSignedCertificates() {
TrustManager[] trustAllCerts = new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
@fmaul
fmaul / default.conf
Last active September 1, 2023 07:26
nginx config that uses the oauth2-proxy (via auth_request) to authenticate against gitlab and then proxies all requests to a backend service while setting the auth headers X-User and X-Email
server {
listen 80;
server_name localhost;
location /oauth2/ {
proxy_pass http://oauth-proxy:4180;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Auth-Request-Redirect $request_uri;
@fmaul
fmaul / alfresco.service
Last active January 3, 2024 15:30
Alfresco systemd service sample configuration file /etc/systemd/system/alfresco.service
[Unit]
Description=Alfresco ECM Repository
After=network.target mysql.service
[Service]
Type=forking
ExecStart=/opt/alfresco/alfresco.sh start
ExecReload=/opt/alfresco/alfresco.sh restart
ExecStop=/opt/alfresco/alfresco.sh stop
User=alfresco
@fmaul
fmaul / pdfjoin.js
Created August 9, 2016 07:17
Join multiple PDF files with the Alfresco PDF Toolkit
function pdfJoin(docs, targetFolder, targetName) {
var appendAction = actions.create("pdf-append");
appendAction.parameters['target-node'] = docs[1];
appendAction.parameters['destination-folder'] = targetFolder;
appendAction.parameters['destination-name'] = targetName;
appendAction.execute(docs[0]);
var merged = targetFolder.childByNamePath(targetName);
@fmaul
fmaul / gist:2a726224e23381fa41f9
Created January 28, 2015 15:12
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) {
@fmaul
fmaul / 0 Custom DocLib metadata.md
Last active August 29, 2015 13:57
Use a repository extension to add custom properties to Alfresco Share Document Library Metdata. This example adds the current users' authorities.

Repository extension to add custom DocLib meta data

Using the repository extension from the files UserInfoCustomResponse.java and fme-user-info-context.xml you can add custom doclib metadata as a json object. This data will be pulled into the browser with Share's DocLib XHR request and can be used to configure or extend the document library.

Usage as DocLib action evaluator

To use the custom data in a Share document library action evaluator you can write an evaluator in as shown in the file FmeGroupEvaluator.java

@fmaul
fmaul / write local files.js
Created December 13, 2013 12:14
Writing local files from the Javascript Console
var FileUtils = Packages.org.apache.commons.io.FileUtils;
var outFile = new Packages.java.io.File("/tmp/output.txt");
FileUtils.writeStringToFile(outFile, "Hello World!", "UTF-8");
@fmaul
fmaul / starfield.html
Last active December 29, 2015 16:29
Minimal HTML5 canvas starfield in 540bytes
<!doctype html><canvas><script>
with(Math)with(a=(c=document.body.children[0]).getContext("2d"),c.width=w=innerWidth-30,
c.height=h=innerHeight-30,p=[],r=random,a.translate(w/2,h/2),a)(f=function(){
for(rotate(.005),save(),setTransform(1,0,0,1,0,0),fillStyle="rgba(0,0,0,.3)",fillRect(0,0,w,h),
restore(),fillStyle="#fff",q=[],i=p.length;i--;)v=p[i],(abs(v[0])<w||abs(v[1])<h)&&(
fillRect(v[0]+=v[2]+=v[4],v[1]+=v[3]+=v[5],1,1),q.push(v))
for(p=q;r()<.8;)p.push([0,0,0,0,.1*r()-.05,.1*r()-.05]);requestAnimationFrame(f)})()</script>
@fmaul
fmaul / createAdminUser.get.desc.xml
Last active July 21, 2023 17:40
Webscript to create a new (emergency) admin user in Alfresco. 1. Copy to alfresco/extension/templates/webscripts/ 2. restart Alfresco 3. Call the URL: http://localhost:8080/alfresco/service/server/createadmin 4. Log in with localadmin / localadmin
<webscript>
<shortname>create admin user</shortname>
<description>creates an user called localAdmin and add it to the admingroup</description>
<url>/server/createadmin</url>
<format default="json">argument</format>
<authentication runas="admin">none</authentication>
<transaction>required</transaction>
</webscript>
@fmaul
fmaul / js1k_tank_duel.js
Last active December 13, 2015 21:38
Tank Duel - Scorched Earth clone for two players JS1K spring demo competition entry 2013-02
/**
Tank Duel
(c) Florian Maul (@fmaul)
Scorched Earth clone for two players.
Gameplay:
- Adjust your browser window size for terrain sizes
- Press F5 until you have a desired terrain and tank placement