Skip to content

Instantly share code, notes, and snippets.

@Magentron
Magentron / upgrade-phpmailer.sh
Created December 29, 2016 15:08
Upgrade PHPMailer files automatically to latest version
#!/bin/sh
#
# phpmailer-upgrade.sh - Upgrade PHPMailer files automatically to latest version
#
# Copyright (c) 2016 Derks.IT / Jeroen Derks / Magentron
#
# Licensed under the Apache License, Version 2.0 (the “License”);
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
<?php
$_POST['email'] = '';
// slack invite
$group = ''; // team name
$token = ''; // admin token generated at https://api.slack.com/docs/oauth-test-tokens
$data = array(
'email' => $_POST['email'],
'channels' => '',
'first_name' => '',
<?php
/**
* @see: https://www.phpfreelancer.org/blog/php-get-current-url.php
*/
function get_current_url()
{
$url = false;
// check whether this script is being run as a web page
if (isset($_SERVER['SERVER_ADDR']))
@Magentron
Magentron / dpkg-verify.alias.sh
Created August 10, 2016 08:15
An alias to verify that installed files are unchanged using dpkg package's md5sums
dpkg-verify() {
exitcode=0
for file in $*; do
pkg=`dpkg -S "$file" | cut -d: -f 1`
hashfile="/var/lib/dpkg/info/$pkg.md5sums"
if [ -s "$hashfile" ]; then
rfile=`echo "$file" | cut -d/ -f 2-`
phash=`grep -E "$rfile\$" "$hashfile" | cut -d\ -f 1`
hash=`md5sum "$file" | cut -d\ -f 1`
if [ "$hash" = "$phash" ]; then