Skip to content

Instantly share code, notes, and snippets.

@the-paulus
the-paulus / LivewireWYSIWYG.md
Created September 27, 2023 07:46
Demonstrates how to use a WYSIWYG editor with Livewire.

resources/js/app.js

import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
ClassicEditor.create(document.querySelector('#body')).then( (editor) => {
  editor.model.document.on('change:data', (e) => {
    let componentId = Livewire.components.getComponentsByName('contact-form')[0].id
    Livewire.find(componentId).set('body', editor.getData())
  })
}).catch( (error) => {
@the-paulus
the-paulus / msi-x99a.config
Created August 18, 2018 05:36
Linux Kernel configuration for an MSI x99a motherboard.
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.9.95-gentoo Kernel Configuration
#
#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
@the-paulus
the-paulus / MacOSADPwdChange.sh
Created April 19, 2018 18:24
Change Active Directory password from the terminal.
#!/bin/bash
DATAPATH=$(dscl localhost -read /SEARCH CSPSearchPath | grep -m 1 "Active" | sed 's/^ *//')
dscl -u $USER -p $DATAPATH -p $HOME
@the-paulus
the-paulus / Solus-VBox-Additions.sh
Last active December 9, 2021 06:12
Cheat sheet for installing VirtualBox's Guest Additions
eopkg upgrade -y
eopkg install -y -c system.devel
# LTS Kernel
eopkg install -y linux-lts linux-lts-headers xorg-server-devel
# Current Kernel
eopkg install -y linux-current-headers xorg-server-devel
reboot
@the-paulus
the-paulus / erase_history.sh
Created April 8, 2018 03:06
Commands to erase bash history
# Clears bash history
cat /dev/null > ~/.bash_history
# Prevent history from being recorded
ln -s ~/.bash_history /dev/null
# A copy of the history is stored in memory and written to the file uppon logout.
# To get around this:
cat /dev/null > ~/.bash_history && history -c && exit
@the-paulus
the-paulus / git-author-rewrite.sh
Created March 2, 2018 18:20
Interactive script that rewrites the Author's and Committer's name and email.
#!/bin/sh
read -e -p "Email address of author to update: " OLD_EMAIL
read -e -p "New name of author: " CORRECT_NAME
read -e -p "New email address of author: " CORRECT_EMAIL
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@the-paulus
the-paulus / NewFormDrupal.php
Last active October 12, 2017 01:00
Old code snippet for creating forms manually using the form API in Drupal.
<?php
/**
* Implementation of hook_elements().
*/
function referralsources_elements() {
return array('referralsources_select' => array(
'#input' => TRUE,
'#process' => array('referralsources_select_process'),
'#element_validate' => array('referralsources_select_validate'),
@the-paulus
the-paulus / create_ssh_config.sh
Created May 25, 2017 18:26
Creates a listing of entries for ssh's config file used for public/private key authentication.
while IFS='' read -r line || [[ -n "$line" ]]
do
user=$(echo $line | cut -d: -f 1)
domain=$(echo $line | cut -d' ' -f 2)
printf "\n\nHost $domain\n\tHostName $domain\n\tPort 22222\n\tUser $user\n\tIdentityFile ~/.ssh/id_rsa"
done < /etc/domainusers
@the-paulus
the-paulus / cpanel_cp_akeys.sh
Created May 25, 2017 18:24
Copies ssh authorized keys to each cPanel user account.
for user in $(cat /etc/domainusers | cut -d: -f 1)
do
if [ ! -d /home/$user/.ssh ]
then
mkdir /home/$user/.ssh
chown "$user":"$user" /home/$user/.ssh
fi
cp /root/.ssh/authorized_keys /home/$user/.ssh
chown "$user":"$user" /home/$user/.ssh/authorized_keys
@the-paulus
the-paulus / MacOSTweaks.md
Created April 23, 2017 00:41
Some commands to tweak MacOS

Set The Screen Saver As The Wallpaper:

/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -background

Show Hidden Files In Finder

defaults write com.apple.finder AppleShowAllFiles TRUE