Skip to content

Instantly share code, notes, and snippets.

View ssddanbrown's full-sized avatar

Dan Brown ssddanbrown

View GitHub Profile
@ssddanbrown
ssddanbrown / readme.md
Created October 11, 2022 23:05
BookStack config Assistance

Step 1

Copy the below to a /etc/apache2/sites-available/bookstack-new-domain.conf file. Then change the second line to be the correct domain.

<VirtualHost *:80>
  ServerName domain2.com

  ServerAdmin webmaster@localhost
@ssddanbrown
ssddanbrown / output.json
Last active October 5, 2022 11:10
PHP array tree task
{
"name": "A",
"parent": null,
"id": 1,
"children": [
{
"name": "B",
"parent": "1",
"id": 2,
"children": [
@ssddanbrown
ssddanbrown / export-body-start.blade.php
Last active January 17, 2024 12:29
BookStack PDF Export header & footer
@if ($format === 'pdf')
<style media="print">
.print-header-footer {
position: fixed;
width: 100%;
}
.print-footer {
position: fixed;
bottom: -40px;
@ssddanbrown
ssddanbrown / mysql-zsh-fix.sh
Created August 1, 2022 22:42
MySQL 8.0.30-0ubuntu0.20.04.2 & ZFS Fix
# BACKUP & SNAPSHOT BEFORE USE
# Files starting with hashes are just comments
# Gather required zeros to append
# Will create a "zeros" file in the current directory
# This has been calculated based upon 2007040 % 16384 = 8192 or <broken_file_size> % <default_page_size>
dd if=/dev/zero bs=1 count=8192 of=./zeros
# Append zeroes to invalid file
cat zeros >> /var/lib/mysql/#innodb_redo/#ib_redo6
@ssddanbrown
ssddanbrown / more_mdn_no_w3schools.goggle
Created July 27, 2022 10:41
Brave Search Goggle: More MDN, No W3Schools
! name: More MDN, No W3Schools
! description: Rerank results to remove W3Schools results while promoting MDN results
! public: true
! author: ssddanbrown
! avatar: #8cb4ff
$boost=4,site=developer.mozilla.org
$discard,site=w3schools.com
<?php
namespace App\Services;
use Closure;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
@ssddanbrown
ssddanbrown / bookstack-backup.sh
Last active March 18, 2024 04:28
bookstack-backup
#!/bin/bash
# Directory to store backups within
# Should not end with a slash and not be stored within
# the BookStack directory
BACKUP_ROOT_DIR="$HOME"
# Directory of the BookStack install
# Should not end with a slash.
BOOKSTACK_DIR="/var/www/bookstack"
@ssddanbrown
ssddanbrown / bs.postman_collection.json
Created February 10, 2022 12:33
BookStack Postman Collection
{
"info": {
"name": "BookStack REST API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "DOCS",
"item": [
{
@ssddanbrown
ssddanbrown / examples.md
Created February 3, 2022 22:52
BookStack Laravel Examples

Originally put together when submitting to laravelexamples.com

I'm not particularly proud of the code-base in terms of cleanliness and style, but I'm proud of where it's got to over the last 6 years. Over those years my experience, knowledge and opinions have changed; And the code-base can often reflect that as inconsistency.

@ssddanbrown
ssddanbrown / functions.php
Created January 6, 2022 22:13
BookStack Webhook Call Before Hook Example
<?php
use BookStack\Actions\Webhook;
use BookStack\Entities\Models\Page;
use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;
Theme::listen(ThemeEvents::WEBHOOK_CALL_BEFORE, function (string $event, Webhook $webhook, $detail) {