Skip to content

Instantly share code, notes, and snippets.

@adamz01h
adamz01h / email_login.sh
Created April 27, 2023 17:37
send email on account login bash script
#!/bin/bash
#install this in the /etc/profile.d/ to have it run on log in
IP="$(who am i|awk '{ print $5}')"
HOSTNAME=$(hostname)
NOW=$(date +"%e %b %Y, %a %r")
echo 'Someone from '$IP' logged into '$HOSTNAME' on '$NOW'.' | mail -s 'SSH Login Notification' <[email protected]>
@adamz01h
adamz01h / wordpress_change_db_urls.sql
Created April 20, 2023 18:13 — forked from harishkotra/wordpress_change_db_urls.sql
Change and Update WordPress URLS in Database When Site is Moved to new Host. After migrating a WordPress site to a new URL either to a live production site or a testing development server, the new URL strings in the mysql database need to be changed and updated in the various mysql database tables.
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
@adamz01h
adamz01h / canvas_fingerprint.js
Created July 20, 2022 20:22
html5 canvas fingerprinting
console.log("canvas fingerprint: " + canvas_fingerprint());
function check_canvas(){
var elem = document.createElement('canvas');
return elem;
}
function canvas_fingerprint(){
@adamz01h
adamz01h / backup_to_nas.bat
Created April 19, 2022 15:05
Backup a windows machine to a nas.
::::::::::::::::::::::::::::::::::::::::::::
:: Automatically check & get admin rights V2
::::::::::::::::::::::::::::::::::::::::::::
@echo off
CLS
ECHO.
ECHO =============================
ECHO Running Admin shell
ECHO =============================
@adamz01h
adamz01h / create_shared_screen.php
Created April 13, 2022 16:12
PHP Ubuntu shared screen service.
<?php
$file = 'myservice.php';
$user = 'username';
$screen_name = 'my_screen';
//create our config file for screen session, you can store this anywhere but I put it in /tmp
$setup = "echo '' > /tmp/multiscreen.conf && echo 'multiuser on' >> /tmp/multiscreen.conf && echo \"acladd $user\" >> /tmp/multiscreen.conf";
//run it
shell_exec( $setup );
//create screen session using our created session config file
$command = "screen -dmS \"$screen_name\" -c /tmp/multiscreen.conf php $file";
@adamz01h
adamz01h / ubuntu_unattended_upgrades_gmail.markdown
Last active October 27, 2017 03:59 — forked from roydq/ubuntu_unattended_upgrades_gmail.markdown
Unattended upgrades on Ubuntu 14.04 with email notifications

Getting Started

Do yourself a favor and login as root to save yourself some time and headaches:

$ sudo su -

Install unattended-upgrades: