Skip to content

Instantly share code, notes, and snippets.

View bonelifer's full-sized avatar

William Jacoby bonelifer

View GitHub Profile
@johnabela
johnabela / [PHP] bitly_MakeShortLink()
Last active September 8, 2015 09:55
Use the bit.ly api to generate short URL
@matiaskorhonen
matiaskorhonen / toggle-tv-power off.sh
Created January 28, 2016 16:04
A quick script to control the power state of a TV attached to a Raspberry Pi over HDMI. Requires `cec-utils` to be installed.
#!/usr/bin/env bash
iso8601_date () {
date +%Y-%m-%dT%H:%M:%S%z
}
turn_on () {
echo 'on 0' | cec-client -s -d 1 RPI
}
@kamermans
kamermans / auto_subscribe_moderators.php
Created February 20, 2012 15:31
Subscribe all phpBB3 moderators to all forums/topics
#!/usr/bin/php
<?php
/**
* This script subscribes all global moderators to all forums.
* Put this in your phpBB3 directory and do "chmod 0700 auto_subscribe_moderators.php"
* You can use crontab to run this script so your moderators stay subscribed!
*/
// Path to the phpBB3 Config Script
require dirname(__FILE__).'/config.php';
@tierra
tierra / convert-avatars.php
Last active April 2, 2019 22:13
phpBB 3.1 script that fetches all remote avatars, and converts them to uploaded avatars hosted locally.
<?php
/**
* Converts all phpBB 3.1 remote avatars to uploaded avatars.
*
* To use this script:
*
* 1. Copy this file into the root of your phpBB installation.
* 2. Run the script from the command line: php convert-avatars.php
*
* Any avatar will be skipped if any errors come up, like these:
@GerB
GerB / cleanup_nru.php
Created October 11, 2018 14:08
Script for phpBB 3.2 to delete all users in Newly registers users group
<?php
/**
*
* @package phpBB3
* @author GerB https://github.com/GerB
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
@irwiss
irwiss / phpbb_mass_prune.php
Last active April 2, 2019 22:59
phpbb_mass_prune.php
phpbb user pruning tool fails to actually work at > 100 users to prune
even though it happily displays a form with about 30000 checkboxes and
usernames to choose.
Slightly modified - this script wants user_ids_to_delete.txt near it,
with numerical user ids, one id per line.
Bulk delete all users with 0 posts in prevoius revision
This needs a *lot* of memory (or swapfile) if you have a lot of users
@piotr-grzelka
piotr-grzelka / \etc\profile.d\notify_log.sh
Created October 16, 2017 20:11
useful scripts for admins
# send informations about new ssh logins to pushover api
who="$(whoami)"
last="$(last -n 5)"
curl -s \
--form-string "token=" \
--form-string "user=" \
--form-string "title=SSH Login: $who" \
--form-string "message=$last" \
@bmgSpark
bmgSpark / df-pushoveralert.sh
Last active July 22, 2020 01:41
bash script to alert via pushover if disk free percentage falls before a certain amount on a particular device [change DevMon var to a different variable to use something different]. Tested on readynas 516
#! /usr/bin/env bash
let notify=75
let criticalnotify=91
let doAct=0
DevMon="/dev/md0"
let percval=`df -h | grep -i $DevMon | awk '{ print +$5 }'`
echo percval = $percval
echo notify = $notify
sSev="INFO"
##check for critical warning -- can be disabled by making $criticalnotify a crazy number
#!/usr/bin/env bash
set -o errexit # Exit on most errors
set -o nounset # Dissallow expansion of unset variables
DISK=/media/backup
export BORG_PASSPHRASE="$(pass borg)"
BORG_REPOSITORY="$DISK/borg"
# DESC: notify the user that backups are done
@jaredh
jaredh / pam-pushover.sh
Created February 21, 2016 22:24
Script for notifying Pushover of successful SSH logins
#!/bin/sh
PUSHOVER_API_URL="https://api.pushover.net/1/messages.json"
PUSHOVER_APPTOKEN="<YOUR_APP_TOKEN>"
PUSHOVER_USERKEY="<YOUR_USER_KEY>"
if [ "$PAM_TYPE" != "close_session" ]; then
MESSAGE="User '$PAM_USER' logged into '`hostname`' from IP address '$PAM_RHOST'"
curl -s -F "user=$PUSHOVER_USERKEY" -F "token=$PUSHOVER_APPTOKEN" -F "message=$MESSAGE" $PUSHOVER_API_URL