Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Reschke mreschke

  • Sunfinity Renewable Energy
  • Grand Junction, CO
View GitHub Profile
View .editorconfig
# 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
.secrets (DotSecrets) gpg encrypted folder helper
View .secrets
#!/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 Dec 14, 2016
Convert to PSR-2 and Tabs to Spaces
View psr2-converter.sh
#!/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
View server-stats.php
#!/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 Apr 7, 2016
Start x11vnc server at KDM or GDM starup using systemd
View x11vnc-server.sh
#!/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]
View clean_oldfiles
#!/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 Feb 2, 2016
Start or stop windows processes if not running or running during time window.
View ProcessManager.vbs
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 Feb 2, 2016
Will start/stop a windows processes, only if not running
View StartStopProc.vbs
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 Feb 2, 2016
Delete old Windows files based on age and recursion depth
View DeleteOldFiles.vbs
' 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
@mreschke
mreschke / nginx.conf
Last active May 6, 2021
Nginx config for multiple laravel sites based on /api/v1 url paths
View nginx.conf
# This config will host your main [Laravel] GUI application at /, and any additional [Lumen] webservices at /api/v1 and /api/v2...
# This also works perfectly for all static file content in all projects
# This is full of debug comments so you can see how to print debug output to browser! Took me hours to nail this perfect config.
# Example:
# http://example.com - Main Laravel site as usual
# http://example.com/about - Main Laravel site about page as usual
# http://example.com/robots.txt - Main Laravel site static content as usual
# http://example.com/api/v1 - Lumen v1 api default / route
# http://example.com/api/v1/ - Lumen v1 api default / route