Skip to content

Instantly share code, notes, and snippets.

View jmaddington's full-sized avatar

JM Addington jmaddington

View GitHub Profile
@jmaddington
jmaddington / OneDrive.md
Last active March 6, 2024 14:32
OneDrive troubleshooting from the terminal

Update permissions on CloudStorage folder, includes OneDrive

Replace username with the actual user

  1. Find the username users

Example:

users
@jmaddington
jmaddington / c1import.py
Last active January 5, 2024 23:24
Import raw ControlOne JSON SIEM data into a Sqlite database
import argparse
import json
import sqlite3
import os
import hashlib
def map_keys(obj):
# Map 'date' and 'method' keys to 'the_date' and 'the_method'
if 'date' in obj:
obj['the_date'] = obj.pop('date')
# 20160728
# [email protected]
#
# Short script to force AD Azure sync
#
# https://azure.microsoft.com/en-us/documentation/articles/active-directory-aadconnectsync-feature-scheduler/
#
# See latest at https://gist.github.com/jmaddington/987c3e52989ed3cad598b537abf0cb15
Import-Module ADSync
@jmaddington
jmaddington / fileicons.scss
Last active August 29, 2015 14:00
SCSS Gist for File Icons
/**** File icons ****/
$fileIconWidth: 32px;
$fileIconHeight: 32px;
.fileIcon {
display: inline-block;
height: $fileIconHeight;
width: $fileIconWidth;
background: url(images/fileIcons.png) center no-repeat;
/*Row 1 */
#Change lines 6 & 10 to where you want to store your backups
echo 'show databases;'|/usr/bin/mysql --skip-column-names|while read -r db
do
fn=`date +%Y%m%d%H%S`
nice /usr/bin/mysqldump $db| bzip2 -9 > /root/backups/mysql/hourly/$fn.$db.sql.bz2
done
#Change +3 to however many days you want to keep backups
find /root/backups/mysql/hourly/ -ctime +3 -exec rm "{}" \;
@jmaddington
jmaddington / autosort.js
Created March 12, 2014 02:33
Automatically sorts jQuery datatables based on atributes
/*
Autosorting function for jQuery datatables. Looks for a table with the classes datatable and autosort
If it finds thead>tr>th[data-autosort] and then sorts the table by that TH's index in the direction indicated
by the data-sortdir attribute.
@author JM Addington <[email protected]>
*/
function autosort() {
$('.datatable.autosort').each(function() {
var n = 0;
@jmaddington
jmaddington / gist:9459207
Created March 10, 2014 03:53
Equal Columns
/*Keeps columns equal height*/
//Modified from http://www.cssnewbie.com/equal-height-columns-with-jquery/#.UtX2EJ5dXTc
function equalHeight(group) {
group.each(function(){
$(this).css('height', 'auto');
})
if ($(document).width() > 600) {
var tallest = 0;
@jmaddington
jmaddington / modx-select-states
Last active December 19, 2015 00:49
Populates an HTML SELECT statement with all US states. If the "value" placeholder has been set, make it the select option. Requires If addon. #MODX
<option value="AL" [[If? &subject=`[[+value]]` &operand=`AL` &then=`SELECTED`]]>Alabama</option>
<option value="AK" [[If? &subject=`[[+value]]` &operand=`AK` &then=`SELECTED`]]>Alaska</option>
<option value="AZ" [[If? &subject=`[[+value]]` &operand=`AZ` &then=`SELECTED`]]>Arizona</option>
<option value="AR" [[If? &subject=`[[+value]]` &operand=`AR` &then=`SELECTED`]]>Arkansas</option>
<option value="CA" [[If? &subject=`[[+value]]` &operand=`CA` &then=`SELECTED`]]>California</option>
<option value="CO" [[If? &subject=`[[+value]]` &operand=`CO` &then=`SELECTED`]]>Colorado</option>
<option value="CT" [[If? &subject=`[[+value]]` &operand=`CT` &then=`SELECTED`]]>Connecticut</option>
<option value="DE" [[If? &subject=`[[+value]]` &operand=`DE` &then=`SELECTED`]]>Delaware</option>
<option value="DC" [[If? &subject=`[[+value]]` &operand=`DC` &then=`SELECTED`]]>District of Columbia</option>
<option value="FL" [[If? &subject=`[[+value]]` &operand=`FL` &then=`SELECTED`]]>Florida</option>
@jmaddington
jmaddington / modx-json-to-placeholders
Last active September 17, 2022 02:49
Quick snippet to set placeholders from a JSON array. Made basically so I could create MIGXs inside MIGXS. There is little error checking are anything else at this point. Use at your own risk.
<?php
/**
* jsonToPlaceholders snippet for JM Customer Database extra
*
* Copyright 2013 by JM Addington [email protected]
* Created on 04-28-2013
*
* @package jmc
*/
@jmaddington
jmaddington / states-modx-tv
Created April 27, 2013 23:50
MODX template variable values for US States
Alabama==AL||Alaska==AK||Arizona==AZ||Arkansas==AR||California==CA||Colorado==CO||Connecticut==CT||Delaware==DE||District of Columbia==DC||Florida==FL||Georgia==GA||Hawaii==HI||Idaho==ID||Illinois==IL||Indiana==IN||Iowa==IA||Kansas==KS||Kentucky==KY||Louisiana==LA||Maine==ME||Montana==MT||Nebraska==NE||Nevada==NV||New Hampshire==NH||New Jersey==NJ||New Mexico==NM||New York==NY||North Carolina==NC||North Dakota==ND||Ohio==OH||Oklahoma==OK||Oregon==OR||Maryland==MD||Massachusetts==MA||Michigan==MI||Minnesota==MN||Mississippi==MS||Missouri==MO||Pennsylvania==PA||Rhode Island==RI||South Carolina==SC||South Dakota==SD||Tennessee==TN||Texas==TX||Utah==UT||Vermont==VT||Virginia==VA||Washington==WA||West Virginia==WV||Wisconsin==WI||Wyoming==WY