Skip to content

Instantly share code, notes, and snippets.

View ssddanbrown's full-sized avatar

Dan Brown ssddanbrown

View GitHub Profile
@ssddanbrown
ssddanbrown / functions.php
Last active December 1, 2022 12:24
bookstack-notify-page-updates-for-favourites
<?php
use BookStack\Actions\ActivityType;
use BookStack\Auth\User;
use BookStack\Entities\Models\Page;
use BookStack\Facades\Theme;
use BookStack\Notifications\MailNotification;
use BookStack\Theming\ThemeEvents;
use Illuminate\Notifications\Messages\MailMessage;
@ssddanbrown
ssddanbrown / functions.php
Created December 1, 2022 03:38
bookstack-notify-page-updates-for-tagged-books
<?php
use BookStack\Actions\ActivityType;
use BookStack\Actions\Tag;
use BookStack\Auth\Role;
use BookStack\Auth\User;
use BookStack\Entities\Models\Page;
use BookStack\Facades\Theme;
use BookStack\Notifications\MailNotification;
use BookStack\Theming\ThemeEvents;
@ssddanbrown
ssddanbrown / functions.php
Last active November 25, 2022 10:13
bookstack-username-login-hack
<?php
use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;
use Illuminate\Http\Request;
const EMAIL_DOMAIN = 'admin.com';
Theme::listen(ThemeEvents::WEB_MIDDLEWARE_BEFORE, function(Request $request) {
@ssddanbrown
ssddanbrown / readme.md
Created November 5, 2022 08:59
BookStack permission setup

BookStack Permission Setup

This document provides an approach for setting permissions for your BookStack instance, which allows updating by the login user while providing the webserver with the required permissions.

The below makes the following assumptions, you will need to change these parts of the command to make it work for you:

  • Your normal login user (That you may run updates with) is called barry.
  • Your bookstack folder is located at /var/www/bookstack.
  • Your webserver/php user called www-data (Default on Ubuntu systems).
@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 / 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 / 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.