Skip to content

Instantly share code, notes, and snippets.

View mitchellurgero's full-sized avatar

Mitchell Urgero mitchellurgero

View GitHub Profile
@mitchellurgero
mitchellurgero / schema_check_old_notice.php
Created April 5, 2017 14:27
PHP7 script for GNU Social that deletes older posts (3 months)
<?php
//Originally from https://ghostbin.com/paste/xjeud by https://social.freedombone.net/bob
//Re-writen to use PHP7.x MySQLi functions as mysql_*() are REMOVED in php7.0
// gnusocial post expiry script, based on StatExpire by Tony Baldwin
// https://github.com/tonybaldwin/statexpire
//Make sure to check and/or change these options
$howfarback="-3 months"; //Check http://php.net/manual/en/function.strtotime.php for syntax
$server="localhost";
@mitchellurgero
mitchellurgero / GS_Follow_Friends.php
Created July 17, 2017 23:19
Follow another user's friends list using GS API (Will not work with Mastodon friends)
<?php
/*
By Mitchell Urgero (@stitchxd@p2px.me)
Mass follower using a friends.json list. Based off of https://gitlab.com/snippets/12852
(Looks like the api will only grab 201 "friends" at a time.... shame really...)
*/
$user = "user";
$pass = "P@ssW0Rd";
$api = "https://example.com/api";
@mitchellurgero
mitchellurgero / cron.text
Created July 26, 2017 09:03
GNU Social Queue Daemon Systemd Unit File & cron
crontab -e
Add:
0 0 * * * /bin/bash /root/restartqueue.sh
(Make sure to change for your setup
@mitchellurgero
mitchellurgero / backup_webserver.sh
Last active August 3, 2017 22:30
Backup 1 MySQL DB and the /var/www folder to backup websites - Very Basic, and does the job.
#! /bin/bash
# Make the following DIR's:
# /temp
# /backups
## START CONFIG
TIMESTAMP=$(date +"%F")
BACKUP_DIR=/temp/My-Backup-$TIMESTAMP
MYSQL_USER="USERNAME"
MYSQL=/usr/bin/mysql
@mitchellurgero
mitchellurgero / mysql_class.php
Last active October 17, 2017 16:40
A simple MySQLi class to make using MySQLi in PHP a little bit easier
/*********************************************************
* Bitcoin Cash (BCH/BCC)
* 1DaXBwnUgWcPuNvEzei9KMkodjxF6rSSw6
*
*/
<?php
class db {
/**
@mitchellurgero
mitchellurgero / memory_watcher.php
Last active October 25, 2017 19:21
Memory Watchdog Service for GNU Social daemons + RabbitMQ
#!/usr/bin/php
<?php
if(php_sapi_name() !== 'cli'){
die();
}
//Tiny config options
$max = 95; //Max percentage the script should detect (in RAM Usage)
$restartScript = "/root/restartqueue.sh"; //Location of the restart script for the daemons.
/* restartqueue.sh "/root/restartqueue.sh" - also see: https://gist.github.com/mitchellurgero/e914c6109d0ad31fd85bf6d4dbb7e1f1
#!/bin/bash
@mitchellurgero
mitchellurgero / mediacenter.md
Last active March 6, 2018 18:59
[HOWTO] Open Source Media Center (RPI / x86)
@mitchellurgero
mitchellurgero / e2b.md
Created March 14, 2018 14:38
Using Easy2Boot for installing Linux!

Looking to install one of the distributions listed on this site? Here are some general instructions to get the job done for most distro's listed here.

 

Note: Some Linux distributions will require special instructions, which you will find on the download site for that specific distro.

Part 1: Downloading the required software.

Assuming you are on Windows (If you are on linux, you know how to install Linux and don't really need this tutorial) the easiest way is using Easy2Boot (Which does more than just Linux too!)

@mitchellurgero
mitchellurgero / search.ps1
Created May 31, 2018 21:18
Search Exchange 2013/2016 for emails and put into a PST file (Powershell!)
# Search All mailbox's on the server:
Get-mailboxserver -identity "SERVERNAME" | search-mailbox -searchquery "Search query as you would type it in Outlook" -targetmailbox "USERNAMEOFTARGETMAILBOX" -TargetFolder "NEWFOLDERTOPUTSEARCHIN" -loglevel full
# Search One mailbox on the server:
search-mailbox -Identity "USERNAME" -searchquery "Search query as you would type it in Outlook" -targetmailbox "USERNAMEOFTARGETMAILBOX" -TargetFolder "NEWFOLDERTOPUTSEARCHIN" -loglevel full
# Explination:
# USERNAMEOFTARGETMAILBOX - The mailbox the search results will be pulled into. (E.G: administrator)
@mitchellurgero
mitchellurgero / SearchExchangeMailBox.ps1
Created June 26, 2018 21:39
Search mailbox in Exchange 2013/2016 for keywords, save to a targetMailbox then export PST.
# Search Mailbox's for given keywords
#
# Make sure the targetMailbox exists, if the folderName folder does not that will be created automatically.
#
#
# Made by Mitchell Urgero
#
#