Skip to content

Instantly share code, notes, and snippets.

@k0nsl
k0nsl / disable-exim-cpanel-whm
Created November 11, 2013 21:01
A way to disable Exim (applies to WHM/cPanel too).
service exim stop
chkconfig exim off
touch /etc/eximdisable (or create an empty file in /etc with the filename 'eximdisable')
@danreb
danreb / dgscanner.sh
Last active July 9, 2018 00:45
Helper shell scripts or command to scan for injected code - DrupalGeddon 2 - 3
#!/bin/bash
# Run this inside your cPanel account or just in public_html drupal web root
# Find the ico malware
find . -type f -name "favicon_*.ico"
find . -type f -name ".*.ico"
# Delete the malware, I did not delete favicon_*.ico as you need to double check it manually
find . -type f -name ".*.ico" -exec rm -f {} \;
@lucien144
lucien144 / backup.sh
Last active September 10, 2018 13:09
MySQL backup using s3cmd & automysqlbackup
#!/bin/bash
apt-get install automysqlbackup
apt-get install s3cmd
s3cmd --configure
s3cmd sync --recursive --delete-removed /var/lib/automysqlbackup/ s3://bucket/mysql/
s3cmd sync --exclude-from=/root/s3cmd.exclude --recursive --delete-removed /sites s3://bucket/sites/daily/`echo $(date +"%F")`/
find /var/lib/automysqlbackup/ -name *.sql.gz -mtime +7 -exec rm {} \;
@adamtester
adamtester / wkhtmltopdf.sh
Last active April 12, 2019 16:58
Install wkhtmltopdf on Ubuntu 14.04+
wget http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
sudo apt-get update
sudo apt-get install wkhtmltox
sudo apt-get -f install
sudo dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
wkhtmltopdf -V
rm wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
@denishvachhani
denishvachhani / function.php
Last active January 27, 2020 16:33
Remove Dashboard Widgets in Wordpress Backend
<?php
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
if( !function_exists('remove_dashboard_widgets') ) :
/**
*
*/
function remove_dashboard_widgets() {
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // Incoming Links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // Plugins
@rakeshtembhurne
rakeshtembhurne / render_view_as_variable.php
Created July 19, 2013 10:10
CakePHP: Render view in a variable inside controlller
<?php
$view = new View($this, false);
$view->set(compact('some', 'vars'));
$html = $view->render('view_name');
@james2doyle
james2doyle / test-was-called.php
Last active February 21, 2022 21:52
Testing that an event listener was called in Laravel without additional frameworks
<?php
// overall test answer
$was_called = false;
$this->app->resolving(function ($object, $app) use (&$was_called) {
if ($object instanceof MyEventListener) {
// the object was resolved at one point
$was_called = true;
}
@nasirkhan
nasirkhan / git command.markdown
Last active May 12, 2022 03:17
`git` discard all local changes/commits and pull from upstream

git discard all local changes/commits and pull from upstream

git reset --hard origin/master

git pull origin master

@akatche
akatche / createdb.sql
Last active October 7, 2022 13:08
Run Laravel parallel tests using Laravel Sail
#
# Create this file in the following folder docker/mysql/docker-entrypoint-initdb.d
#
CREATE DATABASE IF NOT EXISTS `test_1` COLLATE 'utf8_general_ci' ;
GRANT ALL ON `test_1`.* TO 'root'@'%' ;
CREATE DATABASE IF NOT EXISTS `test_2` COLLATE 'utf8_general_ci' ;
GRANT ALL ON `test_2`.* TO 'root'@'%' ;
@addyosmani
addyosmani / workbox.md
Last active January 20, 2024 16:14
Workbox recipes

Workbox runtime caching recipes

Your Service Worker script will need to import in Workbox and initialize it before calling any of the routes documented in this write-up, similar to the below:

importScripts('workbox-sw.prod.v1.3.0.js');
const workbox = new WorkboxSW();

// Placeholder array populated automatically by workboxBuild.injectManifest()