Skip to content

Commit

Permalink
Merge pull request #575 from 3mdeb/issue-550
Browse files Browse the repository at this point in the history
Issue 550: Add handlers in the Authors pages for Reddit and Mastodon profiles
  • Loading branch information
artur-rs authored Mar 11, 2024
2 parents 8b67bd9 + 17a1822 commit 8f3fbdc
Show file tree
Hide file tree
Showing 8 changed files with 144 additions and 40 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,29 @@ can check the deploy job status on the
Employees and post authors profile pages are now implemented to our Hugo blog.
To add new profile page, follow steps below:

1. Add `name.surname.png` image to `blog/static/authors/` for profile image or
use `no-image.png` file in case of missing photo.
1. Add `_index.md` file to `blog/content/authors/name-surname/` with the content
about the author (look at other profile pages for template).
1. Add `name.surname.json` file to `blog/data/authors/` with the content about
the author for the post footer (look for other .json files for template)
1. Add `name.surname.png` image to `blog/static/authors/` for profile image.
1. After rebuilding the site (locally), new profile should be visible in the
authors list page: <http://localhost:1313/authors/>

To enable visibility of your social media profiles or external services, use the
following header parameters with correct urls in the author's `_index.md` file:

```yml
facebook: "https://www.facebook.com/piotr.krol.756859"
twitter: "https://twitter.com/pietrushnic"
linkedin: "https://pl.linkedin.com/in/krolpiotr"
reddit: "https://www.reddit.com/user/pietrushnic"
mastodon: "https://fosstodon.org/@pietrushnic"
matrix: "https://matrix.to/#/@pietrushnic:matrix.3mdeb.com"
github: "https://github.com/pietrushnic"
contribution:
```
## Good practices
### Broken links checker
Expand Down
37 changes: 29 additions & 8 deletions blog/content/authors/piotr-krol/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,36 @@ title: "Piotr Król"
name: "Piotr Król"
identifier: piotr.krol
photo: "/authors/piotr.krol.jpg"
facebook: "https://pl-pl.facebook.com/3mdeb"
twitter: "https://twitter.com/3mdeb_com"
facebook: "https://www.facebook.com/piotr.krol.756859"
twitter: "https://twitter.com/pietrushnic"
linkedin: "https://pl.linkedin.com/in/krolpiotr"
reddit: "https://www.reddit.com/user/pietrushnic"
mastodon: "https://fosstodon.org/@pietrushnic"
matrix: "https://matrix.to/#/@pietrushnic:matrix.3mdeb.com"
github: "https://github.com/pietrushnic"
contribution:
---
Founder and Embedded Systems Consultant at 3mdeb as well as freelance CTO of
Vitro Technology and CEO of LPN Plant. Passionate about building firmware that
enables advanced hardware features in modern products. Dedicated to customers
that treat embedded software security and upgradeability as forethought. Open
source firmware evangelist interested in platform security and trusted
computing. In favor of fixed price projects with a clear definition of success.

I'm into open-source firmware, drawing inspiration from the classic hacker
ethos of collaborative innovation and transparency. At 3mdeb, we're excited
about our two main projects: Zarhus OS, an Embedded Linux distribution based on
Yocto, and Dasharo, a coreboot downstream. Both are about the value of open
development, embedded firmware resilience, platform security transparency, the
right to repair, and digital sovereignty.

Community is at the center of our activity. By being involved in the Dasharo
Users Group, Dasharo Developers vPub, and events like the Qubes OS Summit, we
connect with others who share our passion for open-source. Our efforts with
OpenSecurityTraining2 reflect our commitment to sharing knowledge and improving
the open-source firmware ecosystem.

As the founder of 3mdeb, my daily tasks go beyond managing the company. I am
also responsible for making important decisions about our products, such as
Zarhus OS and Dasharo, and developing valuable processes that establish a
foundation for projects we undertake for our clients.

