Skip to content

Instantly share code, notes, and snippets.

View SmugZombie's full-sized avatar

Ron Egli SmugZombie

View GitHub Profile
@SmugZombie
SmugZombie / VersionCompare.ahk
Created July 13, 2016 23:47
Compares Two Versions
VersionCompare(version1, version2)
{
StringSplit, verA, version1, .
StringSplit, verB, version2, .
Loop, % (verA0> verB0 ? verA0 : verB0)
{
if (verA0 < A_Index)
verA%A_Index% := "0"
if (verB0 < A_Index)
verB%A_Index% := "0"
<?php
function encryptAES($content, $secret){
return openssl_encrypt($content, "AES-256-CBC", $secret);
}
function decryptAES($content, $secret){
return openssl_decrypt($content, "AES-256-CBC", $secret);
}
@SmugZombie
SmugZombie / coloredConsole.js
Created July 28, 2016 22:39
Colorized console output for Javascript
<script>
function log(msg, color) {
color = color || "black";
bgc = "White";
switch (color) {
case "success": color = "Green"; bgc1 = "LimeGreen"; break;
case "info": color = "DodgerBlue"; bgc1 = "Turquoise"; break;
case "error": color = "Red"; bgc1 = "Black"; break;
case "start": color = "OliveDrab"; bgc1 = "PaleGreen"; break;
case "warning": color = "Tomato"; bgc1 = "Black"; break;
chown www-data:www-data -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--
#!/bin/bash
cd /var/www/
sudo chown www-data:www-data -R *
sudo find . -type d -exec chmod 775 {} \;
sudo find . -type f -exec chmod 664 {} \;
<style>
pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
.string { color: green; }
.number { color: darkorange; }
.boolean { color: blue; }
.null { color: magenta; }
.key { color: red; }
</style>
<script>
function include(type, source){
//Includes external resources via injection
var head = document.getElementsByTagName('head')[0];
switch(type){
case 'js': {
resource = document.createElement('script');
resource.type = 'text/javascript';
resource.src = source;
@SmugZombie
SmugZombie / NamedParameters.ahk
Last active September 7, 2016 23:48
Allows you to pass named parameters such as "syslog=1" to an AHK script. Ignores if not in allowedParameters array.
readParameters(){
global
Loop, %0% ; For each parameter:
{
param := %A_Index% ; Fetch the contents of the variable whose name is contained in A_Index.
StringSplit, parameters, param, =
if(ifValidParameter(parameters1)){
;MsgBox, 4,, The value for %parameters1% is %parameters2%. Continue?
%parameters1% = %parameters2%
}
@SmugZombie
SmugZombie / FixOnedrive.bat
Created September 16, 2016 17:30
Fixes OneDrive Credential Issues after Password Change
@echo off
REM Carlos script to fix OneDrive
REM Used to fix OneDrive after a password change
REM to verify saved creds are deleted: rundll32.exe keymgr.dll, KRShowKeyMgr
echo.
echo Open Excel, Word, and signout from your Office 365 Account, then continue
echo.
pause
REM Carlos script to fix OneDrive
REM to verify saved creds are deleted: rundll32.exe keymgr.dll, KRShowKeyMgr
@SmugZombie
SmugZombie / HTTPS Proxy.conf
Created September 19, 2016 22:32
Apache Configuration for a HTTPS to HTTP proxy.
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName proxy.mydomain.com
SSLEngine on
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLCertificateFile /etc/apache2/ssl/myssl.crt
SSLCertificateKeyFile /etc/apache2/ssl/myssl.key
SSLCertificateChainFile /etc/apache2/ssl/mysslcf.crt
ProxyPreserveHost On
<Proxy *>
@SmugZombie
SmugZombie / HTTPS Force.conf
Created September 19, 2016 22:34
Apache configuration to force HTTPS connection for a domain
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
Redirect permanent / https://www.mydomain.com/
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName www.mydomain.com
DocumentRoot /var/www/mysite