Skip to content

Instantly share code, notes, and snippets.

View aimfireready's full-sized avatar

Gandalf the Bray aimfireready

  • Aim Fire Ready LLC
  • Bloomington, Indiana
View GitHub Profile
@aimfireready
aimfireready / pg.bat
Created July 20, 2018 20:32
Generate a complex password using Windows Run dialog
@echo off
setlocal enabledelayedexpansion
set "string=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345678901234567890123456789~!@#$%%^&*()
[]{};:,<.>/?\-_=+~!@#$%%^&*()[]{};:,<.>/?\-_=+"
set "result="
for /L %%i in (1,1,36) do call :add
::echo %result% ::TEST
echo %result%|clip
goto :eof
'Autoprint Script
'(C) 2019 Gandalf Farnam
'Licensed under the MIT license.
'v1.0 2019-03-28
'REQUIREMENTS:
''Requires Adobe Reader: https://get.adobe.com/reader/
'Make sure the path below matches your path to the Adobe Reader .exe file.
'USAGE:
<?php
/*
* Capitalize Input String to Title Case
* Saved from on https://stackoverflow.com/a/44748446/4902224
* "Converting String to Title Case - PHP" 2017-06-25
*/
function makeTitleCase($input) {
$smallwordsarray = array('of','a','the','and','an','or','nor','but','is','if','then','else','when', 'at','from','by','on','off','for','in','to','into','with','it', 'as' );
//Split input string into an array of words
::Show date and time of last reboot on Windows
::2019-08-31 (C) @tree-wizard
::MIT License
:: Based on this SO answer: https://stackoverflow.com/a/32457584/4902224
:: Using 'For' syntax from https://ss64.com/nt/for_cmd.html
@echo off
set command=net statistics workstation
for /f "tokens=3" %%a in ('%command% ^|find "since"') do set bootdate=%%a
:: Goolog - The Poor Man's Logging System
:: License: MIT
::
:: Installation:
:: 1. Make a new Google Form with 2 input fields.
:: 2. Create a Pre-filled Link and copy-paste the URL below
:: 3. Replace the "viewform" in the original URL with "formResponse"
:: 4. Replace the entry ID number for each input field.
:: 5. Test and troubleshoot.
:: Add this file to a folder in your PATH to use it in the Run dialog.
@aimfireready
aimfireready / mem.sh
Last active November 13, 2020 15:58
Display Total Amount of Physical RAM on Ubuntu
printf "Total RAM: %.0fGB\n" $(expr $(cat /proc/meminfo | sed -n 's/MemTotal: //p' | sed -n 's/kB//p') / 1000000)
@aimfireready
aimfireready / clone-groups
Created October 11, 2022 18:47
Copy bash groups from model user to target user
# This script will take the groups of the current user.
# Usage: 'clone-groups wesley'
$targetUser=$1
target=$(for i in $(groups);do echo "$i,";done)
#Remove final character to remove the extra ',' at the end of the string
target=${target%?}
unspaced=$(echo $target | sed 's/ //g')
@aimfireready
aimfireready / motioneye-file-monitor.sh
Created October 21, 2022 14:50
Watch for new files in Motioneye directory and upload them to a shared Nextcloud folder.
# v1.0.0
# 2022 Gandalf Farnam
# Watch for new files in Motioneye directory and upload them to a shared Nextcloud folder.
#
# Specific parameters for inotifywait:
# --event create = only created files. This includes files copied to the target directory
# --exclude .*thumb$ = any files except thumbnails
# -r including subdirectories
#
# Specific parameters for curl:
@aimfireready
aimfireready / pon.sh
Created October 21, 2022 15:56
Pushover curl
####################################################
# v1.0.0
# 2022 Gandalf Farnam
# Send a Pushover notification
#
# Usage:
# - Replace $TOKEN with the shared folder token.*
# - Replace $USER with your domain.
####################################################
@aimfireready
aimfireready / sshd_config
Created October 30, 2022 22:10
Standard Issue SSH Config for Ubuntu Server
######################################################
# Standard Issue SSH Config for Ubuntu Server
# 2022-10-30 v1.0 Distilled from Gondor
#
#
######################################################
Include /etc/ssh/sshd_config.d/*.conf
Port 22
LogLevel INFO
PermitRootLogin no