Skip to content

Instantly share code, notes, and snippets.

View mreschke's full-sized avatar

Matthew Reschke mreschke

  • Grand Junction, CO
View GitHub Profile
@mreschke
mreschke / fa-api
Last active August 10, 2021 15:06
FusionAuth API Bash CLI
#!/usr/bin/env bash
# FusionAuth CLI API Tool
# Requirements: httpie and jq
# mReschke 2021-05-17
# Create an environment config in ~/.config/fusionauth/fa-api-prod like so
# auth_url='https://auth.yourfusion.com'
# api_key='master-api-key'
# user="admin@example.com"
# mReschke Standardized .editor config
# See https://gist.github.com/mreschke/7d9c4ecc8b4f67a8b260593e9ac1e07a
# Top-most EditorConfig file
root = true
# Global settings
[*]
charset = utf-8
indent_size = 4
@mreschke
mreschke / .secrets
Last active May 5, 2021 17:15
.secrets (DotSecrets) gpg encrypted folder helper
#!/bin/bash
# .secrets (dot secrets) by mReschke 2017-10-02
# Download to /usr/local/bin and chmod a+x
# Then run .secrets to setup your first vault!
# Latest gist: https://gist.github.com/mreschke/c0d60e6c81a787c64e61b8ec79c62143
option="$1"
vault="$2"
path=~/.secrets
@mreschke
mreschke / psr2-converter.sh
Last active December 14, 2016 08:57
Convert to PSR-2 and Tabs to Spaces
#!/bin/bash
# Convert tabs to spaces in code files
# and convert all PHP files (that begin with <? or <?php, so not laravel blade files) to PSR-2
# Requires https://github.com/FriendsOfPHP/PHP-CS-Fixer in $path
# mReschke 2016-09-28
dir=$(pwd)
# Replace tabs with 4 spaces in particular files
#!/usr/bin/env php
<?php
# Basic live zabbix stats specifically for Dynatron servers
# This is also a github gist, so be sure to keep that updated
# https://gist.github.com/mreschke/d86e073efc2a8757b30e413850f44439
# mReschke 2016-08-08
while (1) {
system('clear');
@mreschke
mreschke / x11vnc-server.sh
Last active April 7, 2016 14:39
Start x11vnc server at KDM or GDM starup using systemd
#!/bin/bash
# This is run from /etc/systemd/system/x11vnc.service
# This is run at KDM, not when user logs in, therefore the systemd
# unit is running as root user
# mReschke 2016-04-07
# Systemd unit file:
# ---------------------------------------------------
#[Unit]
@mreschke
mreschke / clean_oldfiles
Created February 3, 2016 14:31
Delete old files
#!/usr/bin/env python
# Clean up old files around the server, called weekly Sunday 8am
# mReschke 2012-05-01
import os
import sys
import subprocess
import traceback
import datetime
@mreschke
mreschke / ProcessManager.vbs
Created February 2, 2016 17:45
Start or stop windows processes if not running or running during time window.
Option Explicit
'Process Manager
'Check a process, restart it and send email alert, or kill process depending on time window
'If process is NOT running between start/endHour then restart it and send an email if sendEmail = true
'If process is running outside of start/endHour then kill it.
'Original script created by NetRes
'Modified by mReschke 2008-04-28 (converted to functions, actions change by time, email enhancements, globals, generic process killer)
'Globals
@mreschke
mreschke / StartStopProc.vbs
Created February 2, 2016 17:40
Will start/stop a windows processes, only if not running
Option Explicit
'mReschke fo zabbix 2009-03-12
'Will start/stop a process
'Will only start 1 process, will not start if already started, no multiples
Dim ArgObj, strComputer, objWMIService, colProcesses, Process
Dim processPath, processName, processAction
Set ArgObj = WScript.Arguments
@mreschke
mreschke / DeleteOldFiles.vbs
Last active February 2, 2016 17:40
Delete old Windows files based on age and recursion depth
' A windows vbscript to delete old files. Simply make a .bat file and thow it in Windows scheduled tasks
' Example, same file in C:\batch\DeleteOldFiles.vbs and make C:\batch\CleanupThisServer.bat:
'
' cd C:\batch
' cscript DeleteOldFiles.vbs "D:\SMTPExpress\EasyMail SMTP Express\logfiles" 90
' cscript DeleteOldFiles.vbs "D:\DynaMailPDF\" 720 txt 2 (this one uses max depth =2)
'--------------------------------------------------------------------------------------
' Objective: To delete old files from a given folder and all subfolders below
' Created by: MAK
' Created Date: June 21, 2005