From 1c2713ce2523b994fe34d707a3fd9e305068bd4b Mon Sep 17 00:00:00 2001 From: Stefan B Date: Sun, 5 Jan 2025 13:25:57 +0100 Subject: [PATCH] blog post --- _posts/2025-01-04-blogging-a-setup-options.md | 160 ++++++++++++++++++ _posts/2025-01-04-blogging-b-setup-jekyll.md | 71 ++++++++ _posts/2025-01-05-linux-cmd-find.md | 83 +++++++++ _posts/2025-01-05-linux-cmd-sysetemctl.md | 90 ++++++++++ 4 files changed, 404 insertions(+) create mode 100644 _posts/2025-01-04-blogging-a-setup-options.md create mode 100644 _posts/2025-01-04-blogging-b-setup-jekyll.md create mode 100644 _posts/2025-01-05-linux-cmd-find.md create mode 100644 _posts/2025-01-05-linux-cmd-sysetemctl.md diff --git a/_posts/2025-01-04-blogging-a-setup-options.md b/_posts/2025-01-04-blogging-a-setup-options.md new file mode 100644 index 0000000..8613168 --- /dev/null +++ b/_posts/2025-01-04-blogging-a-setup-options.md @@ -0,0 +1,160 @@ +--- +title: "Blogging: Hosting Options" +categories: [blogging,hosting] +tags: [static-side-generator] # TAG names should always be lowercase +--- + +## Different Blogging Platform Types +- **Static Site Generators (SSG)** Generates static HTML files from markdown files. Themes/templates are used to define the HTML view. +- **Content Management Systems (CMS)** Platforms like WordPress or Drupal dynamically generate pages using a database. +- **Hosted Blogging Platforms** Fully managed platforms where hosting and maintenance are handled by the provider. + + +## Comparison: SSG, CMS, Hosted Blogging Platforms + +| **Feature** | **Static Site Generators** | **CMS** | **Hosted Blogging Platforms** | +| -------------------------- | ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | +| **Hosting** | Self-hosted or free on platforms like GitHub Pages, Netlify | Requires hosting (e.g., shared, cloud, or dedicated servers) | Fully hosted, no need to manage hosting or servers | +| **Ease of Use** | Requires technical skills (e.g., Git, CLI, Markdown, HTML/CSS knowledge) | User-friendly interfaces with WYSIWYG editors, plugins, and themes | Extremely easy to use with drag-and-drop editors and minimal setup | +| **Performance** | Fast, lightweight (static HTML files, no database) | Slower due to dynamic page generation and database queries | Generally fast (depends on the platform), optimized by the provider | +| **Cost** | Free or low-cost (e.g., free hosting options, minimal maintenance costs) | Varies (may include hosting fees, paid themes, and plugin subscriptions) | Subscription-based (monthly or annual fees) | +| **Customization** | Full control over design, templates, and functionality (requires coding skills) | High customizability through themes and plugins (can require development skills) | Limited customization; mostly confined to the platform’s features | +| **Content Workflow** | Markdown-based content creation; no GUI | GUI with editors for creating and managing content | GUI with simple, predefined templates for content creation | +| **Scalability** | Highly scalable (static files are easy to distribute via CDNs) | Requires hosting upgrades for high traffic | Scalable depending on the provider (typically seamless for the user) | +| **Security** | High security (no database or backend vulnerabilities) | Vulnerable to attacks (e.g., SQL injection, brute force, plugin vulnerabilities) | High security managed by the platform provider | +| **SEO** | Manual setup required (custom metadata, sitemaps) | Plugins and tools available for SEO optimization | SEO tools often built-in but limited to platform capabilities | +| **Backup and Versioning** | Git-based version control; easy to track changes | Requires manual backups or plugins | Backups managed by the platform (limited control) | +| **Offline Development** | Content can be created offline and deployed later | Requires access to the CMS dashboard or server for updates | Online-only (requires an internet connection to make changes) | +| **Community and Support** | Large open-source communities, extensive documentation | Huge community support, plugins, and themes | Limited to platform-provided support (no open-source flexibility) | +| **Examples** | Jekyll, Hugo, Gatsby | WordPress, Joomla, Drupal | Medium, Wix, Squarespace | +| **Best For** | Developers, tech-savvy users, those who value performance and customization | Bloggers needing advanced features, large-scale blogs, and non-tech-savvy users | Non-tech-savvy users who need an easy-to-use and fully managed platform | +| **Content Ownership** | Full ownership of all content and files | Full ownership, but hosting providers can affect control | Limited ownership (platform rules and restrictions apply) | +| **Integration with Tools** | Seamless integration with CI/CD pipelines and development tools | Extensive integration via plugins, APIs, and themes | Limited integrations; platform-specific apps may be available | +| **Learning Curve** | Steeper learning curve (requires technical skills) | Moderate learning curve (user-friendly tools, but advanced features take time) | Minimal learning curve (designed for beginners) | +| **Regular Maintenance** | Minimal (focused on updating dependencies or static site generator versions) | Requires updates to CMS core, plugins, and themes | No maintenance required (provider handles everything) | + + +## Which Option for Which User ? +**Static Site Generators:** Best for users with technical knowledge who want full control, high performance, and scalability with minimal costs. + +**CMS:** Ideal for users who want extensive features, customizability, and ease of use for managing blogs or large websites, but are okay with higher maintenance. + +**Hosted Blogging Platforms:** Perfect for beginners and casual bloggers who prioritize ease of use and do not want to deal with hosting or technical complexities. + +--- + +## Popular Static Site Generators + +**[Jekyll](https://jekyllrb.com)** +- Hosted for free on GitHub Pages. +- Requires technical knowledge to set up. +- Great for blogs and personal websites. +- Supports Markdown, Liquid templates, and plugins. + +**[Hugo](https://gohugo.io)** +- Written in Go, known for its speed and simplicity. +- Wide range of themes and templates. +- Ideal for large-scale static websites. +- No dependencies, easy to install and use. + +**[Next.js](https://nextjs.org)** +- Combines static site generation and server-side rendering. +- Powered by React, making it suitable for modern web apps. +- Extensive ecosystem and plugins. +- Supports both static export and dynamic content. + +**[Gatsby](https://www.gatsbyjs.com)** +- Built on React and GraphQL. +- Focused on performance and scalability. +- Excellent plugin library and integration options. +- Designed for developers familiar with modern JavaScript. + +**[Eleventy (11ty)](https://www.11ty.dev/)** +- Simple, lightweight, and flexible. +- Works with multiple template engines like Markdown, Liquid, and Nunjucks. +- Minimal dependencies and quick setup. +- Ideal for small to medium-sized projects. + +**[Pelican](https://blog.getpelican.com/)** +- Written in Python and supports reStructuredText and Markdown. +- Offers multilingual support and custom themes. +- Strong focus on developer flexibility and control. +- Great for Python developers and those familiar with the language. + + +**[List ssg tools](https://jamstack.org/generators/)** + +--- + +## Popular CMS (Self-Hosted) +These platforms require you to set up hosting but give you more control and flexibility: + +**[WordPress.org](https://wordpress.org)** +- Most popular blogging platform. +- Thousands of plugins and themes available. +- Requires your own hosting and domain. +- Bloggers who want full control over their site. + +**[Drupal](https://www.drupal.org)** +- Flexible and scalable for complex websites. +- Known for its strong security features. +- Suitable for enterprise-level projects and large-scale content management. + +**[Ghost (Self-hosted)](https://ghost.org)** +- Modern, fast, and focused on simplicity. +- Requires hosting but offers full customization. + +**[Joomla](https://www.joomla.org)** +- User-friendly and versatile. +- Excellent for multilingual websites. +- Open-source and ideal for medium to large websites. + +**[Grav](https://getgrav.org)** +- Flat-file CMS without a database. +- Lightweight, fast, and easy to set up. +- Ideal for smaller websites and blogs with modern features + +--- + +## Popular Hosted Blogging Platforms +These platforms provide a complete blogging solution, including hosting. + +**[WordPress.com](https://wordpress.com)** +- Easy-to-use, drag-and-drop editor, Free and premium themes available. +- Hosted by WordPress, so no server setup is needed. + +**[Blogger](https://www.blogger.com)** +- Free platform provided by Google. +- Simple setup with integration to Google AdSense. +- Basic customization options. + +**[Medium](https://medium.com)** +- Minimalist writing interface. +- Built-in audience and social features. +- No need for hosting or theme setup. + +**[Wix](https://www.wix.com)** +- Drag-and-drop website builder. +- Blogging functionality included in templates. +- Paid plans offer additional features like custom domains. + +**[Squarespace](https://www.squarespace.com)** +- Visually appealing templates. +- Integrated blogging and e-commerce tools. +- Fully hosted platform with built-in analytics. + +**[Substack](https://www.substack.com)** +- Designed for newsletter-style blogs. +- Integrated email subscription features. +- Free to start, with paid subscriptions available for monetization. + +**[Ghost (Hosted)](https://ghost.org)** +- Focused on minimalist, content-first blogging. +- Built-in membership and subscription features. +- Fully hosted plans available. + + +**[Weebly](https://www.weebly.com)** +- Easy drag-and-drop builder. +- Blogging templates and SEO tools. +- Free plan with limited features. diff --git a/_posts/2025-01-04-blogging-b-setup-jekyll.md b/_posts/2025-01-04-blogging-b-setup-jekyll.md new file mode 100644 index 0000000..ed905ec --- /dev/null +++ b/_posts/2025-01-04-blogging-b-setup-jekyll.md @@ -0,0 +1,71 @@ +--- +title: "Blogging: Setup Free Hosting in 20 Minutes" +categories: [blogging,hosting] +tags: [jekyll, static-side-generator] # TAG names should always be lowercase +--- + +We will setup a blogging web site using jekyll. Jekyll is a static site generator that transforms plain text into beautiful static web sites. We develop in docker using VisualStudio Code dev container. We will create a blog post as a Markdown file(plain text). Jekyll will transform the Markdown file to an HTML page. The web site can be tested locally. To host out blogging web site for free we use GitHub. Alternatively we create a docker image for self hosting. + + +This setup is for developers. Non-technical people please check {% if page.previous %}[{{ page.previous.title }}]({{ page.previous.url }}){% endif %} + +# Fork the Starter Repository +* Login to [github](https://github.com) +* Fork the [starter](https://github.com/cotes2020/chirpy-starter) repository +* Click the "Use this template" button and then select Create a new repository +* Name the new repository .github.io + +# Create a VS Code Project +* Clone a forked template Repository (replace the following github URL) +* ```bash +git clone https://github.com/cotes2020/chirpy-starter +``` +* In vs code open the project (optional: vs code > File > Save as *.github.io.code-workspace) + +# Start our Development Server +* Open the project as dev container +* Run the web site locally. In vs code open a Terminal and run +```bash +bundle exec jekyll s +``` +* Test locally + + + +# Create a new blog page +* create a new file _post/2025-01-04-jekyll.md +```md +--- +title: Setup a Free Blogging Web Site in 20 Minutes +categories: [blogging] +tags: [jekyll] # TAG names should always be lowercase +--- +We will Setup a Free Blogging Web Site in 20 Minutes. +``` +* Test locally + + + +# Modify an existing blog page +* edit the file _post/2025-01-04-jekyll.md +* after saving vs code will automatically regerate the page (regeneration output is visible in code terminal) +* Test locally by doing a browser refresh + +# Commit the blog page to git +fork repo + +# Deploy the blog page to GitHub +https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll +https://chirpy.cotes.page/posts/getting-started/ + + +GitHub Repository > Settings > click Pages in the left navigation bar > Source="GitHub Actions" +Push a commit to Repository to trigger the Actions workflow > Actions tab: you should see the workflow Build and Deploy running > the site will be deployed + +# Create a Dockerimage for local hosting + +# Documentation +jekyll +jekyll-theme-chirpy +https://chirpy.cotes.page/posts/getting-started/ + diff --git a/_posts/2025-01-05-linux-cmd-find.md b/_posts/2025-01-05-linux-cmd-find.md new file mode 100644 index 0000000..2ceba14 --- /dev/null +++ b/_posts/2025-01-05-linux-cmd-find.md @@ -0,0 +1,83 @@ +--- +title: "Linux: find" +categories: [linux] +tags: [cmd] # TAG names should always be lowercase +--- + +Useful find commands. + +## -print and -delete +Step 1: Show matched files (to ensure regex works as intended) + +Step 2: Delete by appending '-delete' (-print is optional, this is default) +```bash +find dir1 -type f -path "*/in/a_*b.log" -print +find dir1 -type f -path "*/in/a_*b.log" -delete +``` + +## Date and Time + +### Find files newer than DATE. Find Files NOT newer than DATE +```bash +find ~ -type f -newermt "2024-12-20" +find ~ -type f -newermt "2024-12-01 00:00:00" + +find ~ -type f ! -newermt "2024-12-20" +``` + +### Sort files by modified timestamp + +```bash +find . -type f -printf "%T+ %p\n" | sort -r +``` + +find the 10 most recently modified files +```bash +find ~ -type f -printf "%T+ %p\n" | sort -r | head -n 10 +``` + + +## Regex + +### Basic Regex +```bash +find ~ -name "*ekyll* +NOK: find ~/pj/obsidian-vault -name ".*ekyll.*" +``` + +```bash +find . -regex '\./[a-f0-9\-]\{36\}\.jpg' +``` +The -regex option matches the entire path, not just the file or directory name. If you want to match only the name part, you can use -name with shell globbing or narrow the regex to consider just the filename. + + + +### Regex in Path + +```bash +find dir1 -type f -path "*/in/a_*b.log" +``` +The find command does not interpret wildcards (`*`) within a file path in the same way as a shell would. If you want to search for files matching the pattern a_*b.log within subdirectories under dir1, you need to let find handle the directory traversal. + + + + + + +### Switch Regex Type +To see which regular expression types are known, use -regextype help. + +switch to egrep expressions by `-regextype posix-egrep`: +```bash +find . -regextype posix-egrep -regex '\./[a-f0-9\-]{36}\.jpg' +``` + +```bash + find . -regextype sed -regex ".*/[a-f0-9\-]\{36\}\.jpg" +``` + +`-E` uses extended regex support +```bash +find -E . -regex ".*/[a-f0-9\-]{36}.jpg" +``` + diff --git a/_posts/2025-01-05-linux-cmd-sysetemctl.md b/_posts/2025-01-05-linux-cmd-sysetemctl.md new file mode 100644 index 0000000..80f63e7 --- /dev/null +++ b/_posts/2025-01-05-linux-cmd-sysetemctl.md @@ -0,0 +1,90 @@ +--- +title: "Linux: systemctl" +categories: [linux, systemctl] +tags: [cmd] # TAG names should always be lowercase +--- + +Useful systemctl commands. + +# System and Service Management Commands + +## List Loaded Systemd Units and Services +- `systemctl` +- `systemctl list-units --type=service` +- `systemctl --type=service` + +## Show Running Services +- `systemctl list-units --type=service --state=running` +- `systemctl --type=service --state=running` + +## Check Open Ports and Services +- `netstat -ltup | grep zabbix_agentd` +- `ss -ltup | grep zabbix_agentd` + +## Check Firewall Open Services/Ports +- `firewall-cmd --list-services` (FirewallD) +- `firewall-cmd --list-ports` (FirewallD) +- `sudo ufw status` (UFW Firewall) + +## Show Service File Content +- `systemctl cat portainer.service` + +## Check if Systemd is Running +- `ps -eaf | grep [s]ystemd` + +## Analyze Systemd Boot Process +- `systemd-analyze` +- `systemd-analyze blame` +- `systemd-analyze critical-chain` + +## List All Available Units +- `systemctl list-unit-files` +- `systemctl list-units` +- `systemctl --failed` + +## Check Service Status +- `systemctl is-enabled crond.service` +- `systemctl status firewalld.service` + +# Manage Services +- List all services: `systemctl list-unit-files --type=service` +- Start: `systemctl start httpd.service` +- Restart: `systemctl restart httpd.service` +- Stop: `systemctl stop httpd.service` +- Reload: `systemctl reload httpd.service` +- Status: `systemctl status httpd.service` +- Check Active: `systemctl is-active httpd.service` +- Enable: `systemctl enable httpd.service` +- Disable: `systemctl disable httpd.service` +- Mask: `systemctl mask httpd.service` +- Unmask: `systemctl unmask httpd.service` +- Kill: `systemctl kill httpd.service` + +# Manage Mount Points +- List mount points: `systemctl list-unit-files --type=mount` +- Start: `systemctl start tmp.mount` +- Stop: `systemctl stop tmp.mount` +- Restart: `systemctl restart tmp.mount` +- Reload: `systemctl reload tmp.mount` +- Status: `systemctl status tmp.mount` +- Active Check: `systemctl is-active tmp.mount` +- Enable: `systemctl enable tmp.mount` +- Disable: `systemctl disable tmp.mount` +- Mask: `systemctl mask tmp.mount` +- Unmask: `systemctl unmask tmp.mount` + +# Manage Sockets +- List sockets: `systemctl list-unit-files --type=socket` +- Start: `systemctl start cups.socket` +- Restart: `systemctl restart cups.socket` +- Stop: `systemctl stop cups.socket` +- Reload: `systemctl reload cups.socket` +- Status: `systemctl status cups.socket` +- Active Check: `systemctl is-active cups.socket` +- Enable: `systemctl enable cups.socket` +- Disable: `systemctl disable cups.socket` +- Mask: `systemctl mask cups.socket` +- Unmask: `systemctl unmask cups.socket` + +# CPU Utilization (Shares) of a Service +- Check CPU shares: `systemctl show -p CPUShares httpd.service`