Skip to content

Instantly share code, notes, and snippets.

@mabutler
mabutler / rename.sql
Created August 10, 2022 15:41
Rename locked MS SQL database
alter database "Standalone"
set single_user with rollback immediate
go
alter database "Standalone" modify name = "Standalone-suffix"
go
alter database "Standalone-suffix"
Set multi_user with rollback immediate
go
#!/bin/bash
#Server hardening script for cPanel servers
# Make sure only root can run this script
if [ "$(id -u)" != "0" ]; then
echo -e "\e[93m This script must be run as root \e[0m"
exit 1
fi
echo -e "\e[1;36;40m Server Hardening initiated \e[0m"
@mabutler
mabutler / \etc\nginx\conf.d\default.conf
Last active December 24, 2018 03:53
Install webserver centos (postgres)
server {
listen 80;
listen 443 ssl;
server_name localhost;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
@mabutler
mabutler / EnsureQueueListenerIsRunning.php
Created July 5, 2018 15:25 — forked from ivanvermeyen/EnsureQueueListenerIsRunning.php
Ensure that the Laravel queue listener is running with "php artisan queue:checkup" and restart it if necessary. You can run this automatically with a cron job: http://laravel.com/docs/scheduling
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class EnsureQueueListenerIsRunning extends Command
{
/**
* The name and signature of the console command.
@mabutler
mabutler / zabbixMessage.xml
Created March 6, 2018 18:09
Twilio Message - Zabbix Down
<Response>
<Say loop=10 voice="woman">Zabbix server could not be reached.</Say>
</Response>
@mabutler
mabutler / archInstall.txt
Last active February 17, 2017 00:20
Stuff done to new Archbox
install i3 (and therefore x)
install alsa and pulse (wasn't working immediately, did after
restart [really should learn how it's supposed to work at
some point])
add script (audioCtrls.sh) for vol up/down and mute
bind buttons to script (in ~/.config/i3/config)
bindsym XF86AudioRaiseVolume exec ~/.scripts/audioCtrls.sh up
bindsym XF86AudioLowerVolume exec ~/.scripts/audioCtrls.sh down
bindsym XF86AudioMute exec ~/.scripts/audioCtrls.sh mute
RewriteEngine On
RewriteBase /
# Remove .php extension
RewriteCond %{THE_REQUEST} ^GET\ /[^?\s]+\.php
RewriteRule (.*)\.php$ /$1/ [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^/(.+)/$
@mabutler
mabutler / gist:1ffce5eca2b6b1260db3
Last active February 24, 2023 08:06
Gogs Server Setup - Digital Ocean - Centos 7 - Start to Finish
useradd -c"Matt Butler" -Gwheel -m matt
# install ssl key for authentication
visudo # change wheel to allow nopassword
vim /etc/ssh/sshd_config # add "PermitRootLogin no"
yum install vim-enhanced
yum install git
yum install epel-release
<?php
/**
* UUID class
*
* The following class generates VALID RFC 4122 COMPLIANT
* Universally Unique IDentifiers (UUID) version 3, 4 and 5.
*
* UUIDs generated validates using OSSP UUID Tool, and output
* for named-based UUIDs are exactly the same. This is a pure
* PHP implementation.