Outside work, I enjoy simple pleasures like chess, bridge, and reading. Nature,
especially the peace of the forest, is where I find solace. My interests in
theology, philosophy, and psychology keep me curious about the world. Whether
it's exploring new technologies or understanding complex ideas, I'm always
eager to learn and grow.
Binary file removed blog/static/img/matrix.png
Binary file not shown.
58 changes: 27 additions & 31 deletions blog/themes/3mdeb/layouts/authors/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,35 @@
<div class="post-cover">
<img src="{{ .Params.photo }}" alt=""/></div>
<div class="author-content">
{{ .Content }}</div>
</div>
</div>
<div class="tile is-child box">
<div class="content">
{{ with or .Params.facebook .Params.twitter .Params.linkedin .Params.github }}
<h2>Social media <strong>profiles</strong></h2>
{{ end }}
{{ with .Params.facebook }}
<div>
<a href="{{ . }}"><img class="social-icon" src="/img/facebook.png" height="32" width="32"> Follow {{ $.Params.name }} on Facebook</a>
</div>
{{ end }}
{{ with .Params.twitter }}
<div>
<a href="{{ . }}"><img class="social-icon" src="/img/twitter.png" height="32" width="32"> Follow {{ $.Params.name }} on Twitter</a>
</div>
{{ end }}
{{ with .Params.linkedin }}
<div>
<a href="{{ . }}"><img class="social-icon" src="/img/linkedin.png" height="32" width="32"> Find {{ $.Params.name }} on LinkedIn</a>
</div>
{{ end }}
{{ with .Params.github }}
<p>
<a href="{{ . }}"><img class="social-icon" src="/img/github.png" height="32" width="32"> Check GitHub profile</a>
{{ .Content }}
</p>
{{ end }}
{{ with .Params.matrix }}
<p>
<a href="{{ . }}"><img class="social-icon" src="/img/matrix.png" height="32" width="32"> Check Matrix profile</a>
</p>
{{ end }}
<div class="content" align="center">
{{ with or .Params.facebook .Params.twitter .Params.linkedin .Params.github .Params.matrix .Params.reddit .Params.mastodon}}
{{ end }}
{{ with .Params.facebook }}
<a href="{{ . }}"><img class="social-icon" src="/img/facebook.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.twitter }}
<a href="{{ . }}"><img class="social-icon" src="/img/twitter.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.linkedin }}
<a href="{{ . }}"><img class="social-icon" src="/img/linkedin.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.reddit }}
<a href="{{ . }}"><img class="social-icon" src="/img/reddit.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.mastodon }}
<a href="{{ . }}"><img class="social-icon" src="/img/mastodon.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.github }}
<a href="{{ . }}"><img class="social-icon" src="/img/github.png" height="32" width="32"></a>
{{ end }}
{{ with .Params.matrix }}
<a href="{{ . }}"><img class="social-icon" src="/img/matrix.png" height="32" width="32"></a>
{{ end }}
</div>
</div>

{{ with .Params.contribution }}
<h2>Contribution to <strong>open-source</strong></h2>
Expand Down
Binary file added blog/themes/3mdeb/static/img/mastodon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/themes/3mdeb/static/img/matrix.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added blog/themes/3mdeb/static/img/reddit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions scripts/docker-host-preview.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

# Check for the required parameters
if [ "$#" -ne 2 ]; then
echo "Usage: $0 <user@remote-host> <local-src-dir>"
exit 1
fi

# Function to clean up background processes when the script exits
cleanup() {
echo "Cleaning up..."
# Kill the inotifywait background process
kill $INOTIFY_PID
}

# Set trap to call cleanup function when the script exits
trap cleanup exit

REMOTE_USER_HOST="$1"
LOCAL_SRC_DIR="$2" # Local source directory provided as the second parameter
REMOTE_SRC_DIR="/tmp/website"
DOCKER_IMAGE="klakegg/hugo:0.105.0-ext-alpine"
DOCKER_PORT="1313"
REMOTE_HOST=$(echo $REMOTE_USER_HOST | cut -d '@' -f2)

# Set DOCKER_HOST environment variable
export DOCKER_HOST="tcp://$REMOTE_HOST:2375"

# Function to continuously sync local directory with remote directory
start_sync() {
ssh $REMOTE_USER_HOST "rm -rf $REMOTE_SRC_DIR"
rsync -avz --exclude='.git/' $LOCAL_SRC_DIR $REMOTE_USER_HOST:$REMOTE_SRC_DIR
inotifywait -m -r -e modify,create,delete --exclude '^\.git/' --format '%w%f' $LOCAL_SRC_DIR | while read file; do
# Check if the changed file is not inside .git directory
if [[ $file != *".git"* ]]; then
rsync -avz --exclude='.git/' $LOCAL_SRC_DIR $REMOTE_USER_HOST:$REMOTE_SRC_DIR
fi
done &
INOTIFY_PID=$!
}

# Function to run Docker container on remote host
run_docker_container() {
docker run --rm -it -v $REMOTE_SRC_DIR/blog:/src -p $DOCKER_PORT:$DOCKER_PORT -u $(id -u) $DOCKER_IMAGE serve -b $REMOTE_HOST
}

#!/bin/bash

# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Check for required commands
if ! command_exists rsync; then
echo "rsync is not installed. Please install it."
exit 1
fi

if ! command_exists inotifywait; then
echo "inotify-tools is not installed. Please install it."
exit 1
fi

# Start continuous synchronization in the background
start_sync

# Run Docker container
run_docker_container

# After the Docker container exits, kill the background sync process
kill $!

0 comments on commit 8f3fbdc

Please sign in to comment.