Create a bcrypt hash on commandline

Its easy to create a bcrypt hash  on commandline with this command: $> htpasswd -nbBC 10 USER PASSWORD Just replace the Placeholder USER and PASSWORD with the corresponding values. The Result should be something like that: USER:$2y$10$gfPbhclOrdjmMLEXSc5CTOWP5aBfjl59hhGvjp/qWXf1FfbQKb5ca The part before “:” is the username. The rest is the bcrypt password hash. The -C parameter specifies […]

Get a filename only list of files in a folder

To get a list of all files in a folder without path, you can use the following snippet: $> find ../PATH/TO/FOLDER/TO/LIST/FILES/FROM -type f -printf “%f\n” Example result: 5ed8d879-9203-4c26-afe4-4eee702ffcc7.ttf 25h-icons.woff 6ab1eb08-75f2-4c1a-9911-2752e3fd6ec9.woff ada6576a-cbce-4da0-994b-b4719f95ac06.eot dc80306d-6b3e-422b-85c3-bad65f5446d4.woff 1791f364-9061-4459-a14d-0b188cfd7193.woff2 fb754dec-aa8f-444c-be48-868464c47ab0.woff 20988062-bfc8-4c30-9306-8053b179b381.eot 79de9df8-0826-46b9-beea-eb39122d4762.woff2 087e5c21-3358-4cf3-9d2c-289a03a48292.eot 7869ff0a-c18f-4ce1-bf07-fbf5b7172b66.ttf c932b9cc-bd91-4ee0-889b-302d53093448.woff2 c9fa0fce-5615-4509-af40-370a4032df9a.woff2 08bae5d9-f7bd-4e7f-8446-be05a16cc9e6.ttf 56ce7ab2-c49f-4aa1-85ce-f1823fc02355.woff bedf9150-5659-4119-9640-0f16e67d82b9.woff2 9131f395-46ef-4940-8480-8ff008c42e59.woff 77fac51a-d062-438a-a493-6b67508aa97f.woff bb8422a9-7303-4111-8be4-7de2f583aaf3.woff2 746ffa4d-bd68-4487-bb7a-0c90d07c6533.woff2 5fdc935e-9e30-442a-bbe9-8d887b858471.woff 616c4c87-a077-43f4-a9f4-f01267c13818.ttf 084ad33e-9248-40f7-b5ce-1d9dee2809c4.eot d399cbfa-b9be-47ac-983c-3600c2684bb2.ttf 295ff20c-2b48-4fa6-be92-a53bbf9bbbb4.ttf 25h-icons.ttf 2f8b7d6e-428d-4cc1-a456-712fc6aa2123.woff2 9322b01d-540d-464b-8990-dcbfa6a03ce8.eot […]

Base64 encode on shell

Sometimes you need to encode a string  with a base64 encoding. For example when trying to send a HTTP request with a Basic Authentication header like that: ### own controller: POST Content-Type: application/json Authorization: Basic c25zOlVzZVRoZWZvcmNlCg== { “uuid”: “08e9a8d3-9279-4af5-88ff-ebe42359f0e0”, “eventname”: “”, “data”: { “sitemap_id”: “1234”, “locale”: “de_DE”, “path”: “unigue/page/path”, “title”: “Testpage over API”, “meta_title”: […]

GIT – reconnect remote branch

Sometimes it is necessary to remap a local git  branch to a remote one (reconnect remote branch). For me it was the case, because I accidentally removed all origins in a multi-origin setup. Hence I got the following error message when trying to pull without naming remote and branch, although I re-added and fetched all […]

Lock shellscript process under Unix based systems

Today I ran again into a common problem when dealing with cron based scipts that run concurrently. That’s why I had to lock shellscript process until it is finished before starting the next executing round. On Unix based systems like Linux you can achieve that with flock. flock binds a file descriptor to a certain lock […]

Associative arrays (hash, dictionary) on bash

This is how to create associative arrays (hash, dictionary) on bash: #!/bin/bash if [ “$1” == “help” ] then echo “Help”; echo “USAGE:”; echo “========”; echo “ LIVE|STAGE”; exit 0; elif [ $1 ] then DOMAINS[‘LIVE’]=””; DOMAINS[‘STAGE’]=”; REQUEST_DOMAIN=””; if [ “$1” == “LIVE” -o “$1” == “STAGE” ] then REQUEST_DOMAIN=${DOMAINS[“$1”]}; else echo “You have to give […]