2015-10-21
- jennifer
- martym
// dm Klopapier Widget | |
// | |
// Copyright (C) 2020 by marco79 <[email protected]> | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL | |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER | |
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE |
Principles of Adult Behavior
alias accio=wget | |
alias avadaKedavra='rm -f' | |
alias imperio=sudo | |
alias priorIncantato='echo `history |tail -n2 |head -n1` | sed "s/[0-9]* //"' | |
alias stupefy='sleep 5' | |
alias wingardiumLeviosa=mv | |
alias sonorus='set -v' | |
alias quietus='set +v' |
If you want to delete a model with related models you can use Laravel model events. There is also a special case if your models cascade.
Lets say you have Folder and File Eloquent models that are related and use SoftDeletes trait and when you delete a folder you also want to delete files in folder and all subfolders with files.
In the boot
method or Folder model you catch delete
and restore
events (actually deleting
and restoring
events that trigger before restoring or deleting happens). You can delete/restore all files in folder you're deleting/restoring with $folder->files()->delete();
and $folder->files()->withTrashed()->restore();
.
Folders on the other hand cascade (folder in a folder in a folder) and because events do not trigger if you don't pull the models (->get()
method), the model events won't trigger for subfolders. That's why you need to pull the folders and iterate trough them (->each()
method) and delete/restore them.
You could use database CASCADE feature but that does
#!/bin/bash | |
# This is a script to send a notification from OTRS to Mattermost. | |
# Create a new Generic Agent and select "TicketCreate" under event based events. | |
# Finally, put in the path to the script into the command box. | |
# Of course you could use it for different notifications, but OTRS is only giving the ticket number and id to the script. | |
header="Content-Type: application/json" | |
ticketid=$2 | |
request_body=$(< <(cat <<EOF |
[Unit] | |
Description=MailCatcher Service | |
After=network.service vagrant.mount | |
[Service] | |
Type=simple | |
ExecStart=/usr/local/bin/mailcatcher --foreground --ip 10.0.2.15 | |
[Install] | |
WantedBy=multi-user.target |
#!/bin/bash | |
set -e | |
show_help() { | |
cat << EOF | |
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE] | |
${0##*/} -h | |
Open a standard connection in Sequel PRO. |
As I've discovered, managing LXC containers is fairly straightforward, but when building out a system for provisioning out user maintained instances of NodeBB, it was imperative that unprivileged LXC containers were used, so that in the event of shell breakout from NodeBB followed by privilege escalation of the saas
user, the root
user in the LXC container would only be an unprivileged user on the host machine.
During the course of development, I ran into numerous blockers when it came to managing LXC containers in unexpected circumstances. Namely:
su
or executing lxc-*
commands as another user via sudo
lxc-*
commands via a program, application, or script. In my case, a Node.js application.;################################################### | |
; NOTE | |
;#################################################### | |
; change your curl.ini on /etc/php.d/curl.ini | |
; | |
;This config was only tested on amazon AMI | |
;Please check if /etc/ssl/certs/ca-bundle.crt exists | |
; | |
;If you don't have the ca-bundle root certificate you | |
; can get this in |