Privacy aware webdeveloper in the FOSS universe, part of Starzel.de, founder of Portknox.net (Nextcloud SaaS) and father of a daughter.
Learn more about me. Email me at mail@steffen-lindner.de
2 min read
I have recently started developing a React app for Nextcloud. After creating the React boilerplate inside my Nextcloud app (in the /src directory) and developing some basic features outside of Nextcloud (just "npm start"), I wanted to get the React part called and included into the Nextcloud app.
As Webpack uses chunk splitting which generates more than one JavaScript file and also adds a hash to the file name for cache resetting, I had problems including it as it is described in the Nextcloud docs. For now my app is not that big so I used this hack to disable chunk splitting in CRA without ejecting.
In the template/index.php i used this PHP code to get the hashed file into app:
/*
* Uses the manifest file to get the filenames with hash
* @param string $filename
* @return string
*/
function asset_path($filename) {
$manifest_path = './apps/portknox_admin/build/asset-manifest.json';
$ext = pathinfo($filename, PATHINFO_EXTENSION);
$strip = ($ext == "css") ? -4 : -3;
if (file_exists($manifest_path)) {
$manifest = json_decode(file_get_contents($manifest_path), TRUE);
} else {
$manifest = [];
}
if (array_key_exists($filename, $manifest)) {
return '../build'. substr($manifest[$filename], 0, $strip);
}
return '../build' . substr($filename, 0, $strip);
}
style('portknox_admin', asset_path('main.css'));
script('portknox_admin', asset_path('main.js'));
Maybe this helps someone, leave a comment if you have improvements or a better way.
1 min read
I just posted an update on the Portknox blog. If you are a Portknox customer or intressted in Portknox read it over there.
1 min read
I recently joined the Plonator Sprint and helped working on new demosites for Plone. Here is a the german news on plone.de and here you can find the sprint report.
1 min read
During the Plonator sprint i have started to replace Supervisor (a process manager) with systemd start/stop scripts.
Right now Supervisor does not work with Python 3 (Supervisor version 4 will work) and it has problems stopping a Zope4 instance (needs more testing).
A systemd script could look like this:
root@xxxy:~# cat /etc/systemd/system/demo-latest.service
[Unit]
Description=demo-latest.plone.de
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/zope/demo-latest.plone.de/
User=zope
Group=zope
ExecStart=/home/zope/demo-latest.plone.de/bin/instance fg
[Install]
WantedBy=multi-user.target
I haven't digged deep into systemd start/stop scripts, but i think i will use it more often. Are you using Supervisor? Is systemd a good replacement?
2 min read
Seit ich ein 7,8 Zoll PocketBook Inkpad 3 besitze, lese ich auch die Zeit auf diesem Ebook-Reader. Um das wöchentlich erscheinde Epub auf den Reader zu bekommen, habe ich mir ein Download Python Script geschrieben.
Es versucht die Downlaod URL zu generieren und die Datei runterzuladen, im Fehlerfall schickt es mir eine E-Mail. Damit (und mit Hilfe meines alten Bash Scripts) bekomme ich die Zeit per Send-to-PocketBook auf meinen Reader.
Meine jetzige Lösung nutzt leider noch Server von dritten (Email über Sent-to-Pocket). Vielleicht bau ich es noch aus, um die Syncronisation über meine Nextcloud laufen zu lassen. Möglich scheint es zu sein.
# -*- coding: utf-8 -*-
"""
"""
import datetime
from email.mime.text import MIMEText
import requests
import smtplib
import sys
import os.path
email = sys.argv[1]
password = sys.argv[2]
def send_mail_to_me():
msg = MIMEText('nt')
msg['Subject'] = 'Zeit.de epub url does not exist'
msg['From'] = email
msg['To'] = email
s = smtplib.SMTP('localhost')
s.sendmail(msg['From'], [msg['To']], msg.as_string())
def download_file(url):
local_filename = url.split('/')[-1]
# NOTE the stream=True parameter
r = requests.get(url, auth=(email, password), stream=True)
with open(local_filename, 'wb') as f:
for chunk in r.iter_content(chunk_size=1024):
if chunk: # filter out keep-alive new chunks
f.write(chunk)
return local_filename
if __name__ == '__main__':
now = datetime.datetime.now()
wk = now.isocalendar()[1]
url = 'https://premium.zeit.de/system/files/{}-{}/epub/die_zeit_2018_{}.epub'.format(now.year, wk, wk+1)
local_filename = url.split('/')[-1]
full_script_path = os.path.dirname(os.path.abspath(__file__))
full_zeit_path = full_script_path + '/' + local_filename
if not os.path.isfile(full_zeit_path):
url_exits = requests.get(url, auth=(email, password))
if url_exits.status_code not in [200, 201]:
send_mail_to_me()
sys.exit(1)
else:
name = download_file(url)
print name
1 min read
Recently Steam published the Steam Link app for Android. Here is what you need to play Magic Arena in the bathroom, bed or maybe in the bus?
Sorry, your browser doesn't support embedded videos, but don't worry, you can download it and watch it with your favorite video player!
I tested it some time within my WLAN and it works great. It plays really well with fingers and on the phone. I haven't tested it on a mobile connections through some kind of VPN, but maybe will.
#MTG #MTGArena #Steam #Android