Skip to content

Instantly share code, notes, and snippets.

View atelierbram's full-sized avatar

Bram de Haan atelierbram

View GitHub Profile
@atelierbram
atelierbram / (un)zipping-ePub-from-command-line.md
Last active August 11, 2024 13:17 — forked from jamesktan/Shell Commands ePub
Unzipping & Zipping ePub from Command Line

Unzipping & Zipping ePub from Command Line

To unzip the epub, move the ePub to a folder, cd to it then simply:

unzip MyEbook.epub

E-book readers require that the mimetype file is the first one in the zip document. What's more, to be fully compliant, this file should start at a very specific point - a 30-byte offset from the beginning of the zip file (so that the mimetype text itself starts at byte 38). If this sounds intimidating, don't worry. It's actually quite easy to achieve if you're careful.

To zip up an epub:

@atelierbram
atelierbram / iterm2kitty.py
Last active September 14, 2024 17:08 — forked from unglitched/iterm2kitty.py
Convert .itermcolors file to kitty term theme colors
#!/usr/bin/env python3
#
# Convert .itermcolors files to kitty terminal color settings.
# Modded from https://gist.github.com/MSylvia/4e90860743f1a4de187d
# Might need to adjust dicts[i][NUMBER].text per your file.
import sys
import xml.etree.ElementTree as ET
def rgb_to_hex(rgb):
@atelierbram
atelierbram / include.md
Last active January 28, 2024 18:16
WordPress maintenance - minimal setup

If maintenance.php is in a folder called inc within the WordPress theme folder, then include this code at the top of the header.php file of the theme:

  require_once get_stylesheet_directory() . '/inc/maintenance.php';

Everyone not logged in visiting the website will get the message.

@atelierbram
atelierbram / make-git-store-the-username-and-password.md
Created November 28, 2023 16:26
Make Git store the username and password
  git config --global credential.helper store
@atelierbram
atelierbram / minify-html-output.php
Last active November 18, 2023 13:18
PHP Function to Minify HTML Output
<?php
// start the output buffer
ob_start('compress_page');
?>
<!-- all html content here -->
<?php
// end the buffer, echo the page content
ob_end_flush();
// function that gets rid of tabs, line breaks, and extra spaces
@atelierbram
atelierbram / accordion-step-javascript.markdown
Created September 27, 2023 09:39
accordion: step javascript
@atelierbram
atelierbram / how-to-setup-homebrew-apache-php-mariadb-on-macos.md
Last active September 20, 2024 20:30
How to setup Homebrew, Apache, PHP and MariaDB on macOS

How to setup Homebrew, Apache, PHP and MariaDB on macOS

This guide is intended to assist you in maintaining an up-to-date development environment for macOS using the latest versions of Homebrew, Apache, PHP, and MariaDB.

Make a backup of your computer, but also think about exporting databases of your projects in .sql files from PhpMyAdmin.

XCode Command Line Tools

If you don't already have XCode installed, it's best to first install the command line tools as these will be used by homebrew:

@atelierbram
atelierbram / test.sh
Created September 10, 2023 19:25
Checking syntax highlighting Base2Tone for bash files in VS-Code
#!/usr/bin/env bash
do_something() {
grep --help | grep '\-i'
grep --help | grep -e -i
grep --help | grep -- -i
}
@atelierbram
atelierbram / start-over-in-github.md
Created January 29, 2023 16:00
Start over in Github

Start over in GitHub

  • Create a new branch to point to your old code
  • Delete all the code and commit on master
  • Start your rewrite on master
# checkout the master branch
git checkout master
@atelierbram
atelierbram / jigsaw-static-site-set-active-class-in-navigation-menu.md
Last active January 28, 2023 15:21
Jigsaw Static Site - Set active class in navigation menu

Jigsaw Static Site - Set active class in navigation menu

Set a custom front matter variable "slug" in top of your post.blade.md file which is the same as the filename, here: this-post-example.blade.md

---
extends: _layouts.post
section: content
title: This Post Example
slug: this-post-example